⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 raw.vhd

📁 MODELSIM开发的模拟CPU
💻 VHD
字号:
package commonConstants is	constant wordSize: integer := 32;	constant adrLength: integer := 32;end package commonConstants;library IEEE;use IEEE.std_logic_1164.all;use IEEE.std_logic_arith.all;use work.commonConstants.all;entity ram is port (        reset, en, r_w: in STD_LOGIC;        aBus: in STD_LOGIC_VECTOR(adrLength-1 downto 0);        dBus: inout STD_LOGIC_VECTOR(wordSize-1 downto 0));end ram;architecture ramArch of ram isconstant resAdrLength: integer := 6; -- address length restricted within architectureconstant memSize: integer := 2**resAdrLength;type ram_typ is array(0 to memSize-1) of STD_LOGIC_VECTOR(wordSize-1 downto 0);signal ram: ram_typ;begin	process(reset, en, r_w, aBus, dBus) begin	  	if reset = '1' then		      	-- basic instruction check	        	  ram(0)  <= x"10000001"; -- immediate load				        ram(1) <= x"a0000000"; -- add		        ram(2) <= x"40000003"; -- brZero		      		        ram(4) <= x"00000000"; -- halt		elsif en = '1' and r_w = '0' then	  		ram(conv_integer(unsigned(aBus(resAdrLength-1 downto 0)))) <= dBus;		end if;	end process;	dBus <= ram(conv_integer(unsigned(aBus(resAdrLength-1 downto 0))))  			when reset = '0' and en = '1' and r_w = '1' else			(dbus'range => 'Z');end ramArch;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -