Hazard Detection in ID

Before issuing an instruction, determine whether its resources, operands, and destination can be used safely.

The professor’s three checks

Slide 20 assumes all hazard detection takes place in ID.

CheckWhat to compare or inspectStall condition
StructuralDivide unit and write port availabilityRequired resource cannot serve the operation at the required time
RAWCurrent source registers versus pending destination registersMatching result will not be available when needed
WAWCurrent destination versus destinations in A1...A4, D, M1...M7An older executing instruction writes the same destination

A1...A4 and M1...M7 are stages of the introductory adder and multiplier. D denotes the divider. These are not the later R4000 FP stage-type names.

Clarification: how to reason through issue

  1. Identify the instruction’s source and destination registers.
  2. Identify its required functional unit and later shared resources.
  3. For each pending producer of a source, check result availability against the consumer’s use stage, including forwarding paths.
  4. Check whether an older executing instruction has the same destination.
  5. Issue only when all required checks permit it; otherwise hold the instruction.

A source/destination match is not automatically a RAW stall: a ready forwarded result can satisfy the consumer. The WAW solution presented in this lecture deliberately stalls the younger matching writer.

What a stall means

The unsafe instruction waits before progressing. Older instructions must continue far enough to release the resource or produce the value; a stall does not mean freezing every unit indefinitely.

The R4000’s corresponding decode, register-fetch, and hazard-checking stage is called RF in MIPS R4000 Pipeline.

Related: RAW and WAW Hazards, Structural Hazards in Multicycle Pipelines.

Source

E. Sanchez, Multicycle operations, Politecnico di Torino, ASE 2026/27, slides 19-20, 24. PDF page numbers match slide numbers.

Lecture context: Lecture 05 - Multicycle Operations. Sections marked as clarification or reusable explanation add study guidance to the slide material.