|
The Parameters Statement allows you to declare one or more parameters that control the implementation of a parameterized megafunction or macrofunction. You can use parameters throughout a Text Design File (.tdf), for example, in If Generate Statements or when implementing macrofunctions or macrofunctions. The following example shows a Parameters Statement:
PARAMETERS ( FILENAME = "myfile.mif", -- optional default value follows "=" sign WIDTH, AD_WIDTH = 8, NUMWORDS = 2^AD_WIDTH );
The Parameters Statement has the following characteristics:
A Parameters Statement begins with the keyword
PARAMETERS
, followed by a list of one or more parameters and
optional default values, enclosed in parentheses ()
.
Parameters in the parameter list are separated by commas (,
);
parameter names are separated from optional default values by an equals symbol
(=
). In the example shown above, only the WIDTH
parameter does not have a default value.
Parameter names can be user-defined symbolic names (for example, names for the name substitution feature) or predefined Altera® parameters (for example, the DEVICE_FAMILY or LPM_PIPELINE parameter).
Parameter values can consist of text strings enclosed in double quotation
marks ("
), which are evaluated as strings. When parameter
values are unquoted, the Compiler attempts to treat them as arithmetic expressions;
failing that, they are treated as strings.
The statement ends with a semicolon (;
).
Once a parameter has been defined, you can use it throughout the TDF.
Parameter Statements must conform to the following rules:
A parameter can only be used after it is declared.
Each parameter name must be unique.
The parameter name cannot contain spaces. Use underscores to separate words and improve readability.
The Parameters Statement can be used any number of times in a TDF.
The Parameters Statement must be placed outside of all other AHDL sections.
Parameters used in the definition of other parameters must already be defined.
Circular references are not allowed. Example
During compilation, the Compiler searches for parameter values as described in Parameter Value Search Order.
- PLDWorld - |
|
Created by chm2web html help conversion utility. |