Ported PL.8 to the CISC IBM 370 using only simple register-register and load/store instructions
Ran up to 6 MIPS where 2 MIPS with the full CISC ISA was considered good
Emer & Clark, DEC VAX-11/780 (external hardware probes)
Delivered only 0.5 MIPS, half its advertised 1 MIPS
20% of instructions used 60% of the microcode but only 0.2% of execution time
VAX 8800
Control store: 16K × 147 bits of fast RAM; unified cache: 64K × 8 bits
4.5× more fast RAM on fixed microcode than on caching user code and data
From Microcode to RISC
VLSI: logic, RAM, ROM all MOS transistors
Semiconductor RAM ≈ same speed as ROM
Fast on-chip RAM holds the user instructions actually needed, not dead microroutines
Simple regular ISA = vertical microcode exposed as the ISA
Early 1980s: 32-bit datapath + small caches fit on one chip
Microarchitecture Styles and the Iron Law
Microarchitecture
CPI
Cycle time
Microcoded
> 1 (e.g., 7.33)
Short
Single-cycle unpipelined
1
Long
Pipelined
1 (ideal)
Short
Pipelining gets both. What keeps it from staying at CPI = 1?
Check Your Understanding
1. Iron Law: Processor A cuts instructions/program by 20% with complex microcoded instructions but doubles CPI vs. Processor B at the same clock. Which is faster, by what factor?
B. A's time scales by $0.80 \times 2.0 = 1.60$, so A takes 1.6× longer.
2. Fill in the blank: when RAM became as fast as ROM, RISC replaced the microcode ROM with a user-visible ________ and the nanoinstruction ROM with ________.
Instruction cache; hardwired decode.
Three Timelines
Microcoded: CPI 7.33, short clock · Single-cycle: CPI 1, long clock · Pipelined: CPI 1, short clock
A 5-Stage Pipeline Does NOT Have CPI = 5
Each instruction has a latency of 5 cycles
But 5 instructions overlap at once
So throughput is 1 instruction per cycle: CPI = 1
Latency, Bandwidth, Occupancy
Latency: time from initiation to a usable result
Bandwidth: rate at which operations can be performed
Occupancy: time the unit is blocked on an operation (structural hazard)
Case
When it happens
Occupancy ≪ Latency
Pipelined unit: 5-stage FP adder takes 5 cycles but accepts a new op every cycle
Occupancy > Latency
Result returns early, then recovery cycles (DRAM precharge after a read)
Bandwidth > 1/Latency
Pipelined ($\text{BW} = 1/\text{Occupancy}$) or replicated sub-units
Bandwidth < 1/Latency
Occupancy > latency, or stalls/bubbles interrupt issue
Classic 5-Stage RISC Pipeline
Dashed lines = pipeline registers (rising edge). Assumes synchronous reads and writes for register file and memories.
Pipeline Bubbles and Hazards
Overlapping instructions interact in three ways that force bubbles:
Structural: two instructions need the same resource
Data: depends on a value produced/consumed by an earlier instruction
Control: branch, jump, or exception changes which instruction is next
Steady-state CPI: count from first finish to last finish
Finish sequence
CPI
I1, I2, I3
3/3 = 1.00
I1, I2, bubble, I3
4/3 = 1.33
I1, bubble, I2, bubble, I3
5/3 = 1.67
Resolving Structural Hazards
Stall the newer instruction until the older one frees the resource
Add hardware
e.g., fetch and data access colliding on one memory port → separate I and D caches
The classic 5-stage integer pipeline has no structural hazards by design
Remaining obstacles to CPI = 1: data and control hazards
Check Your Understanding
1. True or False: a 5-stage pipeline has ideal CPI = 5 because every instruction takes 5 cycles.
False. Latency is 5 cycles, but 5 instructions overlap, so one finishes per cycle: CPI = 1.
2. Quick computation: a memory controller returns read data in 4 cycles, then needs 2 more cycles of precharge before the next request. Latency, occupancy, peak bandwidth?
Saves $I_i$'s PC in EPC, masks interrupts, jumps to the handler
Handler saves EPC before re-enabling interrupts (nesting), reads Cause
ERET: indirect jump restoring user mode and interrupt enables atomically
Synchronous trap: caused by a faulting $I_i$
Usually restarted after the OS fixes it: undo partial effects of $I_i$ and younger
System call counts as completed: EPC = $I_i + 4$
Exceptions in a 5-Stage Pipeline
Four instructions can raise four exceptions in the same cycle:
F: PC address exception
D: illegal opcode
X: arithmetic overflow
M: data address exception (page fault, misaligned)
Plus asynchronous interrupts at any time
Trapping immediately on X's overflow is wrong
An older instruction in M may have an earlier data address exception
Commit Point Exception Handling
Carry Exc flags and PC down the pipeline (Exc D/E/M, PC D/E/M)
Per instruction: earlier stages' exceptions override later ones
Across instructions: hold exceptions until the commit point at the end of M
Instructions reach M in program order, so the oldest fault traps first
Inject asynchronous interrupts at the commit point
On trap: update Cause and EPC (from PC_M); assert Kill F, Kill D, Kill E, Kill Writeback; select handler PC
Data-memory stores and register writes happen only at or after commit.
Speculating on Exceptions
Exceptions are rare, so the pipeline predicts "no exception" every cycle
Younger instructions execute and even consume uncommitted results via bypassing
Check at the commit point; recover by flushing uncommitted state
Flushing registers does not erase every trace
Lazy exception handling
Younger instructions read privileged memory and leave cache side effects before the faulting load is killed
This is the Meltdown vulnerability
Check Your Understanding
1. Ordering: in one cycle, Instruction 1 (in M) has a data address exception and younger Instruction 2 (in X) overflows. Which trap is taken, and what happens to Instruction 2?
Instruction 1's exception reaches the commit point first (EPC = its PC_M); Instruction 2 is killed before changing architectural state.
2. Fill in the blank: exception flags are carried to the ________ at the end of M, so state changes only once an instruction cannot fault.
Commit point.
← → / space to move · A to reveal answers · F fullscreen