GATE / CS ARCHIVE

GATE CSE 2007 / QUESTION 37

Forwarded multicycle pipeline timing

Computer Organization & Architecture · Pipelining & Hazards · Full GATE CSE 2007 paper

GATE 2007, Q37 2 marks · MCQ
Report issue

Pipelining & Hazards

Question 37, GATE 2007: A pipeline has IF, ID (decode/operand fetch), EX, WB. IF, ID and WB each take one cycle; EX takes one cycle for ADD/SUB and three for MUL. Operand forwarding is available. How many cycles complete this sequence?
ADD R2,R1,R0   (R2←R1+R0)
MUL R4,R3,R2   (R4←R3×R2)
SUB R6,R5,R4   (R6←R5−R4)
Options:
(A) 7
(B) 8
(C) 10
(D) 14
Tap to enlarge
Your answer
Answer & solution

Answer: B (no official key was published)

Step through it (5 steps)

1. Approach. Draw one timeline per instruction. Forwarding removes waiting for register writeback, but it cannot make the three-cycle multiply result available before its EX stage finishes.

2. Derivation and interpretation. ADD uses IF1,ID2,EX3,WB4. Its result is forwarded to MUL, which uses IF2,ID3,EX4–6,WB7. SUB uses IF3,ID4 and waits for the EX unit/result, then executes EX7 and WB8. Therefore completion requires 8 cycles, B, assuming the stated forwarding permits consuming an EX result in the next cycle and no additional structural conflicts.

Original paper, page 9