Skip to content
DenseChip
Learn
PracticeCode labInterview

DenseChip

Navigate

Menu

LearnPracticeCode labInterview

Tools

All toolsSV editorCode repoResume
DenseChip

Practice, courses, and chip-design tools in one focused workspace.

LearnPracticeCode labInterviewToolsLearning paths

© 2026 DenseChip

AboutContactPrivacyTerms
Skip to lesson

Course contents

  • Architecture Metrics Reference
  • Workload Taxonomy for Architects
  • Architecture Glossary
  • Computer Architecture Cheatsheet
  • Pipeline Fundamentals14
    • Pipeline Throughput
      • The Five-Stage Datapath
      • Stage Depth and Clock Period
      • CPI and Speedup Arithmetic
      • Hazard Classes: Structural, Data and Control
      • Forwarding and Stalls
    • Branch Prediction and Fetch
    • Out-of-Order Superscalar Execution
  • Memory Hierarchy15
  • NoC and Interconnect Architecture6
  • Coherency and Memory Ordering9
  • Performance Analysis9
  • Accelerator Architectures6
  • SoC Architecture Tradeoffs9
  • Architecture Interview Prep14
Loading lesson

‹Pipeline Throughput
  1. Topics
  2. Computer Architecture
  3. Pipeline Fundamentals
  4. Pipeline Throughput
  5. Hazard Classes: Structural, Data and Control

Computer Architecture · All levels

Hazard Classes: Structural, Data and Control

Structural, data and control hazards in a classic five-stage pipe, with stall arithmetic.

On this page

    Three hazard classes

    A hazard is any condition that blocks the ideal one-instruction-per-cycle flow. Each class has its own cause and its own fix.

    Class

    Cause in a five-stage pipe

    Fix

    Cost when hit

    Structural

    Two stages need one resource, such as one memory port for IF and MEM

    Extra ports or separate caches

    One bubble per conflict

    Data (RAW)

    A consumer reads a register the producer has not written yet

    Forwarding, else stalls

    Up to 3 bubbles without forwarding

    Control

    Fetch does not know the next PC until a branch resolves

    Early resolve, prediction, flush

    Resolve depth in cycles per mispredict

    Stall, bubble and flush name different things. A stall holds issue, a bubble is an empty slot moving down the pipe, and a flush discards wrong-path slots.

    Why WAR and WAW are absent

    The classic pipe reads registers in ID and writes them in WB, strictly in order. A later instruction cannot write before an earlier one reads, so WAR and WAW cannot occur here.

    WAR and WAW appear only with out-of-order write, such as scoreboarding or renaming pipelines. Those belong to the out-of-order topic, which removes false dependences with physical tags.

    Control cost in cycles

    Each mispredicted branch wastes the instructions fetched behind it. Control CPI is mispredict frequency times the flush penalty.

    CPIcontrol​=1000MPKI×penalty​
    Diagram
    Assume 15% of instructions are branches, a 10% mispredict rate and a 12-cycle penalty
    mispredicts per instruction = 0.15 x 0.10 = 0.015
    CPI_control = 0.015 x 12 = 0.18 cycles per instruction
    MPKI = 0.015 x 1000 = 15; check: 15 x 12 / 1000 = 0.18
    Structural example: assume 20% memory instructions sharing one port, 1 conflict cycle each
    CPI_structural = 0.20 x 1 = 0.20 stalls per instruction

    Deeper pipes lengthen the penalty term. Predictor detail lives in the branch prediction topic; here only the depth-times-rate product matters.

    Common pitfall

    Treating WAR and WAW as five-stage problems invites wrong fixes. In this pipe only RAW, structural and control stalls exist, so counters should be grouped by those three classes.

    Interview

    Likely probe: what evidence is needed before removing a stall rule. Proof from trace or property checks that no stale operand can be consumed, plus CPI improvement on dependency-heavy workloads, not one microbenchmark.

    Check yourself Two instructions need the single ALU in the same cycle. Which hazard class is this?

    Structural. The resource is busy, so one instruction waits regardless of operand readiness.

    Check yourself A load is followed at once by an ALU use of the loaded value. Which class, and what is the cheapest possible cost?

    A RAW data hazard, the load-use case. Even full forwarding leaves one bubble, covered in the next lesson.

    Related topics

    • Branch prediction and fetch

    • Out-of-order and superscalar

    • Stalls and bubbles

    Previous

    8 / 86

    Next: Forwarding and Stalls

    Up next

    Up nextForwarding and Stalls

    Sign in to save progress

    Practice this lessonReport an error

    See also

    • The Five-Stage Datapath
    • Stage Depth and Clock Period