Pipelining
From instruction set to cycles, caches and parallelism
Computer Science | Undergraduate (Level 5) | December 2026
WHAT IS INSIDE
1. Instruction sets and the programmer's model
2. Datapath, control and pipelining
3. Memory hierarchy and caches
4. Instruction-level and thread-level parallelism
Exam question patterns
Glossary of exam-ready definitions
1. Instruction sets and the programmer's model
An instruction set architecture is the contract between hardware and compiler: registers, addressing
modes, data types and the instruction formats. RISC designs favour fixed-length instructions, load-store
addressing and many registers so that pipelining stays simple; CISC designs allow memory operands and
richer instructions, trading decode complexity for code density. The exam distinction is not which is faster
but which makes which optimisation cheap.
Calling conventions, the stack frame and the role of the program counter and link register define how
procedures work, and they explain most assembly questions. Addressing modes - immediate, register, base
plus offset, PC-relative - decide whether code is position independent and how many instructions a loop
costs. Counting instructions and cycles for a short loop is the standard calculation, and the answer must
separate instruction count from cycles per instruction.
• RISC vs CISC - the trade is decode complexity against instruction count.
• CPI and clock - time = instruction count x CPI x clock period; name all three.
• Position independence - PC-relative addressing makes code relocatable.
• Stack discipline - saves and restores must balance or the return address is lost.
2. Datapath, control and pipelining
The single-cycle datapath executes one instruction per clock, so the clock period is set by the slowest
instruction - usually a load. Multicycle designs break execution into steps and reuse hardware, which
shortens the clock but adds registers and control states. The control unit is either hardwired or
microprogrammed, and the choice trades flexibility against speed.
A five-stage pipeline (fetch, decode, execute, memory, write back) overlaps instructions, so ideal throughput
is one instruction per cycle, but structural, data and control hazards stall it. Data hazards are handled by
forwarding, with a one-cycle load-use stall when forwarding cannot help; control hazards by branch
prediction, delay slots or flushing. Speedup is limited by the unpipelined fraction and by pipeline depth, and
a deeper pipeline raises both throughput and the penalty of a misprediction.
• Load-use hazard - forwarding cannot cover it; insert one stall or reorder.
• Branch penalty - misprediction cost grows with pipeline depth.
• Superscalar - issue width is limited by dependencies and by functional units.
• Amdahl's law - speedup is capped by the part that does not improve.
Computer Architecture: Datapath, Memory Hierarchy and Pipeli Page 1 of 3