我正在为组合逻辑创建一个测试平台,其中a,b,cin输入到被测试的实例化单元中。所有看起来都运转正常。
但是,我在我的测试平台过程中通过添加得到一个test_s信号,这似乎奇怪地延迟了。我的'等待'语句的持续时间无关紧要,我可以将单位从ps更改为ns并且症状相同。似乎正在发生的事情是a和b设置正确,但test_s不会改变,直到a和b改变它们的值。发生这种情况时,test_s实际更新为a和b的之前的值。因此,当a和b变为0时,test_s变为XXXXXXX。然后,当a变为1时,test_s变为0000000,而实际应该是00000001。
-- Instantiate the Unit Under Test (UUT)
uut: FastCarry8 PORT MAP (
a => a,
b => b,
cin => cinVec(0),
cout => cout
);
signal a : std_logic_vector(7 downto 0) := (others => '0');
signal b : std_logic_vector(7 downto 0) := (others => '0');
signal cinVec : std_logic_vector(1 downto 0);
signal test_s : std_logic_vector(8 downto 0);
-- Stimulus process
stim_proc: process
begin
-- hold reset state
wait for 10 ps;
carry_gen: for carry in 0 to 1 loop
cinVec <= std_logic_vector(to_unsigned(carry, 2));
b_gen: for j in 0 to 255 loop
a_gen: for i in 0 to 255 loop
a <= std_logic_vector(to_unsigned(i, 8));
b <= std_logic_vector(to_unsigned(j, 8));
test_s <= std_logic_vector(resize(unsigned(a), test_s'length) +
unsigned(b) + unsigned(cinVec));
wait for 5ps;
ASSERT (test_s(8) = cout)
REPORT "Carry out failed for cin = 0!";
wait for 5ps;
end loop a_gen;
end loop b_gen;
end loop carry_gen;
答案 0 :(得分:2)
由于test_s取决于那些信号值,因此必须在分配a,b和test_s的分配之间等待。这是私下回答的