Undefined VHDL输出突然未定义,即使编译已通过
我是一名学生,有一项任务是使用VHDL构建和测试一个全加器,以便在将来的任务中使用。几天前它工作得很好,但是今天我再次尝试模拟(在另一台计算机上),我所有的输入和输出现在都没有定义。我使用的是Modelsim SE-64 10.1c 全加器Undefined VHDL输出突然未定义,即使编译已通过,undefined,vhdl,simulation,modelsim,Undefined,Vhdl,Simulation,Modelsim,我是一名学生,有一项任务是使用VHDL构建和测试一个全加器,以便在将来的任务中使用。几天前它工作得很好,但是今天我再次尝试模拟(在另一台计算机上),我所有的输入和输出现在都没有定义。我使用的是Modelsim SE-64 10.1c 全加器 library IEEE; use IEEE.STD_LOGIC_1164.all; entity FullAdder is port (A, B, Cin : in std_logic; Cout, sum : out std_lo
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;
IEEE库;
使用IEEE.STD_LOGIC_1164.all;
实体全加器是
端口(A、B、Cin:std_逻辑中;
Cout,sum:out标准逻辑);
端全加器;
全加器的结构V1为
开始
Cout您的代码看起来不错。我看不出你的代码有什么不起作用的原因。我认为您的问题在于modelsim:
创建一个新的模型Sim项目
添加VHDL文件,然后编译所有
转到“模拟”菜单并选择“开始模拟”
转到“视图”菜单并选择“对象和波形”
拖放输入和输出,并在更改每个输入和输出的时钟周期后按运行按钮
祝你好运你确定你的模拟设置正确吗?乍一看,我看不出你的代码有什么不起作用的原因。我不确定,我根本没有改变任何与模拟有关的设置。如果所有端口都未定义,可能您没有编译测试台。两个模块中的端口名称相同,Modelsim中的波形可能与FullAdder
相关,而不是FullAdderTB
。我的想法也是-确保所有组件都已编译,并且您的sim卡的目标是正确的对象。确保加载sim卡时没有错误/警告。您的代码本身似乎不是问题所在。
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;