Ready

Assembly

Pipeline execution

Selected cycle00

Retired0
Stall cycles0
Flushed instructions0
CPI—

Pipeline timeline

Scroll across cycles and down through instructions. Hover or focus a tile for its explanation.
StallFlushSelected cycle

Machine state

PC Completed cycles 0

32 integer registers · x0 is hardwired to zero.

Pipeline timing guide

Each stage can work on a different instruction in the same cycle. After the last fetch, the remaining instructions continue through WB.

Data hazards

When ID stalls for an operand, IF and ID hold their instructions. A bubble enters EXE on the next cycle, and older instructions continue toward WB.

Forwarding. EX/MEM and MEM/WB can supply operands directly to EXE, including store data. A load produces its value at the end of MEM, so an instruction that uses it immediately still stalls for one cycle.

When WB and ID overlap

In cycle 5 of WB and ID overlap, the first instruction writes 9 to x5 while the fourth reads x5 in ID. With a rising-edge write at the end of WB, ID sees the old value, 0, and stalls even with EXE forwarding. With double pumping, WB writes on the falling edge. ID reads 9 in cycle 5 and advances to EXE in cycle 6.

Control hazards

IF fetches the target on the cycle after a redirect. A branch that falls through keeps its younger instructions.

How the target is resolvedPC updatesYounger slots cleared
Baseline branch or jump. EXE calculates the target.End of MEM3
Branch target adder in EXE. Target calculation and comparison run in parallel.End of EXE2
Jump target adder in ID. ID calculates the target of an unconditional jump.End of ID1

A register-indirect jump resolved in ID waits for its base register. Only occupied younger slots increase the flushed-instruction count.