Hardware Reference
In-Depth Information
ult can be moved from the pipeline register where the
DADD
stores it to where the
DSUB
needs it,
then the need for a stall can be avoided. Using this observation, forwarding works as follows:
1. The ALU result from both the EX/MEM and MEM/WB pipeline registers is always fed back
to the ALU inputs.
2. If the forwarding hardware detects that the previous ALU operation has writen the re-
gister corresponding to a source for the current ALU operation, control logic selects the
forwarded result as the ALU input rather than the value read from the register ile.
Notice that with forwarding, if the
DSUB
is stalled, the
DADD
will be completed and the bypass
will not be activated. This relationship is also true for the case of an interrupt between the two
instructions.
As the example in
Figure C.6
shows, we need to forward results not only from the imme-
diately previous instruction but also possibly from an instruction that started 2 cycles earlier.
Figure C.7
shows our example with the bypass paths in place and highlighting the timing of
the register read and writes. This code sequence can be executed without stalls.
Search WWH ::
Custom Search