A pipelined processor has a base CPI of 1. Branches are 20% of instructions, 40% of branches are mispredicted, and each misprediction costs 2 cycles. What is the effective CPI?
Correct answer D. 1.16
Explanation
Stall cycles per instruction = branch frequency x misprediction rate x penalty = 0.20 x 0.40 x 2 = 0.16, so CPI = 1 + 0.16 = 1.16. The answer 1.40 charges every branch the 2-cycle penalty, ignoring that 60% are predicted correctly. 1.08 forgets the 2-cycle multiplier. Effective CPI always equals ideal CPI plus average stall cycles per instruction.
Answer checked How we write and check questions
Discussion