SystemVerilog Assertions: What They Are and Why They Pay Off (Tested)
Why SystemVerilog assertions pay off: immediate vs concurrent, cover, disable iff, bind and $assertoff. A simple example plus a 7-check UVM bench, tested on VCS.
Why SystemVerilog assertions pay off: immediate vs concurrent, cover, disable iff, bind and $assertoff. A simple example plus a 7-check UVM bench, tested on VCS.
In short: To enable or disable one specific constraint, call constraint_mode() on the named block, not on the whole object: obj.block_name.constraint_mode(0) switches that one rule off, and obj.block_name.constraint_mode(1) switches it back on. Every other constraint keeps working. Called with no argument on a named block it returns the current state, 1 for enabled and 0…
randcase picks one weighted branch; randsequence builds a random sequence from productions. A simple example plus an 8-check UVM bench, tested on VCS.
How wait works in SystemVerilog: @event vs wait(event.triggered), ->>, wait(expression), wait fork and uvm_event, each run in one UVM bench on VCS.
A SystemVerilog mailbox passes messages between processes: put() adds, get() removes the oldest, and both can block. A UVM bench with 8 checks and the reused-handle bug, tested on VCS.
In short: dist makes some random values come up more often than others. := gives the weight to every value in a range, so a wider range gets more in total. :/ gives the weight to the range as a whole and splits it evenly. Weights are shares, not percentages. Other constraints always win over…
In short: Directed testing writes one test per scenario you already know about. Constrained random verification (CRV) lets the simulator generate many legal, varied scenarios from a small set of rules, so it also finds bugs nobody thought to look for. Most real projects use both: CRV first to cover wide ground and catch corner…
How the SystemVerilog bind statement adds SVA checkers to a design without editing RTL: every instance, one instance, internal signals and interfaces, run in one UVM bench on VCS.
How a SystemVerilog semaphore works: new(keys), get(), put() and try_get(), as a mutex and as a pool. One tested UVM bench, real VCS output, and the traps.
In short: SystemVerilog has four kinds of unpacked array. A fixed array has a size set when you write the code. A dynamic array gets its size at run time with new[]. An associative array only stores the keys you actually use, which suits sparse data like memory. A queue grows and shrinks at either…