1,672 views
5 votes
5 votes
consider 5 stage pipeline with cycle time 2ns to execute program segment which contains 20 instruction (I-1 TO I-20)

In the pipeline, all the instruction proceed through all the stages. I-4 INSTRUCTION is an unconditional branch instruction which transfers the control to I-18 INSTRUCTION during its execution. what is the program execution time?

1 Answer

Best answer
1 votes
1 votes

We know :

a)   Instruction execution time in a pipelined system  =  (k + n - 1) * tp + Branch penalty [ In case there is branch         instructions

b) Normally if we go with RISC pipeline , branch target address is known at MA stage which is the 4th stage..Hence branch penalty per branch instruction  = 3 cycles = 3 * tp

As here the instruction flow is I1 - I2 - I3 - I4 - I18 - I19 - I20 [ As it is given I4 is a branch instruction and branch address is corresponding to instruction I18 ]

So number of instructions involved in the sequence = 7

Number of stages in pipeline  =  5

Thus total time taken             =  (k + n - 1) * tp  +  3 * tp

                                            =  (5 + 7 - 1) * 2  +   3 * 2

                                            =  22 + 6

                                            =  28 ns

Hence required time             =  28 ns

Suggested reading : https://gateoverflow.in/330/gate2013_45

P.S.: Unless and unless mentioned there will be uasge of some enhancement like hardware prefetching etc . , we have to assume that stalls are necessary as we need to know the address of the instruction where we are going to branch which is possible in MA stage only as far as RISC pipeline is concerned..As the naming of stages is not done in the question and it is a 5 stage pipeline we assume it is a RISC pipeline which is a standard and commonly used pipeline..

selected by

Related questions

0 votes
0 votes
2 answers
1
prasoon054 asked Jan 7
216 views
In which stage of the classic RISC pipeline, operand is fetched. Is it in Instruction Decode or Execute (ALU) stage?
0 votes
0 votes
1 answer
4
shima abdullah asked Jun 27, 2022
944 views
if an unpipelined processor with a cycle time of 25 ns is evenly divided into 5 pipeline stages using pipeline latches with 1-ns latency,what is the total latency of the ...