ram.vhd
来自「一个8位微处理器的VHDL代码以及testbench」· VHDL 代码 · 共 29 行
VHD
29 行
library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_arith.all;entity ram is port(clk :in std_logic; write_data: in std_logic_vector(7 downto 0); address: in std_logic_vector(4 downto 0); read_data: out std_logic_vector(7 downto 0); we: in std_logic);end entity ram;architecture ram of ram istype mem_type is array (0 to 31) of std_logic_vector(7 downto 0);signal mem: mem_type;begin read_data <= mem(conv_integer(unsigned(address))); process(clk) begin if(clk'event and clk = '1') then if (we = '1') then mem(conv_integer(unsigned(address))) <= write_data; end if; end if; end process;end architecture ram;
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?