OpenCores
URL https://opencores.org/ocsvn/pltbutils/pltbutils/trunk

Subversion Repositories pltbutils

Compare Revisions

  • This comparison shows the changes necessary to convert path
    /pltbutils/trunk/src/vhdl
    from Rev 99 to Rev 101
    Reverse comparison

Rev 99 → Rev 101

/pltbutils_user_cfg_pkg.vhd
65,6 → 65,7
constant C_PLTBUTILS_USE_STD_STARTSIM_MSG : boolean := true;
constant C_PLTBUTILS_USE_STD_ENDSIM_MSG : boolean := true;
constant C_PLTBUTILS_USE_STD_STARTTEST_MSG : boolean := true;
constant C_PLTBUTILS_USE_STD_SKIPTEST_MSG : boolean := true;
constant C_PLTBUTILS_USE_STD_ENDTEST_MSG : boolean := true;
constant C_PLTBUTILS_USE_STD_CHECK_MSG : boolean := true;
constant C_PLTBUTILS_USE_STD_ERROR_MSG : boolean := true;
72,6 → 73,7
constant C_PLTBUTILS_USE_CUSTOM_STARTSIM_MSG : boolean := false;
constant C_PLTBUTILS_USE_CUSTOM_ENDSIM_MSG : boolean := false;
constant C_PLTBUTILS_USE_CUSTOM_STARTTEST_MSG : boolean := false;
constant C_PLTBUTILS_USE_CUSTOM_SKIPTEST_MSG : boolean := false;
constant C_PLTBUTILS_USE_CUSTOM_ENDTEST_MSG : boolean := false;
constant C_PLTBUTILS_USE_CUSTOM_CHECK_MSG : boolean := false;
constant C_PLTBUTILS_USE_CUSTOM_ERROR_MSG : boolean := false;
93,6 → 95,7
constant testcase_name : in string;
constant timestamp : in time;
constant num_tests : in integer;
constant num_skip_tests : in integer;
constant num_checks : in integer;
constant num_errors : in integer;
constant show_success_fail : in boolean
104,10 → 107,17
constant timestamp : in time
);
procedure custom_skiptest_msg(
constant test_num : in integer;
constant test_name : in string;
constant timestamp : in time
);
procedure custom_endtest_msg(
constant test_num : in integer;
constant test_name : in string;
constant timestamp : in time;
constant test_active : in boolean;
constant num_checks_in_test : in integer;
constant num_errors_in_test : in integer
);
189,6 → 199,7
constant testcase_name : in string;
constant timestamp : in time;
constant num_tests : in integer;
constant num_skip_tests : in integer;
constant num_checks : in integer;
constant num_errors : in integer;
constant show_success_fail : in boolean
208,16 → 219,29
print("##teamcity[testStarted name='" & tcfilter(test_name) & "']");
end procedure custom_starttest_msg;
 
procedure custom_skiptest_msg(
constant test_num : in integer;
constant test_name : in string;
constant timestamp : in time
) is
begin
-- TeamCity ignores test_num and timestamp
print("##teamcity[testIgnored name='" & tcfilter(test_name) & "']");
end procedure custom_skiptest_msg;
 
procedure custom_endtest_msg(
constant test_num : in integer;
constant test_name : in string;
constant timestamp : in time;
constant test_active : in boolean;
constant num_checks_in_test : in integer;
constant num_errors_in_test : in integer
) is
begin
-- TeamCity ignores all arguments except test_name
print("##teamcity[testFinished name='" & tcfilter(test_name) & "']");
if test_active then
-- TeamCity ignores all arguments except test_name
print("##teamcity[testFinished name='" & tcfilter(test_name) & "']");
end if;
end procedure custom_endtest_msg;
 
procedure custom_check_msg(
/pltbutils_func_pkg.vhd
55,9 → 55,10
package pltbutils_func_pkg is
 
-- See the package body for a description of the functions and procedures.
constant C_PLTBUTILS_STRLEN : natural := 80;
constant C_PLTBUTILS_TIMEOUT : time := 10 sec;
constant C_WAIT_BEFORE_STOP_TIME : time := 1 us;
constant C_PLTBUTILS_STRLEN : natural := 80;
constant C_PLTBUTILS_SKIPTESTLEN : natural := 512;
constant C_PLTBUTILS_TIMEOUT : time := 10 sec;
constant C_WAIT_BEFORE_STOP_TIME : time := 1 us;
 
-- Type for status- and control variable
type pltbv_t is
67,9 → 68,12
test_num : integer;
test_name : string(1 to C_PLTBUTILS_STRLEN);
test_name_len : integer;
skiptests : std_logic_vector(0 to C_PLTBUTILS_SKIPTESTLEN-1);
test_active : boolean;
info : string(1 to C_PLTBUTILS_STRLEN);
info_len : integer;
test_cnt : integer;
skiptest_cnt : integer;
chk_cnt : integer;
err_cnt : integer;
chk_cnt_in_test : integer;
83,9 → 87,12
0, -- test_num
(others => ' '), -- test_name
1, -- test_name_len
(others => '0'), -- skiptest
true, -- test_active
(others => ' '), -- info
1, -- info_len
0, -- test_cnt
0, -- skiptest_cnt
0, -- chk_cnt
0, -- err_cnt
0, -- chk_cnt_in_test
116,6 → 123,7
-- startsim
procedure startsim(
constant testcase_name : in string;
constant skiptests : in std_logic_vector;
variable pltbv : inout pltbv_t;
signal pltbs : out pltbs_t
);
141,6 → 149,11
signal pltbs : out pltbs_t
);
 
-- is_test_active
function is_test_active(
constant pltbv : in pltbv_t
) return boolean;
 
-- endtest
procedure endtest(
variable pltbv : inout pltbv_t;
494,6 → 507,7
constant testcase_name : in string;
constant timestamp : in time;
constant num_tests : in integer;
constant num_skiptests : in integer;
constant num_checks : in integer;
constant num_errors : in integer;
constant show_success_fail : in boolean
505,10 → 519,17
constant timestamp : in time
);
 
procedure skiptest_msg(
constant test_num : in integer;
constant test_name : in string;
constant timestamp : in time
);
 
procedure endtest_msg(
constant test_num : in integer;
constant test_name : in string;
constant timestamp : in time;
constant test_active : in boolean;
constant num_checks_in_test : in integer;
constant num_errors_in_test : in integer
);
543,6 → 564,7
--
-- procedure startsim(
-- constant testcase_name : in string;
-- constant skiptests : in std_logic_vector;
-- variable pltbv : inout pltbv_t;
-- signal pltbs : out pltbs_t
-- )
554,6 → 576,18
-- Arguments:
-- testcase_name Name of the test case, e.g. "tc1".
--
-- skiptests std_logic_vector for marking tests that should
-- be skipped. The leftmost bit has position 0,
-- and position numbers increment to the right.
-- A '1' indicates that the test with the same
-- number as the position should be skipped.
-- Note that there is usually no test which has
-- number 0, so bit zero in the vector is usually
-- ignored.
-- This argument is normally fed by a generic.
-- If no tests should be skipped, a zero-length
-- vector is allowed, ("").
--
-- pltbv, pltbs PlTbUtils' status- and control variable and
-- -signal.
--
566,15 → 600,18
-- DO NOT MODIFY the message "--- START OF SIMULATION ---".
-- DO NOT OUTPUT AN IDENTICAL MESSAGE anywhere else.
--
-- Example:
-- startsim("tc1", pltbv, pltbs);
-- Examples:
-- startsim("tc1", "", pltbv, pltbs);
-- startsim("tc2", G_SKIPTESTS, pltbv, pltbs); -- G_SKIPTESTS is a generic
----------------------------------------------------------------------------
procedure startsim(
constant testcase_name : in string;
constant skiptests : in std_logic_vector;
variable pltbv : inout pltbv_t;
signal pltbs : out pltbs_t
) is
variable timestamp : time;
variable v_ignored_skiptest : boolean := false;
begin
timestamp := now;
pltbv := C_PLTBV_INIT;
583,6 → 620,23
printv(pltbv.test_name, "START OF SIMULATION");
pltbv.test_name_len := 19;
printv(pltbv.info, testcase_name);
if skiptests'length > 0 then
for i in skiptests'low to skiptests'high loop
if i >= pltbv.skiptests'low and i <= pltbv.skiptests'high then
pltbv.skiptests(i) := skiptests(i);
else
if pltbv.skiptests(i) = '1' then
v_ignored_skiptest := true;
end if;
end if;
end loop;
if v_ignored_skiptest then
assert false
report "Some SKIPTESTS flags ignored. Max " &
integer'image(pltbv.skiptests'length) & " flag bits supported."
severity warning;
end if;
end if;
pltbv.info_len := testcase_name'length;
pltbs_update(pltbv, pltbs);
if C_PLTBUTILS_USE_STD_STARTSIM_MSG then
655,11 → 709,13
timestamp := now;
if C_PLTBUTILS_USE_STD_ENDSIM_MSG then
endsim_msg(pltbv.testcase_name(1 to pltbv.testcase_name_len), timestamp,
pltbv.test_cnt, pltbv.chk_cnt, pltbv.err_cnt, show_success_fail);
pltbv.test_cnt, pltbv.skiptest_cnt, pltbv.chk_cnt, pltbv.err_cnt,
show_success_fail);
end if;
if C_PLTBUTILS_USE_CUSTOM_ENDSIM_MSG then
custom_endsim_msg(pltbv.testcase_name(1 to pltbv.testcase_name_len), timestamp,
pltbv.test_cnt, pltbv.chk_cnt, pltbv.err_cnt, show_success_fail);
pltbv.test_cnt, pltbv.skiptest_cnt, pltbv.chk_cnt, pltbv.err_cnt,
show_success_fail);
end if;
pltbv.test_num := 0;
printv(pltbv.test_name, "END OF SIMULATION");
728,15 → 784,32
end if;
printv(pltbv.test_name, name);
pltbv.test_name_len := name'length;
pltbv.test_cnt := pltbv.test_cnt + 1;
pltbv.chk_cnt_in_test := 0;
pltbv.err_cnt_in_test := 0;
pltbs_update(pltbv, pltbs);
if C_PLTBUTILS_USE_STD_STARTTEST_MSG then
starttest_msg(pltbv.test_num, name, timestamp);
pltbv.test_active := true;
if num >= pltbv.skiptests'low and num <= pltbv.skiptests'high then
if pltbv.skiptests(num) = '1' then
pltbv.test_active := false;
end if;
end if;
if C_PLTBUTILS_USE_CUSTOM_STARTTEST_MSG then
custom_starttest_msg(pltbv.test_num, name, timestamp);
if pltbv.test_active then
pltbv.test_cnt := pltbv.test_cnt + 1;
pltbs_update(pltbv, pltbs);
if C_PLTBUTILS_USE_STD_STARTTEST_MSG then
starttest_msg(pltbv.test_num, name, timestamp);
end if;
if C_PLTBUTILS_USE_CUSTOM_STARTTEST_MSG then
custom_starttest_msg(pltbv.test_num, name, timestamp);
end if;
else
pltbv.skiptest_cnt := pltbv.skiptest_cnt + 1;
pltbs_update(pltbv, pltbs);
if C_PLTBUTILS_USE_STD_SKIPTEST_MSG then
skiptest_msg(pltbv.test_num, name, timestamp);
end if;
if C_PLTBUTILS_USE_CUSTOM_SKIPTEST_MSG then
custom_skiptest_msg(pltbv.test_num, name, timestamp);
end if;
end if;
end procedure starttest;
 
750,6 → 823,32
end procedure starttest;
 
----------------------------------------------------------------------------
-- is_test_active
--
-- function is_test_active(
-- constant pltbv : in pltbv_t
-- ) return boolean
--
-- Returns true if a test is active (not skipped), otherwise false.
--
-- Arguments:
-- pltbv PlTbUtils' status- and control variable.
--
-- Example:
-- starttest(3, "Example test", pltbv, pltbs);
-- if is_test_active(pltbv) then
-- ... test code ...
-- end if;
-- endtest(pltbv, pltbs);
----------------------------------------------------------------------------
function is_test_active(
constant pltbv : in pltbv_t
) return boolean is
begin
return pltbv.test_active;
end function is_test_active;
 
----------------------------------------------------------------------------
-- endtest
--
-- procedure endtest(
775,12 → 874,13
timestamp := now;
if C_PLTBUTILS_USE_STD_ENDTEST_MSG then
endtest_msg(pltbv.test_num, pltbv.test_name(1 to pltbv.test_name_len),
timestamp, pltbv.chk_cnt_in_test, pltbv.err_cnt_in_test);
timestamp, pltbv.test_active, pltbv.chk_cnt_in_test, pltbv.err_cnt_in_test);
end if;
if C_PLTBUTILS_USE_CUSTOM_ENDTEST_MSG then
custom_endtest_msg(pltbv.test_num, pltbv.test_name(1 to pltbv.test_name_len),
timestamp, pltbv.chk_cnt_in_test, pltbv.err_cnt_in_test);
timestamp, pltbv.test_active, pltbv.chk_cnt_in_test, pltbv.err_cnt_in_test);
end if;
pltbv.test_active := true;
printv(pltbv.test_name, " ");
pltbv.test_name_len := 1;
pltbs_update(pltbv, pltbs);
1623,6 → 1723,18
timestamp := now;
pltbv.chk_cnt := pltbv.chk_cnt + 1;
pltbv.chk_cnt_in_test := pltbv.chk_cnt_in_test + 1;
if not is_test_active(pltbv) then
pltbv.err_cnt := pltbv.err_cnt + 1;
pltbv.err_cnt_in_test := pltbv.err_cnt_in_test + 1;
if C_PLTBUTILS_USE_STD_CHECK_MSG then
check_msg("check() executed in skipped test, missing if clause?", timestamp, false, "", "", "", pltbv.test_num,
pltbv.test_name(1 to pltbv.test_name_len), pltbv.chk_cnt, pltbv.err_cnt_in_test);
end if;
if C_PLTBUTILS_USE_CUSTOM_CHECK_MSG then
custom_check_msg("check() executed in skipped test, missing if clause?", timestamp, false, "", "", "", pltbv.test_num,
pltbv.test_name(1 to pltbv.test_name_len), pltbv.chk_cnt, pltbv.err_cnt_in_test);
end if;
end if;
if not expr then
pltbv.err_cnt := pltbv.err_cnt + 1;
pltbv.err_cnt_in_test := pltbv.err_cnt_in_test + 1;
1921,6 → 2033,7
constant testcase_name : in string;
constant timestamp : in time;
constant num_tests : in integer;
constant num_skiptests : in integer;
constant num_checks : in integer;
constant num_errors : in integer;
constant show_success_fail : in boolean
1935,6 → 2048,9
write(l, num_tests, right, 11);
write(l, string'(" Tests"));
writeline(output, l);
write(l, num_skiptests, right, 11);
write(l, string'(" Skipped tests"));
writeline(output, l);
write(l, num_checks, right, 11);
write(l, string'(" Checks"));
writeline(output, l);
1961,15 → 2077,27
print(lf & "Test " & str(test_num) & ": " & test_name & " (" & time'image(timestamp) & ")");
end procedure starttest_msg;
 
procedure skiptest_msg(
constant test_num : in integer;
constant test_name : in string;
constant timestamp : in time
) is
begin
print(lf & "Skipping Test " & str(test_num) & ": " & test_name & " (" & time'image(timestamp) & ")");
end procedure skiptest_msg;
 
procedure endtest_msg(
constant test_num : in integer;
constant test_name : in string;
constant timestamp : in time;
constant test_active : in boolean;
constant num_checks_in_test : in integer;
constant num_errors_in_test : in integer
) is
begin
print("Done with test " & str(test_num) & ": " & test_name & " (" & time'image(timestamp) & ")");
if test_active then
print("Done with test " & str(test_num) & ": " & test_name & " (" & time'image(timestamp) & ")");
end if;
end procedure endtest_msg;
 
procedure check_msg(

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.