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

  • Part 0 · What Debugging Is6
  • Part 1 · Reproduce8
  • Part 2 · Observe9
  • Part 3 · Localise10
  • Part 4 · Hypothesise and Test6
  • Part 5 · Bug Classes16
    • Logic Bugs: Off-by-One, Width and Sign
    • FSM Bugs
    • X and Reset Bugs
    • Races and Simulation-Synthesis Mismatches
    • Latches and Combinational Loops
    • CDC Bugs
    • Reset-Domain Crossing Bugs
    • Timing-Only Bugs
    • Protocol Violations
    • Hangs and Deadlocks
    • Starvation and Livelock
    • Performance Bugs
    • Power-Intent Bugs
    • DFT-Mode Bugs
    • Configuration and Register-Map Bugs
    • Testbench Bugs That Look Like Design Bugs
  • Part 6 · Debug by Stage9
  • Part 7 · Hangs and Deadlocks7
  • Part 8 · Intermittent Failures7
  • Part 9 · Fix, Prove, Prevent7
  • Part 10 · Case Studies12
  • Part 11 · Debug as a Team5
  • Part 12 · Interview Prep5
Loading lesson

‹The Art of Hardware Debug
  1. Topics
  2. The Art of Hardware Debug
  3. Part 5 · Bug Classes

Part 5 · Bug Classes · All levels

Part 5 · Bug Classes

What are the usual suspects, and what does each one look like?

  • 16topics
  • 16lessons

Topics in this section

  1. 1Logic Bugs: Off-by-One, Width and Sign1 lesson
  2. 2FSM Bugs1 lesson
  3. 3X and Reset Bugs1 lesson
  4. 4Races and Simulation-Synthesis Mismatches1 lesson
  5. 5Latches and Combinational Loops1 lesson
  6. 6CDC Bugs1 lesson
  7. 7Reset-Domain Crossing Bugs1 lesson
  8. 8Timing-Only Bugs1 lesson
  9. 9Protocol Violations1 lesson
  10. 10Hangs and Deadlocks1 lesson
  11. 11Starvation and Livelock1 lesson
  12. 12Performance Bugs1 lesson
  13. 13Power-Intent Bugs1 lesson
  14. 14DFT-Mode Bugs1 lesson
  15. 15Configuration and Register-Map Bugs1 lesson
  16. 16Testbench Bugs That Look Like Design Bugs1 lesson
On this page

    Part 5 answers: What are the usual suspects, and what does each one look like?

    Where Part 5 sits on the debug loop: Localise, Hypothesise.

    Most hardware bugs belong to a small number of classes, and each class leaves a recognisable signature. This part gives each class its signature, the first three checks, one real reproduction and the fix pattern, and links to the course that owns the topic.

    After this part you can

    • Recognise the signature of each major bug class from a waveform or log.

    • Name the first three checks for each class.

    • Know which course to read for depth on each class.

    Lessons in this part

    16 lessons, about 166 min

    1. 1Logic Bugs: Off-by-One, Width and SignYou can recognise an off-by-one, width or sign bug from the pattern of wrong values, run the three checks that confirm it, and add the lint rule, boundary test or load check that catches it earlier.10 min
    2. 2FSM BugsYou can tell a stuck, illegal, missing-transition or Mealy-glitch FSM bug from its trace, run the three checks that confirm which one it is, and add the assertion that catches it the cycle it happens.10 min
    3. 3X and Reset BugsYou can tell a missing reset, a wrong reset value and a reset that never acted apart from how they behave in three kinds of simulation, check every register against its documented reset value, and fix the cause.9 min
    4. 4Races and Simulation-Synthesis MismatchesYou can recognise a race or a simulation-synthesis mismatch from runs that disagree, confirm it by simulating the synthesised netlist and reading lint, and fix the RTL so that every simulator and the netlist agree.10 min
    5. 5Latches and Combinational LoopsYou can recognise a latch from history-dependent output and a combinational loop from a hang or oscillation, find each with Yosys and Verilator, and fix them with the complete-assignment pattern and a broken dependency.11 min
    6. 6CDC BugsYou can recognise a missing synchroniser, a reconvergent crossing and an incoherent multi-bit crossing from their symptoms, reproduce each with a metastability model, and choose a fix the model cannot break.11 min
    7. 7Reset-Domain Crossing BugsYou can recognise a reset-domain crossing from a failure tied to a reset event, reproduce an asynchronous-assertion corruption and a release-order hang in simulation, and fix them with isolation and sequencing.11 min
    8. 8Timing-Only BugsYou can recognise a setup, hold or exception failure from how it moves with frequency and which bits fail, reproduce a multicycle-path bug with a timing model, and check the design keeps what the constraints assume.11 min
    9. 9Protocol ViolationsYou can recognise a valid/ready violation from a scoreboard or watchdog message, run the three first checks on the port, reproduce the bug under back-pressure, and add the rule checks that catch it at the first stall.10 min
    10. 10Hangs and DeadlocksYou can recognise a hang from a watchdog line, build the wait-for chain at the hang, tell a cyclic deadlock from a lost credit or token, and add the invariant or rule check that fires at the cause, not thousands of cycles later.11 min
    11. 11Starvation and LivelockYou can tell starvation and livelock from a hang with counters, run the first three checks on an arbiter or retry loop, reproduce both on small designs, and add the per-agent age and progress checks that catch them.9 min
    12. 12Performance BugsYou can recognise throughput collapse, bubbles and cycle regressions from counters, run the first three checks, reproduce a half-rate pipeline stage, and add the cycle budget and per-stage counters that catch the next one.10 min
    13. 13Power-Intent BugsYou can tell missing isolation, missing retention and a wrong power-up order apart from a log or waveform, run the three checks that confirm each, and add the always-on assertion that catches it the cycle it happens.12 min
    14. 14DFT-Mode BugsYou can recognise a scan-enable or test-mode leak and a wrong test reset or clock mux from the shape of the wrong values, trace each test control to its source, and add the functional-mode check that catches it at once.10 min
    15. 15Configuration and Register-Map BugsYou can recognise a wrong reset value, a wrong access type, a decode overlap and a byte-lane mistake from their symptoms, and run the reset, walk and access-type checks that find each one in minutes.10 min
    16. 16Testbench Bugs That Look Like Design BugsYou can recognise a monitor that samples at the wrong time, a race between bench and design, and a checker that never runs, confirm each by changing only the bench, and add the rules that stop them.11 min

    Revision sheet

    The part on one page, taken from each lesson's Remember box.

    Logic Bugs: Off-by-One, Width and Sign

    • Wrong by exactly a power of two means a lost top bit. Wrong only for negative values means an unsigned operand. Wrong only at the end means an off-by-one.

    • In Verilog the width of an expression comes from its context, and one unsigned operand makes the whole expression unsigned.

    • A cast silences the lint warning that would have caught the bug. Check the truncation is meant before you write one.

    Rule of thumb: when a wrong value differs from the right one by a power of two, look for the bit that was dropped.

    FSM Bugs

    • Read the state register first. Is its value legal, how long has it held it, and which event would move it on?

    • A one-hot state with two bits set is two machines at once: each drives its own outputs.

    • A new input added to an FSM must be handled in every state. Review a change by its rows (states), not by its new line.

    Rule of thumb: for every state and every input, be able to say where the machine goes next, and make the simulator check it.

    X and Reset Bugs

    • Missing reset: X in four-state, a pass in two-state, a seed-dependent failure with random start values. Wrong reset value: the same failure everywhere.

    • A synchronous reset needs a clock edge while reset is held. If the clock starts after reset ends, the flop was never reset.

    • Read every register one cycle after reset and compare it with the register map. It is the cheapest test in the plan.

    Rule of thumb: for every register, know its value one cycle after reset and who reads it before its first write.

    Races and Simulation-Synthesis Mismatches

    • A blocking assignment in a clocked block that another block reads is a race: each simulator may order it differently, and the chip has no order at all.

    • Synthesis ignores sensitivity lists and delays, and an ASIC cannot honour initial values. The netlist is what the chip does; simulate it when RTL runs disagree.

    • Rule out X first: a two-state simulator and a four-state one also disagree on unknown values.

    Rule of thumb: if two simulators or the RTL and the netlist disagree, suspect the RTL's ordering before the tools.

    Latches and Combinational Loops

    • A combinational output that depends on what happened before is a latch. Look for a path through an always block that does not assign it.

    • A simulation that stops advancing time without an error is the signature of a zero-delay loop. Verilator calls it DIDNOTCONVERGE.

    • Loops often span two modules. Check them on the elaborated hierarchy: Yosys check after flatten, or Verilator lint on the top.

    Rule of thumb: treat every "Latch inferred" and every logic-loop warning as a bug until someone has written down why it is meant.

    CDC Bugs

    • Zero-delay RTL simulation never shows metastability: every flop captures cleanly. Only a model, a CDC tool or silicon shows these three bugs.

    • One signal, one synchroniser, then fan out. Two flops that sample the same asynchronous signal can disagree for a cycle.

    • Never synchronise a word bit by bit. Hold it stable and synchronise one qualifier, use Gray code for a counter, or use an async FIFO.

    Rule of thumb: if a failure needs a value nobody sent or a state nobody can reach, ask which crossing it came through.

    Reset-Domain Crossing Bugs

    • An asynchronous reset changes its flops at any time in the cycle. Any flop outside that reset that samples them is a crossing, even on the same clock.

    • Isolate before you reset: hold the receiving side, then assert, release, wait, and only then let it sample again.

    • Benches that release every reset together cannot see release-order bugs. Randomise which domain leaves reset first.

    Rule of thumb: for every reset in the design, ask who is still running when it asserts, and who is ready when it releases.

    Timing-Only Bugs

    • A failure that goes away at a slower clock is setup-type. One that stays at every frequency is hold-type. RTL simulation shows neither.

    • A multicycle or false path is a promise the RTL must keep. Static timing believes it; only the design can make it true.

    • High bits wrong and low bits right, on an arithmetic path, is a long carry chain arriving late.

    Rule of thumb: for every timing exception, find the line of RTL that makes it true.

    Protocol Violations

    • Most protocol bugs only fail under back-pressure. A test whose sink is always ready proves almost nothing about the handshake.

    • Check the three rules first: valid held until ready, payload stable while waiting, one response per accepted request, to the master that made it.

    • A protocol checker reports the rule at the cycle it breaks; a scoreboard reports a wrong word later and points at the data path.

    Rule of thumb: put a rules checker on every valid/ready port before you trust any scoreboard result.

    Hangs and Deadlocks

    • A hang is silence: counters freeze, and the only message is the watchdog's. Snapshot every agent and write down what each one waits for.

    • Follow the waits. A chain that comes back to its start is a deadlock; a chain that ends at an idle agent means a credit or token was lost.

    • Prevent with a check on the cause: a conservation invariant for credits, a no-hold-while-waiting rule for locks. Both fire long before a watchdog.

    Rule of thumb: in a hang, follow the waits until they loop or end, and fix the arrow that should not exist.

    Starvation and Livelock

    • Starvation: progress for some, never for one. Livelock: requests and retries keep coming, nothing completes. Neither is silent.

    • An activity watchdog cannot see either. Count completions per agent and the age of the oldest waiting request.

    • Fix the policy, not the symptom: a fair arbiter for starvation, broken symmetry (a different or random back-off, or a winner) for livelock.

    Rule of thumb: measure progress per agent, not activity on the bus.

    Performance Bugs

    • A performance bug has right values and wrong timing. Only counters and cycle budgets fail on it; scoreboards never will.

    • Read stall counters stage by stage. A stage that stalls its input in a cycle when its own output is being taken is the bubble's source.

    • Every fix and every speed-up changes cycles. Compare cycles per test against a baseline in every regression, not only when someone complains.

    Rule of thumb: a test that does not check cycles passes performance bugs; give every directed test a cycle budget.

    Power-Intent Bugs

    • Missing isolation: X or noise on the always-on side, starting the cycle a domain powers off. In a two-state simulator it can show up as a hang or a phantom event.

    • Missing retention: after a wake the register reads its reset value, not garbage. Only tests that sleep with non-default settings see it.

    • Order bugs live in a window of a few cycles around a power transition. Check the sequence against the spec before you look at the data.

    Rule of thumb: for every signal that leaves a switchable domain, ask which supply powers its reader; if it is a different one, the signal needs a clamp.

    DFT-Mode Bugs

    • A register holding its old value shifted by N bits, after N cycles of unrelated pin activity, is a scan shift: look for an ungated scan enable.

    • Flops that ignore a functional reset, or run at the wrong clock, point at a test mux that picked the test input.

    • Scan muxes are added at insertion, so the RTL may have no path for the bug: it shows at gate level, in DFT rule checks or on the tester.

    Rule of thumb: in functional mode every test control is constant and inactive: check that before you debug the data.

    Configuration and Register-Map Bugs

    • A wrong reset value only shows before software writes the register. Tests that always program it first never see it.

    • When writing one register changes another, the register you wrote reads back fine. Read every register after writing every register.

    • Test each access type with both values: write 0 and 1 to a W1C bit, write a read-only one, read a read-to-clear one twice.

    Rule of thumb: test the register block against the register map, typed from the spec, before any test that uses the block.

    Testbench Bugs That Look Like Design Bugs

    • Mismatches that appear only under back-pressure or gaps, off by one beat, while design-side assertions stay quiet: check when the monitor samples.

    • A result that changes with the simulator or an unrelated edit, by exactly one cycle, is a race. Drive away from the edge the design samples on.

    • A checker that made zero comparisons has not passed anything. Every checker reports its count, and zero is a failure.

    Rule of thumb: if the failure moves when you change only the bench's timing, the bug is in the bench.

    Practise it

    • Practice question: Counter with wrap and saturate modes

    • Practice question: FIFO flag off-by-one at wrap

    • Code lab: Signed comparator

    • Code lab: Saturation logic

    • Practice question: FSM illegal state debugging with assertions

    • Interview: run a mock interview on this topic

    Related topics

    • Course hub

    • Previous: Part 4 · Hypothesise and Test

    • Next: Part 6 · Debug by Stage

    PreviousNext: Logic Bugs: Off-by-One, Width and Sign

    Up next

    Up nextLogic Bugs: Off-by-One, Width and Sign

    Sign in to save progress

    Practice this lessonReport an error

    See also

    • Part 0 · What Debugging Is
    • Part 1 · Reproduce
    • Part 2 · Observe