Skip to question
asic.fyi
DesignVerificationSystemVerilogFirmwareArchitectureInterviews
asic.fyi/Interview questions/Race a transaction against a scoped watchdog

Hardware interview practice

Race a transaction against a scoped watchdog

MediumTestbench ConcurrencySystemVerilog

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.

Try it in the question bankReason first. Then compare.

Keep this exact question selected while you check your answer and review the full solution.

Practice this question →
Starting point

Question code

task do_transaction();
task wait_timeout();
Reviewed example

Work through one case

Input
transaction completes after 8 cycles; timeout would complete after 20 cycles
Expected output
success = 1, the timeout child is stopped, and an unrelated monitor remains alive

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

What to cover

Requirements

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

Related questions

Testbench ConcurrencyCapture per-iteration values in fork...join_none→SystemVerilog SchedulingReason about same-region forked output order→
asic.fyi · Learn silicon end to end.info@asic.fyi