Forum Discussion
3 Replies
- Altera_Forum
Honored Contributor
For a 2D array just have one range in the brackets, instead of two.
This will result in an array of 7 std_logic_vectors of range 7 downto 0.type dataout is array (6 downto 0) of std_logic_vector(7 downto 0); - Altera_Forum
Honored Contributor
--- Quote Start --- For a 2D array just have one range in the brackets, instead of two.
--- Quote End --- Nope, thats not a 2d array, thats a 1d array of 1d array. So you access it like this: output <= dout(x). A 2d array is declared like the OP posted. He made a 2d array of 1d arrays. You would access it like this: output <= dout(x,y); --and then add 2nd set of brackets to get individual bitstype dataout is array (6 downto 0) of std_logic_vector(7 downto 0); - Altera_Forum
Honored Contributor
thanks a lot my friend!
--- Quote Start --- Nope, thats not a 2d array, thats a 1d array of 1d array. So you access it like this: output <= dout(x). A 2d array is declared like the OP posted. He made a 2d array of 1d arrays. You would access it like this: output <= dout(x,y); --and then add 2nd set of brackets to get individual bits --- Quote End --- i wanna initialize this vector, i have a 2d matrix of std_logic_vector can i write like this:constant d : dataout :=( -- Content -- Address(i,j) "00111100", -- 0,0 "11110000" --0,1 "01100010" --0,2 "01100010" --0,3 ... "01100010", -- 1,0 "10011000", --1,1 "10111000" --1,2 "00111000" --1,3 ... "00111100", -- 2,0 "11110000" --2,1 "01100010" --2,2 "01100010" --2,3 ... ........