1
我是一名學生,負責構建並測試使用VHDL的完整加法器,以用於將來的作業。它幾天前完美工作,但我今天嘗試再次模擬(在不同的計算機上),現在我的所有輸入和輸出都未定義。我正在使用Modelsim SE-64 10.1c。儘管編譯通過,但VHDL輸出突然不確定
全加
library IEEE;
use IEEE.STD_LOGIC_1164.all;
entity FullAdder is
port (A, B, Cin : in std_logic;
Cout, sum : out std_logic);
end FullAdder;
architecture V1 of FullAdder is
begin
Cout <= ((B and Cin) or (A and Cin) or (A and B));
sum <= ((A and (not(B)) and (not Cin)) or ((not A) and (not B) and Cin) or (A and B and Cin) or ((not A) and B and (not Cin)));
end V1;
測試平臺
library IEEE;
use IEEE.STD_LOGIC_1164.all;
entity FullAdderTB is
end;
architecture TB1 of FullAdderTB is
component FullAdder
port (A, B, Cin : in std_logic;
Cout, sum : out std_logic);
end component;
signal A, B, Cin, Cout, sum : std_logic;
begin
stimuli: process
begin
A <= '0'; B <= '0'; Cin <= '0'; wait for 10 NS;
A <= '0'; B <= '0'; Cin <= '1'; wait for 10 NS;
A <= '0'; B <= '1'; Cin <= '0'; wait for 10 NS;
A <= '0'; B <= '1'; Cin <= '1'; wait for 10 NS;
A <= '1'; B <= '0'; Cin <= '0'; wait for 10 NS;
A <= '1'; B <= '0'; Cin <= '1'; wait for 10 NS;
A <= '1'; B <= '1'; Cin <= '0'; wait for 10 NS;
A <= '1'; B <= '1'; Cin <= '1'; wait for 10 NS;
wait;
end process;
G1: FullAdder port map (A=>A, B=>B, Cin=>Cin, Cout=>Cout, sum=>sum);
end;
你確定你的仿真設置是否正確?乍一看,我沒有看到你的代碼不應該工作的任何理由。 – fru1tbat 2015-03-02 14:39:56
我不確定,我根本沒有改變任何與模擬有關的設置。 – 2015-03-02 14:45:20
如果所有端口都未定義,可能是您沒有編譯測試平臺。兩個模塊中的端口名稱相同,並且Modelsim中的wave可能與FullAdder而不是FullAdderTB有關。 – Amir 2015-03-02 15:23:28