5.2.11 · D3Processor Datapath & Pipelining

Worked examples — Deep pipelining trade-offs

2,946 words13 min readBack to topic

This page is the drill ground for Deep pipelining trade-offs. The parent note built the ideas; here we grind through every kind of number the topic can throw at you — big depths, tiny depths, the degenerate case where extra stages do nothing, the limit as depth runs to infinity, a real chip (Pentium 4), and an exam twist.

Before a single example, one promise: every symbol below was earned in the parent note. Quick refresh, in plain words:

Why frequency is and not something fancier: frequency literally means "how many cycles fit in one second", and if one cycle lasts seconds, then of them fit in a second. If is in nanoseconds ( s), then gives megahertz (MHz), because and ticks/s.


The scenario matrix

Every problem this topic can pose falls into one of these cells. The worked examples below are labelled with the cell(s) they cover, so together they leave no gap.

Cell What makes it distinct Covered by
A. Shallow depth small (e.g. 5) — registers are a small slice of the cycle Ex 1
B. Deep depth large (e.g. 20) — registers eat a big slice; diminishing returns visible Ex 2
C. Ratio comparison "how much better is than ?" — the marginal question Ex 3
D. Limiting case — the hard ceiling on speedup Ex 4
E. Degenerate input , or (no pipeline at all) — the sanity anchors Ex 5
F. Hazards fold in branches raise CPI; frequency win is partly eaten Ex 6
G. Imbalanced stages the "just divide evenly" trap — longest stage rules Ex 7
H. Real-world word problem Pentium 4: frequency up but net performance flat Ex 8
I. Power / DVFS twist dynamic power scaling — exam-style curveball Ex 9

We reuse one baseline machine unless a cell says otherwise:


Example 1 — Shallow depth (Cell A)

Forecast: Guess first — will the speedup be close to , or noticeably less? Jot a number.

  1. Stage logic delay . Why this step? Even splitting means each stage gets an equal share of the work; is that share and it is what sets the useful part of the cycle.
  2. Cycle time . Why this step? A cycle can't be shorter than the slowest stage plus the toll to cross into the next stage — you always pay the register overhead.
  3. Frequency . Why this step? We convert "one tick takes 2.2 ns" into "how many ticks per second"; the turns ns into MHz.
  4. Speedup . Why this step? The unpipelined machine finishes one instruction every ns; the pipeline finishes one every ns once the pipe is full.

Verify: Register overhead as a fraction of the cycle is — small, as promised for shallow pipelines. And , so we did not get the ideal : the ns toll cost us the missing . Sanity: ns ✓.


Example 2 — Deep depth (Cell B)

Forecast: We quadrupled the depth from Ex 1 (5→20). Will speedup quadruple to ? Guess.

  1. . Why? Each stage now does a quarter of what it did at .
  2. . Why? Same toll (), but now it's a big slice of a tiny cycle.
  3. . Why? Convert to ticks/s.
  4. . Why? Throughput ratio vs. unpipelined.

Verify: Overhead fraction is now — over triple the of Ex 1. That's exactly why going 5→20 stages (a deepening) only bought more speedup, not . The register toll is stealing more of every cycle. ✓


Example 3 — Marginal comparison (Cell C)

Forecast: Doubling stages — does frequency double?

  1. , so . Why? Same recipe.
  2. . Why? Ticks/s.
  3. . Why? Speedup vs. unpipelined.
  4. Ratio to Ex 1: . Why this step? This is the honest payoff of doubling depth — the number a designer actually cares about.

Verify: We doubled but got only , not . The missing is the register toll asserting itself — and Figure 1 below shows exactly where this point sits on the curve. ✓

Figure — Deep pipelining trade-offs

Reading Figure 1 (tie it to the numbers above): the dashed yellow line is the ideal speedup (what you'd get if , our Ex 5a result). The solid blue curve is the real speedup from our formula. Find the three white dots: at it reads (Ex 1), at it reads (this example), at it reads (Ex 2). Watch the vertical gap between blue and yellow widen as you move right — that widening gap is the register toll, and it is why the marginal ratio fell from an ideal to our . The pink dotted line at is the ceiling from Ex 4 that the blue curve creeps toward but never touches.


Example 4 — The limit (Cell D)

Forecast: Does speedup grow forever, or hit a wall? What number?

  1. Start from . Why? This is our exact formula — no approximation yet.
  2. As , the term . Why this step? Dividing a fixed by a huge shrinks it toward zero — each stage's useful work vanishes.
  3. So . Why? With the logic term gone, only the toll remains in the denominator, and it's a fixed .

Verify: No matter how many stages you build, you can never beat on this machine. Check with a huge : at , , speedup — creeping toward 50 but never reaching it. On Figure 1 this is the pink dotted asymptote. This is the register-limited regime the parent note warned about. ✓


Example 5 — Degenerate inputs (Cell E)

Forecast: In (a), what should speedup equal exactly? In (b), should there be any speedup?

Case (a):

  1. . Why? Remove the toll entirely.
  2. . Why this step? With zero overhead, speedup equals exactly — the ideal the dashed yellow line in Figure 1 represents.

Case (b):

  1. . Why? One "stage" holds all the logic, yet we still pay one register toll to latch the result.
  2. . Why this step? Adding a register but no splitting makes you slightly slower than unpipelined — a pure loss.

Verify: (a) confirms , the theoretical best. (b) confirms is never worth it (0.98 < 1) — pipelining only pays once and the frequency gain outweighs the one-time toll. Both anchors behave. ✓


Example 6 — Hazards fold in (Cell F)

Forecast: Frequency is higher at 20 stages. Will effective speedup also be ? Or less?

  1. Mispredictions per instruction . Why? of instructions are branches; of those are mispredicted.
  2. CPI (5-stage) . Why this step? Each misprediction flushes stages; multiply by how often it happens and add to the base CPI of 1.
  3. CPI (20-stage) . Why? Now instructions get flushed per misprediction — nearly the pain.
  4. Effective speedup ratio . Why this step? Performance ; the ratio of performances is (frequency ratio) × (inverse CPI ratio).
  5. Compute: . Why? The raw frequency gain of is dragged down to by the worse CPI.

Verify: Frequency alone said ; hazards cut it to . The CPI penalty () ate about of the frequency win. This is why Branch Prediction accuracy is life or death in deep pipelines — see also Pipeline Hazards. ✓


Example 7 — Imbalanced stages (Cell G)

Forecast: The average stage is ns. Does the clock run at the average?

  1. Find the longest stage. The maximum of the list is . Why this step? Every stage must finish before the clock ticks; the clock waits for the slowest worker, never the average.
  2. . Why? Longest stage plus the fixed register toll.
  3. . Why? Throughput vs. unpipelined.
  4. Compare to balanced Ex 3 (). Why this step? Shows how much imbalance costs.

Verify: The naive even-split predicted ; the real imbalanced pipeline delivers only — a loss of about , caused entirely by the one ns stage. The sum of delays still equals ns (average ), yet the max is what rules. Never average — always take the max.

Figure — Deep pipelining trade-offs

Reading Figure 2 (tie it to the numbers above): each blue bar is one stage's logic delay; the -axis is the stage number, the -axis is delay in ns. The single pink bar is stage 4 at ns — the tallest. The pink dashed line drawn across at is what actually sets (add to get ). The yellow dotted line at marks the average — notice it sits below the pink line, which is the whole point: the clock obeys the tallest bar, so every shorter stage (all the ones under the pink line) sits idle for the leftover time, wasting it. That wasted gap is why speedup fell from to .


Example 8 — Real-world word problem: Pentium 4 (Cell H)

Forecast: more frequency — surely faster?

  1. Performance = . For Northwood: . Why? Throughput is ticks/s divided by cycles/instruction.
  2. Prescott: . Why this step? Both factors moved by exactly — one helping, one hurting.
  3. Ratio . Why? The gains cancelled precisely.

Verify: Frequency rose but performance rose zero net gain, exactly the parent note's "deep-pipeline wall." Meanwhile dynamic power (Ex 9) rose, so Prescott was worse per watt. Intel's answer: abandon deep pipes for the 14-stage Core design with wider issue (Superscalar Architectures) and better IPC. ✓


Example 9 — Power / DVFS twist (Cell I)

Forecast: Frequency rose — is that the whole power story?

  1. Frequency ratio . Why? From Examples 2 and 3.
  2. Power ratio . Why this step? cancels (held constant); capacitance and frequency each multiply in.
  3. Evaluate: . So dynamic power rises by a factor of . Why this step? We actually multiply out the numbers to get the final answer — no leaving it symbolic.

Verify: Power grew by while performance (roughly the frequency, ) grew less — so power grew faster than performance (), meaning worse efficiency (more watts per instruction). This is precisely why real chips lower as they add stages, using DVFS; because , a small voltage drop recovers a lot of power. And clock distribution to the registers is itself a major power sink (30–40% in Pentium 4). ✓


Recall Self-test — cover the answers

Even 5→20 stages gives what speedup ratio (register-limited)? ::: About , not (Ex 2 ÷ Ex 1). The absolute speedup ceiling on the baseline machine is? ::: (Ex 4). With and a real register, speedup is? ::: — slightly worse than unpipelined (Ex 5b). What sets the cycle time in an imbalanced pipeline? ::: The longest stage plus , never the average (Ex 7). Why did Prescott's frequency give performance? ::: CPI also rose , cancelling the gain (Ex 8). By what factor did dynamic power rise in Ex 9? ::: , more than the frequency gain — worse efficiency.


Connections: Instruction Pipelining Basics · Pipeline Hazards · Branch Prediction · Superscalar Architectures · Clock Distribution and Skew · Dynamic Voltage and Frequency Scaling (DVFS) · Pentium 4 vs Core Microarchitecture · 5.2.11 Deep pipelining trade-offs (Hinglish)