Robin Khosla
Member level 4
- Joined
- Aug 2, 2012
- Messages
- 76
- Helped
- 7
- Reputation
- 14
- Reaction score
- 6
- Trophy points
- 1,298
- Activity points
- 1,861
i want to make a ram in which data is written in one frequency CLKA and read fom RAM in some other frequency CLKB...
but i am getting error of multiple driver on we signal in the following code....
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_unsigned.all;
entity ram is
port (CLKA,CLKB : in std_logic;
DI : in std_logic_vector(15 downto 0);
DO : out std_logic_vector(15 downto 0));
end ram;
architecture ram2 of ram is
type ram_type is array (63 downto 0) of std_logic_vector (15 downto 0);
signal RAM : ram_type;
signal WE : std_logic;
signal AW,AR : std_logic_vector(5 downto 0);
begin
process (CLKA,WE)
begin
if (WE = '0') then
if (CLKA'event and CLKA = '1') then
if (AW="111111") then
AW <="000000";
WE <= '1';
else
RAM(conv_integer(AW)) <= DI;
AW <= AW + "000001";
end if;
end if;
end if;
end process;
process (CLKB,WE)
begin
if (WE = '1') then
if (CLKB'event and CLKB = '1') then
if (AR="111111") then
AR <="000000";
WE <= '0';
else
DO <= RAM(conv_integer(AR));
AR <= AR + "000001";
end if;
end if;
end if;
end process;
end ram2;
if i make another process as shown below for WE in the above code, then code goes on synthesis for days and never ends (i think it goes in infinite loop)
process(clk)
begin
if aw ="111111" then WE <='1'
elsif ar="111111" then WE <= '0';
end if;
end process;
can anyone solve this issue????
but i am getting error of multiple driver on we signal in the following code....
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_unsigned.all;
entity ram is
port (CLKA,CLKB : in std_logic;
DI : in std_logic_vector(15 downto 0);
DO : out std_logic_vector(15 downto 0));
end ram;
architecture ram2 of ram is
type ram_type is array (63 downto 0) of std_logic_vector (15 downto 0);
signal RAM : ram_type;
signal WE : std_logic;
signal AW,AR : std_logic_vector(5 downto 0);
begin
process (CLKA,WE)
begin
if (WE = '0') then
if (CLKA'event and CLKA = '1') then
if (AW="111111") then
AW <="000000";
WE <= '1';
else
RAM(conv_integer(AW)) <= DI;
AW <= AW + "000001";
end if;
end if;
end if;
end process;
process (CLKB,WE)
begin
if (WE = '1') then
if (CLKB'event and CLKB = '1') then
if (AR="111111") then
AR <="000000";
WE <= '0';
else
DO <= RAM(conv_integer(AR));
AR <= AR + "000001";
end if;
end if;
end if;
end process;
end ram2;
if i make another process as shown below for WE in the above code, then code goes on synthesis for days and never ends (i think it goes in infinite loop)
process(clk)
begin
if aw ="111111" then WE <='1'
elsif ar="111111" then WE <= '0';
end if;
end process;
can anyone solve this issue????