Altera_Forum
Honored Contributor
12 years agoarray slice, type mismatch
I have a 1D-array of std_logic_vector, with 9 elements. I have another 2D array of std_logic_vector, 2x7 elements. I want to take a slice of the 9 element 1D array, and put it in the 2D array. I need elements 1-7 and want to put it in (1,1 to 7) and then elements 3-9 and put it in (2,1 to 7).
I get the following error: Target type arr12 in signal assignment is different from expression type arr11. If I the declare arr13 as type arr11 it does not complain, but I only want a 7 element 2D array not 9. _______________________________________________________________ type arr11 is array (1 to 9) of std_logic_vector(11 downto 0); type arr12 is array (1 to 7) of std_logic_vector(11 downto 0); type arr13 is array (1 to 2) of arr12; signal datain : arr11; signal dataout: arr13; process(s_clk) begin for jj in 1 to 2 loop if (s_clk'event and s_clk='1') then s_dataout(jj)(1 to 7) <= s_datain(1 to 7); end if; end loop;