|
The Assert Statement allows you to test the validity of any arbitrary expression that uses parameters, numbers, or evaluated functions, or test the used or unused status of a port.
The following example shows an Assert Statement:
ASSERT (WIDTH > 0) REPORT "Width (%) must be a positive integer" WIDTH SEVERITY ERROR HELP_ID INTVALUE; -- for internal Altera® use only
The Assert Statement has the following characteristics:
The keyword ASSERT
is followed
by an arithmetic
expression that is optionally enclosed in parentheses ()
.
When the expression is false, the assertion is activated and the message string
following the REPORT
keyword is displayed in the Processing tab of the Messages window and in the Messages section of the Report window. If you do not specify a condition, the assertion is always activated.
The REPORT
keyword is followed by a message string and optional
message variables. The message string is enclosed in quotation marks
("
), and can include %
characters that are substituted with
the values of optional message variables. If no REPORT
keyword
is used, an assertion that is activated displays a generic message of the
following format in the Messages window and Report window:
Assertion failed
Optional message variables consist of one or more parameters, evaluated
functions, or arithmetic expressions. Multiple message variables are separated
by commas (,
). The values of the message variables are substituted,
in order, for the %
characters in the quoted message string. A value can be either a non-negative number or a text string. In the example shown above, the value of WIDTH
is substituted
for the %
in the quoted message string.
The optional SEVERITY
keyword is followed by a severity level
of ERROR
, WARNING
, or INFO
. If no severity is specified,
the ERROR
level is used.
The HELP_ID
keyword and help string are used in some Altera-provided
logic functions and are reserved for internal
Altera use.
The statement ends with a semicolon (;
).
The Assert Statement can be used within the Logic Section or outside any other AHDL section.
- PLDWorld - |
|
Created by chm2web html help conversion utility. |