I would like to create a parametric bit-width assignment in Verilog.
Something like the following code:
module COUNTER
(
CLEAR,
CLK,
CODE)
#(parameter BUS_WIDTH = 8)
reg [BUS_WIDTH-1:0] CODE;
always @(posedge CLK or posedge CLEAR)
begin
if(CLEAR)
begin
CODE <= BUS_WIDTH'b{BUS_WIDTH{0}};
CODEreg <= BUS_WIDTH'b{BUS_WIDTH{0}};
end
...
What is the right way for it to be synthesizable?