Question
An instruction format has the following structure:
Instruction Number: Opcode destination reg, source reg-1, source reg-2
Consider 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, R8
Which of the following statements is/are TRUE?
Official answer and solution
- Official answer
- A
- From
- Official GATE 2024 answer key
Solution
Identify the read and write register sets of I1..I4 and check each pair for RAW (write then read), WAR (read then write), and WAW (write then write) on R3.
Tracking accesses to register R3:
I1writesR3I2readsR3I3writesR3I4readsR3
Checking each statement:
- (A) is TRUE:
I1writesR3andI2subsequently readsR3, which is a Read-After-Write (RAW) dependency. - (B) is FALSE: Both
I1andI3writeR3, which is a WAW dependency (not WAR). - (C) is FALSE:
I2readsR3andI3writesR3, which is a WAR anti-dependency (not RAW). - (D) is FALSE:
I3writesR3andI4readsR3, which is a RAW dependency (not WAW).
Option (A)
The answer is the one in the official GATE answer key. The solution is this site's own explanation.
Source
- Paper
- GATE 2024 Computer Science and Information Technology - Set 2 (CS2)
- Question
- 31 of 65
- Section
- Computer Science and Information Technology
Report an error in this question
GATE questions are the work of the organising institutes. This site is independent and is not affiliated with them.