in CO and Architecture retagged by
283 views
1 vote
1 vote
6 stage pipeline without any branch prediction pipeline cycle time is 4ns used to execute program segment with 20 instruction (i-1 to i-20) i5 is unconditional TOC instruction which transfer the control to i-18.Pipeline target address is available in 4th stage then Program execution time is …..
in CO and Architecture retagged by
283 views

1 Answer

3 votes
3 votes

first instruction i1 to i5 execute then branch then instruction i18 to i20 execute.

=> i-1,i-2,i-3,i-4,i-5,i-18,i-19,i-20 executes  in pipeline mode and some stall cycles are added due to branch.

=> total time = time for executing instructions + stall time

---------------------------------------------------------------------------------------------------------------------------------

K -> number of stages in pipeline =6.

n -> number of instructions. to execute = 8 (  i-1,i-2,i-3,i-4,i-5,i-18,i-19,i-20 )

-----------------------------------------------------------------------------------------------------------------------------------

For executing  i-1,i-2,i-3,i-4,i-5,i-18,i-19,i-20 instructions in pipeline time required

= (K + n-1 ) * clock cycle time

= (6 + 8-1) * 4

= 13 * 4

= 52 ns

--------------------------------------------------------------------------------------------------------------------------------------

number of stall cycles = stage at which target address available -1.

Pipeline target address is available in 4th stage 

=> extra time for stall cycles = no. of stall cycle * clock cycle time

                                              =  3*4

                                              = 12 ns

----------------------------------------------------------------------------------------------------------------------------------------

So total time = time for executing instructions + stall time

                     = 52ns + 12ns

                      = 64ns