Next: HARDWARE REQUIREMENTS FOR BYPASSING
Up: Pipelining: avoiding stalls
Previous: Bypassing to avoid stalls
- The idea of bypassing (often called forwarding) is to add special
hardware to recognise this hazard, and to route the value direct to
where it is needed.
OBSERVE:
Inst |
| |
|
|
|
|
|
|
|
|
|
|
|
|
ADD R1,R2,R3
|
| IF |
ID |
EX |
MEM |
WB |
|
|
|
|
|
|
|
|
|
| |
|
R2+R3 calculated here |
|
|
|
|
|
|
|
SUB R4,R1,R5
|
| |
IF |
ID |
EX |
MEM |
WB |
|
|
|
|
|
|
|
|
| |
|
|
R2+R3 needed here |
|
|
|
|
|
|
Cycle |
| 1 |
2 |
3 |
4 |
5 |
6 |
|
|
|
|
|
|
|
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
- So all we have to do is copy the ALU output back to the ALU input
ready for the next cycle.
- Of course we must still make sure R2 + R3 is eventually stored in R1, in
case it is referred to again.
Next: HARDWARE REQUIREMENTS FOR BYPASSING
Up: Pipelining: avoiding stalls
Previous: Bypassing to avoid stalls