MIPS practice 5-stage pipeline
Progress saves in this browser

ONE PROGRAM · TWO WAYS TO RUN IT

Work out the pipeline.

Fill the cycles. Find the stalls. Compare with forwarding.

The program

Original nine-instruction example
    IF Fetch instructionID Read CPU registersEX ALU / addressMEM Read / write RAMWB Write CPU register
    Timing rules for these questions

    One instruction per stage per cycle, in order. Always advance as early as possible. IF → ID → EX → MEM → WB. Repeat IF or ID while held; leave unused cells blank. I1 is filled for you.

    Without forwarding: the consumer stays in ID until each producer reaches WB. WB writes in the first half of the cycle; ID reads in the second half of that same cycle.

    With forwarding: an ALU result is ready at the end of EX and can feed the next cycle’s EX via MEM-to-EX. A loaded word is ready at the end of MEM and can feed the next cycle’s EX via WB-to-EX. The paths go to EX, not ID. An immediately dependent load-use pair needs one stall.

    Stores: the base address can be forwarded to EX. The value to store is read in ID; there is no store-data forwarding here. Show all five stages for sw, including its unused WB. Stores change RAM in MEM and do not change CPU registers.

    Instruction and data memories are separate. All addresses are valid and aligned; memory takes one cycle. No branches, cache misses, or other structural hazards. A store commits at the end of MEM, before a later load accesses that address.

    Click a cell and type IF, ID, EX, MEM, or WB. Shortcuts: F D E M W. Enter moves right; ↑ / ↓ moves between instructions. Scroll the grid to see later cycles.

    Start a new question?

    This replaces the answers in your current practice mode. Your current question has unfinished work.