C
Charles Gardiner
Guest
Hi,
from the LRM , I see that verilog functions can have parameters. Can I
use such a parameter to specify a variable length vector as input parameter.
e.g. something like
function [MSB:0] whatever
(input [MSB:0] vval);
parameter MSB = 15;
begin
. . . .
end
endfunction
How would I call this from a module body? I don't see a single example
in the LRM.
What I am looking for is a way to write a generic function that I can
use on different vector widths. In VHDL I would just specify a
std_logic_vector as input parameter and use 'length, 'left, 'right etc.
to make it reusable for different vector widths
Thanks for any info,
Charles
from the LRM , I see that verilog functions can have parameters. Can I
use such a parameter to specify a variable length vector as input parameter.
e.g. something like
function [MSB:0] whatever
(input [MSB:0] vval);
parameter MSB = 15;
begin
. . . .
end
endfunction
How would I call this from a module body? I don't see a single example
in the LRM.
What I am looking for is a way to write a generic function that I can
use on different vector widths. In VHDL I would just specify a
std_logic_vector as input parameter and use 'length, 'left, 'right etc.
to make it reusable for different vector widths
Thanks for any info,
Charles