我有这行代码:
entity test is
Port ( a : in STD_LOGIC_VECTOR (7 downto 0);
b : in STD_LOGIC_VECTOR (7 downto 0);
c : out STD_LOGIC_VECTOR (15 downto 0));
end test;
architecture Behavioral of test is
component adder is
Port ( a : in STD_LOGIC_VECTOR (7 downto 0);
b : in STD_LOGIC_VECTOR (7 downto 0);
s : out STD_LOGIC_VECTOR (7 downto 0));
end component;
signal prod: std_logic_vector (15 downto 0) :=X"0000";
signal tempsum1,tempsum2: std_logic_vector (7 downto 0):=X"00";
signal cin,cout:std_logic:='0';
begin
--Working(modelsim can see the upper value of c)
S1: adder port map(tempsum1, prod(15 downto 8), c(15 downto 8));
--Not working(c gets a red line on all bits):
--I replace the first S1 with this one and assign later.
S1: adder port map(tempsum1, prod(15 downto 8), tempsum2);
c(15 downto 8)<=tempsum2;
end Behavioral;
有人可以告诉我为什么使用第一个代码块来设置c并在modelsim中正确显示并且seccond不是吗? 谢谢。
答案 0 :(得分:0)
尝试抑制tempsum2的信号声明中的初始化。