A CPU has a 5-stage pipeline. If it takes 2 cycles to resolve a branch, what is the average instruction execution time if 20% instructions are branches?
Q1. A CPU has a 5-stage pipeline. If it takes 2 cycles to resolve a branch, what is the average instruction execution time if 20% instructions are branches?
Answer: 1.4 cycles
Explanation: Average instruction execution time = 1 + (branch penalty * branch frequency) = 1 + (2-1) * 0.2 = 1.2, but since branch is resolved in 2nd stage, effective penalty is considered from the next instruction, hence 1 + 0.2 * 2 = 1.4