777 views
1 votes
1 votes
Consider a 4 stage pipeline:fetch-IF(2cycle), decode& read -ID(1 cycle) execute-Ex(4 cycle for multiply and 7 cycle for divide ,1 cycle for all other arithmatic operations ) and Write Back WB(1 cycle) . Assume that in a program A there are 10,000 instruction executions to complete ,there are 10% multiplies,5% divides,85% of othe types of instructions that take 1 cycle in execute stage . How many cycle does it take to execute program A?

1 Answer

1 votes
1 votes

set 1): If we consider all stages requires 1 clock cycle. In that case cycle required is: = (4+10000-1)

                                                                                                                            =10003 cycles

set 2): Now first stage actually required  2 clock cycle.and we have calculated for 1 clock cycle already so calculate for remained 1 clock cycle of first stage. that will be = 10000 cycles

second stage required only 1 clock cycle so that we would not calculate.

set 3): In third stage there are 10%  of multiplication instructions.now we have already calculated for 1 clock cycle. now out of 4 cycle we will calculate  for only 3 clock cycle = 3*10000*(0.10)

                                                     =3000 cycles

 there are 5%  of division instructions.now we have already calculated for 1 clock cycle. now out of 7 cycle we will calculate  for only 6 clock cycle = 6*10000*(0.05)

                                                     =3000 cycles

if we total all the cycle considering all set = 10003 + 10000 + 3000 + 3000

Total cycles                                                                  = 26003 cycle

 

Related questions

0 votes
0 votes
0 answers
2
rishabhdevsingh1 asked Nov 10, 2018
730 views
consider a5 stage pipeline processor, 20% load instructions, 25% branches, 20% stores, 20% of all instructions are data dependent on instructions in front of them and bra...
0 votes
0 votes
1 answer
3
Na462 asked Sep 3, 2018
910 views
Its a snapshot from hamacher.According to me there should be stall of 2 cycles why 3 ??Because after Write stage the data will be available in register file so why extra ...
0 votes
0 votes
1 answer
4
Jaggi asked Jul 7, 2018
981 views
A computer with a 5 stage pipeline deals with conditional branches by stalling for the next 3 cycle after hitting one. how much does stalling hurt the performance is 20% ...