📄 microrom_mod.vhd
字号:
-- ************************************************************************-- * NOVAS SOFTWARE CONFIDENTIAL PROPRIETARY NOTE *-- * *-- * This software contains information confidential and proprietary *-- * to Novas Software Inc. It shall not be reproduced in whole *-- * or in part or transferred to other documents, or disclosed *-- * to third parties, or used for any purpose other than that *-- * for which it was obtained, without the prior written consent *-- * of Novas Software Inc. *-- * (c) 1996, 1997, 1998 Novas Software Inc. *-- * All rights reserved *-- * *-- ************************************************************************-- Debussy tutorial case: A simplified microprogramming-based CPU-- file name: microrom.v-- description: This part modelize the mapping rom-- addr: 8-bits address bus-- data: 8-bits data bus-- addr_error: address out of rangelibrary IEEE;use STD.STANDARD.all;use STD.TEXTIO.all;use IEEE.std_logic_1164.all;use work.packageCPU.all;entity rom0 isport ( addr : in std_logic_vector(7 downto 0); dout : out std_logic_vector(21 downto 0); addr_error : out std_logic);end rom0;architecture behav of rom0 is type Mem_Type is array (0 to 2**addr'length-1) of std_logic_vector(dout'range); signal mem : Mem_Type;--- signal addr_i : integer :=0;begin microrom0: process (addr) FILE instuff : TEXT is IN "./vhdl/memory/microrom.dat"; variable Initialization : boolean := true; variable InLine : line; variable memaddr : integer := 0; variable Word : bit_vector(dout'range); begin if Initialization then File_Read : while not Endfile(instuff) loop ReadLine(instuff, InLine); next File_Read when InLine'length = 0; -- empty line read(InLine,Word); mem(memaddr) <= To_StdLogicVector(Word); memaddr := memaddr + 1; end loop File_Read; Initialization := false; end if; dout <= mem(to_natural(addr)); if ((to_natural(addr) > 255) or (to_natural(addr) < 0)) then addr_error <= '1'; else addr_error <= '0'; end if; end process microrom0;end behav;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -