Exercises — Multi-cycle datapath
This page is a self-test ladder. Work each problem before opening its solution. Levels climb from recognising the five steps to designing and comparing whole machines. Every symbol you need was built in the parent note Multi-cycle datapath (5.2.2) — here we only use the tools.
The figure below shows why those step delays are what they are — study it before Level 2, then return to it when you solve L2-Q1.

The bar chart makes the key claim visual: the clock (dashed line) is pinned to the tallest bar (ID = 300 ps), not to the sum of all bars. Notice that IF, EX, and MEM each sit at 200 ps and WB at 100 ps — those stages waste the difference between their height and the dashed line every cycle. That wasted headroom is exactly what makes this particular machine lose on raw speed (Level 3).
Level 1 — Recognition
Recall Solution L1-Q1
(a) IR is written in IF — it holds the raw instruction bits Memory[PC].
(b) A and B are written in ID — they hold the two source-register values Reg[rs], Reg[rt].
(c) ALUOut is first written in ID — it holds the speculatively pre-computed branch target PC + (sign-ext(imm) << 2). (It is written again in EX for R-type/address results — but the first write is ID.)
(d) MDR is written in MEM — it holds data read from memory during lw.
Why this ordering? Each register is a "sticky note" catching a combinational value before the clock edge erases it, so a later cycle can read it.
Recall Solution L1-Q2
(a) add = 4 (IF ID EX WB — no memory).
(b) lw = 5 (IF ID EX MEM WB — the only 5-cycle instruction).
(c) sw = 4 (IF ID EX MEM — finishes in MEM, no write-back).
(d) beq = 3 (IF ID EX — PC updated in EX).
(e) j = 3 (IF ID EX — PC updated in EX).
Level 2 — Application
Recall Solution L2-Q1
- IF = ps. Why? In IF two things happen in parallel: the memory read
IR ← Memory[PC](200 ps) and the PC+4 add on the ALU (200 ps). Because these run on independent hardware at the same time — the memory feeds IR while the ALU feeds PC — the stage delay is the maximum of the two, ps, not their sum. This is the crucial difference from ID (below), where the two operations are chained. - ID = RegFile read then ALU branch-target calc in sequence in the same cycle ps. Here the ALU needs the register-read result as an input, so it must wait for it — the delays add.
- EX = ALU = ps.
- MEM = memory access = ps.
- WB = RegFile write = ps. The clock must fit the worst step, so ps. Why ID dominates: it chains a register read and an ALU op (one feeds the other), so their delays add; IF avoids this because its memory read and PC+4 add are independent and parallel.
Recall Solution L2-Q2
lw uses 5 cycles: ps.
Single-cycle lw = ps. So for lw alone, multi-cycle is slower ().
Why this step: execution time = cycles × period. Never compare clock speeds; compare times.
Recall Solution L2-Q3
beq uses 3 cycles: ps.
This is close to the single-cycle 800 ps, but still slightly slower here because is not perfectly balanced.
Level 3 — Analysis
Recall Solution L3-Q1
Why each term: it is — the fraction of the program that is type times that type's cycle count. Summing over all types gives the weighted average number of cycles a "typical" instruction costs.
Recall Solution L3-Q2
Since , multi-cycle is slower on raw time for these numbers. Why: the ID stage (300 ps) is unbalanced — it hogs the clock period while other stages waste 100–200 ps of that period. Multi-cycle's guaranteed benefit here is less hardware (shared ALU and unified memory), not speed.
Recall Solution L3-Q3
Break-even: ps. So multi-cycle beats single-cycle only when the worst step drops below ≈197.5 ps. Since one memory access already costs 200 ps, that's essentially impossible unless we also reduce CPI or memory delay. This quantifies why this particular machine loses on speed. Why this step: set the two program-times equal and solve for the unknown — the classic break-even technique.
Level 4 — Synthesis
Recall Solution L4-Q1
beq uses IF, ID, EX — the ALU works in all three:
- IF: operands =
PCand4→ resultPC+4, latched into PC (default next instruction). This ALU add runs in parallel with the memory readIR ← Memory[PC], so it does not lengthen the IF stage beyond 200 ps (see L2-Q1). - ID: operands =
PCandsign-ext(imm) << 2→ result = branch target, latched into ALUOut speculatively. - EX: operands =
AandB→ the ALU subtracts to test ; if the zero-flag is set,PC ← ALUOut(the target from ID). Why three uses: multiplexers re-route the single shared ALU's inputs each cycle — that reuse is the point of multi-cycle. (See figure.)

Recall Solution L4-Q2
(a) .
(b) Time per instruction ps.
(c) , so multi-cycle is still slower — the memory-heavy lw fraction pushes CPI up, not down.
Why: more lw means more 5-cycle instructions, raising CPI. Multi-cycle helps only when the step delay advantage outweighs the cycle-count penalty — which it doesn't here.
Recall Solution L4-Q3
sw writes memory: in MEM it does Memory[ALUOut] ← B. Its job — moving a register value into memory — is complete once memory is written. There is no register to update, so no WB.
lw reads memory: in MEM it does MDR ← Memory[ALUOut], capturing the data in MDR. But the destination is a register, and the register file can only be written in a separate cycle (WB): Reg[rt] ← MDR. Hence lw needs the extra 5th step.
Why the asymmetry: a store's destination is memory (written in MEM); a load's destination is a register (written in WB). The direction of data flow decides the last step.
Level 5 — Mastery
Recall Solution L5-Q1
New cycle counts (each +1): lw=6, sw=5, R-type=5, beq=4, j=4.
(a)
.
(b) Time/instr ps.
(c) vs single-cycle: → still slower than single-cycle, but closer.
(d) vs original multi-cycle: → the rebalanced machine is 20% faster than the original multi-cycle.
Why the trade-off matters: shortening the clock (300→200) more than paid for the extra cycle within the multi-cycle family, even though neither beats single-cycle on this mix. This is the exact tension pipelining resolves — see Pipelining.
Recall Solution L5-Q2
Multi-cycle wins here — but for hardware, not speed. Reasoning:
- The workload is memory-heavy, so CPI is high (many 4–5 cycle instructions) → multi-cycle's time advantage is weak (we saw 0.66–0.79 speedups, i.e. slower).
- But the constraint is transistor budget. Multi-cycle uses one unified memory and one shared ALU across cycles, whereas single-cycle needs separate I/D memories and often multiple adders. That is the decisive saving for a tiny chip.
- Full Pipelining would give the best throughput but costs the most hardware (pipeline registers, forwarding, hazard logic) — wrong for a tiny budget. Conclusion: pick multi-cycle: its defining benefit — hardware reuse — matches the binding constraint. See CPI and CPU performance equation for the throughput trade-off and Control unit — FSM vs microprogramming for how the multi-step control is built.
Recall Solution L5-Q3
Equal instruction counts cancel: With , CPI : need ps (matches L3-Q3). The general rule: multi-cycle wins iff the longest step is shorter than the single-cycle period divided by the average cycle count. Why: this is just "program time smaller" with divided out — the cleanest statement of the whole trade-off.
Recall Quick self-check (cloze)
Multi-cycle clock period equals the delay of the longest single step. Program time = N × CPI × T_step. R-type's four steps are IF, ID, EX, WB (it skips MEM). Multi-cycle beats single-cycle iff T_single / CPI. Multi-cycle needs only one (unified) memory because IF and MEM happen in different cycles.
Multi-cycle beats single-cycle when?
Why does R-type skip MEM?
Why can one memory serve both instructions and data?
Why doesn't IF's PC+4 ALU add lengthen the IF stage?
Parent: Multi-cycle datapath · Prereqs: Single-cycle datapath, ALU design, Memory hierarchy · Next: Pipelining, CPI and CPU performance equation.