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
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