Computing CPI, An Example
Consider two code sequences:
- A A B C C = 5 instructions
- A A A A B C = 6 instructions
Compute CPU clock cycles
- CPU clocks = 2x1 + 1x2 + 2x3 = 2 + 2 + 6 = 10
- CPU clocks = 4x1 + 1x2 + 1x3 = 4 + 2 + 3 = 9
CPI = CPU clock cycles/Instruction count
- CPI1 = 10/5 = 2
- CPI2 = 9/6 = 1.5