GATE / CS ARCHIVE

GATE CSE 1999 / QUESTION 13

Schedule variable-duration pipeline stages

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

GATE 1999, Q13 5 marks · Descriptive
Report issue

Pipelining & Hazards

Question 13, GATE 1999: Five instructions pass in order through F, D, E, W. Their respective cycle requirements are I1=(1,2,1,1), I2=(1,2,2,1), I3=(2,1,3,2), I4=(1,3,2,1), I5=(1,2,1,2). Find the completion time.
Tap to enlarge
Answer & solution

Answer: 15 clock cycles (no official key was published)

Step through it (7 steps)

Assume one instruction can occupy each stage at a time, in-order processing and no unmentioned data hazards. A completed instruction may wait for the next stage. A feasible schedule, using inclusive cycle ranges, is:

Instruction   F     D      E      W
I1            1     2–3    4      5
I2            2     4–5    6–7    8
I3            4–5   6      8–10   11–12
I4            6     8–10   11–12  13
I5            8     11–12  13     14–15

Waiting is not additional useful stage work: I2 stays at F through cycle 3; I3 stays at D during cycle 7; I4 stays at F during cycle 7; I5 stays at F through cycle 10. Thus the schedule is also feasible with ordinary backpressure rather than unbounded interstage queues. For a lower bound, even with unrestricted waiting buffers the earliest completion recurrence is C(i,j)=max(C(i−1,j),C(i,j−1))+duration(i,j), with zero boundary values. Its rows are (1,3,4,5), (2,5,7,8), (4,6,10,12), (5,9,12,13), (6,11,13,15). No legal schedule can finish before cycle 15, and the displayed schedule attains it. Summing all stage times would incorrectly remove pipeline overlap.

Original paper, page 7