Lukas' Notes

computer-architecture

Definition

Structural Hazard

A structural hazard is a pipelined hazard in which two instructions need the same hardware resource in the same cycle.

Unlike a data hazard, the conflict is not about data dependencies — it is about physical resources. If the pipeline has only one write-back port, for example, two instructions that finish execution at the same time cannot both write back in that cycle.

Handling

Resolving structural hazards

Common strategies include:

  • stalling one of the conflicting instructions until the resource is free;
  • duplicating the resource, for example adding more write-back ports or using separate register file read/write ports;
  • pipelining the resource so that it can accept a new operation every cycle even if the latency is multiple cycles.

Occurrence

Structural hazards appear when the pipeline tries to exploit instruction-level parallelism by issuing instructions to different functional units with different latencies. Instructions that finish at different times can collide when they reach a shared resource — most commonly the write-back stage — in the same cycle.