71 views

How to calculate number of stalls here I m confused

0
here let total number of instruction is...100c

then 95 instruction will execute ideally (CPI=1) and rest 5 instruction will taken CPI=4...becoz evry branch instructon is executing like this....

S2 s2 s3 s4 s5

s1 s2 s3 s4 s5

s1 s2 s3 s4 s5....therefor CPI=4..

total time would be....95*1+5*4=115clock=115*4=460/100=4.6ns
0
(1+5% * (4-1))*4 nsec = 4.6 nsec
0
Ok means no. Of stalls are 4 due to branching
0
yes here
stalls= current branch stage - 1
= 4-1 =3
0
Why 4-1 ?  Number of stalls shd be 4
0

@hs_yadav you forgot to divide by 100, as it is asked in the question about avg not total nano sec.

0
whats the given ans????
0
Ans is 4.6, but how the stalls are 3 , as after execution stage branched instruction starts executing?
0

thanks..

+1

I think you need to update your diagram which is given in the comment. First stage should be s1 for 1st instruction, and I2 will be fetched after stage 4 is completed,

 S1 S2 S3 S4 S5 STALL STALL STALL S1 S2 S3 S4 S5

Thats why we are getting 3 stalls.

0
Ok got it , thanks