fcfusion
Full Member level 4
Hello everyone
I have a question regarding constant assigments with parameterized bit width. For example, i want to initialize a register with a constant value 10 . If i wish to use a fixed bit width all I have to do is:
reg [7:0] whatever;
always @(posedge)
begin
whatever <= 8'd10;
end
Now, if I want to define the registers with different bit widths, according to my needs I can simply do:
parameter Nbits = 16;
reg [Nbits-1:0] whatever;
However I do not know how to assign the value to the register, because of the " 8'd " expression.
whatever <= 8'd10; //???????
How can I subsitute this expression for something that can be easily changed through parameters without resulting in synthesis warnings?
Thank you
I have a question regarding constant assigments with parameterized bit width. For example, i want to initialize a register with a constant value 10 . If i wish to use a fixed bit width all I have to do is:
reg [7:0] whatever;
always @(posedge)
begin
whatever <= 8'd10;
end
Now, if I want to define the registers with different bit widths, according to my needs I can simply do:
parameter Nbits = 16;
reg [Nbits-1:0] whatever;
However I do not know how to assign the value to the register, because of the " 8'd " expression.
whatever <= 8'd10; //???????
How can I subsitute this expression for something that can be easily changed through parameters without resulting in synthesis warnings?
Thank you