in CO and Architecture
1,531 views
0 votes
0 votes
Consider a pipelined processor having 5 stages. The stage delays are 2, 3, 2.5, 3.2, 2.5ns and interstage buffer delays are 1ns. The 3rd stage is capable of deciding branch target address. Processor starts fetching new instruction when the conditional branch outcome is known. 20% of instructions are conditional branch, then calculate the execution time for 1000 instructions?
in CO and Architecture
1.5k views

4 Comments

 Somoshree Datta 5

You are right but we are not aware of which instruction comes first i.e. either Branched or non branch instructions.

So in this case we generally go by approach shown by @magma

max (2, 3, 2.5, 3.2, 2.5ns ) = 3.2 + 1ns(interstage buffer delays) = 4.2

 1000 x 20 % = 200 instruction are branched instruction which are condition branch and   target address is decided after stage 3 , therefore CPI = 3

800 instruction  (Non branch ) (CPI = 1)

 

Total execution time = 200 x 3 x 4.2 + 800 x 1 x 4.2 = 5880 ns

 

0
0

Hemanth_13 That is the reason why i calculated using extra stall cycles..because whichever instruction comes first, it will always come out after 5 clock cycles..thats y its better to calculate the answer by considering the extra stall cycles needed rather than by taking the CPI as 1..Moreover CPI of pipeline is 1 only under ideal conditions,not in normal pipeline architechture because of the penalty that is incurred by the first instruction..

https://gateoverflow.in/204125/gate2018-50

Check Digvijay Sir's answer in this GATE question..you will understand what I am trying to say.

Next check this question https://gateoverflow.in/683/gate2000-12

Here check Arjun Sir's and Amar SIr's answers..Note this line in the question:

Under ideal conditions

Because of this being mentioned in the question, we wont follow the same approach as we followed in the previous GATE question. Now in this case we solve the problem by considering CPI=1. But if u do the same thing with the previous question, it wont give u the correct answer.

Hope you got what I am trying to say.

1
1
I think we should go with the actual concept rather than trying to match answers.
0
0

1 Answer

2 votes
2 votes
consider non-branch instruction: number of cycles(non-branch) =  5 + {1 + 1 + 1 + ...799 times} = 804

consider branch instruction:  beginning from 804th cycle, next instruction will conditional statement. So, next instruction will end at 804 + 3 = 807th cycle. Next instruction will end at {804 + 3 + 3} = 810th cycle. So, the series goes like {804 + 3 + 3 + ...200 times} = 804 + 3 * 200 = 804 + 600 = 1404 cycle.

1404 * 4.2 = 5896.8ns

Why everyone is giving vague answers. No one is considering it is a 5 stage pipeline. So, the first instruction will be atleast completed after 5 cycles. I don't see any point of just considering 800 * 1. We must take 5 + 800 - 1.