Part 7 answers: Nothing happens. Where do I start?
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.
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.
7 lessons, about 79 min
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.
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