GateAI
Instruction Pipelining

GATE CSE 2015 Set 3 · Q47

MCQ2 marksMedium

Time

Consider the following code sequence having five instructions I1I_1 to I5I_5. Each of these instructions has the following format. OP Ri, Rj, Rk where operation OP is performed on contents of registers Rj and Rk and the result is stored in register Ri. I1I_1: ADD R1, R2, R3 I2I_2: MUL R7, R1, R3 I3I_3: SUB R4, R1, R5 I4I_4: ADD R3, R2, R4 I5I_5: MUL R7, R8, R9 Consider the following three statements. S1: There is an anti-dependence between instructions I2I_2 and I5I_5 S2: There is an anti-dependence between instructions I2I_2 and I4I_4 S3: Within an instruction pipeline an anti-dependence always creates one or more stalls Which one of above statements is/are correct?

Select one answerSingle correct

Pick an option to check

Solution

Step-by-step verified solution

Official answer: B) Only S2 is true

Instruction Pipelining

Let us analyze the read and write sets for each instruction based on the format OP Ri, Rj, Rk (where Ri is written, and Rj, Rk are read):

  • I1I_1: Writes R1, Reads R2, R3

  • I2I_2: Writes R7, Reads R1, R3

  • I3I_3: Writes R4, Reads R1, R5

  • I4I_4: Writes R3, Reads R2, R4

  • I5I_5: Writes R7, Reads R8, R9

Definitions of Data Dependences:

  • True Data Dependence (RAW): An instruction reads a value written by an earlier instruction.

  • Anti-dependence (WAR): An instruction writes to a register that is read by an earlier instruction.

  • Output dependence (WAW): An instruction writes to a register that is also written by an earlier instruction.

Statement Analysis:

  1. S1: Between I2I_2 (writes R7) and I5I_5 (writes R7), both write to the same register R7. This is an output dependence (WAW), not an anti-dependence. Thus, S1 is FALSE.

  2. S2: Instruction I2I_2 reads register R3, while subsequent instruction I4I_4 writes to register R3. This constitutes a Write-After-Read (WAR) relation, which is an anti-dependence. Thus, S2 is TRUE.

  3. S3: In a typical in-order pipeline (like the standard 5-stage RISC pipeline), operands are read in the Instruction Decode (ID) stage and written in the Write Back (WB) stage. Since instructions flow in order, reading occurs before the write-back of a subsequent instruction; thus, anti-dependencies do not cause stalls. In out-of-order execution, WAR hazards can also be eliminated using register renaming without stalls. Thus, S3 is FALSE.

Therefore, only statement S2 is true, which corresponds to option (B).

Try the question first, then check your work.

Think the official key or this write-up is wrong?

Report error or challenge

Examiner trap

The misconception this question tests

This Instruction Pipelining previous year question is Q47 of the GATE CSE 2015 Set 3 paper. Find more GATE CSE PYQs on Instruction Pipelining in Computer Organization and Architecture, or browse all GATE CSE PYQs.

Free diagnostic

Where do you stand for GATE?

Take the 20-minute diagnostic: the 3 topics that cost you the most marks, and a rank range. Or sit 5 related Instruction Pipelining PYQs now with no account.

One GATE CSE PYQ every morning

An official question by email at 7 AM IST, with a link to its verified solution. Unsubscribe in one click.

Instruction Pipelining in GATE CSE

Instruction Pipelining has 25 GATE CSE PYQs across 20 papers from 2011 to 2026. 3 of them are 2-mark MCQs like this one, and GATE CSE 2015 Set 3 has 2.

How GATE tests Instruction Pipelining

More from GATE CSE 2015 Set 3

Share this solution

A plain-text card for WhatsApp or Telegram study groups.

GateAI solution cardGATE CSE 2015 Set 3 · Q47 · MCQ

Consider the following code sequence having five instructions I1 to I5. Each of these instructions has the following format. OP Ri, Rj, Rk where operation OP is performed on contents of registers Rj and Rk and the result is stored in register Ri. I1: ADD R1, R2, R3 I2: MUL R7, R1, R3 I3: SUB R4, R1, R5 I4: ADD R3, R2, R4 I5: MUL R7, R8, R9 Consider the following three statements. S1: There is an anti-dependence between instructions I2 and I5 S2: There is an anti-dependence between instructions I2 and I4 S3: Within an instruction pipeline an anti-dependence always creates one or more stalls Which one of above statements is/are correct?

Topic-wise GATE CS PYQs with verified steps

Independent practice explanation verified by the GateAI team. GATE is conducted by the IITs; question text follows the official paper.