Question
If no branch hazard reduction techniques are implemented in a pipeline, including stalling, a branch instruction might cause pipeline flushing to occur. Assume the standard
If no branch hazard reduction techniques are implemented in a pipeline, including stalling, a branch instruction might cause pipeline flushing to occur. Assume the standard 5-stage MIPS pipeline is being used on this code:
label: addi $10, $10, -1
sub $11, $12, $13
sw $10, 100($10)
ori $14, $15, 56
bne $10, $0,
label and $16, $12, $13
slt $8, $9, $12
a. Using the above code in your explanation, explain the situation in which the pipeline will need to be flushed. Include in your explanation:
i) What kind of value would be stored in register $10 before this code begins to cause a pipeline flush?
ii) When will the branch be evaluated? What instructions will be in the pipeline?
iii) Which instructions would need to be flushed when this happens?
b. Using the above code in your explanation, explain the case when flushing would NOT occur. Include in your explanation:
i) What kind of value would be stored in register $10 before this code begins to prevent needing a pipeline flush?
ii) What happens when the branch is evaluated and how does it affect the pipeline? One way to prevent branch hazards and flushing is to stall until the branch decision is made. This causes a delay in the pipeline.
c. Another way of reducing the branch delay is to use branch delay slots". Explain how the above code segment could be re-arranged to implement branch delay slots", and eliminate the branch delays.
d. Another branch delay prevention/reduction method is prediction .
i) Which type of prediction would best reduce the branch delays in the above code segment (explain)?
ii) Would any delays still remain in the above code segment using this type of prediction?
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