ADDRESS_WIDTH’134
produces a syntax error because it is illegal to use a parameter for a numeric literal size like that, and when you use the apostrophe, it must be followed by a base specifier (such as h
for hexadecimal format). Also, the apostrophe character in your question might be a problem depending on how you copy and paste it into an editor.
To pass a numeric literal to a task
, it is not necessary to specify the bit width of the value because that can be accounted for when you declare the task
input. You can declare the input with the desired bit width, then pass the numeric value with just the base specifier, such as 'h134
for a hexadecimal value:
module tb;
parameter ADDRESS_WIDTH = 9;
task Read_mode (input [ADDRESS_WIDTH-1:0] addr);
$displayh(addr);
endtask
initial begin
Read_mode('h134);
Read_mode(134);
Read_mode('hfff);
end
endmodule
Prints:
134
086
1ff
Note that 134
(without the base) is a decimal value, and that values larger that 9 bits ('hfff
) will be forced to 9 bits (1ff
).
Refer to IEEE Std 1800-2017, section 5.7.1 Integer literal constants.