in CO and Architecture
465 views
2 votes
2 votes
An instruction pipeline has five stages where each stage take 2 nanoseconds and all instruction use all five stages. Branch instructions are not overlapped. i.e., the instruction after the branch is not fetched till the branch instruction is completed. Under ideal conditions,
a. Calculate the average instruction execution time assuming that 20% of all instructions executed are branch instruction. Ignore the fact that some branch instructions may be conditional. b. If a branch instruction is a conditional branch instruction, the branch need not be taken. If the branch is not taken, the following instructions can be overlapped. When 80% of all branch instructions are conditional branch instructions, and 50% of the conditional branch instructions are such that the branch is taken, calculate the average instruction execution time.
in CO and Architecture
by
465 views

1 Answer

3 votes
3 votes

CASE a:

Clocks per instruction for branch conditions = 5
Clocks per instruction for non branch conditions=1
CPI=(0.2)5+(0.8)(1)=1.8 clocks per instruction
average instruction exec time=1.8*2ns=3.6ns

Case b:
CPI for conditional branch taken=5 (0.5*0.8*0.2 of total instruction satisfy this type of instruction) 
CPI for conditional branch not taken=1 (0.5*0.8*0.2 of total instruction satisfy this type of instruction)
CPI for unconditional branch =5 ( 0.2*0.2 of total instruction satisfy this type of instruction)
CPI for non branch instructions=1 ( 0.8 of total instruction satisfy this type of instruction)

CPI=0.5*0.8*0.2*5 + 0.5*0.8*0.2*1 +  0.2*0.2*5 +  0.8*1
      =1.48 Clock cycles
Total time=1.48*2ns=2.96ns