Bypassing (also called forwarding) cannot handle all RAW (Read After Write) hazards.
Let’s explain clearly:
What is a RAW hazard?
A Read After Write (RAW) hazard occurs when an instruction needs to read a value from a register before a previous instruction has written its result to that register.
Example:
1. ADD R1, R2, R3 ; R1 = R2 + R3
2. SUB R4, R1, R5 ; R4 = R1 - R5 ← Needs result of previous instruction
What is bypassing/forwarding?
Bypassing means taking the output of an instruction directly from a pipeline stage (like EX or MEM), before it is written back to the register file, and sending it to the next instruction that needs it.
Bypassing can handle:
For example:
1. ADD R1, R2, R3 ; EX stage produces R1
2. SUB R4, R1, R5 ; Needs R1 in EX → Forward from EX/MEM
This can be handled by forwarding.
Bypassing cannot handle:
Example with load-use hazard:
1. LW R1, 0(R2) ; R1 gets data from memory (available in MEM stage)
2. ADD R3, R1, R4 ; Needs R1 in EX stage
Here, R1 is not ready in time for instruction 2’s EX stage, because the load instruction gets data only at the end of MEM.
Even with bypassing, the second instruction must be stalled for one cycle.
Conclusion: