The pipeline

The pipelined core works on five instructions at once, one per stage. A new instruction starts every cycle, so in steady state the core finishes one instruction per cycle, as the single-cycle core does, when no hazard interrupts the flow.

The five stages

StageWhat happens
IFFetch the instruction at the program counter.
IDDecode it and read the source registers.
EXCompute the ALU result, or the branch decision, or a memory address.
MEMLoad from or store to data memory.
WBWrite the result to the destination register.

Watch it run

This is the Fibonacci program on the pipelined core, with forwarding on. The stage boxes show which instruction is in each stage on the selected cycle. Step through a few cycles and watch the first instructions move through the stages.

Fibonacci, 5-stage pipeline with forwarding5-stage, forwarding

Loading the core…

Two things that break the flow