2.6Operand forwarding (bypass)
The idea
Forwarding (bypassing) sends a result straight from where it is produced to where it is needed, instead of waiting for the register write.
Think of it like this: Passing a note directly to the next person instead of filing it and making them look it up.
Why it exists
It removes most RAW stalls with a little extra wiring.
How it works
- Without forwarding the consumer waits until the producer writes back.
- With forwarding, the ALU output is fed to the next instruction's EX stage next cycle.
- A load's data only exists after MEM, so a load-use dependency still costs 1 stall.
Worked example: ADD then dependent SUB
No forwarding: 2 stalls. With forwarding: 0. LW then dependent ADD: 1 stall even with forwarding.
Now play with it
- →Flip through the three tabs and compare how many "stall" cells appear.
| 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | |
|---|---|---|---|---|---|---|---|---|
| ADD R1,R2,R3 | IF | ID | EX | MEM | WB | |||
| SUB R4,R1,R5 | IF | stall | stall | ID | EX | MEM | WB |
SUB must wait until ADD has written R1 (cycle 5): 2 stalls.
Check yourself
With full forwarding, how many stall cycles does LW R1 followed by an instruction using R1 need?
Exam notes (the dense version)
Send ALU result straight to the next EX input. Removes most RAW stalls. A load-use dependency still needs 1 stall.
Previous year questions: Instruction Pipelining & Hazards (15)
PYQs are grouped by topic, so this is the full set for Instruction Pipelining & Hazards; try the ones that match this subtopic. Open all 15 on the topic page.