我正在尝试实现一个ROM模块并为其构建测试平台。 rom.vhd的检查语法显示'正确',它也显示'正确'的测试平台文件,但是当我点击simluate时会显示一些错误。在xilinx(vhdl)中实现ROM
以下是显示的代码和错误。
LIBRARY ieee ;
USE ieee.std_logic_1164.all ;
----------------
entity rom is
port (clk : in std_logic ;
address : in integer range 0 to 15 ;
data_out : out std_logic_vector(7 downto 0)) ;
end entity ;
------------------
architecture arch of rom is
signal reg_address : integer range 0 to 15 ;
type memory is array (0 to 15) of std_logic_vector(7 downto 0) ;
constant myrom : memory := (
2 => "11111111" , --255
3 => "11010101" ,
4 => "01101000" ,
6 => "10011011" ,
8 => "01101101" ,
9 => "00110111" ,
others => "00000000") ;
begin
process(clk)
begin
if(clk'event and clk = '1') then
reg_address <= address ;
end if ;
end process ;
---------------
data_out <= myrom(reg_address) ;
end architecture ;
测试台的文件:
LIBRARY ieee ;
USE ieee.std_logic_1164.all ;
----------------
entity rom_tb is
end entity ;
-----------------------
architecture tb of rom_tb is
component rom is
port (clk : in std_logic ;
address : in integer range 0 to 15 ;
data_out : out std_logic_vector(7 downto 0)) ;
end component ;
--------------------------
signal clk_tb : std_logic := '0' ;
signal address_tb : integer := 0 ;
signal data_out_tb : std_logic_vector(7 downto 0) ;
--------------------------
begin
dut : rom port map (
clk => clk_tb ,
address => address_tb ,
data_out => data_out_tb) ;
------------------
clk_tb <= not clk_tb after 20ns ;
address_tb <= 1 after 30ns ,
2 after 60ns ,
3 after 90ns ,
4 after 120ns ,
5 after 150ns ,
6 after 180ns ,
7 after 210ns ,
8 after 240ns ,
9 after 270ns ,
10 after 300ns ,
11 after 330ns ,
12 after 360ns ,
13 after 390ns ,
14 after 420ns ,
15 after 450ns ;
end architecture ;
错误是:
ERROR:模拟器:29 - 在时间0 ns:在rom_tb(TB),文件 d:/ VHDLPrograms/TB/ROM /rom_tb.vhd:实体ROM的默认端口映射到 组件ROM将组件的INTEGER类型本地端口地址连接到实体的std_logic_vector类型端口 。
我刚刚使用ISE 14.4和ISim构建了新Xilinx项目中的代码,我无法重新创建您的问题。 –
意味着它正在工作。你是否得到了输出。 – AbKDs
http://i.stack.imgur.com/Q7MhE.png –