Hallo allerseits,
für ein Projekt benötige ich einen true dual port asynchronous ram. Da
das ganze auf verschiedenen Plattformen (Xilinx, Altera, Lattice) laufen
soll, muss der RAM-Block über Inferenz vom Synthesetool erzeugt werden.
folgenden VHDL-Code habe ich dazu genutzt:
1 | --
|
2 | -- Dual-Port Block RAM with Two Write Ports
|
3 | --
|
4 |
|
5 | library IEEE;
|
6 | use IEEE.std_logic_1164.all;
|
7 | use IEEE.std_logic_unsigned.all;
|
8 |
|
9 | entity TDPR is
|
10 | generic( width : natural := 16;
|
11 | depth : natural := 6);
|
12 |
|
13 | port ( clka : in std_logic;
|
14 | clkb : in std_logic;
|
15 | ena : in std_logic;
|
16 | enb : in std_logic;
|
17 | wea : in std_logic;
|
18 | web : in std_logic;
|
19 | rsta : in std_logic;
|
20 | rstb : in std_logic;
|
21 | addra : in std_logic_vector(depth-1 downto 0);
|
22 | addrb : in std_logic_vector(depth-1 downto 0);
|
23 | dia : in std_logic_vector(width-1 downto 0);
|
24 | dib : in std_logic_vector(width-1 downto 0);
|
25 | doa : out std_logic_vector(width-1 downto 0);
|
26 | dob : out std_logic_vector(width-1 downto 0));
|
27 | end TDPR;
|
28 |
|
29 | architecture syn of TDPR is
|
30 | type ram_type is array ((2**depth)-1 downto 0) of std_logic_vector(width-1 downto 0);
|
31 | shared variable RAM : ram_type;
|
32 | begin
|
33 | process(CLKA)
|
34 | begin
|
35 | if CLKA'event and CLKA = '1' then
|
36 | if ENA = '1' then
|
37 | if WEA = '1' then
|
38 | RAM(conv_integer(ADDRA)) := DIA;
|
39 | end if;
|
40 | if rsta = '1' then -- optional reset
|
41 | doa <= (others => '0');
|
42 | else
|
43 | doa <= ram(conv_integer(addra)) ;
|
44 | end if;
|
45 | end if;
|
46 | end if;
|
47 | end process;
|
48 |
|
49 | process (CLKB)
|
50 | begin
|
51 | if CLKB'event and CLKB = '1' then
|
52 | if ENB = '1' then
|
53 | if WEB = '1' then
|
54 | RAM(conv_integer(ADDRB)) := DIB;
|
55 | end if;
|
56 | if rstb = '1' then -- optional reset
|
57 | dob <= (others => '0');
|
58 | else
|
59 | dob <= ram(conv_integer(addrb)) ;
|
60 | end if;
|
61 | end if;
|
62 | end if;
|
63 | end process;
|
64 | end syn;
|
Das ganze wird von Xilinx ISE auch wie gewünscht umgesetzt. Quartus
hingegen spuckt mir die Fehlermeldung "Error: Cannot synthesize
dual-port RAM logic "TDPR:inst|RAM"" mit einem internal Error aus,
scheinbar kann Quartus die shared variable RAM nicht korrekt umsetzen.
Hat jemand damit schon Erfahrungen? Gibt es vllt ne andere Möglichkeit
den RAM-Block zu beschreiben?
mit besten Grüßen, exor