Formal Definition
A statement that checks that a specified condition is true and reports an error if it is not.
Simplified Syntax
assert condition
report string
severity severity_level;
Description
The assertion statement has three optional fields and usually all three are used.
The condition specified in an assertion statement must evaluate to a boolean value (true or false). If it is false, it is said that an assertion violation occurred.
The expression specified in the report clause must be of predefined type STRING and is a message to be reported when assertion violation occurred.
If the severity clause is present, it must specify an expression of predefined type SEVERITY_LEVEL, which determines the severity level of the assertion violation. The SEVERITY_LEVEL type is specified in the STANDARD package and contains following values: NOTE, WARNING, ERROR, and FAILURE. If the severity clause is omitted it is implicitly assumed to be ERROR.
When an assertion violation occurs, the report is issued and displayed on the screen. The supported severity level supplies an information to the simulator. The severity level defines the degree to which the violation of the assertion affects operation of the process:
· NOTE can be used to pass information messages from simulation (example 1);
· WARNING can be used in unusual situation in which the simulation can be continued, but the results may be unpredictable (example 2);
· ERROR can be used when assertion violation makes continuation of the simulation not feasible (example 3);
· FAILURE can be used when the assertion violation is a fatal error and the simulation must be stopped at once (example 4).
Assertion statements are not only sequential, but can be used as concurrent statements as well. A concurrent assertion statement represents a passive process statement containing the specified assertion statement.
Examples
Example 1
assert Status = OPEN_OK
report "The call to FILE_OPEN was not successful"
severity WARNING;
Having called the procedure FILE_OPEN, if the status is different from OPEN_OK, it is indicated by the warning message.
Example 2
assert not (S= '1' and R= '1')
report "Both values of signals S and R are equal to '1'"
severity ERROR;
When the values of the signals S and R are equal to '1', the message is displayed and the simulation is stopped because the severity is set to ERROR.
Example 3
assert Operation_Code = "0000"
report "Illegal Code of Operation"
severity FAILURE;
Event like illegal operation code are severe errors and should cause immediate termination of the simulation, which is forced by the severity level FAILURE.
Important Notes
· The message is displayed when the condition is NOT met, therefore the message should be an opposite to the condition.
· Concurrent assertion statement is a passive process and as such can be specified in an entity.
· Concurrent assertion statement monitors specified condition continuously.
· Synthesis tools generally ignore assertion statements.
No comments:
Post a Comment