Question
implement the following division algorithm in a CPU proccesor by completing the following three steps: C = 0 ; do { A = A B
implement the following division algorithm in a CPU proccesor by completing the following three steps: C = 0 ; do { A = A B ; C = C + 1 ; } while (A >= 0) ; C = C 1 ;
a) Show a flow chart that breaks the program into various states per algorithm line. For example, combine these possible states with arrows displaying proper order and looping.
State 0: A>=0
State 1: A= A-1
State 2: C = C+1
State 3: Loop
b) Show a table like the example of a multiplication algorithm table below of listing the values of the control signals necessary to implement the algorithm above.
c) Show an execution trace for the program in step b. For the trace, assume A = 5 and B = 2. For example, there is a multiplication trace grid below that relates the multiplication example in part b.
Let's implement the algorithm in control memory Algorithm: AR1 ARZ AN WE NZP NextPC Functionality: while (B > 0) { C = C + A; B = B-1; ROW O R3 RO ROW 3 TEST: is B > 0 ROW 1 R2 000 C=C+A ROW 2 ROW O Register File: RO = 0 (for comparison) R1 = 1 (to subtract from B) R2 = A (initially 5 for ex.) R3 = B (initially 2 for ex.) R4 = C(initially O) B=B-1 and loop back to rowo ROW 3 1 x | x X 111 ROW 3 Loop forever on row 3 NZP Test Tricks NZP Condition: 000 Forces output to O NZP Condition: 111 Forces output to 1 V #1 #2 #2 #0 #3 1 x 4 3 2 Lo Clock Cycle PC state #0 +/- A r1 3 A r2 WE Aw ALU out RO 0 R1 R2(#A) 5 R3(#B) R4(#C) Operation B>0? 12 10 X 0 1 5 5 5 55 5 12 10 10 10 B>0 B>0 10 Loop C=C+A B=B- C=C+A B=B- Loop Let's implement the algorithm in control memory Algorithm: AR1 ARZ AN WE NZP NextPC Functionality: while (B > 0) { C = C + A; B = B-1; ROW O R3 RO ROW 3 TEST: is B > 0 ROW 1 R2 000 C=C+A ROW 2 ROW O Register File: RO = 0 (for comparison) R1 = 1 (to subtract from B) R2 = A (initially 5 for ex.) R3 = B (initially 2 for ex.) R4 = C(initially O) B=B-1 and loop back to rowo ROW 3 1 x | x X 111 ROW 3 Loop forever on row 3 NZP Test Tricks NZP Condition: 000 Forces output to O NZP Condition: 111 Forces output to 1 V #1 #2 #2 #0 #3 1 x 4 3 2 Lo Clock Cycle PC state #0 +/- A r1 3 A r2 WE Aw ALU out RO 0 R1 R2(#A) 5 R3(#B) R4(#C) Operation B>0? 12 10 X 0 1 5 5 5 55 5 12 10 10 10 B>0 B>0 10 Loop C=C+A B=B- C=C+A B=B- LoopStep 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