GATE / CS ARCHIVE

GATE CSE 2021 SET 2 / QUESTION 53

GATE CSE 2021 Set 2 Q53

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

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

Pipelining & Hazards

Question 53, GATE 2021: Five-stage IF,ID,EX,MEM,WB pipeline; stages each one cycle except MUL EX needs two; ADD EX needs one. ID only decodes; register read happens in EX. Eight instructions alternate ADD,MUL starting ADD, each dependent on previous. Ignore pipeline register delays. Find execution time without forwarding divided by time with forwarding, rounded to two decimals.
Tap to enlarge
Answer & solution

Official answer: 1.87 to 1.88

Our answer: 1.88

With forwarding, dependent instructions enter EX immediately after the previous EX result is ready. EX occupies cycles 3; 4–5; 6; 7–8; 9; 10–11; 12; 13–14. The last WB is cycle 16. Without forwarding, register operands must wait for the previous instruction to finish WB: EX intervals 3; 6–7; 10; 13–14; 17; 20–21; 24; 27–28, and final WB30. Thus speedup=30/16=1.875, rounding to 1.88, inside official 1.87–1.88. This uses the intended cycle-boundary model: a WB result becomes available to an EX register read in the following cycle. Allowing same-cycle WB-to-EX visibility would require a different timing convention; the prompt does not explicitly specify subcycle register timing.

For any instruction with EX finishing in cycle c, MEM occurs c+1 and WB c+2. Forwarding allows the dependent EX to start c+1, whereas the adopted no-forwarding convention requires c+3. Initial IF,ID place first EX in cycle 3; the last instruction then needs two drain cycles after EX. Counting only EX work or omitting pipeline fill/drain produces an incorrect speedup.

Original paper, page 87 · Answer key