alu_tb cleanup
This commit is contained in:
parent
e8f3e33271
commit
5e3b7d307f
28
alu_tb.vhdl
28
alu_tb.vhdl
|
@ -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,12 +116,10 @@ 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;
|
||||
|
@ -129,11 +127,10 @@ begin
|
|||
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;
|
||||
|
@ -157,12 +152,10 @@ begin
|
|||
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
|
||||
|
@ -196,12 +189,10 @@ begin
|
|||
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
|
||||
|
@ -236,12 +227,10 @@ begin
|
|||
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
|
||||
|
@ -276,7 +265,6 @@ begin
|
|||
severity error;
|
||||
end loop ld;
|
||||
|
||||
report "[test_07] finished";
|
||||
|
||||
|
||||
wait for 1 ns;
|
||||
|
|
Loading…
Reference in New Issue