The Gateway to Computer Science Excellence

0 votes

+1

Normally if all the stages would have taken 1 clock cycle as is the case with a normal pipelined execution, then number of clock cycles needed to execute 200 instructions would be= 1*5+199*1=204

now add instruction executes in 1 clock cycle, so it doesnt take up any extra time.

Division requires 5 clock cycles for execution, so number of stalls in the pipeline caused due to these 25 instructions= 4

So extra clock cycles needed by these 25 instructions= 25*4=100

Similarly multiplication requires 3 clock cycles in execute stage. So number of stalls for each of these 75 instructions= 2

So extra clock cycles needed by these 75 instructions= 75*2=150

hence total number of clock cycles needed= 204+100+150= 454

now add instruction executes in 1 clock cycle, so it doesnt take up any extra time.

Division requires 5 clock cycles for execution, so number of stalls in the pipeline caused due to these 25 instructions= 4

So extra clock cycles needed by these 25 instructions= 25*4=100

Similarly multiplication requires 3 clock cycles in execute stage. So number of stalls for each of these 75 instructions= 2

So extra clock cycles needed by these 75 instructions= 75*2=150

hence total number of clock cycles needed= 204+100+150= 454

0

Yes but for the first instruction you will not face that many stall right @magma and Somoshree Datta 5

0

But u don't know what the first instruction will be right? So u can never say whether there will be any stalls or not..

0

I mean can't we take all ADD first followed by all MUL and DIV, the first mul and first div instruction will have 0 stalls and 2 stalls respectively then answer would be 454-4=>450.

Shouldn't we do in this way

Shouldn't we do in this way

0

Division requires 5 clock cycles for execution, so number of stalls in the pipeline caused due to these 25 instructions= 4

I think that this approach doesn't hold good for this question

0

see my approach:-

for addition : 100+5-1= 104 cycles

for divison :

for 1st instruction it will take 9 cycles

and for rest of 24 instructions it will be 24*5 , therefore 9+24*5 = 129;

for multiplication :

for 1st instruction it will take 7 cycles

and for rest 74 instruction it will take 3 cycles ;therefore 7+74*3=229

hence total cycles = 104+129+229= 462

for addition : 100+5-1= 104 cycles

for divison :

for 1st instruction it will take 9 cycles

and for rest of 24 instructions it will be 24*5 , therefore 9+24*5 = 129;

for multiplication :

for 1st instruction it will take 7 cycles

and for rest 74 instruction it will take 3 cycles ;therefore 7+74*3=229

hence total cycles = 104+129+229= 462

0

@Hemanth_13 why will u assume such? It could be the case that the first instruction performs multiplication or division also. Here it isn't mentioned in the question that the instructions are executed sequentially in this order i.e. add, divide and then multiply

0

Gate Fever how can u consider the first instruction is performing both multiplication and division??

0

Thanks Somoshree Datta 5 but I'm still worried is that the right way because we not giving the worst case pipeline value or the best case value.

Gate Fever what's you reason for using 5 here

and for rest of 24 instructions it will be 24*5 , therefore 9+24*5 = 129;

0

@Magma @Hemanth got the same question here..check out this link https://gateoverflow.in/227703/pipeline-execution-time

0

ThanksSomoshree Datta 5 :)

it is values change of last year gate question https://gateoverflow.in/204125/gate2018-50

- All categories
- General Aptitude 1.9k
- Engineering Mathematics 7.5k
- Digital Logic 2.9k
- Programming and DS 4.9k
- Algorithms 4.4k
- Theory of Computation 6.2k
- Compiler Design 2.1k
- Databases 4.1k
- CO and Architecture 3.4k
- Computer Networks 4.2k
- Non GATE 1.4k
- Others 1.4k
- Admissions 595
- Exam Queries 573
- Tier 1 Placement Questions 23
- Job Queries 72
- Projects 18

50,737 questions

57,397 answers

198,610 comments

105,454 users