Section A.2.4, Syntax 6-5, 6.20.1
Mantis 907: Default parameter assignments should be optional
In A.2.4 and Syntax 6-5, REPLACE
param_assignment ::=
parameter_identifier { unpacked_dimension
} = constant_param_expression
specparam_assignment ::=
specparam_identifier
= constant_mintypmax_expression
| pulse_control_specparam
type_assignment ::=
type_identifier = data_type
WITH
param_assignment ::=
parameter_identifier { unpacked_dimension
} [ = constant_param_expression ]99
specparam_assignment ::=
specparam_identifier
= constant_mintypmax_expression
| pulse_control_specparam
type_assignment ::=
type_identifier [ = data_type ] 99
99In a param_assignment
it shall be illegal to omit the constant_param_expression
except within a parameter_declaration in a parameter_port_list. In a type_assignment
it shall be illegal to omit the data_type except
within a parameter_declaration in a parameter_port_list.
In 6.20.1, REPLACE
The parameter keyword can be omitted
in a parameter port list. For example:
class vector #(size = 1); // size is a parameter in a
parameter port list
logic [size-1:0] v;
endclass
interface simple_bus #(AWIDTH = 64, type T
= word) // parameter port list
(input bit clk) ; //
port list
...
endinterface
In
a list of parameter constants, a parameter can depend on earlier parameters. In
the following declaration, the default value of the second parameter depends on
the value of the first parameter. The third parameter is a type, and the fourth
parameter is a value of that type.
module mc #(int N =
5, M = N*16, type T = int, T x = 0)
(
... );
...
endmodule
WITH
The parameter keyword can be omitted
in a parameter port list. For example:
class vector #(size = 1); // size is a parameter in a
parameter port list
logic [size-1:0] v;
endclass
interface simple_bus #(AWIDTH = 64, type T
= word) // parameter port list
(input bit clk) ; //
port list
...
endinterface
In
a list of parameter constants, a parameter can depend on earlier parameters. In
the following declaration, the default value of the second parameter depends on
the value of the first parameter. The third parameter is a type, and the fourth
parameter is a value of that type.
module mc #(int N =
5, M = N*16, type T = int, T x = 0)
(
... );
...
endmodule
In the declaration of a parameter in a parameter_port_list,
the specification for its default value may be omitted, in which case the
parameter shall have no default value. If
no default value is specified for a parameter of a design element, then the
parameter shall be overridden in every instantiation of the design element (see
22.9). If a parameter of a design
element has no default value, then the design element shall not be implicitly
instantiated (see 22.3, 22.4, and 23.3). If no default value is specified for a
parameter of a class, then the parameter shall be overridden in every
specialization of the class (see 8.24).
class Mem #(type T, int size);
T words[size];
...
endclass
typedef Mem#(byte,
1024) Kbyte;
In 6.20.1, REPLACE
If any param_assignments
appear in a parameter_port_list, then any param_assignments that appear within the
module, interface, program or class shall become local parameters and shall not
be overridden by any method.
WITH
If the declaration of a
design element or class uses any param_assignments appear in a parameter_port_list (even
an empty one),
then any param_assignments
that appear in any parameter_declaration directly
contained within the module, interface, program or class declaration shall become
local parameters and shall not be overridden by any method the parameter keyword shall be a synonym for the localparam keyword (see 6.20.4).