Home › Practice › RTL Design › Forwarding: take the newest value

Forwarding: take the newest value

EasyRTLcombinationalarchitecture

An instruction needs a register that the instruction just ahead of it has computed, but has not yet written back. Waiting would waste cycles, so the processor passes the new value along a shortcut.

Concept first. In a pipeline an instruction may need a register value that an earlier instruction has computed but not yet written to the register file (a data hazard). Forwarding, also called bypassing, routes the value straight from a later stage (Memory or Writeback) into the ALU input. Two stages can hold a newer value for the same register at once. The instruction in the Memory stage is younger than the one in Writeback, so its value is the most recent and wins. In this processor, register 0 always reads zero, so nothing is ever forwarded to it. The unit outputs a 2-bit select for a multiplexer: 00 means use the normal register file value, 01 means take it from Writeback, 10 means take it from Memory.

What to build.

Solve in your browser →

No install and no sign-up needed. You write your answer in the editor and Nishkam checks it.

More in this track

← Pipeline register: stall and flushLoad-use hazard detector →