As the question contains percentage so let’s assume the total number of instructions = 100.
Total Number of Instruction = 100 (Let).
For X1 :
As 30% are branch instructions and branch instruction incurs 2 stalls. So these branch instruction will take 3 cycles.
Total number of clock for branch Instruction = 90 clocks.
Total number of clock for Non-branch Instruction = 70 clocks.
Total clocks for 100 instructions will be = 90 + 70 = 160 clocks.
As the processor is operating at 2GHz. So, 1 clock cycle will take 0.5 ns.
So, Total time required for 100 instructions = 160 * 0.5 ns = 80 ns.
Processor X1 will take 80 ns.
For X2 :
As for improvement in X1 we are provided with a Branch Prediction Unit(BPU) with accuracy of 80%.
So, Out of 30 Branch Instruction, BPU will eliminate stalls for 80%. For rest 20% question is saying that :
“ there is neither any savings nor any additional stalls for wrong predictions”. So, for 20% of instructions
they will incur 2 stalls (means 3 clock) as it is.
So total number of clocks = 24 + 18 + 70 = 112 clocks.
As X2 is also operating at 2GHz. So, 1 clock cycle will take 0.5 ns.
So, Total time required for 100 instruction = 112 * 0.5 = 56 ns.
Processor X2 will take 56 ns.
So, overall speed up = (Time Taken By X1) / (Time Taken By X2) = 80 / 56 = 1.42 (2 decimal places).