I've a VHDL problem: for a homework we've to write a testbench with assert for our VHDL designed circuit. We should test every signal combination for a for bit comparator. I thought to solve this with a for loop, like this:
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";
First of all I tested the idea (for loop etc.) in Python, to check if it works (it did). Well, now I've no idea why my VHDL code doesn't work. I've got many error reports which doesn't make sense in my mind. Have anyone an idea?
COMP96 ERROR COMP96_0329: "Generate statement must have a label." "testbench.vhd" 18 3 COMP96 ERROR COMP96_0019: "Keyword 'generate' expected." "testbench.vhd" 18 22 COMP96 ERROR COMP96_0661: "Expression with a sequence of different logical operators is not allowed. Parenthesize subexpressions containing and, or, xor, and xnor operators." "testbench.vhd" 28 9 COMP96 ERROR COMP96_0016: "Design unit declaration expected." "testbench.vhd" 35 4
If you need I've a link for the whole VHDL Code: https://www.edaplayground.com/x/4c2n
a
andb
and before testing the output onc0
andc1
. – Morten Zilmer