2013-09-01 72 views
0

在Isim波形窗口中,我的內部信號和輸出顯示爲綠色且已初始化,但所有輸入均顯示爲「UU」,即使它們已初始化也是如此。我只是試圖在兩個輸入中的任何一個都是1時加1。代碼合成很好,沒有警告。 任何想法?Isim Wave窗口中的VHDL編碼

library IEEE; 
use IEEE.STD_LOGIC_1164.ALL; 
use ieee.numeric_std.all; 

entity scoreboard2 is 
    Port (clk : in STD_LOGIC; 
      T1 : in STD_LOGIC; 
      T2 : in STD_LOGIC; 
      Output : out STD_LOGIC_VECTOR (3 downto 0)); 
end scoreboard2; 

architecture Behavioral of scoreboard2 is 
signal output_temp: STD_LOGIC_VECTOR(3 downto 0) := "0000"; 
signal score1,score2: unsigned(1 downto 0) := "00"; 
signal score3: unsigned(3 downto 0):= "0000"; 

begin 
    proc: process(T1,T2,clk) 
    begin 
     if(rising_edge(clk)) then 
      if(T1 = '1') then 
       score1 <= score1 + 1; 
      end if; 
      if(T2 = '1') then 
       score2 <= score2 + 1; 
      end if; 
     end if; 
    end process proc; 

score3 <= score1 & score2; 
output_temp <= STD_LOGIC_VECTOR(score3); 
Output <= output_temp; 

end Behavioral; 



LIBRARY ieee; 
USE ieee.std_logic_1164.ALL; 
USE ieee.numeric_std.ALL; 


ENTITY test6 IS 
END test6; 

ARCHITECTURE behavior OF test6 IS 

    COMPONENT scoreboard2 
    PORT(
     clk : IN std_logic; 
     T1 : IN std_logic; 
     T2 : IN std_logic; 
     Output : OUT std_logic_vector(3 downto 0) 
     ); 
    END COMPONENT; 


    --Inputs 
    signal clk : std_logic := '1'; 
    signal T1 : std_logic := '1'; 
    signal T2 : std_logic := '1'; 

    --Outputs 
    signal Output : std_logic_vector(3 downto 0) := "0000"; 
    signal output_temp: STD_LOGIC_VECTOR(3 downto 0) := "0000"; 
    signal score1,score2: unsigned(1 downto 0) := "00"; 
    signal score3: unsigned(3 downto 0):= "0000"; 

    constant clk_period : time := 10 ns; 

BEGIN 

    uut: scoreboard2 PORT MAP (
      clk => clk, 
      T1 => T1, 
      T2 => T2, 
      Output => Output 
     ); 

    clk_process :process 
    begin 
     clk <= '0'; 
     wait for clk_period/2; 
     clk <= '1'; 
     wait for clk_period/2; 
    end process; 


    stim_proc: process 
    begin   
     wait for 100 ns; 
     T1 <= '1'; 
     wait; 
    end process; 

END; 
+1

您是模擬「test6」(測試臺)而不是「scoreboard2」(UUT),對不對?並檢查test6中的「uut」是否指向scoreboard2。這樣做,您的問題在ISIM 14.3中不存在。 –

回答

0

我沒有Isim,但有些模擬器允許您運行一個具有未連接輸入端口的頂層設計。它通常與進行交互式模擬(運行,停止,步驟,強制輸入等)的能力是同義的。

ise_tutorial_ug695.pdf的第5章,2011年3月1日(v13.1)說你需要一個測試平臺,我沒有所有文檔來確定它是否被強制執行。

對於測試平臺:

library ieee; 
use ieee.std_logic_1164.all; 

entity scoreboard_tb is 
end entity; 

architecture test of scoreboard_tb is 
    signal clk:  std_logic := '0'; 
    signal T1:  std_logic := '0'; 
    signal T2:  std_logic := '0'; 
    signal RESULT: std_logic_vector(3 downto 0); 
begin 

UNDER_TEST: 
    entity work.scoreboard2 
     port map (
      clk => clk, 
      T1 => T1, 
      T2 => T2, 
      Output => RESULT 
     ); 
CLOCK: 
    process 
    begin 
     if Now > 340 ns then  -- simulation stops with no signal events 
      wait; 
     end if; 
     clk <= not clk; 
     wait for 20 ns;  
    end process; 
STIMULUS: 
    process 
    begin 
     wait for 40 ns; 
     T1 <= '1'; 
     wait for 40 ns; 
     T2 <= '1'; 
     wait for 40 ns; 
     T1 <= '0'; 
     T2 <= '0'; 
     wait for 40 ns; 
     T2 <= '1'; 
     wait for 40 ns; 
     T2 <= '0'; 
     T1 <= '1'; 
     wait for 40 ns; 
     T1 <= '0'; 
     wait; 

    end process; 

end architecture; 

ghdl生產:

enter image description here

爲你scoreboard2實體/架構對分析不變。

+0

他已經有了一個測試平臺,看起來不錯(如果不是很徹底)。我的猜測是簡單地模擬UUT而不是TB(因爲TB沒有輸入)。通過點擊錯誤的地方輕鬆完成! –

-1

我沒有Isim。軟件本身可能不適用。如果在Isim中有波形編輯器或類似的東西,請使用它來代替測試臺。然後再次模擬您的項目。希望這有助於:)