GATE CS 2024 Set 2 — Question 31
MSQ+1 / -0EasyData Hazards (RAW, WAR, WAW)Instruction PipeliningComputer Organization & Architecture
Computer Organization & Architecture → Instruction Pipelining → Data Hazards (RAW, WAR, WAW)
Last updated
Question
An instruction format has the following structure:Instruction Number: Opcode destination reg, source reg-1, source reg-2Consider the following sequence of instructions to be executed in a pipelined processor:I1: DIV R3, R1, R2
I2: SUB R5, R3, R4
I3: ADD R3, R5, R6
I4: MUL R7, R3, R8Which of the following statements is/are TRUE?
I2: SUB R5, R3, R4
I3: ADD R3, R5, R6
I4: MUL R7, R3, R8Which of the following statements is/are TRUE?
A.
There is a RAW dependency on R3 between I1 and I2
B.
There is a WAR dependency on R3 between I1 and I3
C.
There is a RAW dependency on R3 between I2 and I3
D.
There is a WAW dependency on R3 between I3 and I4
Correct answer
(A) There is a RAW dependency on R3 between I1 and I2
Solution
Let's analyze the dependencies based on the instruction format: Opcode dest, src1, src2.Instructions:
- I1:
DIV R3, R1, R2Writes , Reads - I2:
SUB R5, R3, R4Writes , Reads - I3:
ADD R3, R5, R6Writes , Reads - I4:
MUL R7, R3, R8Writes , Reads
- I1 writes .
- I2 reads .
- Since I2 follows I1 and reads the value written by I1, this is a RAW (Read-After-Write) dependency.
- This statement is TRUE.
- I1 writes .
- I3 writes .
- This is a WAW (Write-After-Write) dependency (Output dependency), not WAR.
- This statement is FALSE.
- I2 reads .
- I3 writes .
- This is a WAR (Write-After-Read) dependency (Anti-dependency), not RAW.
- This statement is FALSE.
- I3 writes .
- I4 reads .
- This is a RAW (Read-After-Write) dependency, not WAW.
- This statement is FALSE.
More questions on Instruction Pipelining
2024 Set 2 Q11Consider a computer with a 4 MHz processor. Its DMA controller can transfer 8 bytes in 1 cycle from…2024 Set 1 Q15Which one of the following statements is FALSE?2024 Set 1 Q30Consider a 5-stage pipelined processor with Instruction Fetch (IF), Instruction Decode (ID),…2024 Set 2 Q53Consider a disk with the following specifications: rotation speed of 6000 RPM, average seek time of…2024 Set 1 Q53Consider two set-associative cache memory architectures: WBC, which uses the write back policy,…
Practice GATE CS PYQs with adaptive difficulty
Timed practice, skill tracking, and AI explanations — free to start.
Start practicing free