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.
| Check | What to compare or inspect | Stall condition |
|---|---|---|
| Structural | Divide unit and write port availability | Required resource cannot serve the operation at the required time |
| RAW | Current source registers versus pending destination registers | Matching result will not be available when needed |
| WAW | Current destination versus destinations in A1...A4, D, M1...M7 | An 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
- Identify the instruction’s source and destination registers.
- Identify its required functional unit and later shared resources.
- For each pending producer of a source, check result availability against the consumer’s use stage, including forwarding paths.
- Check whether an older executing instruction has the same destination.
- 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.