- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
hi every body
can i declare a 2D array as following ?type dataout is array (6 downto 0,11 downto 0) of std_logic_vector(7 downto 0);
i guess this is a 3D array not 2D. so how i can have a 2d array of std_logic_vector? thank u
Link Copied
3 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
For a 2D array just have one range in the brackets, instead of two.
type dataout is array (6 downto 0) of std_logic_vector(7 downto 0);
This will result in an array of 7 std_logic_vectors of range 7 downto 0.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
--- Quote Start --- For a 2D array just have one range in the brackets, instead of two.
type dataout is array (6 downto 0) of std_logic_vector(7 downto 0);
--- 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 bits
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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 ...
........

Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page