If (A>B) OR (B<C) then
A = A + C
Else
B = C - A
For x = 1 to 10
A = A + x
Next x
if ((a>=b) AND (b==c)) OR (a<=c) then
a = b + c
else
a = b - c
Write a procedure that reads a text-paragraph from a file and then prints the number of characters on the screen.
Suppose that you have a computer with a memory unit of 24 bits per word. In this
computer, the assembly program’s instruction set consists of 198 different operations.
All instructions have an operation code part (opcode) and an address part (allowing for
only one address). Each instruction is stored in one word of memory.
a. How many bits are needed for the opcode?
b. How many bits are left for the address part of the instruction?
c. How many additional instructions could be added to this instruction set without
exceeding the assigned number of bits? Discuss and show your calculations.
d. What is the largest unsigned binary number that the address can hold?
Let assume we have a list of numbers contains even and odd numbers , so you need to build an algorithm to make the odd number in the beginning of the list and the even number at the end of the list. For example:
List=[5,6,8,3,1,7,10] so after you build the algorithm the result will be as below: List=[5,3,1,7,6,8,10]
To answer question 1, you need to do the following:
1. Write an algorithm to do the above task.
2. Implement the algorithm using OUBuild script following the algorithm.
3. Provide 2 screenshots showing output using two different Lists.
4. What is the most efficient algorithm to sort the List in question 1.
Let assume we have a list of numbers contains even and odd numbers , so you need to build an algorithm to make the odd number in the beginning of the list and the even number at the end of the list. For example:
List=[5,6,8,3,1,7,10] so after you build the algorithm the result will be as below: List=[5,3,1,7,6,8,10]
To answer question 1, you need to do the following:
1. Write an algorithm to do the above task.
2. Implement the algorithm using OUBuild script following the algorithm.
3. Provide 2 screenshots showing output using two different Lists.
4. What is the most efficient algorithm to sort the List in question 1.
Suppose that you have a computer with a memory unit of 24 bits per word. In this computer, the assembly program’s instruction set consists of 198 different operations.
All instructions have an operation code part (opcode) and an address part (allowing for only one address).
Each instruction is stored in one word of memory.
a. How many bits are needed for the opcode?
b. How many bits are left for the address part of the instruction?
c. How many additional instructions could be added to this instruction set without exceeding the assigned number of bits? Discuss and show your calculations.
d. What is the largest unsigned binary number that the address can hold?
b) Add a screenshot of the simulation, showing the result (A screenshot of the MARIE Simulator window after running the program).
Instructions:
- Use “ORG” instruction to start your program at address equivalent to 25610.
- Use your last university ID number to input the value of X. For example, if your ID is1915161678234, then you will use the number 4 as the value of x.
- Do not forget to change the representation of the Input and Output windows in the simulator to Decimal.
a) Write an assembly program using MARIE's assembly Instruction set that prompts the user to enter a non-negative integer that is less than 10. The program should include a subroutine that keeps prompting until a valid value is obtained. When a valid number is entered, it will be displayed. (Hint: Use JNS & JUMPI instructions to implement the subroutine)
N.B: You should include the MARIE code in your Answer, with an explanation of each instruction in your code beside it (not a screenshot!). Example: Subt One /Subtract 1 from AC
The architects of the single-cycle computer in this lesson have come to the conclusion that the two commands jal and jr can be merged. This command is as follows:
jalr $t0,$t1 # $t0 = PC + 4, PC = $t1
Change the control unit and data path of the single-cycle processor to execute the "jalr" command. What kind of instructions do you think this is?
generalize The control unit and data path of the single-cycle processor we have designed (Figure 4.24 page 271 of the book computer organization and design) to implement the following instructions
addm $t0,24($t1) # $t0 = $t0 + Mem(24 + $t1), PC=PC+4 ($t0:Rt, $t1:Rs)