GATE / CS ARCHIVE

GATE CSE 2024 SET 2 / QUESTION 31

Classify register dependencies by read and write sets

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

GATE 2024 Set 2, Q31 1 mark · MSQ
Report issue

Pipelining & Hazards

Question 31, GATE 2024: Instructions have destination first: I1 DIV R3,R1,R2; I2 SUB R5,R3,R4; I3 ADD R3,R5,R6; I4 MUL R7,R3,R8. Which are true? A I1→I2 RAW on R3; B I1→I3 WAR on R3; C I2→I3 RAW on R3; D I3→I4 WAW on R3.
Tap to enlarge
Select all that apply
Answer & solution

Official answer: A

Approach: Write down which instruction produces a register and which consumes it; retain the stated register name.

1. Derivation. I1 writes R3 and I2 reads R3, a read-after-write dependency, so A is true. I1 and I3 both write R3, making their relation WAW rather than WAR. I2 reads R3 and I3 writes it, giving WAR on R3 (they also have RAW on R5). I3 writes R3 and I4 reads it, giving RAW rather than WAW. Only A.

2. Explanation and checks. On R3 the four operations are write, read, write, read. A later read after an earlier write is RAW, two writes give WAW, and a write after an earlier read gives WAR. This sequence directly classifies each proposed pair. Although I2→I3 does have a RAW dependency on R5, option C explicitly says R3 and is therefore false. A dependency is a program-order relationship; whether it produces an actual stall depends on the implementation.

Original paper, page 21 · Answer key