Subtopic 3 of 4
6.3Average CPI
The idea
Average CPI is a weighted average of the CPI of each instruction class, weighted by how often each class occurs.
Think of it like this: Your average speed over a trip with highway and city sections.
Why it exists
Real programs mix cheap and expensive instructions; designers optimise by frequency.
How it works
- List classes with their fraction and CPI.
- CPI = Σ fraction × CPI.
- Time share of a class = fraction × CPI ÷ average CPI.
- Optimise the class with the biggest time share.
Worked example: 50% ALU (1), 30% load/store (2), 20% branch (3)
CPI = 0.5 + 0.6 + 0.6 = 1.7.
Now play with it
- →Change the percentages and watch the time shares shift.
Mix total100 %
Average CPI1.700
MIPS1176
ALU share of time29 %
Load/store share35 %
Branch share35 %
CPI = Σ fraction × CPI. Note the share of time each class takes is not the same as its share of instructions.
Check yourself
50% ALU instructions (CPI 1), 30% load/store (CPI 2), 20% branches (CPI 3). Average CPI?
Remember: CPI = Σ (fraction × CPI).
Exam notes (the dense version)
Weighted by instruction mix.
Previous year questions: Performance: CPI, MIPS, Amdahl (3)
PYQs are grouped by topic, so this is the full set for Performance: CPI, MIPS, Amdahl; try the ones that match this subtopic. Open all 3 on the topic page.