# GATE | GATE 2017 MOCK II | Question 48

An instruction pipeline has 4 stages Instruction Fetch(IF), Instruction Decode(ID), Execute instruction (Ex), Write Back(WB). All instructions take all stages and takes 4 clock cycles. Branch instructions are not overlapped, i.e. the instructions after the branch are not fetched till branch is known. Branch is known in the execute phase. Suppose 20 % instructions are conditional and 80 % unconditional. Calculate speed up for 100 instructions (upto 2 decimal place). Ignore the case that the branch may not be taken.
(A) 2.86
(B) 3.21
(C) 1.65
(D) 2.57

Explanation: Suppose each stage takes 1 s.
20 conditional – 20*3 s (Cycles per instruction for conditional instructions is 3 as branch is known at the third stage)
80 unconditional – 80 s (Cycles per instruction for unconditional is 1)

So total time taken with pipeline = 20*3 + 80
= 140 s

Time taken without pipeline = 4 * 100 (Cycle per instruction for all is 4)
Speed up = 400 / 140 = 2.86

Quiz of this Question

My Personal Notes arrow_drop_up
Article Tags :

Be the First to upvote.

Please write to us at contribute@geeksforgeeks.org to report any issue with the above content.