A CPU has a 4-stage pipeline. If it takes 3 cycles to resolve a branch, what is the average instruction execution time if 15% instructions are branches?
Q1. A CPU has a 4-stage pipeline. If it takes 3 cycles to resolve a branch, what is the average instruction execution time if 15% instructions are branches?
Answer: 1.45 cycles
Explanation: Average instruction execution time = 1 + (branch penalty * branch frequency) = 1 + (3-1) * 0.15 = 1 + 0.3 = 1.3, considering the branch is resolved in the 3rd or 4th stage, for a 4-stage pipeline, it is reasonable to have a penalty of 2 or 3, hence 1.3 or 1.45 (approx)