alu_tb cleanup

This commit is contained in:
Adrien Bourmault 2022-01-20 17:32:11 +01:00
parent e8f3e33271
commit 5e3b7d307f
No known key found for this signature in database
GPG Key ID: 6EB408FE0ACEC664
1 changed files with 10 additions and 22 deletions

View File

@ -82,7 +82,7 @@ begin
-- SUM
cmd <= "00";
wait for 1 ns;
report "[test_01] addition of 32 random numbers, range between (0 to 536870911)";
report "addition of 32 random numbers, range between (0 to 536870911)";
la : for va in 0 to 31 loop
@ -106,7 +106,7 @@ begin
vz := '0';
end if;
wait for 1 ns;
assert (res = vres) report "[error] resultat of sum. vres = " & integer'image(to_integer(unsigned(vres))) & " versus res = " & integer'image(to_integer(unsigned(res)))
assert (res = vres) report "[error] vres = " & integer'image(to_integer(unsigned(vres))) & " versus res = " & integer'image(to_integer(unsigned(res)))
severity error;
assert (bit_to_integer(n) = bit_to_integer(vtemp(31))) report "[error] negative. n = " & integer'image(bit_to_integer(n)) & " versus vn = " & integer'image(bit_to_integer(vtemp(31)))
severity error;
@ -116,24 +116,21 @@ begin
severity error;
end loop la;
report "[test_01] finished";
cin <= '0';
wait for 1 ns;
report "[test_02] addition of (7fff ffff) + (7fff ffff)";
report "addition of (7fff ffff) + (7fff ffff)";
op1 <= x"7fffffff"; --(+)2147483647
op2 <= x"7fffffff"; --(+)2147483647
wait for 1 ns;
assert (res = x"fffffffe") report "[error] res = " & integer'image(to_integer(unsigned(res))) severity error;
assert (bit_to_integer(cout) = 0) report "cout = " & integer'image(bit_to_integer(cout)) severity error;
assert (bit_to_integer(v) = 1) report "[error] v = " & integer'image(bit_to_integer(v)) severity error;
report "[test_02] finished";
wait for 1 ns;
report "[test_03] test overflow, zero and carry in addition (ffff ffff) + (0000 0001)";
report "overflow, zero and carry in addition (ffff ffff) + (0000 0001)";
op1 <= x"ffffffff";
op2 <= x"00000001";
wait for 1 ns;
@ -142,11 +139,9 @@ begin
assert (bit_to_integer(cout) = 1) report "[error] cout = " & integer'image(bit_to_integer(cout)) severity error;
assert (bit_to_integer(v) = 1) report "[error] v = " & integer'image(bit_to_integer(v)) severity error;
report "[test_03] finished";
wait for 1 ns;
report "[test_04] test addition negative number with negative result";
report "test addition negative number with negative result";
op1 <= x"0000002a"; -- 42
op2 <= x"ffffffd3"; -- -45
wait for 1 ns;
@ -156,13 +151,11 @@ begin
assert (bit_to_integer(z) = 0) report "[error] z = " & integer'image(bit_to_integer(z)) severity error;
assert (bit_to_integer(cout) = 0) report "[error] cout = " & integer'image(bit_to_integer(cout)) severity error;
assert (bit_to_integer(v) = 1) report "[error] v = " & integer'image(bit_to_integer(v)) severity error;
report "[test_04] finished";
-- AND
wait for 1 ns;
report "[test_05] and of 32 random numbers in a range between (0 to 536870911)";
report "and of 32 random numbers in a range between (0 to 536870911)";
cmd <= "01";
wait for 1 ns;
lb : for vb in 0 to 31 loop
@ -195,13 +188,11 @@ begin
assert (bit_to_integer(z) = bit_to_integer(vz)) report "[error] z flag. z = " & integer'image(bit_to_integer(z)) & " versus vz = " & integer'image(bit_to_integer(vz))
severity error;
end loop lb;
report "[test_05] finished";
-- OR
wait for 1 ns;
report "[test_06] or of 32 random numbers in a range between (0 to 536870911)";
report "or of 32 random numbers in a range between (0 to 536870911)";
cmd <= "10";
wait for 1 ns;
lc : for vc in 0 to 31 loop
@ -235,13 +226,11 @@ begin
assert (bit_to_integer(z) = bit_to_integer(vz)) report "[error] z flag. z = " & integer'image(bit_to_integer(z)) & " versus vz = " & integer'image(bit_to_integer(vz))
severity error;
end loop lc;
report "[test_06] finished";
-- XOR
wait for 1 ns;
report "[test_07] xor of 32 random numbers in a range between (0 to 536870911)";
report "xor of 32 random numbers in a range between (0 to 536870911)";
cmd <= "11";
wait for 1 ns;
ld : for vd in 0 to 31 loop
@ -275,8 +264,7 @@ begin
assert (bit_to_integer(z) = bit_to_integer(vz)) report "[error] z flag. z = " & integer'image(bit_to_integer(z)) & " versus vz = " & integer'image(bit_to_integer(vz))
severity error;
end loop ld;
report "[test_07] finished";
wait for 1 ns;