The two type of assertions are discussed in details with examples below.
Immediate Assertions -
Immediate assertions are executed only once and are mostly implemented within ‘initial blocks’. Due to limited use cases its not widely used and limited to simulations.
Example of immediate assertion below:-
assert (A==B) $display(“Pass”);
else $error(“Fail, reporting Error”);
Failure of assertion is reported by else statement. In ‘else’ branch we can also include severity of the failure. The level of severity varies from $info, $warning, $error or $fatal. The $error is the default severity in SystemVerilog.
Concurrent Assertions -
The concurrent assertions are tied closely to the RTL design to behave inline with the implementation logic. These assertions are most valuable and widely used. Its useful for both formal verification and behavioral simulations.
There are two types of concurrent assertions :-
Assertions checking the property only with rising edges of the clock.
Assertions which are always active in time and properties are constantly validated.
Example of concurrent assertions:-
assert property (@posedge clk) (fifo_full && fifo_wr);
Checks that the FIFO full flag and FIFO write data control is never set high (or 1) at any rising edge of the clock.