Skip to content
Tactiverge

Pipeline throughput vs hazard rate: experiment bench

Simulation OS · siliconEducational model, not a digital twin

Pipeline throughput vs hazard rate

How data hazards and taken branches eat into the speed-up of a 5-stage pipeline, with and without forwarding.

Your level (shows more controls and deeper equations)
  1. 1. Ask
  2. 2. Hypothesise
  3. 3. Set up
  4. 4. Run
  5. 5. Record
  6. 6. Change one variable
  7. 7. Compare
  8. 8. Interpret
  9. 9. Limitations & save

If I change …, then … will …, because …

3 · Set up the parameters

10–1000

Longer runs hide the 4-clock fill time of the pipeline.

0–1

Fraction of instructions that need the result of the instruction just before them.

0–1

Forwarding passes a result straight from EX or MEM to the next instruction.

4 more controls appear at higher levels; until then they stay at the default value.

The seed fixes any random noise. Same parameters + same seed = exactly the same result, every time, on every computer.

6 · Change one variable

Your first run is the baseline. After it, change one thing at a time.

7 · Compare on a graph

Run the model to draw your first curve here.

5 · Run log

No runs yet.

Equations

cycles = N + 4 + stalls, CPI = cycles / N. Without forwarding each hazard costs 2 stalls; with forwarding only a load followed by a use costs 1.

Assumptions (always true in this model)

  • Every stage takes exactly one time unit; there is no pipeline-register overhead.
  • Every hazard is between neighbouring instructions (distance 1).
  • Branches are predicted not-taken and resolved in EX.
  • No structural hazards, cache misses or interrupts.
  • Counts are rounded to whole instructions, so results are whole clocks.
Text description of what the chart shows

A line chart of clocks per instruction (CPI) against hazard rate from 0 to 1. Without forwarding CPI climbs steeply, by about 2 for every hazard per instruction; with forwarding it stays close to 1, rising only for hazards that follow a load. Taken branches lift both lines by the branch penalty.

Did the result support your hypothesis? Use the numbers from the comparison table and link them to an equation.

Which assumptions could change your answer in the real world?

Export and save

Exports use the ticked runs (or every run if none are ticked). Your draft saves automatically in this browser only. The Journal is private to you.

Valid parameter ranges

ParameterRangeDefault
Instructions executed10 to 1000100
Hazard rate0 to 10.3
Forwarding (0 off, 1 on)0 to 11
Share of hazards after a load0 to 10.25
Branch rate0 to 0.50.15
Taken fraction0 to 10.6
Taken-branch penalty0 to 3 clocks2

Independent reference checks

  • no hazards, no branches

    Hand: 100 instructions + 4 fill clocks = 104; 5·100/104.

  • 20% hazards, no forwarding

    Hand: 20 hazards × 2 stalls = 40; 100 + 4 + 40 = 144.

  • 20% hazards, forwarding, quarter after loads

    Hand: 5 load-use hazards × 1 stall; 100 + 4 + 5 = 109.

  • taken branches only

    Hand: 200 × 0.1 × 0.5 = 10 taken branches × 2 = 20; 200 + 4 + 20 = 224.

Checked automatically on every change to the code. Educational model, not engineering-grade.