这个程序请懂的高手给我讲下原理好吗?
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_arith.all;
use ieee.std_logic_unsigned.all;
entity sram is
generic(width:integer:=8;
depth:integer:=8;
adder:integer:=3);
port(datain:in std_logic_vector(width-1 downto 0);
dataout
ut std_logic_vector(width-1 downto 0);
clock:in std_logic;
we,re:in std_logic;
wadd:in std_logic_vector(adder-1 downto 0);
radd:in std_logic_vector(adder-1 downto 0));
end sram;
architecture art of sram is
type men is array(0 to depth-1)of
std_logic_vector(width-1 downto 0);
signal ramtmp:men;
begin
process(clock)
begin
if(clock'event and clock='1')then
if(we='1')then
ramtmp(conv_integer(wadd))<=datain;
end if;
end if;
end process;
process(clock)
begin
if(clock'event and clock='1')then
if(re='1')then
dataout<=ramtmp(conv_integer(radd));
end if;
end if;
end process;
end art;