Forwarding Control Signals


The following table shows the control values for the forwarding multiplexors that select either the register file values or one of the forwarded values.

Control signal Explanation
ForwardA = 00 First ALU operand comes from the register file.
ForwardA = 01 Forwarded from the previous ALU result
ForwardA = 10 Forwarded from data memory or the second previous ALU result
ForwardB = 00 Second ALU operand comes from the register file.
ForwardB = 01 Forwarded from the previous ALU result
ForwardB = 10 Forwarded from data memory or the second previous ALU result

The conditions for finding hazards and the control signals to resolve them are
   if ( IF/ID.Rs == ID/EX.Rw ≠ 0 and ID/EX.RegWrite)
      ForwardA = 01        // EX hazard

elseif ( IF/ID.Rs == EX/MEM.Rw ≠ 0 and EX/MEM.RegWrite ) ForwardA = 10 // MEM hazard
else ForwardA = 00 // No hazard if ( IF/ID.Rt == ID/EX.Rw ≠ 0 and ID/EX.RegWrite ) ForwardB = 01 // EX hazard
elseif ( IF/ID.Rt == EX/MEM.Rw ≠ 0 and EX/MEM.RegWrite ) ForwardB = 10 // MEM hazard
else ForwardB = 00 // No hazard




      β€œIt doesn’t matter where you are coming from.    
      All that matters is where you are going.”    
      ― Brian Tracy