Reputation: 11
I was trying to generalize a module that had the parameter "int max=15". Is there some way to set an output of the module to the value of the parameter. For example, if the parameter max was set to the value 8, zout would be set to the value of 4'b1000.
module example
#(parameter int max=15,
parameter int bw=$clog2(m))
(input logic ............,
.........................,
output logic [b-1:0] zout);
assign zout = [value of max];
Upvotes: 1
Views: 653
Reputation: 911
You can directly assign it:
module example #(
parameter int max=15,
parameter int b=$clog2(max+1)
) (
output logic [b-1:0] zout
);
assign zout = max[b-1:0];
endmodule
Upvotes: 1