|
发表于 2004-9-12 22:53:47
|
显示全部楼层
数据线的分时复用问题?
library ieee;
use ieee.std_logic_1164.all;
use ieee.numeric_std.all;
use ieee.std_logic_unsigned.all;
entity sram is
port(ncs2,noe,nwe :in std_logic;
fiq ut std_logic;
d :inout std_logic_vector(15 downto 0);
add );
end sram;
architecture a of sram is
signal address: std_logic_vector(1 downto 0);
begin
address(0) <= add(2);
address(1) <=add(3);
hpi_sync <= '0';
hclk <= '0';
fiq<='1';
process(add, ncs2, noe, nwe) is
type ram_array is array (0 to 2) of std_logic_vector(15 downto 0);
variable mem : ram_array;
begin
d <= (others =>'Z');
if ncs2 = '0' then
if noe = '0' then
d <= mem(to_integer(unsigned(address)));
elsif rising_edge(nwe) then
mem(to_integer(unsigned(address))) := d;
end if;
end if;
end process;
end a; |
|