GATE / CS ARCHIVE

GATE CSE 2015 SET 2 / QUESTION 53

GATE CSE 2015 Set 2 Q53

Computer Organization & Architecture · Pipelining & Hazards · Full GATE CSE 2015 Set 2 paper

GATE 2015 Set 2, Q53 2 marks · NAT
Report issue

Pipelining & Hazards

Question 53, GATE 2015: Instructions are MUL R5, R0, R1; DIV R6, R2, R3; ADD R7, R5, R6; SUB R8, R7, R4. Pipeline stages IF, OF and WB take one cycle; PO takes 3 for MUL, 5 for DIV and 1 for ADD/SUB. PO output can forward to OF. Find total cycles under the stated single occupied PO-stage interpretation.
Tap to enlarge
Answer & solution

Official answer: 13

Step through it (6 steps)

With a single occupied PO stage and the stated forwarding, MUL uses IF1, OF2, PO3–5, WB6. DIV uses PO6–10, ADD uses PO11 and SUB uses PO12; SUB writes back in cycle 13. The dependent ADD/SUB operand fetches use the forwarded results at the end of the preceding producer PO cycle. Thus total 13 cycles. This is the conventional in-order, non-internally-pipelined PO-stage model; independent or internally pipelined functional units would require more scheduling details.

Count occupied execution cycles rather than adding all independent instruction latencies. MUL starts PO in cycle 3 and occupies cycles 3–5. DIV cannot use the same PO stage until cycle 6, then occupies 6–10. ADD depends on both results and uses PO in cycle 11 after forwarding; SUB follows in cycle 12. Its WB is cycle 13. The explicit resource model matters: a separately pipelined multiplier/divider would permit a different schedule, and a non-forwarding design would add dependency stalls.

Original paper, page 47 · Answer key