URL
https://opencores.org/ocsvn/pltbutils/pltbutils/trunk
Subversion Repositories pltbutils
Compare Revisions
- This comparison shows the changes necessary to convert path
/
- from Rev 107 to Rev 108
- ↔ Reverse comparison
Rev 107 → Rev 108
/pltbutils/tags/v1.2/bench/testfiles/bintestfile_correct.bin
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
pltbutils/tags/v1.2/bench/testfiles/bintestfile_correct.bin
Property changes :
Added: svn:mime-type
## -0,0 +1 ##
+application/octet-stream
\ No newline at end of property
Index: pltbutils/tags/v1.2/bench/testfiles/bintestfile_error.bin
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Index: pltbutils/tags/v1.2/bench/testfiles/bintestfile_error.bin
===================================================================
--- pltbutils/tags/v1.2/bench/testfiles/bintestfile_error.bin (nonexistent)
+++ pltbutils/tags/v1.2/bench/testfiles/bintestfile_error.bin (revision 108)
pltbutils/tags/v1.2/bench/testfiles/bintestfile_error.bin
Property changes :
Added: svn:mime-type
## -0,0 +1 ##
+application/octet-stream
\ No newline at end of property
Index: pltbutils/tags/v1.2/bench/testfiles/bintestfile_longer.bin
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Index: pltbutils/tags/v1.2/bench/testfiles/bintestfile_longer.bin
===================================================================
--- pltbutils/tags/v1.2/bench/testfiles/bintestfile_longer.bin (nonexistent)
+++ pltbutils/tags/v1.2/bench/testfiles/bintestfile_longer.bin (revision 108)
pltbutils/tags/v1.2/bench/testfiles/bintestfile_longer.bin
Property changes :
Added: svn:mime-type
## -0,0 +1 ##
+application/octet-stream
\ No newline at end of property
Index: pltbutils/tags/v1.2/bench/testfiles/bintestfile_reference.bin
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Index: pltbutils/tags/v1.2/bench/testfiles/bintestfile_reference.bin
===================================================================
--- pltbutils/tags/v1.2/bench/testfiles/bintestfile_reference.bin (nonexistent)
+++ pltbutils/tags/v1.2/bench/testfiles/bintestfile_reference.bin (revision 108)
pltbutils/tags/v1.2/bench/testfiles/bintestfile_reference.bin
Property changes :
Added: svn:mime-type
## -0,0 +1 ##
+application/octet-stream
\ No newline at end of property
Index: pltbutils/tags/v1.2/bench/testfiles/bintestfile_shorter.bin
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Index: pltbutils/tags/v1.2/bench/testfiles/bintestfile_shorter.bin
===================================================================
--- pltbutils/tags/v1.2/bench/testfiles/bintestfile_shorter.bin (nonexistent)
+++ pltbutils/tags/v1.2/bench/testfiles/bintestfile_shorter.bin (revision 108)
pltbutils/tags/v1.2/bench/testfiles/bintestfile_shorter.bin
Property changes :
Added: svn:mime-type
## -0,0 +1 ##
+application/octet-stream
\ No newline at end of property
Index: pltbutils/tags/v1.2/bench/testfiles/dattestfile_correct.dat
===================================================================
--- pltbutils/tags/v1.2/bench/testfiles/dattestfile_correct.dat (nonexistent)
+++ pltbutils/tags/v1.2/bench/testfiles/dattestfile_correct.dat (revision 108)
@@ -0,0 +1,10 @@
+# Dattestfile (modified comments and whitespaces, but it shouldn't matter)
+1 2
+3
+4 5 6
+7 8 9
+ ABC DEF
+GHI
+ JKL MNO PQR
+# Modified Comment
+STUVW XYZ
Index: pltbutils/tags/v1.2/bench/testfiles/dattestfile_error.dat
===================================================================
--- pltbutils/tags/v1.2/bench/testfiles/dattestfile_error.dat (nonexistent)
+++ pltbutils/tags/v1.2/bench/testfiles/dattestfile_error.dat (revision 108)
@@ -0,0 +1,9 @@
+# Dattestfile Error
+1
+2
+7
+4 5 6
+7 8 9
+ ABC DEF GHI
+ JqL MNO PQR # Comment2
+STUVW XYZ
Index: pltbutils/tags/v1.2/bench/testfiles/dattestfile_longer.dat
===================================================================
--- pltbutils/tags/v1.2/bench/testfiles/dattestfile_longer.dat (nonexistent)
+++ pltbutils/tags/v1.2/bench/testfiles/dattestfile_longer.dat (revision 108)
@@ -0,0 +1,9 @@
+# Dattestfile
+1
+2
+3
+4 5 6
+7 8 9
+ ABC DEF GHI
+ JKL MNO PQR # Comment
+STUVW XYZ WOW
Index: pltbutils/tags/v1.2/bench/testfiles/dattestfile_reference.dat
===================================================================
--- pltbutils/tags/v1.2/bench/testfiles/dattestfile_reference.dat (nonexistent)
+++ pltbutils/tags/v1.2/bench/testfiles/dattestfile_reference.dat (revision 108)
@@ -0,0 +1,9 @@
+# Dattestfile
+1
+2
+3
+4 5 6
+7 8 9
+ ABC DEF GHI
+ JKL MNO PQR # Comment
+STUVW XYZ
Index: pltbutils/tags/v1.2/bench/testfiles/dattestfile_shorter.dat
===================================================================
--- pltbutils/tags/v1.2/bench/testfiles/dattestfile_shorter.dat (nonexistent)
+++ pltbutils/tags/v1.2/bench/testfiles/dattestfile_shorter.dat (revision 108)
@@ -0,0 +1,9 @@
+# Dattestfile
+1
+2
+3
+4 5 6
+7 8 9
+ ABC DEF GHI
+ JKL MNO PQR # Comment
+STUVW
Index: pltbutils/tags/v1.2/bench/testfiles/texttestfile_correct.txt
===================================================================
--- pltbutils/tags/v1.2/bench/testfiles/texttestfile_correct.txt (nonexistent)
+++ pltbutils/tags/v1.2/bench/testfiles/texttestfile_correct.txt (revision 108)
@@ -0,0 +1,3 @@
+Texttestfile line 1
+line 2
+line 3
Index: pltbutils/tags/v1.2/bench/testfiles/texttestfile_error.txt
===================================================================
--- pltbutils/tags/v1.2/bench/testfiles/texttestfile_error.txt (nonexistent)
+++ pltbutils/tags/v1.2/bench/testfiles/texttestfile_error.txt (revision 108)
@@ -0,0 +1,3 @@
+Texttestfile lone 1
+line 2
+line 3
Index: pltbutils/tags/v1.2/bench/testfiles/texttestfile_longer.txt
===================================================================
--- pltbutils/tags/v1.2/bench/testfiles/texttestfile_longer.txt (nonexistent)
+++ pltbutils/tags/v1.2/bench/testfiles/texttestfile_longer.txt (revision 108)
@@ -0,0 +1,4 @@
+Texttestfile line 1
+line 2
+line 3
+l
\ No newline at end of file
Index: pltbutils/tags/v1.2/bench/testfiles/texttestfile_reference.txt
===================================================================
--- pltbutils/tags/v1.2/bench/testfiles/texttestfile_reference.txt (nonexistent)
+++ pltbutils/tags/v1.2/bench/testfiles/texttestfile_reference.txt (revision 108)
@@ -0,0 +1,3 @@
+Texttestfile line 1
+line 2
+line 3
Index: pltbutils/tags/v1.2/bench/testfiles/texttestfile_shorter.txt
===================================================================
--- pltbutils/tags/v1.2/bench/testfiles/texttestfile_shorter.txt (nonexistent)
+++ pltbutils/tags/v1.2/bench/testfiles/texttestfile_shorter.txt (revision 108)
@@ -0,0 +1,3 @@
+Texttestfile line 1
+line 2
+line
\ No newline at end of file
Index: pltbutils/tags/v1.2/bench/vhdl/tb_pltbutils.vhd
===================================================================
--- pltbutils/tags/v1.2/bench/vhdl/tb_pltbutils.vhd (nonexistent)
+++ pltbutils/tags/v1.2/bench/vhdl/tb_pltbutils.vhd (revision 108)
@@ -0,0 +1,622 @@
+----------------------------------------------------------------------
+---- ----
+---- PlTbUtils Testbench ----
+---- ----
+---- This file is part of the PlTbUtils project ----
+---- http://opencores.org/project,pltbutils ----
+---- ----
+---- Description ----
+---- PlTbUtils is a collection of functions, procedures and ----
+---- components for easily creating stimuli and checking response ----
+---- in automatic self-checking testbenches. ----
+---- ----
+---- This is a testbench file, which is used to verify ----
+---- - pltbutils_func_pkg ----
+---- - pltbutils_comp ----
+---- This testbench is NOT selfchecking or automatic. ----
+---- Manually check the transcript and waveform, when simulating. ----
+---- It prints some informative text in the transcript, to help ----
+---- with the manual inspection. ----
+---- ----
+---- ----
+---- To Do: ----
+---- - ----
+---- ----
+---- Author(s): ----
+---- - Per Larsson, pela.opencores@gmail.com ----
+---- ----
+----------------------------------------------------------------------
+---- ----
+---- Copyright (C) 2013-2020 Authors and OPENCORES.ORG ----
+---- ----
+---- This source file may be used and distributed without ----
+---- restriction provided that this copyright statement is not ----
+---- removed from the file and that any derivative work contains ----
+---- the original copyright notice and the associated disclaimer. ----
+---- ----
+---- This source file is free software; you can redistribute it ----
+---- and/or modify it under the terms of the GNU Lesser General ----
+---- Public License as published by the Free Software Foundation; ----
+---- either version 2.1 of the License, or (at your option) any ----
+---- later version. ----
+---- ----
+---- This source is distributed in the hope that it will be ----
+---- useful, but WITHOUT ANY WARRANTY; without even the implied ----
+---- warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR ----
+---- PURPOSE. See the GNU Lesser General Public License for more ----
+---- details. ----
+---- ----
+---- You should have received a copy of the GNU Lesser General ----
+---- Public License along with this source; if not, download it ----
+---- from http://www.opencores.org/lgpl.shtml ----
+---- ----
+----------------------------------------------------------------------
+library ieee;
+use ieee.std_logic_1164.all;
+use ieee.numeric_std.all;
+use std.textio.all;
+use work.txt_util.all;
+use work.pltbutils_func_pkg.all;
+use work.pltbutils_comp_pkg.all;
+
+entity tb_pltbutils is
+ generic (
+ G_SKIPTESTS : std_logic_vector := (
+ '0', -- Dummy
+ '0', -- Test 1
+ '0', -- Test 2
+ '0', -- Test 3
+ '0', -- Test 4: NonSkipTest
+ '1' -- Test 5: SkipTest
+ );
+ G_CLK_PERIOD : time := 10 ns;
+ G_CHECKFILE_VERBOSITY : integer := 10;
+ G_BINTESTFILE_HEADER : string := "Bintestfile R ";
+ G_BINTESTFILE_LEN : integer := 528;
+ G_BINTESTFILE_REFERENCE : string := "../../../bench/testfiles/bintestfile_reference.bin";
+ G_BINTESTFILE_CORRECT : string := "../../../bench/testfiles/bintestfile_correct.bin";
+ G_BINTESTFILE_ERROR : string := "../../../bench/testfiles/bintestfile_error.bin";
+ G_BINTESTFILE_SHORTER : string := "../../../bench/testfiles/bintestfile_shorter.bin";
+ G_BINTESTFILE_LONGER : string := "../../../bench/testfiles/bintestfile_longer.txt";
+ G_TEXTTESTFILE_REFERENCE : string := "../../../bench/testfiles/texttestfile_reference.txt";
+ G_TEXTTESTFILE_CORRECT : string := "../../../bench/testfiles/texttestfile_correct.txt";
+ G_TEXTTESTFILE_ERROR : string := "../../../bench/testfiles/texttestfile_error.txt";
+ G_TEXTTESTFILE_SHORTER : string := "../../../bench/testfiles/texttestfile_shorter.txt";
+ G_TEXTTESTFILE_LONGER : string := "../../../bench/testfiles/texttestfile_longer.txt";
+ G_DATTESTFILE_REFERENCE : string := "../../../bench/testfiles/dattestfile_reference.dat";
+ G_DATTESTFILE_CORRECT : string := "../../../bench/testfiles/dattestfile_correct.dat";
+ G_DATTESTFILE_ERROR : string := "../../../bench/testfiles/dattestfile_error.dat";
+ G_DATTESTFILE_SHORTER : string := "../../../bench/testfiles/dattestfile_shorter.dat";
+ G_DATTESTFILE_LONGER : string := "../../../bench/testfiles/dattestfile_longer.dat"
+ );
+end entity tb_pltbutils;
+
+architecture bhv of tb_pltbutils is
+
+ -- Simulation status- and control signals
+ -- for accessing .stop_sim and for viewing in waveform window
+ signal pltbs : pltbs_t := C_PLTBS_INIT;
+
+ -- Expected number of checks and number of errors to be reported
+ -- by pltbutils. The counting is made by variables, but the
+ -- variables are copied to these signals for easier viewing in
+ -- the simulator's waveform window.
+ signal expected_checks_cnt : integer := 0;
+ signal expected_errors_cnt : integer := 0;
+
+ -- DUT stimuli and response signals
+ signal clk : std_logic;
+ signal clk_cnt : integer := 0;
+ signal clk_cnt_clr : boolean := false;
+ signal s_i : integer;
+ signal s_sl : std_logic;
+ signal s_slv : std_logic_vector(7 downto 0);
+ signal s_u : 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_str1 : string(1 to 44);
+ signal s_str2 : string(1 to 44);
+ signal s_str3 : string(1 to 43);
+ signal s_str4 : string(1 to 45);
+
+
+ constant C_EXPECTED_SUCCESS : boolean := false;
+ constant C_EXPECTED_FAIL : boolean := true;
+
+ procedure check_cnt (
+ constant C_EXPECT_FAIL : boolean;
+ variable v_checks_cnt : inout integer;
+ variable v_errors_cnt : inout integer;
+ signal checks_cnt : out integer;
+ signal errors_cnt : out integer
+ ) is
+ begin
+ v_checks_cnt := v_checks_cnt + 1;
+ if C_EXPECT_FAIL then
+ v_errors_cnt := v_errors_cnt + 1;
+ end if;
+ checks_cnt <= v_checks_cnt;
+ errors_cnt <= v_errors_cnt;
+ end procedure check_cnt;
+
+begin
+
+ -- Clock generator
+ clkgen0 : pltbutils_clkgen
+ generic map(
+ G_PERIOD => G_CLK_PERIOD
+ )
+ port map(
+ clk_o => clk,
+ stop_sim_i => pltbs.stop_sim
+ );
+
+ -- Clock cycle counter
+ p_clk_cnt : process (clk_cnt_clr, clk)
+ begin
+ if clk_cnt_clr then
+ clk_cnt <= 0;
+ elsif rising_edge(clk) then
+ clk_cnt <= clk_cnt + 1;
+ end if;
+ end process p_clk_cnt;
+
+ -- Testcase
+ p_tc1 : process
+ variable pltbv : pltbv_t := C_PLTBV_INIT;
+ variable v_expected_tests_cnt : integer := 0;
+ variable v_expected_skiptests_cnt : integer := 0;
+ variable v_expected_checks_cnt : integer := 0;
+ variable v_expected_errors_cnt : integer := 0;
+ variable v_expected_data : integer;
+ variable v_actual_data : integer;
+ variable f_status : file_open_status;
+ type charfile is file of character;
+ file binfile : charfile;
+ variable c : character;
+ variable i : integer;
+ variable v_errcnt : integer;
+ begin
+
+ print(lf & "");
+ startsim("tc1", G_SKIPTESTS, pltbv, pltbs);
+ wait until rising_edge(clk);
+ assert (pltbv.test_num = 0) and (pltbs.test_num = 0)
+ report "test_num after startsim() incorrect"
+ severity error;
+ print("