📄 ram_mn_dual.vhd
字号:
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_unsigned.all;
entity RAM_MN_dual is --dual ports ram ,read and write at the same time .
port
( wr_addr :in std_logic_vector(4 downto 0); --write address bus --integer range 0 to 155; --155=m*n-1=13*12-1
re_addr :in std_logic_vector(4 downto 0); --read
CLK :in std_logic; --wr
CH : IN std_logic; -- SELECT signal port
din :in std_logic;
flag:out std_logic:='0'; --read data bus
dout :out std_logic --read data bus
-- wr_en:in std_logic :='0'; --write enable port
--re_en:in std_logic :='0' --read enable port
);
end RAM_MN_dual;
architecture beha of RAM_MN_dual is
subtype ram_word is std_logic ;
signal flag1:std_logic:='0';
type ram_table is array (0 to 29) of ram_word; --255=16x16-1
signal ram: ram_table;
-- signal wr_en,re_en:std_logic;
begin
process(CLK)
begin
if CLK'event and CLK='0' then
if ch='1' then
ram(conv_integer(wr_addr))<=din;
flag1<='0';
dout <= '0'; --06.10.25
else
dout<=ram(conv_integer(re_addr));
flag1<='1';
end if;
end if;
end process;
process(flag1)
begin
if flag1='1' then
flag<='1';
end if;
end process;
end beha;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -