In a 5-stage pipeline, branch is resolved in EX stage. If branch frequency =…
2026
In a 5-stage pipeline, branch is resolved in EX stage. If branch frequency = 15% and misprediction penalty = 2 cycles, what is pipeline CPI?
- A.
1.3
- B.
1.2
- C.
1.1
- D.
1.4
Show answer & explanation
Correct answer: A
Concept: In a pipelined processor achieving an ideal one-cycle-per-instruction throughput, the baseline CPI is 1. Any instruction that forces the pipeline to stall raises the effective CPI above this baseline. A branch instruction whose outcome is not known until a later pipeline stage forces the pipeline to stall for a fixed number of cycles on every occurrence; this fixed per-branch stall cost is the branch (misprediction) penalty. Since the item supplies only a single branch frequency and a single fixed penalty value, with no separate misprediction-rate figure, the standard convention for this class of numerical is to apply that penalty uniformly to every branch instruction encountered. Averaged over all instructions, the overall CPI is: CPI = Ideal CPI + (Branch Frequency x Branch Penalty).
Application:
Identify the given quantities: ideal CPI = 1 (one instruction completes per cycle in a hazard-free pipeline); branch frequency = 15% = 0.15 (fraction of instructions that are branches); branch penalty = 2 cycles (stall cycles incurred per branch, since the outcome is known only in the EX stage).
Compute the average stall contributed by branch instructions: Stall per instruction = Branch Frequency x Branch Penalty = 0.15 x 2 = 0.30 cycles.
Add this stall contribution to the ideal CPI: CPI = 1 + 0.30 = 1.30.
Cross-check with a per-100-instruction count: out of 100 instructions, 15 are branches; each branch adds 2 stall cycles, giving 15 x 2 = 30 extra cycles; total cycles = 100 (base) + 30 (stalls) = 130 cycles; CPI = total cycles / total instructions = 130 / 100 = 1.3, which matches the formula result.
Hence, the pipeline CPI is 1.3.