Questions: Pipeline Hazards

5 questions to test your understanding

Score: 0 / 5
Question 1 Multiple Choice

A pipeline has full data forwarding (bypassing) implemented. Consider the instruction sequence: LOAD R1, [addr]; ADD R2, R1, R3. How many stall cycles are required between these two instructions?

AZero — data forwarding eliminates all data hazard stalls
BOne — a load-use hazard requires one stall even with full forwarding
CTwo — the loaded value is not available until write-back, two stages after execute
DThree — the pipeline must wait until LOAD completes all five stages
Question 2 Multiple Choice

A branch instruction is in the pipeline and the branch predictor predicts 'not taken.' Three instructions after the branch have already been fetched speculatively. The branch turns out to be taken. What happens?

AThe processor raises an exception and restarts from the branch
BThe three speculatively fetched instructions are flushed, and the pipeline restarts from the branch target
CThe processor stalls until the branch condition is evaluated before fetching any further instructions
DThe three instructions complete execution but their results are discarded
Question 3 True / False

Data forwarding (bypassing) eliminates the need for stall cycles in most data hazard cases.

TTrue
FFalse
Question 4 True / False

Branch mispredictions are processor errors that indicate a bug in branch prediction logic; a correctly functioning processor should rarely mispredict a branch.

TTrue
FFalse
Question 5 Short Answer

Why does a load-use hazard require a stall cycle even when the pipeline has full data forwarding, while a RAW (read-after-write) hazard between two arithmetic instructions does not?

Think about your answer, then reveal below.