A testbench is a set of concurrent processes that must share data, arbitrate resources and agree when the test is over. SystemVerilog provides three primitives for this, event, semaphore and mailbox, plus the fork family and process handles for thread control.
Primitive | Carries data | Blocking | Typical use |
|---|---|---|---|
event | No | @ and wait block | Done flags, phase sync |
semaphore | No, keys only | get blocks | Resource arbitration |
mailbox | Yes | put and get block | Producer-consumer pipes |
Lesson | What it covers | Path |
|---|---|---|
Trigger versus wait, triggered, handle passing and wait_order. | Required | |
Keys, bus arbitration, deadlock and backoff fixes. | Recommended | |
Bounded versus unbounded, typed handles and sizing. | Required | |
Join variants, loop capture, disable fork, wait fork and process. | Required | |
Synchronization Patterns: Handshakes, Phasing and Objections | Completion counters, objections with drain, races and barriers. | Recommended |
A deterministic bench tying every primitive together. | Optional |
Path labels. Required means core first pass for this topic, Recommended means most learners should read it, and Optional means reference, specialist or revision material you can return to later.
Mailbox for the items, semaphore for the bus, and an objection counter or completion counter for end of test. Events only signal moments, so they cannot carry the items or arbitrate the bus.