goodpranoy
Junior Member level 3
- Joined
- Dec 5, 2013
- Messages
- 29
- Helped
- 0
- Reputation
- 0
- Reaction score
- 0
- Trophy points
- 1
- Activity points
- 201
Code:
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_unsigned.all;
entity ram_ent is
port(addr:in std_logic_vector(3 downto 0);
addr_in:in std_logic_vector(3 downto 0);
data_in:in std_logic_vector(7 downto 0);
ram_write:in std_logic;
enter:in std_logic;
clock:in std_logic;
ram_enable:in std_logic;
dout:out std_logic_vector(7 downto 0));
end ram_ent;
architecture ram_arch of ram_ent is
type ram_arr is array(0 to 15)of std_logic_vector(7 downto 0);
signal tmp_ram:ram_arr;
begin
process(clock,ram_enable,ram_write,enter)
begin
if ram_enable='1' and ram_write='0' then
if (clock'event and clock='1') then
dout<=tmp_ram(conv_integer(addr));
end if;
elsif ram_enable='1' and ram_write='1' then
if (clock'event and clock='1') then
if rising_edge(enter) then
tmp_ram(conv_integer(addr_in))<=data_in;
end if;
end if;
end if;
end process;
end ram_arch;
i wanted the data to be written to the ram only when there is a rising edge from the enter pin.( i've planned to use a push button ).
but when i simulated in modelsim, then it is not working as planned.
can anyone please tell me what is wrong in the program and also how to correct it.
thanks in advance.