【发布时间】:2011-03-04 02:37:03
【问题描述】:
我正在为组合逻辑创建一个测试平台,其中 a、b、cin 是被测实例化单元的输入。一切似乎都运行良好。
但是,我通过在我的测试台进程中添加一个 test_s 信号,这似乎被奇怪地延迟了。我的“等待”语句的持续时间无关紧要,我可以将单位从 ps 更改为 ns 并且症状是相同的。似乎正在发生的是 a 和 b 设置正确,但 test_s 在 a 和 b 改变它们的值之前不会改变。发生这种情况时,test_s 实际上会更新为 previous 的 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;
【问题讨论】:
-
数字和物理单位之间需要一个空格。 “5 ps”而不是“5ps”。那么语言定义在这里需要一个空格。有些工具可能会接受它,但其他工具不会。
标签: vhdl