

Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!


add $3, $4, $ add $5, $3, $ lw $7, 100($5) add $8, $7, $
Instructions Cycle 1 2 3 4 5 6 7 8 9 IF ID EX MEM WB
IF ID EX MEM WB
IF ID EX MEM WB
IF ID EX MEM WB
IF ID EX MEM WB
IF ID EX MEM WB
10
add $2, $3, $ add $4, $3, $ add $5, $3, $ add $7, $6, $ add $8, $2, $
Assuming that initially: $2 = $7 - 34000 Find (1) the total number of cycles, (2) the CPI and (3) execution time, when running this code on:
a) Single cycle CPU with clock cycle = 8ns. b) Multi-cycle CPU (as covered in class - 3rd^ Edition Figure 5.28 page 323) with clock cycle = 2ns.
c) An ideal pipelined CPU with no stall cycles and clock cycle =2ns. d) MIPS pipelined CPU version 1 without forwarding (4 th^ Edition Figure 4.46 page 359 - 3 rd^ Edition Figure 6.22 page 400) with clock cycle = 2ns. e) MIPS pipelined CPU version 3 with forwarding and reduced branch delay (4 th Edition Figure 4.65 page 384 - 3 rd^ Edition Figure 6.41 page 427) and clock cycle = 2ns. For both non-ideal pipelined CPUs (parts d, e above) assume the branch not taken method, ignore initial pipeline fill cycles, and show resulting stall cycles.
loop: lw $1, 0($2) lw $1, 8($1) add $1, $1, $ lw $3, 0($4) lw $3, 12($3) add $1, $1, $ addi $2, $2, 4 addi $4, $4, 4 sw $1, 0($5) sub $6, $7, $ addi $5, $5, 4 bne $6, $0, loop