In VHDL we can constrain the length of an std_logic_vector in port map as follows:
entity fdct_coeff_rom is
generic (
data_len : integer range 1 to 8
);
port (
i_clk : in std_logic;
i_rst_n : in std_logic;
i_data : in std_logic_vector(data_len-1 downto 0);
i_we : in std_logic;
i_re : in std_logic;
o_data : out std_logic_vector(data_len-1 downto 0)
);
I have an array of std_logic_vectors in the port map. The ports are 8 std_logic_vectors, the length of which can change. Now I am not sure how to use generic to change the length of each std_logic_vector. Is this possible?
entity fdct_coeff_rom is
generic (
data_len : integer range 1 to 8
);
port (
i_clk : in std_logic;
i_rst_n : in std_logic;
i_data : in data_arr_t; -- 8 std_logic_vector, each data_len-1 downto 0
i_we : in std_logic;
i_re : in std_logic;
o_data : out data_arr_t -- 8 std_logic_vector, each data_len-1 downto 0
);
The data_arry_t is defined in a package as an array of std_logic_vector. I am not sure how I can specify the size of the std_logic_vector using a generic such that, each instance of the module has a different length of the std_logic_vector.
Please note that the module I am dealing with is complex, the example in this question is just to illustrate what I am trying to do.
Now, if this is not at all possible in VHDL, can this be done in SystemVerilog?