----------------------------------------------------------------------
|
----------------------------------------------------------------------
|
---- ----
|
---- ----
|
---- PlTbUtils Fuctions and Procedures Package ----
|
---- PlTbUtils Fuctions and Procedures Package ----
|
---- ----
|
---- ----
|
---- This file is part of the PlTbUtils project ----
|
---- This file is part of the PlTbUtils project ----
|
---- http://opencores.org/project,pltbutils ----
|
---- http://opencores.org/project,pltbutils ----
|
---- ----
|
---- ----
|
---- Description: ----
|
---- Description: ----
|
---- PlTbUtils is a collection of functions, procedures and ----
|
---- PlTbUtils is a collection of functions, procedures and ----
|
---- components for easily creating stimuli and checking response ----
|
---- components for easily creating stimuli and checking response ----
|
---- in automatic self-checking testbenches. ----
|
---- in automatic self-checking testbenches. ----
|
---- ----
|
---- ----
|
---- This file defines fuctions and procedures for controlling ----
|
---- This file defines fuctions and procedures for controlling ----
|
---- stimuli to a DUT and checking response. ----
|
---- stimuli to a DUT and checking response. ----
|
---- ----
|
---- ----
|
---- To Do: ----
|
---- To Do: ----
|
---- - ----
|
---- - ----
|
---- ----
|
---- ----
|
---- Author(s): ----
|
---- Author(s): ----
|
---- - Per Larsson, pela@opencores.org ----
|
---- - Per Larsson, pela@opencores.org ----
|
---- ----
|
---- ----
|
----------------------------------------------------------------------
|
----------------------------------------------------------------------
|
---- ----
|
---- ----
|
---- Copyright (C) 2013 Authors and OPENCORES.ORG ----
|
---- Copyright (C) 2013 Authors and OPENCORES.ORG ----
|
---- ----
|
---- ----
|
---- This source file may be used and distributed without ----
|
---- This source file may be used and distributed without ----
|
---- restriction provided that this copyright statement is not ----
|
---- restriction provided that this copyright statement is not ----
|
---- removed from the file and that any derivative work contains ----
|
---- removed from the file and that any derivative work contains ----
|
---- the original copyright notice and the associated disclaimer. ----
|
---- the original copyright notice and the associated disclaimer. ----
|
---- ----
|
---- ----
|
---- This source file is free software; you can redistribute it ----
|
---- This source file is free software; you can redistribute it ----
|
---- and/or modify it under the terms of the GNU Lesser General ----
|
---- and/or modify it under the terms of the GNU Lesser General ----
|
---- Public License as published by the Free Software Foundation; ----
|
---- Public License as published by the Free Software Foundation; ----
|
---- either version 2.1 of the License, or (at your option) any ----
|
---- either version 2.1 of the License, or (at your option) any ----
|
---- later version. ----
|
---- later version. ----
|
---- ----
|
---- ----
|
---- This source is distributed in the hope that it will be ----
|
---- This source is distributed in the hope that it will be ----
|
---- useful, but WITHOUT ANY WARRANTY; without even the implied ----
|
---- useful, but WITHOUT ANY WARRANTY; without even the implied ----
|
---- warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR ----
|
---- warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR ----
|
---- PURPOSE. See the GNU Lesser General Public License for more ----
|
---- PURPOSE. See the GNU Lesser General Public License for more ----
|
---- details. ----
|
---- details. ----
|
---- ----
|
---- ----
|
---- You should have received a copy of the GNU Lesser General ----
|
---- You should have received a copy of the GNU Lesser General ----
|
---- Public License along with this source; if not, download it ----
|
---- Public License along with this source; if not, download it ----
|
---- from http://www.opencores.org/lgpl.shtml ----
|
---- from http://www.opencores.org/lgpl.shtml ----
|
---- ----
|
---- ----
|
----------------------------------------------------------------------
|
----------------------------------------------------------------------
|
library ieee;
|
library ieee;
|
use ieee.std_logic_1164.all;
|
use ieee.std_logic_1164.all;
|
use ieee.numeric_std.all;
|
use ieee.numeric_std.all;
|
use std.textio.all;
|
use std.textio.all;
|
use std.env.all; -- VHDL-2008
|
use std.env.all; -- VHDL-2008
|
use work.txt_util.all;
|
use work.txt_util.all;
|
use work.pltbutils_type_pkg.all; -- Use for VHDL-2002, comment out for VHDL-93
|
use work.pltbutils_type_pkg.all; -- Use for VHDL-2002, comment out for VHDL-93
|
|
|
package pltbutils_func_pkg is
|
package pltbutils_func_pkg is
|
|
|
-- See the package body for a description of the functions and procedures.
|
-- See the package body for a description of the functions and procedures.
|
constant C_PLTBUTILS_STRLEN : natural := 80;
|
constant C_PLTBUTILS_STRLEN : natural := 80;
|
constant C_PLTBUTILS_TIMEOUT : time := 10 sec;
|
constant C_PLTBUTILS_TIMEOUT : time := 10 sec;
|
constant C_WAIT_BEFORE_STOP_TIME : time := 1 us;
|
constant C_WAIT_BEFORE_STOP_TIME : time := 1 us;
|
|
|
-- Counters for number of checks and number of errors
|
-- Counters for number of checks and number of errors
|
-- VHDL-2002:
|
-- VHDL-2002:
|
shared variable v_pltbutils_test_num : pltbutils_p_integer_t;
|
shared variable v_pltbutils_test_num : pltbutils_p_integer_t;
|
shared variable v_pltbutils_test_name : pltbutils_p_string_t;
|
shared variable v_pltbutils_test_name : pltbutils_p_string_t;
|
shared variable v_pltbutils_info : pltbutils_p_string_t;
|
shared variable v_pltbutils_info : pltbutils_p_string_t;
|
shared variable v_pltbutils_chk_cnt : pltbutils_p_integer_t;
|
shared variable v_pltbutils_chk_cnt : pltbutils_p_integer_t;
|
shared variable v_pltbutils_err_cnt : pltbutils_p_integer_t;
|
shared variable v_pltbutils_err_cnt : pltbutils_p_integer_t;
|
shared variable v_pltbutils_stop_sim : pltbutils_p_std_logic_t;
|
shared variable v_pltbutils_stop_sim : pltbutils_p_std_logic_t;
|
-- VHDL-1993:
|
-- VHDL-1993:
|
--shared variable v_pltbutils_test_num : natural := 0;
|
--shared variable v_pltbutils_test_num : natural := 0;
|
--shared variable v_pltbutils_test_name : string(1 to C_PLTBUTILS_STRLEN) := (others => ' ');
|
--shared variable v_pltbutils_test_name : string(1 to C_PLTBUTILS_STRLEN) := (others => ' ');
|
--shared variable v_pltbutils_info : string(1 to C_PLTBUTILS_STRLEN) := (others => ' ');
|
--shared variable v_pltbutils_info : string(1 to C_PLTBUTILS_STRLEN) := (others => ' ');
|
--shared variable v_pltbutils_chk_cnt : natural := 0;
|
--shared variable v_pltbutils_chk_cnt : natural := 0;
|
--shared variable v_pltbutils_err_cnt : natural := 0;
|
--shared variable v_pltbutils_err_cnt : natural := 0;
|
--shared variable v_pltbutils_stop_sim : std_logic := '0';
|
--shared variable v_pltbutils_stop_sim : std_logic := '0';
|
|
|
-- Global status- and control signal
|
-- Global status- and control signal
|
type pltbutils_sc_t is
|
type pltbutils_sc_t is
|
record
|
record
|
test_num : natural;
|
test_num : natural;
|
test_name : string(1 to C_PLTBUTILS_STRLEN);
|
test_name : string(1 to C_PLTBUTILS_STRLEN);
|
info : string(1 to C_PLTBUTILS_STRLEN);
|
info : string(1 to C_PLTBUTILS_STRLEN);
|
chk_cnt : natural;
|
chk_cnt : natural;
|
err_cnt : natural;
|
err_cnt : natural;
|
stop_sim : std_logic;
|
stop_sim : std_logic;
|
end record;
|
end record;
|
signal pltbutils_sc : pltbutils_sc_t;
|
signal pltbutils_sc : pltbutils_sc_t;
|
|
|
-- startsim
|
-- startsim
|
procedure startsim(
|
procedure startsim(
|
constant testcase_name : in string;
|
constant testcase_name : in string;
|
signal pltbutils_sc : out pltbutils_sc_t
|
signal pltbutils_sc : out pltbutils_sc_t
|
);
|
);
|
|
|
-- endsim
|
-- endsim
|
procedure endsim(
|
procedure endsim(
|
signal pltbutils_sc : out pltbutils_sc_t;
|
signal pltbutils_sc : out pltbutils_sc_t;
|
constant show_success_fail : in boolean := false;
|
constant show_success_fail : in boolean := false;
|
constant force : in boolean := false
|
constant force : in boolean := false
|
);
|
);
|
|
|
-- testname
|
-- testname
|
procedure testname(
|
procedure testname(
|
constant num : in integer := -1;
|
constant num : in integer := -1;
|
constant name : in string;
|
constant name : in string;
|
signal pltbutils_sc : out pltbutils_sc_t
|
signal pltbutils_sc : out pltbutils_sc_t
|
);
|
);
|
procedure testname(
|
procedure testname(
|
constant name : in string;
|
constant name : in string;
|
signal pltbutils_sc : out pltbutils_sc_t
|
signal pltbutils_sc : out pltbutils_sc_t
|
);
|
);
|
|
|
-- print, printv, print2
|
-- print, printv, print2
|
procedure print(
|
procedure print(
|
signal s : out string;
|
signal s : out string;
|
constant txt : in string
|
constant txt : in string
|
);
|
);
|
procedure printv(
|
procedure printv(
|
variable s : out string;
|
variable s : out string;
|
constant txt : in string
|
constant txt : in string
|
);
|
);
|
procedure printv(
|
procedure printv(
|
variable s : inout pltbutils_p_string_t;
|
variable s : inout pltbutils_p_string_t;
|
constant txt : in string
|
constant txt : in string
|
);
|
);
|
procedure print(
|
procedure print(
|
signal pltbutils_sc : out pltbutils_sc_t;
|
signal pltbutils_sc : out pltbutils_sc_t;
|
constant txt : in string
|
constant txt : in string
|
);
|
);
|
procedure print2(
|
procedure print2(
|
signal s : out string;
|
signal s : out string;
|
constant txt : in string
|
constant txt : in string
|
);
|
);
|
procedure print2(
|
procedure print2(
|
signal pltbutils_sc : out pltbutils_sc_t;
|
signal pltbutils_sc : out pltbutils_sc_t;
|
constant txt : in string
|
constant txt : in string
|
);
|
);
|
|
|
-- waitclks
|
-- waitclks
|
procedure waitclks(
|
procedure waitclks(
|
constant N : in natural;
|
constant N : in natural;
|
signal clk : in std_logic;
|
signal clk : in std_logic;
|
signal pltbutils_sc : out pltbutils_sc_t;
|
signal pltbutils_sc : out pltbutils_sc_t;
|
constant falling : in boolean := false;
|
constant falling : in boolean := false;
|
constant timeout : in time := C_PLTBUTILS_TIMEOUT
|
constant timeout : in time := C_PLTBUTILS_TIMEOUT
|
);
|
);
|
|
|
-- check
|
-- check
|
procedure check(
|
procedure check(
|
constant rpt : in string;
|
constant rpt : in string;
|
constant data : in integer;
|
constant data : in integer;
|
constant expected : in integer;
|
constant expected : in integer;
|
signal pltbutils_sc : out pltbutils_sc_t
|
signal pltbutils_sc : out pltbutils_sc_t
|
);
|
);
|
procedure check(
|
procedure check(
|
constant rpt : in string;
|
constant rpt : in string;
|
constant data : in std_logic;
|
constant data : in std_logic;
|
constant expected : in std_logic;
|
constant expected : in std_logic;
|
signal pltbutils_sc : out pltbutils_sc_t
|
signal pltbutils_sc : out pltbutils_sc_t
|
);
|
);
|
procedure check(
|
procedure check(
|
constant rpt : in string;
|
constant rpt : in string;
|
constant data : in std_logic;
|
constant data : in std_logic;
|
constant expected : in integer;
|
constant expected : in integer;
|
signal pltbutils_sc : out pltbutils_sc_t
|
signal pltbutils_sc : out pltbutils_sc_t
|
);
|
);
|
procedure check(
|
procedure check(
|
constant rpt : in string;
|
constant rpt : in string;
|
constant data : in std_logic_vector;
|
constant data : in std_logic_vector;
|
constant expected : in std_logic_vector;
|
constant expected : in std_logic_vector;
|
signal pltbutils_sc : out pltbutils_sc_t
|
signal pltbutils_sc : out pltbutils_sc_t
|
);
|
);
|
procedure check(
|
procedure check(
|
constant rpt : in string;
|
constant rpt : in string;
|
constant data : in std_logic_vector;
|
constant data : in std_logic_vector;
|
constant expected : in std_logic_vector;
|
constant expected : in std_logic_vector;
|
constant mask : in std_logic_vector;
|
constant mask : in std_logic_vector;
|
signal pltbutils_sc : out pltbutils_sc_t
|
signal pltbutils_sc : out pltbutils_sc_t
|
);
|
);
|
procedure check(
|
procedure check(
|
constant rpt : in string;
|
constant rpt : in string;
|
constant data : in std_logic_vector;
|
constant data : in std_logic_vector;
|
constant expected : in integer;
|
constant expected : in integer;
|
signal pltbutils_sc : out pltbutils_sc_t
|
signal pltbutils_sc : out pltbutils_sc_t
|
);
|
);
|
procedure check(
|
procedure check(
|
constant rpt : in string;
|
constant rpt : in string;
|
constant data : in std_logic_vector;
|
constant data : in std_logic_vector;
|
constant expected : in integer;
|
constant expected : in integer;
|
constant mask : in std_logic_vector;
|
constant mask : in std_logic_vector;
|
signal pltbutils_sc : out pltbutils_sc_t
|
signal pltbutils_sc : out pltbutils_sc_t
|
);
|
);
|
procedure check(
|
procedure check(
|
constant rpt : in string;
|
constant rpt : in string;
|
constant data : in unsigned;
|
constant data : in unsigned;
|
constant expected : in unsigned;
|
constant expected : in unsigned;
|
signal pltbutils_sc : out pltbutils_sc_t
|
signal pltbutils_sc : out pltbutils_sc_t
|
);
|
);
|
procedure check(
|
procedure check(
|
constant rpt : in string;
|
constant rpt : in string;
|
constant data : in unsigned;
|
constant data : in unsigned;
|
constant expected : in integer;
|
constant expected : in integer;
|
signal pltbutils_sc : out pltbutils_sc_t
|
signal pltbutils_sc : out pltbutils_sc_t
|
);
|
);
|
procedure check(
|
procedure check(
|
constant rpt : in string;
|
constant rpt : in string;
|
constant data : in signed;
|
constant data : in signed;
|
constant expected : in signed;
|
constant expected : in signed;
|
signal pltbutils_sc : out pltbutils_sc_t
|
signal pltbutils_sc : out pltbutils_sc_t
|
);
|
);
|
procedure check(
|
procedure check(
|
constant rpt : in string;
|
constant rpt : in string;
|
constant data : in signed;
|
constant data : in signed;
|
constant expected : in integer;
|
constant expected : in integer;
|
signal pltbutils_sc : out pltbutils_sc_t
|
signal pltbutils_sc : out pltbutils_sc_t
|
);
|
);
|
procedure check(
|
procedure check(
|
constant rpt : in string;
|
constant rpt : in string;
|
constant expr : in boolean;
|
constant expr : in boolean;
|
signal pltbutils_sc : out pltbutils_sc_t
|
signal pltbutils_sc : out pltbutils_sc_t
|
);
|
);
|
|
|
-- pltbutils internal procedure(s), do not call from user's code
|
-- pltbutils internal procedure(s), do not call from user's code
|
procedure pltbutils_sc_update(
|
procedure pltbutils_sc_update(
|
signal pltbutils_sc : out pltbutils_sc_t
|
signal pltbutils_sc : out pltbutils_sc_t
|
);
|
);
|
|
|
end package pltbutils_func_pkg;
|
end package pltbutils_func_pkg;
|
|
|
package body pltbutils_func_pkg is
|
package body pltbutils_func_pkg is
|
|
|
----------------------------------------------------------------------------
|
----------------------------------------------------------------------------
|
-- startsim
|
-- startsim
|
--
|
--
|
-- procedure startsim(
|
-- procedure startsim(
|
-- constant testcase_name : in string;
|
-- constant testcase_name : in string;
|
-- signal pltbutils_sc : out pltbutils_sc_t
|
-- signal pltbutils_sc : out pltbutils_sc_t
|
-- )
|
-- )
|
--
|
--
|
-- Displays a message at start of simulation message, and initializes
|
-- Displays a message at start of simulation message, and initializes
|
-- PlTbUtils' global status and control signal.
|
-- PlTbUtils' global status and control signal.
|
-- Call startsim() only once.
|
-- Call startsim() only once.
|
--
|
--
|
-- Arguments:
|
-- Arguments:
|
-- testcase_name Name of the test case, e.g. "tc1".
|
-- testcase_name Name of the test case, e.g. "tc1".
|
--
|
--
|
-- pltbutils_sc PlTbUtils' global status- and control signal.
|
-- pltbutils_sc PlTbUtils' global status- and control signal.
|
-- Must be set to pltbutils_sc.
|
-- Must be set to pltbutils_sc.
|
--
|
--
|
-- NOTE:
|
-- NOTE:
|
-- The start-of-simulation message is not only intended to be informative
|
-- The start-of-simulation message is not only intended to be informative
|
-- for humans. It is also intended to be searched for by scripts,
|
-- for humans. It is also intended to be searched for by scripts,
|
-- e.g. for collecting results from a large number of regression tests.
|
-- e.g. for collecting results from a large number of regression tests.
|
-- For this reason, the message must be consistent and unique.
|
-- For this reason, the message must be consistent and unique.
|
--
|
--
|
-- DO NOT MODIFY the message "--- START OF SIMULATION ---".
|
-- DO NOT MODIFY the message "--- START OF SIMULATION ---".
|
-- DO NOT OUTPUT AN IDENTICAL MESSAGE anywhere else.
|
-- DO NOT OUTPUT AN IDENTICAL MESSAGE anywhere else.
|
--
|
--
|
-- Example:
|
-- Example:
|
-- startsim("tc1", pltbutils_sc);
|
-- startsim("tc1", pltbutils_sc);
|
----------------------------------------------------------------------------
|
----------------------------------------------------------------------------
|
procedure startsim(
|
procedure startsim(
|
constant testcase_name : in string;
|
constant testcase_name : in string;
|
signal pltbutils_sc : out pltbutils_sc_t
|
signal pltbutils_sc : out pltbutils_sc_t
|
) is
|
) is
|
variable dummy : integer;
|
variable dummy : integer;
|
begin
|
begin
|
printv(v_pltbutils_info, testcase_name);
|
printv(v_pltbutils_info, testcase_name);
|
print(lf & "--- START OF SIMULATION ---");
|
print(lf & "--- START OF SIMULATION ---");
|
print("Testcase: " & testcase_name);
|
print("Testcase: " & testcase_name);
|
print(time'image(now));
|
print(time'image(now));
|
-- VHDL-2002:
|
-- VHDL-2002:
|
v_pltbutils_stop_sim.clr;
|
v_pltbutils_stop_sim.clr;
|
v_pltbutils_test_num.clr;
|
v_pltbutils_test_num.clr;
|
v_pltbutils_test_name.set("START OF SIMULATION");
|
v_pltbutils_test_name.set("START OF SIMULATION");
|
v_pltbutils_chk_cnt.clr;
|
v_pltbutils_chk_cnt.clr;
|
v_pltbutils_err_cnt.clr;
|
v_pltbutils_err_cnt.clr;
|
pltbutils_sc_update(pltbutils_sc);
|
pltbutils_sc_update(pltbutils_sc);
|
-- VHDL-1993:
|
-- VHDL-1993:
|
--v_pltbutils_stop_sim := '0';
|
--v_pltbutils_stop_sim := '0';
|
--v_pltbutils_test_num := 0;
|
--v_pltbutils_test_num := 0;
|
--printv(v_pltbutils_test_name, "START OF SIMULATION");
|
--printv(v_pltbutils_test_name, "START OF SIMULATION");
|
--v_pltbutils_chk_cnt := 0;
|
--v_pltbutils_chk_cnt := 0;
|
--v_pltbutils_err_cnt := 0;
|
--v_pltbutils_err_cnt := 0;
|
--pltbutils_sc_update(pltbutils_sc);
|
--pltbutils_sc_update(pltbutils_sc);
|
end procedure startsim;
|
end procedure startsim;
|
|
|
----------------------------------------------------------------------------
|
----------------------------------------------------------------------------
|
-- endsim
|
-- endsim
|
--
|
--
|
-- procedure endsim(
|
-- procedure endsim(
|
-- signal pltbutils_sc : out pltbutils_sc_t;
|
-- signal pltbutils_sc : out pltbutils_sc_t;
|
-- constant show_success_fail : in boolean := false;
|
-- constant show_success_fail : in boolean := false;
|
-- constant force : in boolean := false
|
-- constant force : in boolean := false
|
-- )
|
-- )
|
--
|
--
|
-- Displays a message at end of simulation message, presents the simulation
|
-- Displays a message at end of simulation message, presents the simulation
|
-- results, and stops the simulation.
|
-- results, and stops the simulation.
|
-- Call endsim() it only once.
|
-- Call endsim() it only once.
|
--
|
--
|
-- Arguments:
|
-- Arguments:
|
-- pltbutils_sc PlTbUtils' global status- and control signal.
|
-- pltbutils_sc PlTbUtils' global status- and control signal.
|
-- Must be set to pltbutils_sc.
|
-- Must be set to pltbutils_sc.
|
--
|
--
|
-- show_success_fail If true, endsim() shows "*** SUCCESS ***",
|
-- show_success_fail If true, endsim() shows "*** SUCCESS ***",
|
-- "*** FAIL ***", or "*** NO CHECKS ***".
|
-- "*** FAIL ***", or "*** NO CHECKS ***".
|
-- Optional, default is false.
|
-- Optional, default is false.
|
--
|
--
|
-- force If true, forces the simulation to stop using an
|
-- force If true, forces the simulation to stop using an
|
-- assert failure statement. Use this option only
|
-- assert failure statement. Use this option only
|
-- if the normal way of stopping the simulation
|
-- if the normal way of stopping the simulation
|
-- doesn't work (see below).
|
-- doesn't work (see below).
|
-- Optional, default is false.
|
-- Optional, default is false.
|
--
|
--
|
-- The testbench should be designed so that all clocks stop when endsim()
|
-- The testbench should be designed so that all clocks stop when endsim()
|
-- sets the signal stop_sim to '1'. This should stop the simulator.
|
-- sets the signal stop_sim to '1'. This should stop the simulator.
|
-- In some cases, that doesn't work, then set the force argument to true, which
|
-- In some cases, that doesn't work, then set the force argument to true, which
|
-- causes a false assert failure, which should stop the simulator.
|
-- causes a false assert failure, which should stop the simulator.
|
-- Scripts searching transcript logs for errors and failures, should ignore
|
-- Scripts searching transcript logs for errors and failures, should ignore
|
-- the failure with "--- FORCE END OF SIMULATION ---" as part of the report.
|
-- the failure with "--- FORCE END OF SIMULATION ---" as part of the report.
|
--
|
--
|
-- NOTE:
|
-- NOTE:
|
-- The end-of-simulation messages and success/fail messages are not only
|
-- The end-of-simulation messages and success/fail messages are not only
|
-- intended to be informative for humans. They are also intended to be
|
-- intended to be informative for humans. They are also intended to be
|
-- searched for by scripts, e.g. for collecting results from a large number
|
-- searched for by scripts, e.g. for collecting results from a large number
|
-- of regression tests.
|
-- of regression tests.
|
-- For this reason, the message must be consistent and unique.
|
-- For this reason, the message must be consistent and unique.
|
--
|
--
|
-- DO NOT MODIFY the messages "--- END OF SIMULATION ---",
|
-- DO NOT MODIFY the messages "--- END OF SIMULATION ---",
|
-- "*** SUCCESS ***", "*** FAIL ***", "*** NO CHECKS ***".
|
-- "*** SUCCESS ***", "*** FAIL ***", "*** NO CHECKS ***".
|
-- DO NOT OUTPUT IDENTICAL MESSAGES anywhere else.
|
-- DO NOT OUTPUT IDENTICAL MESSAGES anywhere else.
|
--
|
--
|
-- Examples:
|
-- Examples:
|
-- endsim(pltbutils_sc);
|
-- endsim(pltbutils_sc);
|
-- endsim(pltbutils_sc, true);
|
-- endsim(pltbutils_sc, true);
|
-- endsim(pltbutils_sc, true, true);
|
-- endsim(pltbutils_sc, true, true);
|
----------------------------------------------------------------------------
|
----------------------------------------------------------------------------
|
procedure endsim(
|
procedure endsim(
|
signal pltbutils_sc : out pltbutils_sc_t;
|
signal pltbutils_sc : out pltbutils_sc_t;
|
constant show_success_fail : in boolean := false;
|
constant show_success_fail : in boolean := false;
|
constant force : in boolean := false
|
constant force : in boolean := false
|
) is
|
) is
|
variable l : line;
|
variable l : line;
|
begin
|
begin
|
printv(v_pltbutils_info, "");
|
printv(v_pltbutils_info, "");
|
print(lf & "--- END OF SIMULATION ---");
|
print(lf & "--- END OF SIMULATION ---");
|
print("Note: the results presented below are based on the PlTbUtil's check() procedure calls.");
|
print("Note: the results presented below are based on the PlTbUtil's check() procedure calls.");
|
print(" The design may contain more errors, for which there are no check() calls.");
|
print(" The design may contain more errors, for which there are no check() calls.");
|
write(l, now, right, 14);
|
write(l, now, right, 14);
|
writeline(output, l);
|
writeline(output, l);
|
write(l, v_pltbutils_chk_cnt.value, right, 11); -- VHDL-2002
|
write(l, v_pltbutils_chk_cnt.value, right, 11); -- VHDL-2002
|
--write(l, v_pltbutils_chk_cnt, right, 11); -- VHDL-1993
|
--write(l, v_pltbutils_chk_cnt, right, 11); -- VHDL-1993
|
write(l, string'(" Checks"));
|
write(l, string'(" Checks"));
|
writeline(output, l);
|
writeline(output, l);
|
write(l, v_pltbutils_err_cnt.value, right, 11); -- VHDL-2002
|
write(l, v_pltbutils_err_cnt.value, right, 11); -- VHDL-2002
|
--write(l, v_pltbutils_chk_cnt, right, 11); -- VHDL-1993
|
--write(l, v_pltbutils_chk_cnt, right, 11); -- VHDL-1993
|
write(l, string'(" Errors"));
|
write(l, string'(" Errors"));
|
writeline(output, l);
|
writeline(output, l);
|
|
|
if show_success_fail then
|
if show_success_fail then
|
if v_pltbutils_err_cnt.value = 0 and v_pltbutils_chk_cnt.value > 0 then -- VHDL-2002
|
if v_pltbutils_err_cnt.value = 0 and v_pltbutils_chk_cnt.value > 0 then -- VHDL-2002
|
--if v_pltbutils_err_cnt = 0 and v_pltbutils_chk_cnt > 0 then -- VHDL-1993
|
--if v_pltbutils_err_cnt = 0 and v_pltbutils_chk_cnt > 0 then -- VHDL-1993
|
print("*** SUCCESS ***");
|
print("*** SUCCESS ***");
|
elsif v_pltbutils_chk_cnt.value > 0 then -- VHDL-2002
|
elsif v_pltbutils_chk_cnt.value > 0 then -- VHDL-2002
|
--elsif v_pltbutils_chk_cnt > 0 then -- VHDL-1993
|
--elsif v_pltbutils_chk_cnt > 0 then -- VHDL-1993
|
print("*** FAIL ***");
|
print("*** FAIL ***");
|
else
|
else
|
print("*** NO CHECKS ***");
|
print("*** NO CHECKS ***");
|
end if;
|
end if;
|
end if;
|
end if;
|
-- VHDL-2002:
|
-- VHDL-2002:
|
v_pltbutils_stop_sim.set('1');
|
v_pltbutils_stop_sim.set('1');
|
v_pltbutils_test_num.clr;
|
v_pltbutils_test_num.clr;
|
v_pltbutils_test_name.set("END OF SIMULATION");
|
v_pltbutils_test_name.set("END OF SIMULATION");
|
-- VHDL-1993:
|
-- VHDL-1993:
|
--v_pltbutils_stop_sim := '1';
|
--v_pltbutils_stop_sim := '1';
|
--v_pltbutils_test_num := 0;
|
--v_pltbutils_test_num := 0;
|
--printv(v_pltbutils_test_name, "END OF SIMULATION");
|
--printv(v_pltbutils_test_name, "END OF SIMULATION");
|
pltbutils_sc_update(pltbutils_sc);
|
pltbutils_sc_update(pltbutils_sc);
|
wait for C_WAIT_BEFORE_STOP_TIME;
|
wait for C_WAIT_BEFORE_STOP_TIME;
|
stop(0); -- VHDL-2008
|
stop(0); -- VHDL-2008
|
assert not force
|
assert not force
|
report "--- FORCE END OF SIMULATION ---" &
|
report "--- FORCE END OF SIMULATION ---" &
|
" (ignore this false failure message, it's not a real failure)"
|
" (ignore this false failure message, it's not a real failure)"
|
severity failure;
|
severity failure;
|
wait;
|
wait;
|
end procedure endsim;
|
end procedure endsim;
|
|
|
----------------------------------------------------------------------------
|
----------------------------------------------------------------------------
|
-- testname
|
-- testname
|
--
|
--
|
-- procedure testname(
|
-- procedure testname(
|
-- constant num : in integer := -1;
|
-- constant num : in integer := -1;
|
-- constant name : in string;
|
-- constant name : in string;
|
-- signal pltbutils_sc : out pltbutils_sc_t
|
-- signal pltbutils_sc : out pltbutils_sc_t
|
-- )
|
-- )
|
--
|
--
|
-- Sets a number (optional) and a name for a test. The number and name will
|
-- Sets a number (optional) and a name for a test. The number and name will
|
-- be printed to the screen, and displayed in the simulator's waveform
|
-- be printed to the screen, and displayed in the simulator's waveform
|
-- window.
|
-- window.
|
-- The test number and name is also included if there errors reported by the
|
-- The test number and name is also included if there errors reported by the
|
-- check() procedure calls.
|
-- check() procedure calls.
|
--
|
--
|
-- Arguments:
|
-- Arguments:
|
-- num Test number. Optional, default is to increment
|
-- num Test number. Optional, default is to increment
|
-- the current test number.
|
-- the current test number.
|
--
|
--
|
-- name Test name.
|
-- name Test name.
|
--
|
--
|
-- pltbutils_sc PlTbUtils' global status- and control signal.
|
-- pltbutils_sc PlTbUtils' global status- and control signal.
|
-- Must be set to pltbutils_sc.
|
-- Must be set to pltbutils_sc.
|
--
|
--
|
-- If the test number is omitted, a new test number is automatically
|
-- If the test number is omitted, a new test number is automatically
|
-- computed by incrementing the current test number.
|
-- computed by incrementing the current test number.
|
-- Manually setting the test number may make it easier to find the test code
|
-- Manually setting the test number may make it easier to find the test code
|
-- in the testbench code, though.
|
-- in the testbench code, though.
|
--
|
--
|
-- Examples:
|
-- Examples:
|
-- testname("Reset test", pltbutils_sc);
|
-- testname("Reset test", pltbutils_sc);
|
-- testname(1, "Reset test", pltbutils_sc);
|
-- testname(1, "Reset test", pltbutils_sc);
|
----------------------------------------------------------------------------
|
----------------------------------------------------------------------------
|
procedure testname(
|
procedure testname(
|
constant num : in integer := -1;
|
constant num : in integer := -1;
|
constant name : in string;
|
constant name : in string;
|
signal pltbutils_sc : out pltbutils_sc_t
|
signal pltbutils_sc : out pltbutils_sc_t
|
) is
|
) is
|
begin
|
begin
|
-- VHDL-2002:
|
-- VHDL-2002:
|
if num = -1 then
|
if num = -1 then
|
v_pltbutils_test_num.inc;
|
v_pltbutils_test_num.inc;
|
else
|
else
|
v_pltbutils_test_num.set(num);
|
v_pltbutils_test_num.set(num);
|
end if;
|
end if;
|
v_pltbutils_test_name.set(name);
|
v_pltbutils_test_name.set(name);
|
pltbutils_sc_update(pltbutils_sc);
|
pltbutils_sc_update(pltbutils_sc);
|
print("Test " & str(v_pltbutils_test_num.value) & ": " & name);
|
print("Test " & str(v_pltbutils_test_num.value) & ": " & name);
|
-- VHDL-1993:
|
-- VHDL-1993:
|
--if num = -1 then
|
--if num = -1 then
|
-- b_pltbutils_test_num := v_pltbutils_test_num + 1;
|
-- b_pltbutils_test_num := v_pltbutils_test_num + 1;
|
--else
|
--else
|
-- v_pltbutils_test_num := num;
|
-- v_pltbutils_test_num := num;
|
--end if;
|
--end if;
|
--printv(v_pltbutils_test_name, name);
|
--printv(v_pltbutils_test_name, name);
|
--pltbutils_sc_update(pltbutils_sc);
|
--pltbutils_sc_update(pltbutils_sc);
|
--print("Test " & str(v_pltbutils_test_num) & ": " & name);
|
--print("Test " & str(v_pltbutils_test_num) & ": " & name);
|
end procedure testname;
|
end procedure testname;
|
|
|
procedure testname(
|
procedure testname(
|
constant name : in string;
|
constant name : in string;
|
signal pltbutils_sc : out pltbutils_sc_t
|
signal pltbutils_sc : out pltbutils_sc_t
|
) is
|
) is
|
begin
|
begin
|
testname(-1, name, pltbutils_sc);
|
testname(-1, name, pltbutils_sc);
|
end procedure testname;
|
end procedure testname;
|
|
|
----------------------------------------------------------------------------
|
----------------------------------------------------------------------------
|
-- print printv print2
|
-- print printv print2
|
--
|
--
|
-- procedure print(
|
-- procedure print(
|
-- signal s : out string;
|
-- signal s : out string;
|
-- constant txt : in string
|
-- constant txt : in string
|
-- )
|
-- )
|
--
|
--
|
-- procedure print(
|
-- procedure print(
|
-- signal pltbutils_sc : out pltbutils_sc_t;
|
-- signal pltbutils_sc : out pltbutils_sc_t;
|
-- constant txt : in string
|
-- constant txt : in string
|
-- )
|
-- )
|
--
|
--
|
-- procedure printv(
|
-- procedure printv(
|
-- variable s : out string;
|
-- variable s : out string;
|
-- constant txt : in string
|
-- constant txt : in string
|
-- )
|
-- )
|
--
|
--
|
-- procedure print2(
|
-- procedure print2(
|
-- signal s : out string;
|
-- signal s : out string;
|
-- constant txt : in string
|
-- constant txt : in string
|
-- )
|
-- )
|
--
|
--
|
-- procedure print2(
|
-- procedure print2(
|
-- signal pltbutils : out pltbutils_sc_t;
|
-- signal pltbutils : out pltbutils_sc_t;
|
-- constant txt : in string
|
-- constant txt : in string
|
-- )
|
-- )
|
--
|
--
|
-- print() prints text messages to a signal for viewing in the simulator's
|
-- print() prints text messages to a signal for viewing in the simulator's
|
-- waveform window. printv() does the same thing, but to a variable instead.
|
-- waveform window. printv() does the same thing, but to a variable instead.
|
-- print2() prints both to a signal and to the transcript window.
|
-- print2() prints both to a signal and to the transcript window.
|
-- The type of the output can be string or pltbutils_sc_t.
|
-- The type of the output can be string or pltbutils_sc_t.
|
-- If the type is pltbutils_sc_t, the name can be no other than pltbutils_sc.
|
-- If the type is pltbutils_sc_t, the name can be no other than pltbutils_sc.
|
--
|
--
|
-- Arguments:
|
-- Arguments:
|
-- s Signal or variable of type string to be
|
-- s Signal or variable of type string to be
|
-- printed to.
|
-- printed to.
|
--
|
--
|
-- txt The text.
|
-- txt The text.
|
--
|
--
|
-- pltbutils_sc PlTbUtils' global status- and control signal
|
-- pltbutils_sc PlTbUtils' global status- and control signal
|
-- of type pltbutils_sc_t.
|
-- of type pltbutils_sc_t.
|
-- The name must be no other than pltbutils_sc.
|
-- The name must be no other than pltbutils_sc.
|
--
|
--
|
-- If the string txt is longer than the signal s, the text will be truncated.
|
-- If the string txt is longer than the signal s, the text will be truncated.
|
-- If txt is shorter, s will be padded with spaces.
|
-- If txt is shorter, s will be padded with spaces.
|
--
|
--
|
-- Examples:
|
-- Examples:
|
-- print(msg, "Hello, world"); -- Prints to signal msg
|
-- print(msg, "Hello, world"); -- Prints to signal msg
|
-- printv(v_msg, "Hello, world"); -- Prints to variable msg
|
-- printv(v_msg, "Hello, world"); -- Prints to variable msg
|
-- print(pltbutils_sc, "Hello, world"); -- Prints to "info" in waveform window
|
-- print(pltbutils_sc, "Hello, world"); -- Prints to "info" in waveform window
|
-- print2(msg, "Hello, world"); -- Prints to signal and transcript window
|
-- print2(msg, "Hello, world"); -- Prints to signal and transcript window
|
-- print(pltbutils_sc, "Hello, world"); -- Prints to "info" in waveform and
|
-- print(pltbutils_sc, "Hello, world"); -- Prints to "info" in waveform and
|
-- -- transcript windows
|
-- -- transcript windows
|
----------------------------------------------------------------------------
|
----------------------------------------------------------------------------
|
procedure print(
|
procedure print(
|
signal s : out string;
|
signal s : out string;
|
constant txt : in string
|
constant txt : in string
|
) is
|
) is
|
variable j : positive := txt 'low;
|
variable j : positive := txt 'low;
|
begin
|
begin
|
for i in s'range loop
|
for i in s'range loop
|
if j <= txt 'high then
|
if j <= txt 'high then
|
s(i) <= txt (j);
|
s(i) <= txt (j);
|
else
|
else
|
s(i) <= ' ';
|
s(i) <= ' ';
|
end if;
|
end if;
|
j := j + 1;
|
j := j + 1;
|
end loop;
|
end loop;
|
end procedure print;
|
end procedure print;
|
|
|
procedure printv(
|
procedure printv(
|
variable s : out string;
|
variable s : out string;
|
constant txt : in string
|
constant txt : in string
|
) is
|
) is
|
variable j : positive := txt 'low;
|
variable j : positive := txt 'low;
|
begin
|
begin
|
for i in s'range loop
|
for i in s'range loop
|
if j <= txt 'high then
|
if j <= txt 'high then
|
s(i) := txt (j);
|
s(i) := txt (j);
|
else
|
else
|
s(i) := ' ';
|
s(i) := ' ';
|
end if;
|
end if;
|
j := j + 1;
|
j := j + 1;
|
end loop;
|
end loop;
|
end procedure printv;
|
end procedure printv;
|
|
|
-- VHDL-2002:
|
-- VHDL-2002:
|
procedure printv(
|
procedure printv(
|
variable s : inout pltbutils_p_string_t;
|
variable s : inout pltbutils_p_string_t;
|
constant txt : in string
|
constant txt : in string
|
) is
|
) is
|
variable j : positive := txt 'low;
|
variable j : positive := txt 'low;
|
begin
|
begin
|
s.set(txt );
|
s.set(txt );
|
end procedure printv;
|
end procedure printv;
|
|
|
-- Print to info element in pltbutils_sc, which shows up in waveform window
|
-- Print to info element in pltbutils_sc, which shows up in waveform window
|
procedure print(
|
procedure print(
|
signal pltbutils_sc : out pltbutils_sc_t;
|
signal pltbutils_sc : out pltbutils_sc_t;
|
constant txt : in string
|
constant txt : in string
|
) is
|
) is
|
variable j : positive := txt 'low;
|
variable j : positive := txt 'low;
|
begin
|
begin
|
printv(v_pltbutils_info, txt );
|
printv(v_pltbutils_info, txt );
|
pltbutils_sc_update(pltbutils_sc);
|
pltbutils_sc_update(pltbutils_sc);
|
end procedure print;
|
end procedure print;
|
|
|
procedure print2(
|
procedure print2(
|
signal s : out string;
|
signal s : out string;
|
constant txt : in string
|
constant txt : in string
|
) is
|
) is
|
begin
|
begin
|
print(s, txt );
|
print(s, txt );
|
print(txt );
|
print(txt );
|
end procedure print2;
|
end procedure print2;
|
|
|
procedure print2(
|
procedure print2(
|
signal pltbutils_sc : out pltbutils_sc_t;
|
signal pltbutils_sc : out pltbutils_sc_t;
|
constant txt : in string
|
constant txt : in string
|
) is
|
) is
|
begin
|
begin
|
print(pltbutils_sc, txt );
|
print(pltbutils_sc, txt );
|
print(txt );
|
print(txt );
|
end procedure print2;
|
end procedure print2;
|
|
|
----------------------------------------------------------------------------
|
----------------------------------------------------------------------------
|
-- waitclks
|
-- waitclks
|
--
|
--
|
-- procedure waitclks(
|
-- procedure waitclks(
|
-- constant n : in natural;
|
-- constant n : in natural;
|
-- signal clk : in std_logic;
|
-- signal clk : in std_logic;
|
-- signal pltbutils_sc : out pltbutils_sc_t;
|
-- signal pltbutils_sc : out pltbutils_sc_t;
|
-- constant falling : in boolean := false;
|
-- constant falling : in boolean := false;
|
-- constant timeout : in time := C_PLTBUTILS_TIMEOUT
|
-- constant timeout : in time := C_PLTBUTILS_TIMEOUT
|
-- )
|
-- )
|
--
|
--
|
-- Waits specified amount of clock cycles of the specified clock.
|
-- Waits specified amount of clock cycles of the specified clock.
|
-- Or, to be more precise, a specified number of specified clock edges of
|
-- Or, to be more precise, a specified number of specified clock edges of
|
-- the specified clock.
|
-- the specified clock.
|
--
|
--
|
-- Arguments:
|
-- Arguments:
|
-- n Number of rising or falling clock edges to wait.
|
-- n Number of rising or falling clock edges to wait.
|
--
|
--
|
-- clk The clock to wait for.
|
-- clk The clock to wait for.
|
--
|
--
|
-- pltbutils_sc PlTbUtils' global status- and control signal.
|
-- pltbutils_sc PlTbUtils' global status- and control signal.
|
-- Must be set to pltbutils_sc.
|
-- Must be set to pltbutils_sc.
|
--
|
--
|
-- falling If true, waits for falling edges, otherwise
|
-- falling If true, waits for falling edges, otherwise
|
-- rising edges. Optional, default is false.
|
-- rising edges. Optional, default is false.
|
--
|
--
|
-- timeout Timeout time, in case the clock is not working.
|
-- timeout Timeout time, in case the clock is not working.
|
-- Optional, default is C_PLTBUTILS_TIMEOUT.
|
-- Optional, default is C_PLTBUTILS_TIMEOUT.
|
--
|
--
|
-- Examples:
|
-- Examples:
|
-- waitclks(5, sys_clk, pltbutils_sc);
|
-- waitclks(5, sys_clk, pltbutils_sc);
|
-- waitclks(5, sys_clk, pltbutils_sc, true);
|
-- waitclks(5, sys_clk, pltbutils_sc, true);
|
-- waitclks(5, sys_clk, pltbutils_sc, true, 1 ms);
|
-- waitclks(5, sys_clk, pltbutils_sc, true, 1 ms);
|
----------------------------------------------------------------------------
|
----------------------------------------------------------------------------
|
procedure waitclks(
|
procedure waitclks(
|
constant n : in natural;
|
constant n : in natural;
|
signal clk : in std_logic;
|
signal clk : in std_logic;
|
signal pltbutils_sc : out pltbutils_sc_t;
|
signal pltbutils_sc : out pltbutils_sc_t;
|
constant falling : in boolean := false;
|
constant falling : in boolean := false;
|
constant timeout : in time := C_PLTBUTILS_TIMEOUT
|
constant timeout : in time := C_PLTBUTILS_TIMEOUT
|
) is
|
) is
|
variable i : natural := n;
|
variable i : natural := n;
|
variable v_timeout_time : time;
|
variable v_timeout_time : time;
|
begin
|
begin
|
v_timeout_time := now + timeout;
|
v_timeout_time := now + timeout;
|
while i > 0 loop
|
while i > 0 loop
|
if FALLING then
|
if FALLING then
|
wait until falling_edge(clk) for timeout / n;
|
wait until falling_edge(clk) for timeout / n;
|
else
|
else
|
wait until rising_edge(clk) for timeout / n;
|
wait until rising_edge(clk) for timeout / n;
|
end if;
|
end if;
|
i := i - 1;
|
i := i - 1;
|
end loop;
|
end loop;
|
if now >= v_timeout_time then
|
if now >= v_timeout_time then
|
assert false
|
assert false
|
report "waitclks() timeout"
|
report "waitclks() timeout"
|
severity error;
|
severity error;
|
v_pltbutils_err_cnt.inc; -- VHDL-2002
|
v_pltbutils_err_cnt.inc; -- VHDL-2002
|
--v_pltbutils_err_cnt := v_pltbutils_err_cnt + 1; -- VHDL-1993
|
--v_pltbutils_err_cnt := v_pltbutils_err_cnt + 1; -- VHDL-1993
|
pltbutils_sc_update(pltbutils_sc);
|
pltbutils_sc_update(pltbutils_sc);
|
end if;
|
end if;
|
end procedure waitclks;
|
end procedure waitclks;
|
|
|
----------------------------------------------------------------------------
|
----------------------------------------------------------------------------
|
-- check
|
-- check
|
--
|
--
|
-- procedure check(
|
-- procedure check(
|
-- constant rpt : in string;
|
-- constant rpt : in string;
|
-- constant data : in integer|std_logic|std_logic_vector|unsigned|signed;
|
-- constant data : in integer|std_logic|std_logic_vector|unsigned|signed;
|
-- constant expected : in integer|std_logic|std_logic_vector|unsigned|signed;
|
-- constant expected : in integer|std_logic|std_logic_vector|unsigned|signed;
|
-- signal pltbutils_sc : out pltbutils_sc_t
|
-- signal pltbutils_sc : out pltbutils_sc_t
|
-- )
|
-- )
|
--
|
--
|
-- procedure check(
|
-- procedure check(
|
-- constant rpt : in string;
|
-- constant rpt : in string;
|
-- constant data : in std_logic_vector;
|
-- constant data : in std_logic_vector;
|
-- constant expected : in std_logic_vector;
|
-- constant expected : in std_logic_vector;
|
-- constant mask : in std_logic_vector;
|
-- constant mask : in std_logic_vector;
|
-- signal pltbutils_sc : out pltbutils_sc_t
|
-- signal pltbutils_sc : out pltbutils_sc_t
|
-- )
|
-- )
|
--
|
--
|
-- procedure check(
|
-- procedure check(
|
-- constant rpt : in string;
|
-- constant rpt : in string;
|
-- constant expr : in boolean;
|
-- constant expr : in boolean;
|
-- signal pltbutils_sc : out pltbutils_sc_t
|
-- signal pltbutils_sc : out pltbutils_sc_t
|
-- )
|
-- )
|
--
|
--
|
-- Checks that the value of a signal or variable is equal to expected.
|
-- Checks that the value of a signal or variable is equal to expected.
|
-- If not equal, displays an error message and increments the error counter.
|
-- If not equal, displays an error message and increments the error counter.
|
--
|
--
|
-- Arguments:
|
-- Arguments:
|
-- rpt Report message to be displayed in case of
|
-- rpt Report message to be displayed in case of
|
-- mismatch.
|
-- mismatch.
|
-- It is recommended that the message is unique
|
-- It is recommended that the message is unique
|
-- and that it contains the name of the signal
|
-- and that it contains the name of the signal
|
-- or variable being checked.
|
-- or variable being checked.
|
-- The message should NOT contain the expected
|
-- The message should NOT contain the expected
|
-- value, becase check() prints that
|
-- value, becase check() prints that
|
-- automatically.
|
-- automatically.
|
--
|
--
|
-- data The signal or variable to be checked.
|
-- data The signal or variable to be checked.
|
-- Supported types: integer, std_logic,
|
-- Supported types: integer, std_logic,
|
-- std_logic_vector, unsigned, signed.
|
-- std_logic_vector, unsigned, signed.
|
--
|
--
|
-- expected Expected value.
|
-- expected Expected value.
|
-- Same type as data or integer.
|
-- Same type as data or integer.
|
--
|
--
|
-- mask Bit mask and:ed to data and expected
|
-- mask Bit mask and:ed to data and expected
|
-- before comparison.
|
-- before comparison.
|
-- Optional if data is std_logic_vector.
|
-- Optional if data is std_logic_vector.
|
-- Not allowed for other types.
|
-- Not allowed for other types.
|
--
|
--
|
-- expr boolean expression for checking.
|
-- expr boolean expression for checking.
|
-- This makes it possible to check any kind of
|
-- This makes it possible to check any kind of
|
-- expresion, not just equality.
|
-- expresion, not just equality.
|
--
|
--
|
-- pltbutils_sc PlTbUtils' global status- and control signal.
|
-- pltbutils_sc PlTbUtils' global status- and control signal.
|
-- Must be set to the name pltbutils_sc.
|
-- Must be set to the name pltbutils_sc.
|
--
|
--
|
-- Examples:
|
-- Examples:
|
-- check("dat_o after reset", dat_o, 0, pltbutils_sc);
|
-- check("dat_o after reset", dat_o, 0, pltbutils_sc);
|
-- -- With mask:
|
-- -- With mask:
|
-- check("Status field in reg_o after start", reg_o, x"01", x"03", pltbutils_sc);
|
-- check("Status field in reg_o after start", reg_o, x"01", x"03", pltbutils_sc);
|
-- -- Boolean expression:
|
-- -- Boolean expression:
|
-- check("Counter after data burst", cnt_o > 10, pltbutils_sc);
|
-- check("Counter after data burst", cnt_o > 10, pltbutils_sc);
|
----------------------------------------------------------------------------
|
----------------------------------------------------------------------------
|
-- check integer
|
-- check integer
|
procedure check(
|
procedure check(
|
constant rpt : in string;
|
constant rpt : in string;
|
constant data : in integer;
|
constant data : in integer;
|
constant expected : in integer;
|
constant expected : in integer;
|
signal pltbutils_sc : out pltbutils_sc_t
|
signal pltbutils_sc : out pltbutils_sc_t
|
) is
|
) is
|
begin
|
begin
|
v_pltbutils_chk_cnt.inc; -- VHDL-2002
|
v_pltbutils_chk_cnt.inc; -- VHDL-2002
|
--v_pltbutils_chk_cnt := v_pltbutils_chk_cnt + 1; -- VHDL-1993
|
--v_pltbutils_chk_cnt := v_pltbutils_chk_cnt + 1; -- VHDL-1993
|
if data /= expected then
|
if data /= expected then
|
assert false
|
assert false
|
report "Check " &
|
report "Check " &
|
str(v_pltbutils_chk_cnt.value) & -- VHDL-2002
|
str(v_pltbutils_chk_cnt.value) & -- VHDL-2002
|
--str(v_pltbutils_chk_cnt) & -- VHDL-1993
|
--str(v_pltbutils_chk_cnt) & -- VHDL-1993
|
"; " & rpt &
|
"; " & rpt &
|
"; Data=" & str(data) &
|
"; Data=" & str(data) &
|
" Expected=" & str(expected) &
|
" Expected=" & str(expected) &
|
" " & --str(character'(lf)) &
|
" " & --str(character'(lf)) &
|
" in test " &
|
" in test " &
|
str(v_pltbutils_test_num.value) & -- VHDL-2002
|
str(v_pltbutils_test_num.value) & -- VHDL-2002
|
--str(v_pltbutils_test_num) & -- VHDL-1993
|
--str(v_pltbutils_test_num) & -- VHDL-1993
|
" " &
|
" " &
|
v_pltbutils_test_name.value -- VHDL-2002
|
v_pltbutils_test_name.value -- VHDL-2002
|
--v_pltbutils_test_name -- VHDL-1993
|
--v_pltbutils_test_name -- VHDL-1993
|
severity error;
|
severity error;
|
v_pltbutils_err_cnt.inc; -- VHLD-2002
|
v_pltbutils_err_cnt.inc; -- VHLD-2002
|
--v_pltbutils_err_cnt := v_pltbutils_err_cnt + 1; -- VHDL-1993
|
--v_pltbutils_err_cnt := v_pltbutils_err_cnt + 1; -- VHDL-1993
|
end if;
|
end if;
|
pltbutils_sc_update(pltbutils_sc);
|
pltbutils_sc_update(pltbutils_sc);
|
end procedure check;
|
end procedure check;
|
|
|
-- check std_logic
|
-- check std_logic
|
procedure check(
|
procedure check(
|
constant rpt : in string;
|
constant rpt : in string;
|
constant data : in std_logic;
|
constant data : in std_logic;
|
constant expected : in std_logic;
|
constant expected : in std_logic;
|
signal pltbutils_sc : out pltbutils_sc_t
|
signal pltbutils_sc : out pltbutils_sc_t
|
) is
|
) is
|
begin
|
begin
|
v_pltbutils_chk_cnt.inc; -- VHDL-2002
|
v_pltbutils_chk_cnt.inc; -- VHDL-2002
|
--v_pltbutils_chk_cnt := v_pltbutils_chk_cnt + 1; -- VHDL-1993
|
--v_pltbutils_chk_cnt := v_pltbutils_chk_cnt + 1; -- VHDL-1993
|
if data /= expected then
|
if data /= expected then
|
assert false
|
assert false
|
report "Check " &
|
report "Check " &
|
str(v_pltbutils_chk_cnt.value) & -- VHDL-2002
|
str(v_pltbutils_chk_cnt.value) & -- VHDL-2002
|
--str(v_pltbutils_chk_cnt) & -- VHDL-1993
|
--str(v_pltbutils_chk_cnt) & -- VHDL-1993
|
"; " & rpt &
|
"; " & rpt &
|
"; Data=" & str(data) &
|
"; Data=" & str(data) &
|
" Expected=" & str(expected) &
|
" Expected=" & str(expected) &
|
" " & --str(character'(lf)) &
|
" " & --str(character'(lf)) &
|
" in test " &
|
" in test " &
|
str(v_pltbutils_test_num.value) & -- VHDL-2002
|
str(v_pltbutils_test_num.value) & -- VHDL-2002
|
--str(v_pltbutils_test_num) & -- VHDL-1993
|
--str(v_pltbutils_test_num) & -- VHDL-1993
|
" " &
|
" " &
|
v_pltbutils_test_name.value -- VHDL-2002
|
v_pltbutils_test_name.value -- VHDL-2002
|
--v_pltbutils_test_name -- VHDL-1993
|
--v_pltbutils_test_name -- VHDL-1993
|
severity error;
|
severity error;
|
v_pltbutils_err_cnt.inc; -- VHLD-2002
|
v_pltbutils_err_cnt.inc; -- VHLD-2002
|
--v_pltbutils_err_cnt := v_pltbutils_err_cnt + 1; -- VHDL-1993
|
--v_pltbutils_err_cnt := v_pltbutils_err_cnt + 1; -- VHDL-1993
|
end if;
|
end if;
|
pltbutils_sc_update(pltbutils_sc);
|
pltbutils_sc_update(pltbutils_sc);
|
end procedure check;
|
end procedure check;
|
|
|
-- check std_logic against integer
|
-- check std_logic against integer
|
procedure check(
|
procedure check(
|
constant rpt : in string;
|
constant rpt : in string;
|
constant data : in std_logic;
|
constant data : in std_logic;
|
constant expected : in integer;
|
constant expected : in integer;
|
signal pltbutils_sc : out pltbutils_sc_t
|
signal pltbutils_sc : out pltbutils_sc_t
|
) is
|
) is
|
variable v_expected : std_logic;
|
variable v_expected : std_logic;
|
begin
|
begin
|
if expected = 0 then
|
if expected = 0 then
|
check(rpt , data, std_logic'('0'), pltbutils_sc);
|
check(rpt , data, std_logic'('0'), pltbutils_sc);
|
elsif expected = 1 then
|
elsif expected = 1 then
|
check(rpt , data, std_logic'('1'), pltbutils_sc);
|
check(rpt , data, std_logic'('1'), pltbutils_sc);
|
else
|
else
|
v_pltbutils_chk_cnt.inc; -- VHDL-2002
|
v_pltbutils_chk_cnt.inc; -- VHDL-2002
|
--v_pltbutils_chk_cnt := v_pltbutils_chk_cnt + 1; -- VHDL-1993
|
--v_pltbutils_chk_cnt := v_pltbutils_chk_cnt + 1; -- VHDL-1993
|
assert false
|
assert false
|
report "Check " &
|
report "Check " &
|
str(v_pltbutils_chk_cnt.value) & -- VHDL-2002
|
str(v_pltbutils_chk_cnt.value) & -- VHDL-2002
|
--str(v_pltbutils_chk_cnt) & -- VHDL-1993
|
--str(v_pltbutils_chk_cnt) & -- VHDL-1993
|
"; " & rpt &
|
"; " & rpt &
|
"; Data=" & str(data) &
|
"; Data=" & str(data) &
|
" Expected=" & str(expected) &
|
" Expected=" & str(expected) &
|
" " & --str(character'(lf)) &
|
" " & --str(character'(lf)) &
|
" in test " &
|
" in test " &
|
str(v_pltbutils_test_num.value) & -- VHDL-2002
|
str(v_pltbutils_test_num.value) & -- VHDL-2002
|
--str(v_pltbutils_test_num) & -- VHDL-1993
|
--str(v_pltbutils_test_num) & -- VHDL-1993
|
" " &
|
" " &
|
v_pltbutils_test_name.value -- VHDL-2002
|
v_pltbutils_test_name.value -- VHDL-2002
|
--v_pltbutils_test_name -- VHDL-1993
|
--v_pltbutils_test_name -- VHDL-1993
|
severity error;
|
severity error;
|
v_pltbutils_err_cnt.inc; -- VHLD-2002
|
v_pltbutils_err_cnt.inc; -- VHLD-2002
|
--v_pltbutils_err_cnt := v_pltbutils_err_cnt + 1; -- VHDL-1993
|
--v_pltbutils_err_cnt := v_pltbutils_err_cnt + 1; -- VHDL-1993
|
pltbutils_sc_update(pltbutils_sc);
|
pltbutils_sc_update(pltbutils_sc);
|
end if;
|
end if;
|
end procedure check;
|
end procedure check;
|
|
|
-- check std_logic_vector
|
-- check std_logic_vector
|
procedure check(
|
procedure check(
|
constant rpt : in string;
|
constant rpt : in string;
|
constant data : in std_logic_vector;
|
constant data : in std_logic_vector;
|
constant expected : in std_logic_vector;
|
constant expected : in std_logic_vector;
|
signal pltbutils_sc : out pltbutils_sc_t
|
signal pltbutils_sc : out pltbutils_sc_t
|
) is
|
) is
|
begin
|
begin
|
v_pltbutils_chk_cnt.inc; -- VHDL-2002
|
v_pltbutils_chk_cnt.inc; -- VHDL-2002
|
--v_pltbutils_chk_cnt := v_pltbutils_chk_cnt + 1; -- VHDL-1993
|
--v_pltbutils_chk_cnt := v_pltbutils_chk_cnt + 1; -- VHDL-1993
|
if data /= expected then
|
if data /= expected then
|
assert false
|
assert false
|
report "Check " &
|
report "Check " &
|
str(v_pltbutils_chk_cnt.value) & -- VHDL-2002
|
str(v_pltbutils_chk_cnt.value) & -- VHDL-2002
|
--str(v_pltbutils_chk_cnt) & -- VHDL-1993
|
--str(v_pltbutils_chk_cnt) & -- VHDL-1993
|
"; " & rpt &
|
"; " & rpt &
|
"; Data=" & str(data) &
|
"; Data=" & str(data) &
|
" Expected=" & str(expected) &
|
" Expected=" & str(expected) &
|
" " & --str('lf') &
|
" " & --str('lf') &
|
" in test " &
|
" in test " &
|
str(v_pltbutils_test_num.value) & -- VHDL-2002
|
str(v_pltbutils_test_num.value) & -- VHDL-2002
|
--str(v_pltbutils_test_num) & -- VHDL-1993
|
--str(v_pltbutils_test_num) & -- VHDL-1993
|
" " &
|
" " &
|
v_pltbutils_test_name.value -- VHDL-2002
|
v_pltbutils_test_name.value -- VHDL-2002
|
--v_pltbutils_test_name -- VHDL-1993
|
--v_pltbutils_test_name -- VHDL-1993
|
severity error;
|
severity error;
|
v_pltbutils_err_cnt.inc; -- VHDL-2002
|
v_pltbutils_err_cnt.inc; -- VHDL-2002
|
--v_pltbutils_err_cnt := v_pltbutils_err_cnt + 1; -- VHDL-1993
|
--v_pltbutils_err_cnt := v_pltbutils_err_cnt + 1; -- VHDL-1993
|
end if;
|
end if;
|
pltbutils_sc_update(pltbutils_sc);
|
pltbutils_sc_update(pltbutils_sc);
|
end procedure check;
|
end procedure check;
|
|
|
-- check std_logic_vector with mask
|
-- check std_logic_vector with mask
|
procedure check(
|
procedure check(
|
constant rpt : in string;
|
constant rpt : in string;
|
constant data : in std_logic_vector;
|
constant data : in std_logic_vector;
|
constant expected : in std_logic_vector;
|
constant expected : in std_logic_vector;
|
constant mask : in std_logic_vector;
|
constant mask : in std_logic_vector;
|
signal pltbutils_sc : out pltbutils_sc_t
|
signal pltbutils_sc : out pltbutils_sc_t
|
) is
|
) is
|
begin
|
begin
|
v_pltbutils_chk_cnt.inc; -- VHDL-2002
|
v_pltbutils_chk_cnt.inc; -- VHDL-2002
|
--v_pltbutils_chk_cnt := v_pltbutils_chk_cnt + 1; -- VHDL-1993
|
--v_pltbutils_chk_cnt := v_pltbutils_chk_cnt + 1; -- VHDL-1993
|
if (data and mask) /= (expected and mask) then
|
if (data and mask) /= (expected and mask) then
|
assert false
|
assert false
|
report "Check " &
|
report "Check " &
|
str(v_pltbutils_chk_cnt.value) & -- VHDL-2002
|
str(v_pltbutils_chk_cnt.value) & -- VHDL-2002
|
--str(v_pltbutils_chk_cnt) & -- VHDL-1993
|
--str(v_pltbutils_chk_cnt) & -- VHDL-1993
|
"; " & rpt &
|
"; " & rpt &
|
"; Data=" & str(data) &
|
"; Data=" & str(data) &
|
" Expected=" & str(expected) &
|
" Expected=" & str(expected) &
|
" Mask=" & str(mask) &
|
" Mask=" & str(mask) &
|
" " & --str('lf') &
|
" " & --str('lf') &
|
" in test " &
|
" in test " &
|
str(v_pltbutils_test_num.value) & -- VHDL-2002
|
str(v_pltbutils_test_num.value) & -- VHDL-2002
|
--str(v_pltbutils_test_num) & -- VHDL-1993
|
--str(v_pltbutils_test_num) & -- VHDL-1993
|
" " &
|
" " &
|
v_pltbutils_test_name.value -- VHDL-2002
|
v_pltbutils_test_name.value -- VHDL-2002
|
--v_pltbutils_test_name -- VHDL-1993
|
--v_pltbutils_test_name -- VHDL-1993
|
severity error;
|
severity error;
|
v_pltbutils_err_cnt.inc; -- VHDL-2002
|
v_pltbutils_err_cnt.inc; -- VHDL-2002
|
--v_pltbutils_err_cnt := v_pltbutils_err_cnt + 1; -- VHDL-1993
|
--v_pltbutils_err_cnt := v_pltbutils_err_cnt + 1; -- VHDL-1993
|
end if;
|
end if;
|
pltbutils_sc_update(pltbutils_sc);
|
pltbutils_sc_update(pltbutils_sc);
|
end procedure check;
|
end procedure check;
|
|
|
-- check std_logic_vector against integer
|
-- check std_logic_vector against integer
|
procedure check(
|
procedure check(
|
constant rpt : in string;
|
constant rpt : in string;
|
constant data : in std_logic_vector;
|
constant data : in std_logic_vector;
|
constant expected : in integer;
|
constant expected : in integer;
|
signal pltbutils_sc : out pltbutils_sc_t
|
signal pltbutils_sc : out pltbutils_sc_t
|
) is
|
) is
|
begin
|
begin
|
check(rpt, data, std_logic_vector(to_signed(expected, data'length)), pltbutils_sc);
|
check(rpt, data, std_logic_vector(to_signed(expected, data'length)), pltbutils_sc);
|
end procedure check;
|
end procedure check;
|
|
|
-- check std_logic_vector with mask against integer
|
-- check std_logic_vector with mask against integer
|
procedure check(
|
procedure check(
|
constant rpt : in string;
|
constant rpt : in string;
|
constant data : in std_logic_vector;
|
constant data : in std_logic_vector;
|
constant expected : in integer;
|
constant expected : in integer;
|
constant mask : in std_logic_vector;
|
constant mask : in std_logic_vector;
|
signal pltbutils_sc : out pltbutils_sc_t
|
signal pltbutils_sc : out pltbutils_sc_t
|
) is
|
) is
|
begin
|
begin
|
check(rpt, data, std_logic_vector(to_signed(expected, data'length)), mask, pltbutils_sc);
|
check(rpt, data, std_logic_vector(to_signed(expected, data'length)), mask, pltbutils_sc);
|
end procedure check;
|
end procedure check;
|
|
|
-- check unsigned
|
-- check unsigned
|
procedure check(
|
procedure check(
|
constant rpt : in string;
|
constant rpt : in string;
|
constant data : in unsigned;
|
constant data : in unsigned;
|
constant expected : in unsigned;
|
constant expected : in unsigned;
|
signal pltbutils_sc : out pltbutils_sc_t
|
signal pltbutils_sc : out pltbutils_sc_t
|
) is
|
) is
|
begin
|
begin
|
v_pltbutils_chk_cnt.inc; -- VHDL-2002
|
v_pltbutils_chk_cnt.inc; -- VHDL-2002
|
--v_pltbutils_chk_cnt := v_pltbutils_chk_cnt + 1; -- VHDL-1993
|
--v_pltbutils_chk_cnt := v_pltbutils_chk_cnt + 1; -- VHDL-1993
|
if data /= expected then
|
if data /= expected then
|
assert false
|
assert false
|
report "Check " &
|
report "Check " &
|
str(v_pltbutils_chk_cnt.value) & -- VHDL-2002
|
str(v_pltbutils_chk_cnt.value) & -- VHDL-2002
|
--str(v_pltbutils_chk_cnt) & -- VHDL-1993
|
--str(v_pltbutils_chk_cnt) & -- VHDL-1993
|
"; " & rpt &
|
"; " & rpt &
|
"; Data=" & str(std_logic_vector(data)) &
|
"; Data=" & str(std_logic_vector(data)) &
|
" Expected=" & str(std_logic_vector(expected)) &
|
" Expected=" & str(std_logic_vector(expected)) &
|
" " & --str('lf') &
|
" " & --str('lf') &
|
" in test " &
|
" in test " &
|
str(v_pltbutils_test_num.value) & -- VHDL-2002
|
str(v_pltbutils_test_num.value) & -- VHDL-2002
|
--str(v_pltbutils_test_num) & -- VHDL-1993
|
--str(v_pltbutils_test_num) & -- VHDL-1993
|
" " &
|
" " &
|
v_pltbutils_test_name.value -- VHDL-2002
|
v_pltbutils_test_name.value -- VHDL-2002
|
--v_pltbutils_test_name -- VHDL-1993
|
--v_pltbutils_test_name -- VHDL-1993
|
severity error;
|
severity error;
|
v_pltbutils_err_cnt.inc; -- VHDL-2002
|
v_pltbutils_err_cnt.inc; -- VHDL-2002
|
--v_pltbutils_err_cnt := v_pltbutils_err_cnt + 1; -- VHDL-1993
|
--v_pltbutils_err_cnt := v_pltbutils_err_cnt + 1; -- VHDL-1993
|
end if;
|
end if;
|
pltbutils_sc_update(pltbutils_sc);
|
pltbutils_sc_update(pltbutils_sc);
|
end procedure check;
|
end procedure check;
|
|
|
-- check unsigned against integer
|
-- check unsigned against integer
|
procedure check(
|
procedure check(
|
constant rpt : in string;
|
constant rpt : in string;
|
constant data : in unsigned;
|
constant data : in unsigned;
|
constant expected : in integer;
|
constant expected : in integer;
|
signal pltbutils_sc : out pltbutils_sc_t
|
signal pltbutils_sc : out pltbutils_sc_t
|
) is
|
) is
|
begin
|
begin
|
check(rpt, data, to_unsigned(expected, data'length), pltbutils_sc);
|
check(rpt, data, to_unsigned(expected, data'length), pltbutils_sc);
|
end procedure check;
|
end procedure check;
|
|
|
-- check signed
|
-- check signed
|
procedure check(
|
procedure check(
|
constant rpt : in string;
|
constant rpt : in string;
|
constant data : in signed;
|
constant data : in signed;
|
constant expected : in signed;
|
constant expected : in signed;
|
signal pltbutils_sc : out pltbutils_sc_t
|
signal pltbutils_sc : out pltbutils_sc_t
|
) is
|
) is
|
begin
|
begin
|
v_pltbutils_chk_cnt.inc; -- VHDL-2002
|
v_pltbutils_chk_cnt.inc; -- VHDL-2002
|
--v_pltbutils_chk_cnt := v_pltbutils_chk_cnt + 1; -- VHDL-1993
|
--v_pltbutils_chk_cnt := v_pltbutils_chk_cnt + 1; -- VHDL-1993
|
if data /= expected then
|
if data /= expected then
|
assert false
|
assert false
|
report "Check " &
|
report "Check " &
|
str(v_pltbutils_chk_cnt.value) & -- VHDL-2002
|
str(v_pltbutils_chk_cnt.value) & -- VHDL-2002
|
--str(v_pltbutils_chk_cnt) & -- VHDL-1993
|
--str(v_pltbutils_chk_cnt) & -- VHDL-1993
|
"; " & rpt &
|
"; " & rpt &
|
"; Data=" & str(std_logic_vector(data)) &
|
"; Data=" & str(std_logic_vector(data)) &
|
" Expected=" & str(std_logic_vector(expected)) &
|
" Expected=" & str(std_logic_vector(expected)) &
|
" " & --str('lf') &
|
" " & --str('lf') &
|
" in test " &
|
" in test " &
|
str(v_pltbutils_test_num.value) & -- VHDL-2002
|
str(v_pltbutils_test_num.value) & -- VHDL-2002
|
--str(v_pltbutils_test_num) & -- VHDL-1993
|
--str(v_pltbutils_test_num) & -- VHDL-1993
|
" " &
|
" " &
|
v_pltbutils_test_name.value -- VHDL-2002
|
v_pltbutils_test_name.value -- VHDL-2002
|
--v_pltbutils_test_name -- VHDL-1993
|
--v_pltbutils_test_name -- VHDL-1993
|
severity error;
|
severity error;
|
v_pltbutils_err_cnt.inc; -- VHDL-2002
|
v_pltbutils_err_cnt.inc; -- VHDL-2002
|
--v_pltbutils_err_cnt := v_pltbutils_err_cnt + 1; -- VHDL-1993
|
--v_pltbutils_err_cnt := v_pltbutils_err_cnt + 1; -- VHDL-1993
|
end if;
|
end if;
|
pltbutils_sc_update(pltbutils_sc);
|
pltbutils_sc_update(pltbutils_sc);
|
end procedure check;
|
end procedure check;
|
|
|
-- check signed against integer
|
-- check signed against integer
|
-- TODO: find the bug reported by tb_pltbutils when expected is negative (-1):
|
-- TODO: find the bug reported by tb_pltbutils when expected is negative (-1):
|
-- ** Error: (vsim-86) numstd_conv_unsigned_nu: NATURAL arg value is negative (-1)
|
-- ** Error: (vsim-86) numstd_conv_unsigned_nu: NATURAL arg value is negative (-1)
|
procedure check(
|
procedure check(
|
constant rpt : in string;
|
constant rpt : in string;
|
constant data : in signed;
|
constant data : in signed;
|
constant expected : in integer;
|
constant expected : in integer;
|
signal pltbutils_sc : out pltbutils_sc_t
|
signal pltbutils_sc : out pltbutils_sc_t
|
) is
|
) is
|
begin
|
begin
|
check(rpt, data, to_signed(expected, data'length), pltbutils_sc);
|
check(rpt, data, to_signed(expected, data'length), pltbutils_sc);
|
end procedure check;
|
end procedure check;
|
|
|
-- check with boolean expression
|
-- check with boolean expression
|
-- Check signal or variable with a boolean expression as argument C_EXPR.
|
-- Check signal or variable with a boolean expression as argument C_EXPR.
|
-- This allowes any kind of check.
|
-- This allowes any kind of check.
|
procedure check(
|
procedure check(
|
constant rpt : in string;
|
constant rpt : in string;
|
constant expr : in boolean;
|
constant expr : in boolean;
|
signal pltbutils_sc : out pltbutils_sc_t
|
signal pltbutils_sc : out pltbutils_sc_t
|
) is
|
) is
|
begin
|
begin
|
v_pltbutils_chk_cnt.inc; -- VHDL-2002
|
v_pltbutils_chk_cnt.inc; -- VHDL-2002
|
--v_pltbutils_chk_cnt := v_pltbutils_chk_cnt + 1; -- VHDL-1993
|
--v_pltbutils_chk_cnt := v_pltbutils_chk_cnt + 1; -- VHDL-1993
|
if not expr then
|
if not expr then
|
assert false
|
assert false
|
report "Check " &
|
report "Check " &
|
str(v_pltbutils_chk_cnt.value) & -- VHDL-2002
|
str(v_pltbutils_chk_cnt.value) & -- VHDL-2002
|
--str(v_pltbutils_chk_cnt) & -- VHDL-1993
|
--str(v_pltbutils_chk_cnt) & -- VHDL-1993
|
"; " & rpt &
|
"; " & rpt &
|
" " & --str('lf') &
|
" " & --str('lf') &
|
" in test " &
|
" in test " &
|
str(v_pltbutils_test_num.value) & -- VHDL-2002
|
str(v_pltbutils_test_num.value) & -- VHDL-2002
|
--str(v_pltbutils_test_num) & -- VHDL-1993
|
--str(v_pltbutils_test_num) & -- VHDL-1993
|
" " &
|
" " &
|
v_pltbutils_test_name.value -- VHDL-2002
|
v_pltbutils_test_name.value -- VHDL-2002
|
--v_pltbutils_test_name -- VHDL-1993
|
--v_pltbutils_test_name -- VHDL-1993
|
severity error;
|
severity error;
|
v_pltbutils_err_cnt.inc; -- VHDL-2002
|
v_pltbutils_err_cnt.inc; -- VHDL-2002
|
--v_pltbutils_err_cnt := v_pltbutils_err_cnt + 1; -- VHDL-1993
|
--v_pltbutils_err_cnt := v_pltbutils_err_cnt + 1; -- VHDL-1993
|
end if;
|
end if;
|
pltbutils_sc_update(pltbutils_sc);
|
pltbutils_sc_update(pltbutils_sc);
|
end procedure check;
|
end procedure check;
|
|
|
----------------------------------------------------------------------------
|
----------------------------------------------------------------------------
|
-- pltbutils internal procedure(s), called from other pltbutils procedures.
|
-- pltbutils internal procedure(s), called from other pltbutils procedures.
|
-- Do not to call this/these from user's code.
|
-- Do not to call this/these from user's code.
|
-- This/these procedures are undocumented in the specification on purpose.
|
-- This/these procedures are undocumented in the specification on purpose.
|
----------------------------------------------------------------------------
|
----------------------------------------------------------------------------
|
procedure pltbutils_sc_update(
|
procedure pltbutils_sc_update(
|
signal pltbutils_sc : out pltbutils_sc_t
|
signal pltbutils_sc : out pltbutils_sc_t
|
) is
|
) is
|
begin
|
begin
|
-- VHDL-2002:
|
-- VHDL-2002:
|
pltbutils_sc.test_num <= v_pltbutils_test_num.value;
|
pltbutils_sc.test_num <= v_pltbutils_test_num.value;
|
print(pltbutils_sc.test_name, v_pltbutils_test_name.value);
|
print(pltbutils_sc.test_name, v_pltbutils_test_name.value);
|
print(pltbutils_sc.info, v_pltbutils_info.value);
|
print(pltbutils_sc.info, v_pltbutils_info.value);
|
pltbutils_sc.chk_cnt <= v_pltbutils_chk_cnt.value;
|
pltbutils_sc.chk_cnt <= v_pltbutils_chk_cnt.value;
|
pltbutils_sc.err_cnt <= v_pltbutils_err_cnt.value;
|
pltbutils_sc.err_cnt <= v_pltbutils_err_cnt.value;
|
pltbutils_sc.stop_sim <= v_pltbutils_stop_sim.value;
|
pltbutils_sc.stop_sim <= v_pltbutils_stop_sim.value;
|
-- VHDL-1993:
|
-- VHDL-1993:
|
--pltbutils_sc.test_num <= v_pltbutils_test_num;
|
--pltbutils_sc.test_num <= v_pltbutils_test_num;
|
--print(pltbutils_sc.test_name, v_pltbutils_test_name);
|
--print(pltbutils_sc.test_name, v_pltbutils_test_name);
|
--print(pltbutils_sc.info, v_pltbutils_info);
|
--print(pltbutils_sc.info, v_pltbutils_info);
|
--pltbutils_sc.chk_cnt <= v_pltbutils_chk_cnt;
|
--pltbutils_sc.chk_cnt <= v_pltbutils_chk_cnt;
|
--pltbutils_sc.err_cnt <= v_pltbutils_err_cnt;
|
--pltbutils_sc.err_cnt <= v_pltbutils_err_cnt;
|
--pltbutils_sc.stop_sim <= v_pltbutils_stop_sim;
|
--pltbutils_sc.stop_sim <= v_pltbutils_stop_sim;
|
end procedure pltbutils_sc_update;
|
end procedure pltbutils_sc_update;
|
|
|
|
|