Parameters are values that are passed into a module when instantiating that allow it to be customized. Once passed in, parameters act like constants, meaning that they cannot be changed.

Parameters are declared at the top of the module with a statements of the form:

parameter [real|integer] name=<expr> [rangeLimit];

The parameter keyword is followed by an optional type, either real or integer. The name of the parameter is followed by an initializing expression that when evaluated gives the default value of the parameter. More than one parameter can be declared in the same statement by adding more names (with initializer and optional range limit). If the type is not given explicitly, it is inferred from the type of the initializing expression. The range limit takes the form of one or more of the following:

from[λ:υ ] λ ≤ value ≤ υ
from(λ:υ ] λ < value ≤ υ
from[λ:υ ) λ ≤ value < υ
from(λ:υ ) λ < value < υ
exclude[λ:υ ] λ ≤ value ≤ υ
exclude(λ:υ ] λ < value ≤ υ
exclude[λ:υ ) λ ≤ value < υ
exclude(λ:υ ) λ < value < υ
exclude ε value != ε

When the expressions are given as a pair separated by a colon, the first expression (λ) is the lower bound of the range, and the second (υ) is the upper bound. To eliminate a bound, use inf as the upper bound or -inf as the lower bound.


parameter bits=8, vdd=3.0;
parameter thresh=vdd/2;
parameter integer size=16;
parameter real td=0;
parameter integer bits = 8 from [23:0];
parameter integer dir = 1 from [-1:1] exclude 0;
parameter real period=1 from (0:inf);
parameter real toff=0 from [0:inf), td=0 exclude 0;
parameter real Vmin=0;
parameter real Vmax=Vmin+1 from (Vmin:inf);

Expressions must be written in terms of either literal constants or previously defined parameters.

Parameters can also be arrays, in which case the array bounds are given after the parameter name and the parameter is initialized using an array.


parameter real poles[3:0] = {1.0, 3.198, 4.554, 12.0};