Question: (MIPS) The Pipelined Implementation: The MIPS code shown below sets every 100th word in a 1000-word block to 100. Assume that the branch decision hardware

(MIPS) The Pipelined Implementation:

The MIPS code shown below sets every 100th word in a 1000-word block to 100. Assume that the branch decision hardware has been moved to stage 2 of the pipeline.

a) Identify all data and control hazards that occur INSIDE the loop.

b) Which of these hazards can be eliminated by forwarding?

c) Assume that the code will not be reordered, and we cannot use a branch delay slot. If the computer uses forwarding and guesses BRANCH TAKEN for both branches, what is the approximate CPI if this code is executed on the data shown below?

.data block: .space 4000 .text main: la $s0, block add $t0, $zero, $zero # count = 0; add $t1, $zero, $zero # addi $t2, $zero, 1000 # addi $t3, $zero, 100 # loop: # for (i = 0; i < 1000; i ++) beq $t1, $t2, endloop # { addi $t0, $t0, 1 # count++; if: # if (count == 100) bne $t0, $t3, endif # { sw $t3, 0($s0) # list[i] = count; sub $t0, $t0, $t0 # count = 0; endif: # } addi $s0, $s0, 4 # addi $t1, $t1, 1 # j loop # } endloop: # addi $v0, $zero, 10 # syscall # exit;

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!