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