Pipelining & Hazards

Answer & solution
Official answer: B
Our answer: B in the classic in-order fixed-stage model; WAR/WAW can also be hazards in broader pipeline models.
Givens and goal
Which register dependence can cause a data hazard in a pipelined processor? A read-after-read, B read-after-write, C write-after-read, D write-after-write. The source does not explicitly constrain instruction issue or completion order.
Approach
Explain the true producer-consumer hazard, then state the narrower pipeline model needed to make the official MCQ selection unique.
Step-by-step solution
1. Suppose instruction I1 computes R1=R2+R3 and the following instruction I2 computes R4=R1+1. I2 must read the value produced by I1, so this is a read-after-write (RAW) dependence on R1.
2. If I2 reaches its register-read/use stage before I1’s result is available, it can read the old R1. That is a data hazard. Forwarding or a stall may be needed to preserve the intended computation. Thus B is a genuine hazard category.
3. In the conventional single-issue, in-order, fixed-stage pipeline, reads occur in an earlier fixed stage than writes. A later instruction cannot overtake an earlier read or write. Under those assumptions, WAR and WAW dependencies do not cause hazards, and B is the intended unique answer. RAR is not a hazard because neither instruction changes the shared register.
4. The unrestricted wording is broader. A write-after-read (WAR) hazard can arise if an earlier instruction is delayed before reading R1 and a later instruction overwrites R1 first. A write-after-write (WAW) hazard can arise if a slow earlier instruction and a fast later instruction both write R1, but the earlier write completes last, leaving the wrong final value.
5. Therefore preserve official B for scoring, with the qualification that C and D can also be hazard categories in pipelines permitting the relevant reordering. Register renaming and ordering mechanisms may prevent them, but are not specified.
CS-2026-S1-Q16-PIPELINE-MODEL. This is a model-dependent uniqueness issue, not an official key correction. The published single-answer selection requires the narrower pipeline convention described above.