VLSI DV Interview Puzzles · All levels

Semaphore & Mailbox Puzzles

These puzzles model real bench hangs where nothing crashes but progress stops. The key skill is drawing wait-for graphs across semaphore tokens and mailbox blocking behavior, including `try_*` APIs and bounded queues.

About this puzzle set

These puzzles model real bench hangs where nothing crashes but progress stops. The key skill is drawing wait-for graphs across semaphore tokens and mailbox blocking behavior, including `try_*` APIs and bounded queues.

Puzzles in this topic

diagram
1. Lock Held Across Blocking Response Wait  [Medium]
2. Bounded Mailbox put Deadlock  [Hard]
3. try_get Busy Spin at Time 0  [Easy]
4. Leaked Semaphore Token on Error Path  [Medium]
5. Two Consumers Waiting on One Mailbox  [Hard]
6. Deadlock-Free Request Loop with try_put/try_get  [Medium]

Work each puzzle before reading the solution: predict the exact output or answer, name the rule that governs it, then check yourself.

SV scheduling regions at puzzle scale

diagram
SYSTEMVERILOG EVENT REGIONS (SIMPLIFIED ORDER)

time slot T
   |
   +--> ACTIVE   : blocking statements, RHS sampling
   +--> INACTIVE : #0 queued work
   +--> NBA      : non-blocking LHS updates commit
   +--> OBSERVED : assertions sample stable design values
   +--> REACTIVE : testbench/program reaction code

If behavior looks impossible, ask: "Which region saw which value?"

Related topics