100 views
In a pipelined architecture Static branch prediction is used with branch taken assumption. Assume that 30% of the instructions executed for a program are branch instructions. Each stage has 2 nsec delay. Average Execution time(in nsec) if 80 % of the instructions are taken?

is the answer is 2.24 ns?
Yes, can you explain

It is given $30$% of the instruction are branch instruction.

It is using static branch prediction which always assume branch is taken.

branch was taken =$80$% of the time

So,20% of the time branch was not taken but due to static branch prediction it assume branch was taken but it doesn’t .So this much time contribute to branch penalty.

Now Assuming branch is taken in EX-stage and the target branch instruction will be fetched in the next IF stage – so $2$ stall cycles per conditional branch taken.

So,Branch penalty=$2$ .

So, average CPI=$1+0.3*0.2*2$=$1.12$cycle.

Now as it is using an uniform pipeline where each stage delay=2 ns.

So ,average instruction execution time$=1.12*2=2.24$ ns