SystemVerilog assertions (SVA) are used to check if a design behaves as expected. Assertions express design properties or conditions that must hold true at certain times during the execution of the hardware. They help detect and diagnose functional errors early in the design cycle.
In SystemVerilog there are two main kinds of assertions: immediate and concurrent.
Immediate asertions are evaluated as soon as the statement is executed, typically used for conditions that should hold true in a single simulation cycle.
Syntax:
label: assert(expression) pass_statement; else fail_statement;
Where:
label (identifier and colon): optional, creates a named block around the assertion statement
pass_statement, fail_statement:optional, depending on the value of the expression, either pass_statement or fail_statement will be executed.
There are three severity system tasks that can be included in the fail statement to specify a severity level: $fatal, $error (the default severity) and $warning. In addition, the system task $info indicates that the assertion failure carries no specific severity.
If the pass_statement and fail_statement are not specified, a assertion error report will be generated.
Example:
Output: