The GATE Grind

GATE 2015 CS (CS3) – Question 49

Computer Organization and Architecture · Instruction Pipelining and Pipeline Hazards · 2 marks · Multiple choice

Instructions have form OP Ri,Rj,Rk, writing Ri and reading Rj,Rk:

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

S1: I2 and I5 have an anti-dependence. S2: I2 and I4 have an anti-dependence. S3: An anti-dependence always causes a pipeline stall. Which hold?

  1. S1 only
  2. S2 only
  3. S1 and S3 only
  4. S2 and S3 only

Practise this question in The GATE Grind →

Show answer and explanation

Correct answer: (B) S2 only

Explanation

I2 and I5 both write R7, an output dependence rather than anti-dependence. I2 reads R3 before I4 writes it, so S2 is a write-after-read anti-dependence. Such dependencies need not stall an in-order read-before-write pipeline and can be removed by renaming. Thus only S2, B.

More Instruction Pipelining and Pipeline Hazards questions

All Instruction Pipelining and Pipeline Hazards questions →