2 votes 2 votes How to calculate number of stalls here I m confused Chirag arora asked Jan 17, 2018 Chirag arora 485 views answer comment Share Follow See all 11 Comments See all 11 11 Comments reply hs_yadav commented Jan 17, 2018 i edited by hs_yadav Jan 17, 2018 reply Follow Share 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 votes 0 votes akankshadewangan24 commented Jan 17, 2018 reply Follow Share (1+5% * (4-1))*4 nsec = 4.6 nsec 0 votes 0 votes Chirag arora commented Jan 17, 2018 reply Follow Share Ok means no. Of stalls are 4 due to branching 0 votes 0 votes akankshadewangan24 commented Jan 17, 2018 reply Follow Share yes here stalls= current branch stage - 1 = 4-1 =3 0 votes 0 votes Chirag arora commented Jan 17, 2018 reply Follow Share Why 4-1 ? Number of stalls shd be 4 0 votes 0 votes Shubhanshu commented Jan 17, 2018 reply Follow Share @hs_yadav you forgot to divide by 100, as it is asked in the question about avg not total nano sec. 0 votes 0 votes akankshadewangan24 commented Jan 17, 2018 reply Follow Share whats the given ans???? 0 votes 0 votes Chirag arora commented Jan 17, 2018 reply Follow Share Ans is 4.6, but how the stalls are 3 , as after execution stage branched instruction starts executing? 0 votes 0 votes hs_yadav commented Jan 17, 2018 reply Follow Share @ Shubhanshu thanks.. 0 votes 0 votes Shubhanshu commented Jan 17, 2018 reply Follow Share @hs_yadav 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. 1 votes 1 votes Chirag arora commented Jan 17, 2018 reply Follow Share Ok got it , thanks 0 votes 0 votes Please log in or register to add a comment.