GATE / CS ARCHIVE

GATE CSE 2010 / QUESTION 33

Variable-latency pipeline execution

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

GATE 2010, Q33 2 marks · MCQ
Report issue

Pipelining & Hazards

Question 33, GATE 2010: A five-stage pipeline has IF, ID, OF, PO and WO stages. IF, ID, OF and WO each take one cycle. PO takes one cycle for ADD/SUB, three for MUL and six for DIV. Operand forwarding is used. How many cycles execute this instruction sequence?
I₀: MUL R₂,R₀,R₁   (R₂←R₀×R₁)
I₁: DIV R₅,R₃,R₄   (R₅←R₃/R₄)
I₂: ADD R₂,R₅,R₂   (R₂←R₅+R₂)
I₃: SUB R₅,R₂,R₆   (R₅←R₂−R₆)
Options: (A) 13; (B) 15; (C) 17; (D) 19.
Tap to enlarge
Your answer
Answer & solution

Answer: B (no official key was published)

Step through it (6 steps)

With the single shared PO stage, the first MUL occupies PO in cycles 4–6 after IF,ID,OF in cycles 1–3. DIV occupies PO in cycles 7–12; the dependent ADD then uses the forwarded DIV result in PO cycle 13, and SUB uses PO cycle 14. The last WO is cycle 15. Earlier stages stall as necessary while PO is occupied, but forwarding avoids waiting for an extra writeback before dependent execution. Total 15, B. This assumes the ordinary unpipelined multi-cycle PO unit implicit in this question, not separate independently pipelined arithmetic units.

A compact timing schedule is MUL: PO 4–6, WO 7; DIV: PO 7–12, WO 13; ADD: PO 13, WO 14; SUB: PO 14, WO 15. PO is the bottleneck and its occupied cycles sum to 3+6+1+1=11. Three initial stages plus eleven PO cycles plus the final writeback give 3+11+1=15. Forwarding handles the DIV→ADD and ADD→SUB true dependencies.

Original paper, page 8