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