我正在嘗試實現一個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 –