Question
From the slide: implement the following division algorithm: C = 0 ; do { A = A B ; C = C + 1 ;
From the slide:
implement the following division algorithm:
C = 0 ;
do {
A = A B ;
C = C + 1 ;
} while (A >= 0) ;
C = C 1 ;
NOTE: this algorithm uses a do-while loop. It is slightly different than a normal while loop. The computer will always go through the loop once, and then check the condition before it performs it again. This differs from a while loop that will only perform the loop IF the condition is first met.
a) Show a Flow Chart, like the one shown in the previous segment, Programming a CPU with Machine Language - The Setup, this will help you break the program into its various states. In a flow chart, operation states (A=B+C) are in boxes while conditional states (while(A
I think I have finished this part:
b) Show a table like the one shown on the slide titled Multiply Algorithm: Control Memory Contents from the lecture segment Programming a CPU with Machine Language - The Execution, listing the values of the control signals necessary to implement the algorithm above. The values in your table should be in binary except for registers (use R2 instead of 010), and use the following register allocation: R0=0, R1=1, R2=A, R3=B, R4=C
c) Show an Execution Trace (like the one shown in the same lecture segment, including the control signals) for your program in step (b). Your table should be in decimal. For your trace, assume A=5 and B=2.
The part b) and part c) ask you to fill in the following tables:
1 C=0 State 0: A20? J True, next state=1 Go back to State 0 1 False, next state=3 State 1: A=A-B I 1 Go to State 2 State 2: C=C+1 When program is done, stay in State 3 forever State 3: Loop | C=C-1 AW WE NZP NextPC b) Add rows to the table as needed RO=0, R1=1, R2=A, R3=B, R4=C PC +/- AR1 AR2 0 1 2 3 4 4 5 5 6 7 8 8 9 10 11 c) Add columns to the table as needed RO=0, R1=1, R2=A, R3=B, R4=C Clock 0 1 2 3 PC +/- AR1 AR2 WE AW ALUout RO R1 R2 R3 R4 Operation 1 C=0 State 0: A20? J True, next state=1 Go back to State 0 1 False, next state=3 State 1: A=A-B I 1 Go to State 2 State 2: C=C+1 When program is done, stay in State 3 forever State 3: Loop | C=C-1 AW WE NZP NextPC b) Add rows to the table as needed RO=0, R1=1, R2=A, R3=B, R4=C PC +/- AR1 AR2 0 1 2 3 4 4 5 5 6 7 8 8 9 10 11 c) Add columns to the table as needed RO=0, R1=1, R2=A, R3=B, R4=C Clock 0 1 2 3 PC +/- AR1 AR2 WE AW ALUout RO R1 R2 R3 R4 OperationStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started