2016-10-10 59 views
-3

我一直在實驗室的作業,幾乎是完整的,但我遇到了一個問題,我合成時我沒有看到的輸出。我有7塊,單獨測試時顯示正確的輸出。在使用頂級模塊和測試平臺文件時,我怎麼會得不到任何輸出?以下是我的頂級模塊,其次是我的測試臺,因爲我懷疑問題可能在那裏。我已經看過它,不能指出我可能做錯的任何事情。任何幫助,將不勝感激。爲什麼我綜合時沒有看到輸出?

library IEEE; 
use IEEE.STD_LOGIC_1164.ALL; 

entity top_module is port(
    x,y : in std_logic_vector(7 downto 0); 
    opcode : in std_logic_vector(2 downto 0); 
    z : out std_logic_vector(7 downto 0) 
    ); 
end top_module; 

architecture behavior of top_module is 

signal bwAnd, bwOr, bwXor, add, subtract, bwComplement, mux_in1, mux_in2, mux_in3, mux_in4, mux_in5, mux_in6 : std_logic_vector(7 downto 0); 


component BW_And is port(
    x,y : in std_logic_vector(7 downto 0); 
    z1 : out std_logic_vector(7 downto 0) 
    ); 
end component; 

component BW_Rr is port(
    x,y : in std_logic_vector(7 downto 0); 
    z2 : out std_logic_vector(7 downto 0) 
    ); 
end component; 

component BW_Xor is port(
    x,y : in std_logic_vector(7 downto 0); 
    z3 : out std_logic_vector(7 downto 0) 
    ); 
end component; 

component full_adder_8 is port(
    x,y : in std_logic_vector(7 downto 0); 
    cin : in std_logic_vector(7 downto 0) := "00000000"; 
    sum, cout: out std_logic_vector(7 downto 0) 
    ); 
end component; 

component full_subtractor_8 is port(
    x,y : in std_logic_vector(7 downto 0); 
    cin : in std_logic_vector(7 downto 0) := "11111111"; 
difference, cout: out std_logic_vector(7 downto 0) 
    ); 
end component; 

component Complement is port(
    x : in std_logic_vector(7 downto 0); 
    z4 : out std_logic_vector(7 downto 0) 
    ); 
end component; 

component mux is port(
    z1,z2,z3,sum,difference,z4 : in std_logic_vector(7 downto 0); 
    opcode : in std_logic_vector(2 downto 0); 
    mux_out : out std_logic_vector(7 downto 0) 
    ); 
end component; 

begin 

--instantiating components and mapping ports 

c0: BW_And port map(x => x, y => y, z1 => bwAnd); 

c1: BW_Or port map(x => x, y => y, z2 => bwOr); 

c2: BW_Xor port map(x => x, y => y, z3 => bwXor); 

c3: full_adder_8 port map(x => x, y => y, sum => add); 

c4: full_subtractor_8 port map(x => x, y => y, difference => subtract); 

c5: Complement port map(x => x, z4 => bwComplement); 

c6: mux port map(z1 => mux_in1, z2 => mux_in2, z3 => mux_in3, sum => mux_in4, difference => mux_in5, z4 =>mux_in6, opcode => opcode, mux_out => z); 

end behavior; 

試驗檯:

library IEEE; 
use IEEE.STD_LOGIC_1164.ALL; 

entity Lab4 is 
end Lab4; 

architecture behavior of Lab4 is 

component top_module is port(
    x,y : in std_logic_vector(7 downto 0); 
    opcode : in std_logic_vector(2 downto 0); 
    z : out std_logic_vector(7 downto 0) 
    ); 
end component; 

signal test_x : std_logic_vector(7 downto 0); 
signal test_y : std_logic_vector(7 downto 0); 
signal test_opcode : std_logic_vector(2 downto 0) := "000"; 
signal test_z : std_logic_vector(7 downto 0); 

begin 

    uut: top_module port map (x => test_x, y => test_y, opcode => test_opcode, z => test_z); 

sim_proc : process 
begin 

    test_x <= "00010100"; test_y <= "11001111"; test_opcode <= "000"; 
    wait for 100 ns; 
    test_x <= "00010100"; test_y <= "11001111"; test_opcode <= "001"; 
    wait for 100 ns; 
    test_x <= "00010100"; test_y <= "11001111"; test_opcode <= "010"; 
    wait for 100 ns; 
    test_x <= "00010100"; test_y <= "11001111"; test_opcode <= "011"; 
    wait for 100 ns; 
    test_x <= "00010100"; test_y <= "11001111"; test_opcode <= "100"; 
    wait for 100 ns; 
    test_x <= "00010100"; test_y <= "11001111"; test_opcode <= "101"; 

end process; 
end behavior; 

實體爲每個組件:

entity BW_And is port(
    x,y : in std_logic_vector(7 downto 0); 
    z1 : out std_logic_vector(7 downto 0) 
    ); 
end BW_And; 

entity BW_Or is port(
    x,y : in std_logic_vector(7 downto 0); 
    z2 : out std_logic_vector(7 downto 0) 
    ); 
end BW_Or; 

entity BW_Xor is port(
    x,y : in std_logic_vector(7 downto 0); 
    z3 : out std_logic_vector(7 downto 0) 
    ); 
end BW_Xor; 

entity full_adder_8 is port(
    x,y : in std_logic_vector(7 downto 0); 
    cin : in std_logic_vector(7 downto 0) := "00000000"; 
    sum, cout: out std_logic_vector(7 downto 0) 
    ); 
end full_adder_8; 

entity full_subtractor_8 is port(
    x,y : in std_logic_vector(7 downto 0); 
    cin : in std_logic_vector(7 downto 0) := "11111111"; 
    difference, cout: out std_logic_vector(7 downto 0) 
    ); 
end full_subtractor_8; 

entity Complement is port(
    x : in std_logic_vector(7 downto 0); 
    z4 : out std_logic_vector(7 downto 0) 
    ); 
end Complement; 

entity mux is port(
    z1,z2,z3,sum,difference,z4 : in std_logic_vector(7 downto 0); 
    opcode : in std_logic_vector(2 downto 0); 
    mux_out : out std_logic_vector(7 downto 0) 
    ); 
end mux; 
+0

如果對應到你的7個組件的實體? –

+0

@MatthewTaylor實體在單獨的文件中。例如:bw_and.vhd,bw_or.vhd等分別定義。它們包括實體和體系結構。 – Kevin

+0

輸出'z'從'mux'驅動,但該實體不包括馬修指出,所以無法確定什麼是錯的輸出。 –

回答

-1

我意識到在我的問題是畢竟。問題出在我的mux文件上。在我的過程中,我只通過了「操作碼」而忽略了所有的輸入。

前:

process (opcode) 
    . 
    . 
    . 
end process; 

後:

process (z1,z2,z3,sum,difference,z4,opcode) 
    . 
    . 
    . 
end process; 
+2

您不會將輸入傳遞給進程。這是一個過程敏感性列表。參見IEEE Std 1076-2008 11.3用作隱式等待語句靈敏度列表的過程語句作爲過程中的最後一個語句。靈敏度列表通常對合成沒有影響。請考慮用[最小,完整和可驗證示例]提供您的問題(http://stackoverflow.com/help/mcve)。 – user1155120

相關問題