GATE / CS ARCHIVE

GATE CSE 2018 / QUESTION 50

Pipeline with a variable-duration stage

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

GATE 2018, Q50 2 marks · NAT
Report issue

Pipelining & Hazards

Question 50, GATE 2018: A pipeline is IF,ID,OF,PO,WB. Every stage except PO takes one cycle. Among 100 instructions PO takes 3 cycles for 40, 2 for 35, and 1 for 25. No data/control hazards. Find total cycles under single-occupancy PO operation.
Tap to enlarge
Answer & solution

Official answer: 219

Method

Start with the ideal five-stage baseline: 100+5−1=104 cycles if every PO takes one cycle. The 40 three-cycle operations add 40·2=80 stall cycles; the 35 two-cycle operations add 35·1=35. Total is 104+80+35=219. This agrees with adding three fill cycles, all PO occupancies, and one final writeback cycle. It would be wrong to charge every instruction five separate nonoverlapped stages; most stage work overlaps.

Solution

The single PO stage is occupied for 40*3+35*2+25*1=215 clocks. The first instruction needs 3 clocks to reach PO through IF, ID, OF, and the final instruction needs 1 WB clock afterward. With no data/control hazards, earlier stages can supply the next instruction whenever PO becomes free, so total=3+215+1=219. This uses the intended non-overlapped PO-stage model; a separately internally pipelined execution unit would need an initiation-interval specification.

Original paper, page 21 · Answer key