Similar questions 10 more →
Pipelining & Hazards


Shared context
An ideal five-stage pipeline has stage time 2 ns; every instruction uses all five stages. For a nonoverlapped branch, the following instruction is not fetched until the branch completes. Branches are 20% of all executed instructions. Compute steady-state average time, ignoring finite-stream fill/drain overhead.
Answer & solution
Answer: 3.6 ns per instruction (CPI 1.8 at a 2 ns clock). (no official key was published)
1. Without branches, the pipeline accepts a new instruction every cycle, hence steady-state throughput time is 2 ns per instruction, not the individual instruction latency of 10 ns.
2. A branch fetched in cycle t completes at the end of t+4. The successor can be fetched in t+5, whereas normal overlap would fetch it in t+1. Thus each such branch adds four idle fetch cycles, or 8 ns.
3. The expected cycles per instruction are 1+0.20×4=1.8. Multiplying by 2 ns gives 3.6 ns per instruction.
4. Equivalently, 80% of inter-fetch intervals are 2 ns and 20% are 10 ns, so 0.8×2+0.2×10=3.6 ns. Finite programs have fill/drain effects; the question’s average uses the usual long-run idealization.