Altera_Forum
Honored Contributor
14 years agoHow to write a 88bit*4096 ram in VHDL?
Hi everyone,
I am trying to write a 88bit*4096 RAM all in VHDL. I defined an array as RAM and use package to initialize it. But there is an error when I compile it saying that *Error: Cannot convert all sets of registers into RAM megafunctions when creating nodes. The resulting number of registers remaining in design exceeds the number of registers in the device* Can anybody shed some light on how to fix the error? Thanks. Following is my VHDL code. /* RAM */ library IEEE; use IEEE.STD_LOGIC_1164.ALL; use IEEE.STD_LOGIC_UNSIGNED.ALL; library work; use work.pack.all; entity RAM_test is port( clk : in std_logic; addr :in std_logic_vector(11 downto 0); cs : in std_logic; oe : in std_logic; data_i: in std_logic_vector(87 downto 0); data_o: out std_logic_vector(87 downto 0) ); end RAM_test; architecture Behavioral of RAM_test is signal ram1 : RamType := MEM_INIT; begin process(clk) begin if(clk'event and clk = '1') then if(cs = '0') then if(oe = '0') then data_o <= ram1(conv_integer(addr)); else ram1(conv_integer(addr)) <= data_i; end if; end if; end if; end process; end Behavioral; /*Package*/ library IEEE; use IEEE.STD_LOGIC_1164.ALL; package pack is type RamType is array (0 to 4095) of std_logic_vector(87 downto 0); constant MEM_INIT : RamType := ( /*content of RAM*/ ); end package pack;