[an error occurred while processing this directive]
|
почему квартус не хочет память встроенную для rom использовать(мультиплексоры генерит)? Разумеется могу мегафункцию altsyncram использовать, но не для того AHDL бросаю.
library ieee,work;
use ieee.std_logic_1164.all;
use ieee.numeric_std.all;
use work.pack.all;
entity rom is
generic
(
width : INTEGER := 8;
depth : INTEGER := 64
);
port
(
clk : in STD_LOGIC;
reset : in STD_LOGIC;
enable : in STD_LOGIC;
addr : in STD_LOGIC_VECTOR (log2_ceil(depth)-1 downto 0);
q : out STD_LOGIC_VECTOR (width-1 downto 0)
);
end rom;
architecture first of rom is
constant width_addr : INTEGER := log2_ceil(depth);
type rom_array is array (depth-1 downto 0) of integer range 0 to 2**width-1;
constant table : rom_array :=
(
0 => 0,
1 => 128,
2 => 1,
3 => 250,
4 => 2,
5 => 29,
6 => 240,
7 => 28,
8 => 4,
9 => 27,
10 => 5,
11 => 26,
12 => 6,
13 => 25,
14 => 7,
15 => 24,
16 => 8,
17 => 23,
18 => 30,
19 => 22,
20 => 20,
21 => 21,
22 => 22,
23 => 23,
24 => 24,
25 => 25,
26 => 26,
27 => 27,
28 => 28,
29 => 29,
30 => 30,
31 => 31,
32 => 222,
33 => 223,
34 => 24,
35 => 25,
36 => 26,
37 => 27,
38 => 100,
39 => 200,
63 => 211,
others => 255
);
signal addr_reg : STD_LOGIC_VECTOR (width_addr-1 downto 0);
begin
process (clk, reset, enable, addr)
begin
if (reset = '1') then
q <= (others =>'0');
addr_reg <= (others =>'0');
elsif rising_edge(clk) then
if (enable = '1') then
addr_reg <= addr;
q <= STD_LOGIC_VECTOR(TO_UNSIGNED(table(TO_INTEGER(UNSIGNED(addr_reg))),width));
end if;
end if;
end process;
end first;
E-mail: info@telesys.ru