Forum Discussion
Abe
Frequent Contributor
7 years agoYes, @ak6dn is right. All parameters used within a module should be initialized with a default value. Then you can override them when creating instances.
module top
#(
parameter WIDTH = 1
)
(
input wire clock,
input wire [WIDTH-1:0 ] in,
output reg [WIDTH-1:0] out
);
bottom
#(
.WIDTH(WIDTH)
)
bottom_instantiation
(
.clock(clock),
.in(in),
.out(out)
);
endmodulemodule bottom
#(
parameter WIDTH = 1
)
(
input wire clock,
input wire [WIDTH-1:0] in,
output reg [WIDTH-1:0] out // reg is a keyword in Verilog, Do not use it as a signal/variable name.
);
endmodule