Question:medium

A processor X1 operating at 2 GHz has a standard 5-stage RISC instruction pipeline having a base CPI (cycles per instruction) of one without any pipeline hazards. For a given program P that has 30% branch instructions, control hazards incur 2 cycles stall for every branch. A new version of the processor X2 operating at same clock frequency has an additional branch predictor unit (BPU) that completely eliminates stalls for correctly predicted branches. There is neither any savings nor any additional stalls for wrong predictions. There are no structural hazards and data hazards for X1 and X2. If the BPU has a prediction accuracy of 80%, the speed up (rounded off to two decimal places) obtained by X2 over X1 in executing P is \(\underline{\hspace{1cm}}\).

Show Hint

The speedup in a processor with a branch predictor can be calculated using the accuracy of the predictor and the penalty for mispredictions, which in turn affects the overall CPI.
Updated On: Jan 30, 2026
Show Solution

Correct Answer: 1.42 - 1.45

Solution and Explanation

Given Parameters:

  • Base CPI = 1
  • Branch Instruction Frequency = 30% (0.3)
  • Penalty for Branch Stalls = 2 cycles
  • X2 Branch Predictor Accuracy = 80% (0.8)

Step 1: Calculate Effective CPI for Processor X1

Processor X1 incurs a stall for every branch instruction encountered. The effective CPI is the sum of the base cycles and the average stall cycles per instruction:

$CPI_{X1} = Base\ CPI + (Branch\ Frequency \times Stall\ Cycles)$ $CPI_{X1} = 1 + (0.3 \times 2) = 1.6$


Step 2: Calculate Effective CPI for Processor X2

Processor X2 uses a branch predictor. Stalls only occur when the prediction is incorrect. Since the accuracy is 80%, the misprediction rate is 20% (0.2).

$CPI_{X2} = Base\ CPI + (Branch\ Frequency \times Misprediction\ Rate \times Stall\ Cycles)$ $CPI_{X2} = 1 + (0.3 \times 0.2 \times 2) = 1.12$


Step 3: Determine the Speedup

Speedup is calculated by comparing the execution time (or CPI, since clock frequency is identical) of the original processor to the enhanced one:

$Speedup = \frac{CPI_{X1}}{CPI_{X2}}$ $Speedup = \frac{1.6}{1.12} \approx \mathbf{1.43}$


Final Answer:

The speedup obtained by X2 over X1 is: 1.43

Was this answer helpful?
0

Top Questions on Instruction Pipelining