Open In App

GATE | GATE CS 2013 | Question 65

Like Article
Like
Save
Share
Report

Consider an instruction pipeline with five stages without any branch prediction: Fetch Instruction (FI), Decode Instruction (DI), Fetch Operand (FO), Execute Instruction (EI) and Write Operand (WO). The stage delays for FI, DI, FO, EI and WO are 5 ns, 7 ns, 10 ns, 8 ns and 6 ns, respectively. There are intermediate storage buffers after each stage and the delay of each buffer is 1 ns. A program consisting of 12 instructions I1, I2, I3, …, I12 is executed in this pipelined processor. Instruction I4 is the only branch instruction and its branch target is I9. If the branch is taken during the execution of this program, the time (in ns) needed to complete the program is

(A)

132

(B)

165

(C)

176

(D)

328


Answer: (B)

Explanation:

Pipeline will have to be stalled till EI stage of I4 completes, 
as EI stage will tell whether to take branch or not. 

After that I4(WO) and I9(FI) can go in parallel and later the
following instructions.
So, till I4(EI) completes : 7 cycles * (10 + 1 ) ns = 77ns
From I4(WO) or I9(FI) to I12(WO) : 8 cycles * (10 + 1)ns = 88ns
Total = 77 + 88 = 165 ns


Quiz of this Question
Please comment below if you find anything wrong in the above post


Last Updated : 13 Aug, 2019
Like Article
Save Article
Previous
Next
Share your thoughts in the comments
Similar Reads