📄 ram_16_8.vhd
字号:
library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;entity ram_16_8 isport(ad:in std_logic_vector(7 downto 0); clk:in std_logic; di:in std_logic_vector(7 downto 0); do:out std_logic_vector(7 downto 0); wr_en:in std_logic:='0'; rd_en:in std_logic:='0'); end ram_16_8;architecture rtl of ram_16_8 is subtype ram_word is std_logic_vector(7 downto 0); type ram_table is array(0 to 15) of ram_word; signal ram:ram_table:=ram_table'( ram_word'("00000000"), ram_word'("00000000"), ram_word'("00000000"), ram_word'("00000000"), ram_word'("00000000"), ram_word'("00000000"), ram_word'("00000000"), ram_word'("00000000"), ram_word'("00000000"), ram_word'("00000000"), ram_word'("00000000"), ram_word'("00000000"), ram_word'("00000000"), ram_word'("00000000"), ram_word'("00000000"), ram_word'("00000000")); begin process(clk) begin if clk'event and clk='1' then if rd_en='1' then do<=ram(conv_integer(ad)); end if; if wr_en='1' then ram(conv_integer(ad))<=di; end if; end if; end process; end rtl;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -