Questions: Hazards in Pipelined Processors

5 questions to test your understanding

Score: 0 / 5
Question 1 Multiple Choice

Consider the sequence: ADD R1, R2, R3 followed immediately by SUB R4, R1, R5. In a 5-stage pipeline with full data forwarding, how many stall cycles does the processor insert?

A2 stall cycles — ADD must complete write-back before SUB can read R1
B1 stall cycle — the result needs one extra cycle to propagate
C0 stall cycles — forwarding routes ADD's ALU output directly to SUB's ALU input
DIt depends on whether the operands are in cache
Question 2 Multiple Choice

Consider the sequence: LOAD R1, [address] followed immediately by ADD R4, R1, R5. With a full forwarding network, how many stall cycles are needed?

A0 — forwarding eliminates all data hazards
B1 — the load result is not available until after memory access, one stage later than ALU results
C2 — load instructions always require two extra cycles
D3 — the pipeline must fully drain before continuing
Question 3 True / False

Not every data dependency between adjacent instructions in a pipeline causes a hazard — only dependencies where the dependent instruction needs a result before it has been written.

TTrue
FFalse
Question 4 True / False

Data forwarding eliminates most data hazards in a pipelined processor.

TTrue
FFalse
Question 5 Short Answer

Why does a control hazard occur in a pipelined processor, and what is the fundamental difficulty in resolving it compared to data hazards?

Think about your answer, then reveal below.