IAE Academy

Pipelining formulas

Instruction pipelining and pipeline hazards. 12 formulas for GATE CS Computer Organization and Architecture, each with when to use it. Each is explained in the topic notes.

All 12 Pipelining formulas

PIPELINE CLOCK PERIOD

is the delay of stage and is the inter-stage register (latch) delay, taken as 0 only if the question says so. The slowest stage sets the clock for every stage.

TOTAL TIME FOR N INSTRUCTIONS, K STAGES (NO STALLS)

The first instruction needs cycles to pass through all the stages (pipeline fill). After that, one instruction completes every cycle. Valid for an ideal pipeline with no stalls.

SPEED-UP OVER NON-PIPELINED EXECUTION (GENERAL)

is the time one instruction takes on the non-pipelined machine, as the question defines it: usually the sum of the stage delays. As , .

SPEED-UP, BALANCED STAGES (SPECIAL CASE)

Only when , i.e. all stages have equal delay and latch delay is ignored (or the non-pipelined machine is defined as taking pipelined cycles per instruction). Then as : the ideal maximum speed-up equals the number of stages.

THROUGHPUT

Instructions completed per unit time with no stalls. It approaches as .

PIPELINE EFFICIENCY

Efficiency is the fraction of stage-cycles that do useful work: busy stage-cycles out of . It is below 1 for any finite because of fill and drain, and it tends to 1 as . It equals only in the balanced-stage case, where .

AVERAGE CPI WITH STALLS

For a scalar in-order pipeline, . Here is the fraction of all instructions that suffer hazard type , and is the number of stall cycles it costs. The sum is the average number of stall cycles per instruction. This is the steady-state figure: pipeline fill cycles are ignored.

EXECUTION TIME FROM CPI

The standard performance equation. On the pipelined machine, .

SPEED-UP WITH STALLS

is the non-pipelined time per instruction. The second line holds only for balanced stages with no latch overhead. Both lines ignore fill cycles, so they describe a long program.

RAW STALLS WITHOUT FORWARDING (5-STAGE, SPLIT-CYCLE REGISTER FILE)

is the distance in program order: for the very next instruction. This assumes the register file is written in the first half of WB and read in the second half of ID, so a read in the same cycle as the write sees the new value. The consumer's ID must then fall no earlier than the producer's WB, so needs no stall. If the register file is not split-cycle (the read must come in a cycle after the write), the result becomes .

BRANCH PENALTY (PER TAKEN OR MISPREDICTED BRANCH)

is the number of the stage at whose end both the outcome and the target are known. The correct instruction is fetched in the next cycle. No delay slot or prediction is assumed. For example, resolving at the end of EX (stage 3) squashes the 2 instructions in IF and ID, a penalty of 2 cycles; resolving at the end of ID gives 1.

AVERAGE CPI CONTRIBUTION FROM BRANCHES

is the fraction of all instructions that are branches. is the fraction of those branches that pay the penalty: under predict-not-taken, the taken fraction; under a predictor, the mispredicted fraction. If the pipeline stalls on every branch regardless of outcome, .

Where this was asked: 2018 (1), 2020 (1), 2022 (1), 2023 (1), 2024 (3), 2025 (2), 2026 (3). See the 12 previous-year questions on Pipelining. This shows what was asked, not what will be asked.