Altera_Forum
Honored Contributor
12 years agoArrays of arrays: How to assign them to instances of components?
Hi,
Could you please help me (= still a beginner, started with VHDL a few months ago :-) ) with the following problem?: I have to use, lets say, two arrays of 48 RAMs (= arrays of integer) containing 128 words of 10-bit-integer each, and i have to give always one of each such RAMs to one of 48 instances of a VHDL-component. After i figured out that i have to use packages for that, in my main VHDL program there is now: ------------------------------------------------------------------------- architecture BEHAVIOR of blubb is type RAM_integer_array is array (0 to 127) of integer range 0 to 1023; type RAM_total_array is array (1 to 48) of RAM_integer_array; signal RAM1 : RAM_total_array; signal RAM2 : RAM_total_array; component bla is port ( sub_RAM1 : in sub_RAM_integer_array; sub_RAM2 : in sub_RAM_integer_array; ); end component; begin # bla01 : bla port map ( sub_RAM1 => RAM1(01), sub_RAM2 => RAM2(01) );# bla02 : bla port map ( sub_RAM1 => RAM1(02), sub_RAM2 => RAM2(02) );# bla03 : bla port map ( sub_RAM1 => RAM1(03), sub_RAM2 => RAM2(03) ); (... 48 times...) ------------------------------------------------------------------------- and in my component bla there is: ------------------------------------------------------------------------- library ieee; use ieee.std_logic_1164.all; package my_packages is type sub_RAM_integer_array is array (0 to 127) of integer range 0 to 1023; end my_packages; library ieee; use ieee.std_logic_1164.all; use ieee.numeric_std.all; library altera_mf; use altera_mf.altera_mf_components.all; use work.my_packages.all; entity bla is port ( sub_RAM1 : in sub_RAM_integer_array; sub_RAM2 : in sub_RAM_integer_array; ); end; ------------------------------------------------------------------------- Now I get the following error message at the lines marked with "#": Error (10381): VHDL Type Mismatch error at blubb.vhd(1538): indexed name returns a value whose type does not match "sub_RAM_integer_array", the type of the target expression File: blubb.vhd Line: 1538 But i think that sub_RAM1 and RAM1(01) ARE the same data type; because when i say the following in blubb: RAM1(01) <= (0,0,0,0,0,0,(...128x...),0,0,0,0,0,0,0,0); sub_RAM1 <= (0,0,0,0,0,0,(...128x...),0,0,0,0,0,0,0,0); the data is assigned without an error, and when i assign in the port map to the subroutine: sub_RAM1 => (0,0,0,0,0,0,(...128x...),0,0,0,0,0,0,0,0); instead of sub_RAM1 => RAM1(01) (and the same with all other RAMs), the compiler gives no error too. So... how can i assign arrays of arrays to selfmade components? :-) Thanks a lot in advance, best regards :-)