Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Consider the following code sequence: loop: add $t0, $t1 $t2 lw $t3, 10($t0) lw

ID: 3816398 • Letter: C

Question

Consider the following code sequence: loop: add $t0, $t1 $t2 lw $t3, 10($t0) lw $t4, 14($t0) sub $t5, $t4, $t3 sw $t5, 18($t0) addi $t2, $t2, 4 slti $t6, $t2, 200 bne $t6, $zero, loop Assume that each datapath stage requires the following minimum amount of time to complete: Instruction fetch (IF): 30 ns Instruction decode (ID): 20 ns Execute address calculation (EX): 25 ns Memory access (MEM): 30 ns Register write back (WB): 20 ns a. How long will one loop iteration take in a single-cycle datapath? b. How long will one loop iteration take in a multi-cycle datapath?

Explanation / Answer

a.

-Each instruction will take minimum time to complete is

=>Time(IF+ID+EX+MEM+WB)=30+20+25+30+20=125 ns

-As there are 8 instructions in the loop it will take

=>8*125 ns=1000 ns or 1 micro second

-One iteration loop will take 1 micro second in single cycle datapath.

b.

-In Multi cycle datapath the instruction cycles are reduced to improve the performance.

-In it unutilized cycles are used to improve performance and efficiency in terms of time.

- In the above example lw instruction is used twice but for it there is no requirement of WB instruction. So 2 WB will not take place.

-And last instruction in the loop bne will not require store means WB instruction. So this time will be reduced.

Time Required to execute is=>

=>total time-not utilized time

=> we caluculated total time above

not utilized time is => 2WB+1WB=40+20=60 ns.

Time required to execute is

1000-60=940 ns

-So in multicycle datapath 940 ns will be required.

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote