|
The Define Statement allows you to substitute a meaningful symbolic name (an evaluated function) for the value of an arithmetic expression. When you use an evaluated function in a Text Design File (.tdf), the Compiler replaces the evaluated function with the value of the arithmetic expression assigned to the evaluated function in the Define Statement. The value of the arithmetic expression is a number or text string, and is based on optional arguments for the expression.
|
The following example defines and uses the evaluated function EX
to ensure that the Subdesign Section declares at least one port,.
DEFINE EX(a,b) = (a > b) ? a : b; SUBDESIGN ( dataa[EX(WIDTH,0)..0]: INPUT; datab[EX(WIDTH,0)..0]: OUTPUT; ) BEGIN datab[] = dataa[]; END;
The Define Statement has the following characteristics:
The Define Statement begins with the keyword
DEFINE
, followed by a symbolic name, an optional list of one or more arguments enclosed in parentheses ()
, an equals symbol (=
), and an arithmetic expression.
Arguments in the argument list are separated by commas (,
).
If no arguments are listed, an evaluated function behaves as a constant. |
The statement ends with a semicolon (;
).
Once an evaluated function is declared, you can use it to represent the value of an arithmetic expression
throughout a TDF. For example, you can use the EX
evaluated function shown above to represent the value of the arithmetic expression (a,b) = (a > b) ? a : b
anywhere in the TDF where you declare the evaluated function.
You can use previously defined constants, evaluated functions, or parameters to define evaluated functions. Example
The value of the arithmetic expression that you use to define an evaluated function can be a text string. These text strings can be the values of previously defined parameters, constants, or evaluated functions.
Define Statements must conform to the following rules:
An evaluated expression can be used in a TDF only after it is defined in the TDF, or in an AHDL Include File (.inc) that is included in the TDF. However, AHDL includes several predefined evaluated functions that do not need to be defined.
Each evaluated function must be unique in a TDF.
The evaluated function name cannot contain spaces. Use underscores to separate the words in the name and improve readability.
The Define Statement can be used any number of times in a TDF.
The Define Statement must be placed outside all other AHDL sections.
- PLDWorld - |
|
Created by chm2web html help conversion utility. |