Skip to the selected question
ASIC.FYI

ASIC Question Bank

1,000+ hardware interview questions
DescriptionQ932
Page ↗
Q932DVASIC interview problem

Race a transaction against a scoped watchdog

TechniquesDVSystemVerilogfork joinWatchdogTimeoutCleanup
DifficultyMedium
TopicTestbench Concurrency
LanguageSystemVerilog
Requirements4 checkpoints
01

Problem

Run a transaction and a timeout concurrently. Continue when either finishes, stop only the losing child, return one success-or-timeout result, and leave unrelated background processes alive.

Task headerSystemVerilog
task do_transaction();
task wait_timeout();

Example input and output

Use this case to check your interpretation
Input
transaction completes after 8 cycles; timeout would complete after 20 cycles
Output
success = 1, the timeout child is stopped, and an unrelated monitor remains alive
Explanation

The transaction branch deposits the first result token; join_any returns, and disabling only the named contenders fork removes its losing sibling.

02

Requirements (4)

  • Use join_any to detect the first completed contender.
  • Cancel the remaining contender before returning.
  • Scope disable so it cannot terminate unrelated descendants owned by the caller.
  • Publish exactly one success or timeout result, including when completions occur in the same time slot.