【发布时间】:2019-12-25 09:53:42
【问题描述】:
我有一个 VHDL 问题:对于家庭作业,我们必须为我们的 VHDL 设计电路编写一个带有断言的测试台。我们应该测试每个信号组合的 for bit 比较器。我想用一个 for 循环来解决这个问题,如下所示:
architecture ts of testbench is
signal a: std_logic_vector(3 downto 0) := "0000";
signal b: std_logic_vector(3 downto 0) := "1011";
signal c1, c0: std_logic := '0';
begin
TEST: entity forBitVergleicher port map(a, b, c1, c0);
for i in 0 to 2**n loop
k for k in 0 to 2**n loop
a <= std_logic_vector(i); b <= std_logic_vector(k);
assert(unsigned(a) > unsigned(b) and (c1 = '0' or c0 =
'1') and (c1 = '0' and c0 = '0') and (c1 = '1' and c0 =
'0'))
report "error";
assert(unsigned(b) > unsigned(a) and (c1 = '1' and c0 =
'0' or c1 = '0' and c0 = '0' or c1 = '1' and c0 = '0'))
report "error";
assert(a = b and ((c1 = '1' and c0 = '1') or (c1 /= c0)))
report "error";
首先,我在 Python 中测试了这个想法(for 循环等),以检查它是否有效(确实有效)。好吧,现在我不知道为什么我的 VHDL 代码不起作用。我有很多错误报告在我看来没有意义。 有人有想法吗?
COMP96 错误 COMP96_0329:“生成语句必须有标签。” “测试台.vhd” 18 3 COMP96 错误 COMP96_0019:“需要关键字‘生成’。” “测试台.vhd”18 22 COMP96 错误 COMP96_0661:“不允许使用一系列不同逻辑运算符的表达式。将包含 and、or、xor 和 xnor 运算符的子表达式括起来。” “测试台.vhd”28 9 COMP96 错误 COMP96_0016:“需要设计单元声明。” "testbench.vhd" 35 4
如果您需要我有整个 VHDL 代码的链接: https://www.edaplayground.com/x/4c2n
【问题讨论】:
-
一些建议:将循环放在一个进程中,在
a和b上应用刺激之后以及在c0和c1上测试输出之前添加等待。跨度>
标签: vhdl test-bench