[an error occurred while processing this directive]
|
а он не компилится. Квартусом выдаётся ошибка:
Error: VHDL error at cos_table.vhd(52): object cannot be indexed because it has integer type rather than array type, в строчке где массив индексируется. Что не так?
library ieee,work;
use ieee.std_logic_1164.all;
use ieee.std_logic_arith.all;
--use ieee.std_logic_unsigned.all;
--use ieee.std_logic_signed.all;
use work.pack.all;
entity cos_table is
generic
(
width : INTEGER := 2;
depth : INTEGER := 4
);
port
(
clk : in STD_LOGIC;
reset : in STD_LOGIC;
enable : in STD_LOGIC;
addr_cos, addr_sin : in STD_ULOGIC_VECTOR (log2_ceil(depth)-1 downto 0);
q_cos, q_sin : out STD_LOGIC_VECTOR (width-1 downto 0)
);
end cos_table;
architecture first of cos_table is
type rom_array is array (depth-1 downto 0) of STD_LOGIC_VECTOR (width-1 downto 0);
constant table: rom_array :=
(
0 => CONV_STD_LOGIC_VECTOR(1,width),
1 => CONV_STD_LOGIC_VECTOR(0,width),
2 => CONV_STD_LOGIC_VECTOR(-1,width),
3 => CONV_STD_LOGIC_VECTOR(-2,width)
--others => (others => '0')
);
begin
process (clk, reset, enable, addr_cos, addr_sin)
begin
if (reset = '1') then
q_cos <= (others =>'0');
q_sin <= (others =>'0');
elsif rising_edge(clk) then
if (enable = '1') then
q_cos <= table(CONV_INTEGER(addr_cos));
q_sin <= table(CONV_INTEGER(addr_sin));
end if;
end if;
end process;
end first;
E-mail: info@telesys.ru