Assertions are mainly used to validate the behavior of a design and provide functional coverage information for a design. Using Simulation we can checked Assertions dynamically, or statically by a separate property checker tool.
There are two
kinds of assertions:
Immediate Assertions
Concurrent Assertions
Immediate Assertions are similar to “if statement”, a statement that something must be true. The difference is that if statement does not assert that an expression is true, it simply checks that it is true. It is a procedural statements and mainly used in simulation.
An immediate assertion may include a pass statement and/or a fail statement. In our example the pass statement is omitted, so no action is taken when the assert expression is true. If the pass statement exists:
assert (A == B) $display (“OK. A equals B”);
it is executed immediately after the evaluation of the assert expression. The statement associated with an else is called a fail statement and is executed if the assertion fails:
assert (A == B) $display (“OK. A equals B”);
else $error(“It’s gone wrong”);
You may omit the pass statement yet still include a fail statement:
assert (A == B) else $error(“It’s gone wrong”);
Assertion failure has a severity associated with it. There are three severity system tasks that can be included in the fail statement to specify the severity level: $fatal, $error (the default severity) and $warning. In addition, the system task $info indicates that the assertion failure carries no specific severity.
Concurrent assertions check the sequence of events spread over multiple clock cycles. The concurrent assertion is evaluated only at the occurrence of a clock tick
The test expression is evaluated at clock edges based on the sampled values of the variables involved. It can be placed in a procedural block, a module, an interface or a program definition
c_assert: assert property(@(posedge clk) not(a && b)); |
Concurrent assertions (assert property and cover property statements) use a generalized model of a clock and are only evaluated when a clock tick occurs