shaiko
Advanced Member level 5
Hi,
Suppose we have a VHDL array of 'n' elements and width of each element is 'k'.
How can we convert the array to a vector?
If we know the width and number of elements - we can use the concatenation operator:
-----------------------------------------------------------------------
type matrix is array (0 to 2) of std_logic_vector(7 downto 0);
signal concatenated_matrix: std_logic_vector(23 downto 0);
concatenated_matrix <= matrix(0) & matrix(1) & matrix(2);
-----------------------------------------------------------------------
But what if we want to write genericly ('k' and 'n' will be generics)
How can we code it?
Suppose we have a VHDL array of 'n' elements and width of each element is 'k'.
How can we convert the array to a vector?
If we know the width and number of elements - we can use the concatenation operator:
-----------------------------------------------------------------------
type matrix is array (0 to 2) of std_logic_vector(7 downto 0);
signal concatenated_matrix: std_logic_vector(23 downto 0);
concatenated_matrix <= matrix(0) & matrix(1) & matrix(2);
-----------------------------------------------------------------------
But what if we want to write genericly ('k' and 'n' will be generics)
How can we code it?