• retagged by
1,604 views
5 5 votes
I) In a 4 stage pipeline processor, if each stage takes 4 cycles then what is CPI in case of successfull pipeline???

II) In a 4 stage pipeline processor, if each stage takes 2,3,4,5 cycles respectively then what is CPI in case of successfull pipeline??

II) If there are branch imstructions and branch address is available in 3rd stage then what should be branch pelanty??(In both the implementations mentioned above)

1 Answer

Best answer
4 4 votes

Genaral diagram for pipeline is like this:

1. Now, each stage takes 4 cycles.  As shown by red highlighted part, 1 instruction ( though they are operations corresponding to different instructions) is executed in 1 stage (of non-pipelined processor) as operations are overlapped.

Hence, CPI = cycles per instruction = 1 stage = 4 cycles.

2. Now, lets assume the above 5 stage pipeline processor with stage execution times as 2,3,4,5,6 for IF,ID, EX, MA, WB respectively.

WHen they overlap as shown by red highlighted part, the stages that complete early like IF have to wait for other stages to complete. They cant proceed with their work individually and independently. Else, we wont get correct data in buffers at right times.

Hence, stage delay corresponds to longest stage.

Hence, cycle time  = longest stage = 6 (@Rahul. For your question, it would be 5)

3. 

Assume that only 1st and 2nd instructions are pipelined.

Lets say that first instruction is branch instruction. SO, till 3rd stage, we wont know that this is going to be branch instruction.

Now, 2nd instruction (in red) is also in pipeline. So, when 1st instruction is in  ID stage, 2nd will be in IF stage.

Now, when branch address is available at end of 3rd stage, the procesor will be instructed to flush already pieplined instructions viz. I2, I3, I4 and so on    and newly load the instruction whose execution will start with 4 stage.

So, remaining stages of 2nd instructon viz. EX, MA, WB are flushed (shown by a strike) an newly loaded instruction is shown in green which starts execution from 4th stage. So, there was unexpected delay of 2 stages(in pipeline) as shown by the yellow part.

This yellow part corresponds to stall cycles.

• selected by
Position:
Show:

Related questions

0 0 votes
1 1 answer
1.4k
1.4k views
Jaggi asked Jul 7, 2018
1,397 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% ...
0 0 votes
1 1 answer
1.1k
1.1k views
Raj Singh 1 asked Jan 9, 2019
1,140 views
The title says it all: How many stall cycles are caused due to each incorrect branch prediction?Additional details you might need:Branch is executed in execution stage of...
0 0 votes
1 1 answer
1.5k
1.5k views
bts1jimin asked Oct 3, 2018
1,517 views
Is branch prediction in pipelining im Co and architecture part of gate syllabus?
1 1 vote
1 1 answer
1.7k
1.7k views
gourav94240 asked Aug 28, 2018
1,731 views
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 operation...