Line 85... |
Line 85... |
signal s_i : integer;
|
signal s_i : integer;
|
signal s_sl : std_logic;
|
signal s_sl : std_logic;
|
signal s_slv : std_logic_vector(7 downto 0);
|
signal s_slv : std_logic_vector(7 downto 0);
|
signal s_u : unsigned(7 downto 0);
|
signal s_u : unsigned(7 downto 0);
|
signal s_s : unsigned(7 downto 0);
|
signal s_s : unsigned(7 downto 0);
|
|
signal s_b : boolean;
|
|
signal s_time : time;
|
signal s_str_exp : string(1 to 44);
|
signal s_str_exp : string(1 to 44);
|
signal s_str1 : string(1 to 44);
|
signal s_str1 : string(1 to 44);
|
signal s_str2 : string(1 to 44);
|
signal s_str2 : string(1 to 44);
|
signal s_str3 : string(1 to 43);
|
signal s_str3 : string(1 to 43);
|
signal s_str4 : string(1 to 45);
|
signal s_str4 : string(1 to 45);
|
Line 186... |
Line 188... |
s_i <= -1;
|
s_i <= -1;
|
wait until rising_edge(clk);
|
wait until rising_edge(clk);
|
check("Testing negative integer = -1", s_i, -1, pltbv, pltbs);
|
check("Testing negative integer = -1", s_i, -1, pltbv, pltbs);
|
v_expected_checks_cnt := v_expected_checks_cnt + 1;
|
v_expected_checks_cnt := v_expected_checks_cnt + 1;
|
expected_checks_cnt <= v_expected_checks_cnt;
|
expected_checks_cnt <= v_expected_checks_cnt;
|
|
|
print("<Done testing check() integer>");
|
print("<Done testing check() integer>");
|
|
|
print("<Testing check() std_logic>");
|
print("<Testing check() std_logic>");
|
s_sl <= '0';
|
s_sl <= '0';
|
wait until rising_edge(clk);
|
wait until rising_edge(clk);
|
Line 396... |
Line 397... |
expected_checks_cnt <= v_expected_checks_cnt;
|
expected_checks_cnt <= v_expected_checks_cnt;
|
v_expected_errors_cnt := v_expected_errors_cnt + 1;
|
v_expected_errors_cnt := v_expected_errors_cnt + 1;
|
expected_errors_cnt <= v_expected_errors_cnt;
|
expected_errors_cnt <= v_expected_errors_cnt;
|
s_s <= x"FF";
|
s_s <= x"FF";
|
wait until rising_edge(clk);
|
wait until rising_edge(clk);
|
|
print("NOTE: Skipping test with negative signed. There seem to be a bug in ModelSim.");
|
--print("The following check fails in ModelSim for unknown reason." &
|
--print("The following check fails in ModelSim for unknown reason." &
|
-- " It causes mismatch between expected number of errors" &
|
-- " It causes mismatch between expected number of errors" &
|
-- " and the number presented by endsim()");
|
-- " and the number presented by endsim()");
|
--check("Testing negative signed = x'FF'", s_s, -1, pltbv, pltbs);
|
--check("Testing negative signed = x'FF'", s_s, -1, pltbv, pltbs);
|
--v_expected_checks_cnt := v_expected_checks_cnt + 1;
|
--v_expected_checks_cnt := v_expected_checks_cnt + 1;
|
--expected_checks_cnt <= v_expected_checks_cnt;
|
--expected_checks_cnt <= v_expected_checks_cnt;
|
--print("<Done testing check() signed against integer>");
|
print("<Done testing check() signed against integer>");
|
|
|
|
print("<Testing check() boolean>");
|
|
s_b <= false;
|
|
wait until rising_edge(clk);
|
|
check("Testing correct boolean = false", s_b, false, pltbv, pltbs);
|
|
v_expected_checks_cnt := v_expected_checks_cnt + 1;
|
|
expected_checks_cnt <= v_expected_checks_cnt;
|
|
s_b <= true;
|
|
wait until rising_edge(clk);
|
|
check("Testing correct boolean = true", s_b, true, pltbv, pltbs);
|
|
v_expected_checks_cnt := v_expected_checks_cnt + 1;
|
|
expected_checks_cnt <= v_expected_checks_cnt;
|
|
s_b <= false;
|
|
wait until rising_edge(clk);
|
|
check("Testing incorrect boolean = true", s_b, true, pltbv, pltbs);
|
|
v_expected_checks_cnt := v_expected_checks_cnt + 1;
|
|
expected_checks_cnt <= v_expected_checks_cnt;
|
|
v_expected_errors_cnt := v_expected_errors_cnt + 1;
|
|
expected_errors_cnt <= v_expected_errors_cnt;
|
|
print("<Done testing check() boolean>");
|
|
|
|
print("<Testing check() boolean against integer>");
|
|
s_b <= false;
|
|
wait until rising_edge(clk);
|
|
check("Testing correct boolean = false", s_b, 0, pltbv, pltbs);
|
|
v_expected_checks_cnt := v_expected_checks_cnt + 1;
|
|
expected_checks_cnt <= v_expected_checks_cnt;
|
|
s_b <= true;
|
|
wait until rising_edge(clk);
|
|
check("Testing correct boolean = true", s_b, 1, pltbv, pltbs);
|
|
v_expected_checks_cnt := v_expected_checks_cnt + 1;
|
|
expected_checks_cnt <= v_expected_checks_cnt;
|
|
s_b <= false;
|
|
wait until rising_edge(clk);
|
|
check("Testing incorrect boolean = true", s_b, 1, pltbv, pltbs);
|
|
v_expected_checks_cnt := v_expected_checks_cnt + 1;
|
|
expected_checks_cnt <= v_expected_checks_cnt;
|
|
v_expected_errors_cnt := v_expected_errors_cnt + 1;
|
|
expected_errors_cnt <= v_expected_errors_cnt;
|
|
s_b <= true;
|
|
wait until rising_edge(clk);
|
|
check("Testing boolean = true with incorrect expected", s_b, 2, pltbv, pltbs);
|
|
v_expected_checks_cnt := v_expected_checks_cnt + 1;
|
|
expected_checks_cnt <= v_expected_checks_cnt;
|
|
v_expected_errors_cnt := v_expected_errors_cnt + 1;
|
|
expected_errors_cnt <= v_expected_errors_cnt;
|
|
print("<Done testing check() boolean against integer>");
|
|
|
|
print("<Testing check() time>");
|
|
s_time <= 0 sec;
|
|
wait until rising_edge(clk);
|
|
check("Testing correct time = 0 sec", s_time, 0 sec, pltbv, pltbs);
|
|
v_expected_checks_cnt := v_expected_checks_cnt + 1;
|
|
expected_checks_cnt <= v_expected_checks_cnt;
|
|
s_time <= 47 ns;
|
|
wait until rising_edge(clk);
|
|
check("Testing correct time = 47 ns", s_time, 47 ns, pltbv, pltbs);
|
|
v_expected_checks_cnt := v_expected_checks_cnt + 1;
|
|
expected_checks_cnt <= v_expected_checks_cnt;
|
|
s_time <= 11 us;
|
|
wait until rising_edge(clk);
|
|
check("Testing incorrect time = 10 us", s_time, 10 us, pltbv, pltbs);
|
|
v_expected_checks_cnt := v_expected_checks_cnt + 1;
|
|
expected_checks_cnt <= v_expected_checks_cnt;
|
|
v_expected_errors_cnt := v_expected_errors_cnt + 1;
|
|
expected_errors_cnt <= v_expected_errors_cnt;
|
|
print("<Done testing check() time>");
|
|
|
|
print("<Testing check() time with tolerance>");
|
|
s_time <= 0 sec;
|
|
wait until rising_edge(clk);
|
|
check("Testing correct unsigned = 0 sec +/- 0 sec", s_time, 0 sec, 0 sec, pltbv, pltbs);
|
|
v_expected_checks_cnt := v_expected_checks_cnt + 1;
|
|
expected_checks_cnt <= v_expected_checks_cnt;
|
|
s_time <= 47 ns - 3 ns;
|
|
wait until rising_edge(clk);
|
|
check("Testing correct time = 47 ns +/- 5 ns", s_time, 47 ns, 5 ns, pltbv, pltbs);
|
|
v_expected_checks_cnt := v_expected_checks_cnt + 1;
|
|
expected_checks_cnt <= v_expected_checks_cnt;
|
|
s_time <= 10 us + 7 us;
|
|
wait until rising_edge(clk);
|
|
check("Testing incorrect time = 10 us +/- 5 us", s_time, 10 us, 5 us, pltbv, pltbs);
|
|
v_expected_checks_cnt := v_expected_checks_cnt + 1;
|
|
expected_checks_cnt <= v_expected_checks_cnt;
|
|
v_expected_errors_cnt := v_expected_errors_cnt + 1;
|
|
expected_errors_cnt <= v_expected_errors_cnt;
|
|
print("<Done testing check() time with tolerance>");
|
|
|
print("<Testing check() string>");
|
print("<Testing check() string>");
|
s_str_exp <= string'("The quick brown fox jumps over the lazy dog.");
|
s_str_exp <= string'("The quick brown fox jumps over the lazy dog.");
|
s_str1 <= string'("The quick brown fox jumps over the lazy dog.");
|
s_str1 <= string'("The quick brown fox jumps over the lazy dog.");
|
s_str2 <= string'("The quick brown dog jumps over the lazy fox.");
|
s_str2 <= string'("The quick brown dog jumps over the lazy fox.");
|
Line 457... |
Line 546... |
endtest(pltbv, pltbs);
|
endtest(pltbv, pltbs);
|
print("<Done testing endtest()>");
|
print("<Done testing endtest()>");
|
|
|
wait until rising_edge(clk);
|
wait until rising_edge(clk);
|
print("<Testing endsim()>");
|
print("<Testing endsim()>");
|
|
print("");
|
print("Expected number of tests: " & str(v_expected_tests_cnt));
|
print("Expected number of tests: " & str(v_expected_tests_cnt));
|
print("Expected number of checks: " & str(v_expected_checks_cnt));
|
print("Expected number of checks: " & str(v_expected_checks_cnt));
|
print("Expected number of errors: " & str(v_expected_errors_cnt));
|
print("Expected number of errors: " & str(v_expected_errors_cnt));
|
|
if v_expected_errors_cnt = 0 then
|
|
print("Expected result: SUCCESS");
|
|
else
|
|
print("Expected result: FAIL");
|
|
end if;
|
wait until rising_edge(clk);
|
wait until rising_edge(clk);
|
endsim(pltbv, pltbs, true);
|
endsim(pltbv, pltbs, true);
|
wait until rising_edge(clk);
|
wait until rising_edge(clk);
|
print("<Done testing endsim()>");
|
print("<Done testing endsim()>");
|
wait;
|
wait;
|