adamira
Newbie
Hi,
VHDL has a powerful feature called attributes. Using attribute I can generalize modules quite easily, for example:
The counter in this module get its size using an attribute, and match its size to the "CountTo" input size. More importantly "CountTo" input can be any size...
I couldn't find an equivalent Verilog syntax. Not to the counter size being generic and not to the input being generic.
Passing a parameter is not the solution I am looking for because in complicated blocks there might be dozens of attributes and I don't want to pass too many parameters or create dozens of local parameters...
Are you familiar with an equivalent Verilog syntax?
Thanks
VHDL has a powerful feature called attributes. Using attribute I can generalize modules quite easily, for example:
Code:
entity alaram is
port(
clk : in std_logic;
reset : in std_logic;
CountTo : in std_logic_vector;
CountEn : in std_logic;
Done : out std_logic);
end alaram ;
architecture arch of alaram is
signal counter : std_logic_vector(CountTo'range);
begin
process(clk) begin
if (reset='1') then
counter <= (others => '0');
Done <= '0';
elsif (rising_edge(clk)) then
if (CountEn='1') then
if (counter = CountTo) then
Done <= '1';
counter <= (others => '0');
else
Done <= '0';
counter <= counter + '1';
end if;
end if;
end if;
end process;
end arch;
The counter in this module get its size using an attribute, and match its size to the "CountTo" input size. More importantly "CountTo" input can be any size...
I couldn't find an equivalent Verilog syntax. Not to the counter size being generic and not to the input being generic.
Passing a parameter is not the solution I am looking for because in complicated blocks there might be dozens of attributes and I don't want to pass too many parameters or create dozens of local parameters...
Are you familiar with an equivalent Verilog syntax?
Thanks