Parameters

Parameters do not belong to either the variable or the net group. Parameters are not variables; they are constants. There are two types of parameters: module parameters and specify parameters. It is illegal to redeclare a name already declared by a net, parameter, or variable declaration. 

Both types of parameters accept a range specification. By default, parameters and specify params shall be as wide as necessary to contain the value of the constant, except when a range specification is present.

For example: 
parameter msb = 7; // defines msb as a constant value 7 
parameter e = 25, f = 9; // defines two constant numbers 
parameter r = 5.7; // declares r as a real parameter 
parameter byte_size = 8, byte_mask = byte_size - 1; 
parameter average_delay = (r + f) / 2; 
parameter signed [3:0] mux_selector = 0;

Parameters represent constants; hence, it is illegal to modify their value at run time. However, module parameters can be modified at compilation time to have values that are different from those specified in the declaration assignment. This allows customization of module instances. A parameter can be modified with the defparam statement or in the module instance statement. Typical uses of parameters are to specify delays and width of variables.

local parameters are identical to parameters except that they cannot directly be modified by defparam statements.

<< Previous | Next >>

Comments are closed.