Top Qs
Timeline
Chat
Perspective

Operand forwarding

CPU optimization technique to improve instruction-level parallelism From Wikipedia, the free encyclopedia

Remove ads

Operand forwarding (or data forwarding) is an optimization in pipelined CPUs to limit performance deficits which occur due to pipeline stalls.[1][2] A data hazard can lead to a pipeline stall when the current operation has to wait for the results of an earlier operation which has not yet finished.

Example

ADD A B C  #A=B+C
SUB D C A  #D=C-A

If these two assembly pseudocode instructions run in a pipeline, after fetching and decoding the second instruction, the pipeline stalls, waiting until the result of the addition is written and read.

Without operand forwarding
12345678
Fetch ADDDecode ADDRead Operands ADDExecute ADDWrite result
Fetch SUBDecode SUBstallstallRead Operands SUBExecute SUBWrite result
With operand forwarding
1234567
Fetch ADDDecode ADDRead Operands ADDExecute ADDWrite result
Fetch SUBDecode SUBstallRead Operands SUB: use result from previous operationExecute SUBWrite result

In some cases all stalls from such read-after-write data hazards can be completely eliminated by operand forwarding:[3][4][5]

With operand forwarding (enhanced)
123456
Fetch ADDDecode ADDRead Operands ADDExecute ADDWrite result
Fetch SUBDecode SUBRead Operands SUB: use result from previous operationExecute SUBWrite result
Remove ads

Technical realization

The CPU control unit must implement logic to detect dependencies where operand forwarding makes sense. A multiplexer can then be used to select the proper register or flip-flop to read the operand from.

See also

References

Loading content...
Loading content...
Loading related searches...

Wikiwand - on

Seamless Wikipedia browsing. On steroids.

Remove ads