VHDL Programming

(C. Jardin) #1

Sequential Processing 57


Assertions of severity level error are used to alert the designer of con-
ditions that will cause the model to work incorrectly, or not work at all. If
the result of a calculation was supposed to return a positive value, but in-
stead returned a negative value, depending on the operation, this could
be considered an error.
Assertions of severity level failure are used to alert the designer of con-
ditions within the model that can have disastrous effects. An example of
such a condition was discussed in the EXITstatement section. Division
by 0 is an example of an operation that could cause a failure in the
model. Another is addressing beyond the end of an array. In both cases,
the severity level failure can let the designer know that the model is
behaving incorrectly.
The severity level is a good method for classifying assertions into infor-
mational messages to the designer that can describe conditions during
execution of the model.
The ASSERTstatement is currently ignored by synthesis tools. Because
the ASSERTstatement is used mainly for exception handling while writ-
ing a model, no hardware is built.

Assertion BNF


Following is the BNF description for the ASSERTstatement:

assert_statement ::=
ASSERT condition
[REPORT expression]
[SEVERITY expression];

The keyword ASSERTis followed by a boolean-valued expression called
a condition. The condition determines whether the text expression specified
by the REPORTclause is output or not. If false, the text expression is output;
if true, the text expression is not output.
There are two optional clauses in the ASSERTstatement. The first is the
REPORTclause. The REPORTclause gives the designer the ability to specify
the value of a text expression to output. The second is the SEVERITYclause.
The SEVERITYclause allows the designer to specify the severity level of
the ASSERTstatement. If the REPORTclause is not specified, the default
value for the ASSERTstatement is assertion violation. If the SEVERITY
clause is not specified, the default value is error.
Free download pdf