CPU Performance: CPI, Execution Time, and MIPS from an Instruction Mix
To analyze CPU performance from an instruction mix, we compute three quantities from the given instruction counts and per-instruction clock-cycle costs: CPI (part a), execution time (part b), and MIPS (part c).
From the table:
- Control transfer: 5000 instructions × 5 cycles each
- Data transfer: 4000 instructions × 4 cycles each
- Floating point: 2000 instructions × 2 cycles each
- Integer: 1000 instructions × 1 cycle each
We’ll use these to find:
- Total instructions executed
- Total clock cycles required
- Average cycles per instruction (CPI)
- Execution time at 10 GHz
- MIPS = (instruction count per second) /
Compute CPI, Execution Time, and MIPS
- 1Step 1
Sum instruction counts: .
- 2Step 2
Multiply each instruction class by its cycle cost and sum: .
- 3Step 3
Use .
- 4Step 4
Clock rate cycles/s, so .
- 5Step 5
MIPS is . First, instructions per second . Then .
Instruction Mix Contribution to Total Cycles
Each bar shows total cycles contributed by that instruction type.
Pro Tip: CPI is a weighted average
CPI is not the simple average of the cycle counts; it is the instruction-count-weighted average: .
Watch units for execution time and MIPS
For a 10 GHz CPU, convert to cycles/s: . For MIPS, divide instruction rate by .
Final Answers
(a) CPI
(b) Execution time
Clock rate:
(c) MIPS rate for the program
Common Checks
Knowledge Check
Given total cycles and total instructions , what is CPI?