2,031 views
1 votes
1 votes
Consider the 4 stage pipeline with the following stages

S1:Instruction fetch

S2:Instruction decode

S3:Execute

S4:Write back

Program consists of 16 instructions(I1,I2,...I16).In which I6 is a unconditional branch instruction transfer the control to I12.In the pipeline branch target address will be available at the end of execution state.Each instruction spends the same amount of time in all the pipeline is 4ns.How much time is required to execute the above program without using the branch prediction?

2 Answers

1 votes
1 votes

Uncondition branch instruction is always taken.

Here, branch will be taken at the end of S3 stage of I6 .

i.e., at the end of 8th clock cycle. So, I9, I10 & I11 will be skipped & I12 will be taken.

Since 3 instruction is skipped Pipeline will execute 13 instruction.

so, Total clock cycle = 4 + (13-1)*1 = 16

Thus, Total Execution Time = 16 * 4 ns = 64 ns.

0 votes
0 votes

..............

 

edited by

Related questions

0 votes
0 votes
1 answer
1