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
  • Part 6 · Debug by Stage9
  • Part 7 · Hangs and Deadlocks7
    • Hang, Livelock or Starvation
    • Who Is Waiting for Whom
    • Finding the Cycle
    • Credit and Token Loss
    • Valid/Ready Deadlock Patterns
    • Watchdogs and Hang Detectors
    • A Full Hang on dbglab
  • 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 7 · Hangs and Deadlocks

Part 7 · Hangs and Deadlocks · All levels

Part 7 · Hangs and Deadlocks

Nothing happens. Where do I start?

  • 7topics
  • 7lessons

Topics in this section

  1. 1Hang, Livelock or Starvation1 lesson
  2. 2Who Is Waiting for Whom1 lesson
  3. 3Finding the Cycle1 lesson
  4. 4Credit and Token Loss1 lesson
  5. 5Valid/Ready Deadlock Patterns1 lesson
  6. 6Watchdogs and Hang Detectors1 lesson
  7. 7A Full Hang on dbglab1 lesson
On this page

    Part 7 answers: Nothing happens. Where do I start?

    Where Part 7 sits on the debug loop: Observe, Localise.

    A hang gives no error message and no first wrong value, so guessing fails completely. This part builds a method for silence: tell a hang from a livelock, ask who is waiting for whom, find the cycle in the wait-for graph, and build the detectors that catch the next one.

    After this part you can

    • Tell a deadlock, a livelock and starvation apart from evidence.

    • Build a wait-for table and find the cycle.

    • Add hang detectors to a design and its bench.

    Lessons in this part

    7 lessons, about 79 min

    1. 1Hang, Livelock or StarvationYou can classify a stalled test as deadlock, livelock or starvation from per-agent attempt and progress counts, and build a liveness monitor that names the class instead of timing out.11 min
    2. 2Who Is Waiting for WhomYou can write one wait-for rule per agent from a design's spec, apply the rules to a dump taken at a hang with a small script, and read the result as a cycle of waits or a chain that ends at an agent owing nothing.11 min
    3. 3Finding the CycleYou can dump a wait-for graph at a hang, find its cycles with a strongly connected component search, separate cycle members from agents blocked behind them, and argue from the static graph that a fix holds for every run.12 min
    4. 4Credit and Token LossYou can write the conservation law of a credit loop, check it continuously even when the loop crosses clock domains, and find a loss that appears only at one clock ratio by sweeping the ratio.12 min
    5. 5Valid/Ready Deadlock PatternsYou can recognise the three valid/ready deadlock patterns from the levels at a hang, reproduce each, and catch them earlier with the dependency rule, a combinational-loop check or the response rule.10 min
    6. 6Watchdogs and Hang DetectorsYou can specify and build an in-design hang detector with per-port timers, a programmable limit, a sticky first-hang record and snapshot, and a recovery request, and verify that legal waits pass and the record survives recovery.10 min
    7. 7A Full Hang on dbglabYou can take a hang that only shows as a timeout through classification, the wait-for table, the cycle, localisation, an experiment that could fail, a fix and its proof, and leave behind checks that fire near the cause.13 min

    Revision sheet

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

    Hang, Livelock or Starvation

    • Count two things per agent: attempts (a step towards a goal) and progress (a goal reached). Activity on the wires is neither.

    • No attempts and no progress anywhere: deadlock. Attempts but no progress: livelock. Blocked while others progress: starvation, or a partial deadlock.

    • Classify per agent, not per system. A livelock of two agents can sit next to a third that runs fine.

    Rule of thumb: count attempts and progress per agent before you open a waveform.

    Who Is Waiting for Whom

    • One rule per agent, from the spec: given the signals, what is it waiting for, and which agent can give it? Write the rules before the hang.

    • Every agent gets a row, idle ones too. An idle agent is where a chain ends, and a chain that ends means something owed was lost.

    • Check each edge against the payload: an arrow is only real if the request that is waiting is the one that would unblock the next agent.

    Rule of thumb: write the wait-for rules before the hang, and apply them to every agent, not just the one the watchdog named.

    Finding the Cycle

    • A cycle is a group of waiting agents that can all reach each other. Every other waiter is a victim: fix the cycle, not the loudest victim.

    • The graph at the hang finds the cycle; the design's static dependency graph says whether that state can ever be reached. Prove the fix on the second.

    • Only a snapshot taken after progress stopped means anything. Mid-traffic, every graph has waits, and its cycles and dead ends may be passing.

    Rule of thumb: find the cycle with a search, fix an edge on it, and prove from the design's rules that the cycle's state can never form again.

    Credit and Token Loss

    • Every credit spent must come back exactly once. Write that law for each loop and check it all the time; the hang is only its last symptom.

    • Across clocks no edge sees the whole sum. Count at each end, keep the local laws, and give every credit in flight a deadline to come back.

    • Token losses hide behind rate assumptions. A one-bit event crossing carries one event per sample; a count carries any number.

    Rule of thumb: for every credit loop, write the conservation law and check it continuously, with a deadline for credits in flight.

    Valid/Ready Deadlock Patterns

    • valid=0 ready=0 at a hang: one side waits for the other to go first. valid must never wait for ready; ready may wait for valid.

    • A combinational path from ready to valid and back is a loop. Both simulators here settle it to 0, like pattern 1; others may not. Lint and synthesis report it.

    • valid=1 ready=0 on two channels at once: each waits for the other. An agent must take the responses it is owed without needing its next request accepted.

    Rule of thumb: valid never waits for ready, and nothing waits for a new request to be accepted before it takes a response it is owed.

    Watchdogs and Hang Detectors

    • Time a port only while it waits: pending with no progress. Idle is not a hang, so a per-port limit can be far tighter than a global watchdog.

    • Record the first hang only: the port, a timestamp and a snapshot taken at that moment. Later hangs set their bits and never overwrite it.

    • Put the record on a reset that recovery does not touch, or the reset you asked for erases the answer.

    Rule of thumb: every port that can wait gets a timer, and its first firing is kept through the reset that recovers from it.

    A Full Hang on dbglab

    • A hang behind polling is still a hang: count progress per agent, and the polling CPU shows up as activity with no progress.

    • When the table says two views of one thing disagree (full and empty at once), the bug is in how one side learns about the other.

    • Test with an experiment that changes only the suspect. One that also changes something else, such as a forced port, tells you nothing.

    Rule of thumb: never gate the path that carries the news a waiting agent is waiting for.

    Practise it

    • Practice question: FSM deadlock and livelock debugging

    • Practice question: Deadlock and livelock: detection, debug and SVA

    • Practice question: Round-robin arbiter: starvation, fairness and reset flush

    • Code lab: Round-robin arbiter

    • Code lab: Testbench timeout

    • Interview: run a mock interview on this topic

    Related topics

    • Course hub

    • Previous: Part 6 · Debug by Stage

    • Next: Part 8 · Intermittent Failures

    PreviousNext: Hang, Livelock or Starvation

    Up next

    Up nextHang, Livelock or Starvation

    Sign in to save progress

    Practice this lessonReport an error

    See also

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