1 |
2 |
pela |
----------------------------------------------------------------------
|
2 |
|
|
---- ----
|
3 |
|
|
---- PlTbUtils Testbench ----
|
4 |
|
|
---- ----
|
5 |
|
|
---- This file is part of the PlTbUtils project ----
|
6 |
|
|
---- http://opencores.org/project,pltbutils ----
|
7 |
|
|
---- ----
|
8 |
|
|
---- Description ----
|
9 |
|
|
---- PlTbUtils is a collection of functions, procedures and ----
|
10 |
|
|
---- components for easily creating stimuli and checking response ----
|
11 |
|
|
---- in automatic self-checking testbenches. ----
|
12 |
|
|
---- ----
|
13 |
|
|
---- This is a testbench file, which is used to verify ----
|
14 |
|
|
---- - pltbutils_func_pkg ----
|
15 |
|
|
---- - pltbutils_comp ----
|
16 |
|
|
---- This testbench is NOT selfchecking or automatic. ----
|
17 |
|
|
---- Manually check the transcript and waveform, when simulating. ----
|
18 |
|
|
---- It prints some informative text in the transcript, to help ----
|
19 |
|
|
---- with the manual inspection. ----
|
20 |
|
|
---- ----
|
21 |
|
|
---- ----
|
22 |
|
|
---- To Do: ----
|
23 |
|
|
---- - ----
|
24 |
|
|
---- ----
|
25 |
|
|
---- Author(s): ----
|
26 |
97 |
pela |
---- - Per Larsson, pela.opencores@gmail.com ----
|
27 |
2 |
pela |
---- ----
|
28 |
|
|
----------------------------------------------------------------------
|
29 |
|
|
---- ----
|
30 |
107 |
pela |
---- Copyright (C) 2013-2020 Authors and OPENCORES.ORG ----
|
31 |
2 |
pela |
---- ----
|
32 |
|
|
---- This source file may be used and distributed without ----
|
33 |
|
|
---- restriction provided that this copyright statement is not ----
|
34 |
|
|
---- removed from the file and that any derivative work contains ----
|
35 |
|
|
---- the original copyright notice and the associated disclaimer. ----
|
36 |
|
|
---- ----
|
37 |
|
|
---- This source file is free software; you can redistribute it ----
|
38 |
|
|
---- and/or modify it under the terms of the GNU Lesser General ----
|
39 |
|
|
---- Public License as published by the Free Software Foundation; ----
|
40 |
|
|
---- either version 2.1 of the License, or (at your option) any ----
|
41 |
|
|
---- later version. ----
|
42 |
|
|
---- ----
|
43 |
|
|
---- This source is distributed in the hope that it will be ----
|
44 |
|
|
---- useful, but WITHOUT ANY WARRANTY; without even the implied ----
|
45 |
|
|
---- warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR ----
|
46 |
|
|
---- PURPOSE. See the GNU Lesser General Public License for more ----
|
47 |
|
|
---- details. ----
|
48 |
|
|
---- ----
|
49 |
|
|
---- You should have received a copy of the GNU Lesser General ----
|
50 |
|
|
---- Public License along with this source; if not, download it ----
|
51 |
|
|
---- from http://www.opencores.org/lgpl.shtml ----
|
52 |
|
|
---- ----
|
53 |
|
|
----------------------------------------------------------------------
|
54 |
|
|
library ieee;
|
55 |
|
|
use ieee.std_logic_1164.all;
|
56 |
|
|
use ieee.numeric_std.all;
|
57 |
|
|
use std.textio.all;
|
58 |
|
|
use work.txt_util.all;
|
59 |
|
|
use work.pltbutils_func_pkg.all;
|
60 |
|
|
use work.pltbutils_comp_pkg.all;
|
61 |
|
|
|
62 |
|
|
entity tb_pltbutils is
|
63 |
|
|
generic (
|
64 |
107 |
pela |
G_SKIPTESTS : std_logic_vector := (
|
65 |
|
|
'0', -- Dummy
|
66 |
|
|
'0', -- Test 1
|
67 |
|
|
'0', -- Test 2
|
68 |
|
|
'0', -- Test 3
|
69 |
|
|
'0', -- Test 4: NonSkipTest
|
70 |
|
|
'1' -- Test 5: SkipTest
|
71 |
|
|
);
|
72 |
|
|
G_CLK_PERIOD : time := 10 ns;
|
73 |
|
|
G_CHECKFILE_VERBOSITY : integer := 10;
|
74 |
|
|
G_BINTESTFILE_HEADER : string := "Bintestfile R ";
|
75 |
|
|
G_BINTESTFILE_LEN : integer := 528;
|
76 |
|
|
G_BINTESTFILE_REFERENCE : string := "../../../bench/testfiles/bintestfile_reference.bin";
|
77 |
|
|
G_BINTESTFILE_CORRECT : string := "../../../bench/testfiles/bintestfile_correct.bin";
|
78 |
|
|
G_BINTESTFILE_ERROR : string := "../../../bench/testfiles/bintestfile_error.bin";
|
79 |
|
|
G_BINTESTFILE_SHORTER : string := "../../../bench/testfiles/bintestfile_shorter.bin";
|
80 |
|
|
G_BINTESTFILE_LONGER : string := "../../../bench/testfiles/bintestfile_longer.txt";
|
81 |
|
|
G_TEXTTESTFILE_REFERENCE : string := "../../../bench/testfiles/texttestfile_reference.txt";
|
82 |
|
|
G_TEXTTESTFILE_CORRECT : string := "../../../bench/testfiles/texttestfile_correct.txt";
|
83 |
|
|
G_TEXTTESTFILE_ERROR : string := "../../../bench/testfiles/texttestfile_error.txt";
|
84 |
|
|
G_TEXTTESTFILE_SHORTER : string := "../../../bench/testfiles/texttestfile_shorter.txt";
|
85 |
|
|
G_TEXTTESTFILE_LONGER : string := "../../../bench/testfiles/texttestfile_longer.txt";
|
86 |
|
|
G_DATTESTFILE_REFERENCE : string := "../../../bench/testfiles/dattestfile_reference.dat";
|
87 |
|
|
G_DATTESTFILE_CORRECT : string := "../../../bench/testfiles/dattestfile_correct.dat";
|
88 |
|
|
G_DATTESTFILE_ERROR : string := "../../../bench/testfiles/dattestfile_error.dat";
|
89 |
|
|
G_DATTESTFILE_SHORTER : string := "../../../bench/testfiles/dattestfile_shorter.dat";
|
90 |
|
|
G_DATTESTFILE_LONGER : string := "../../../bench/testfiles/dattestfile_longer.dat"
|
91 |
2 |
pela |
);
|
92 |
|
|
end entity tb_pltbutils;
|
93 |
|
|
|
94 |
|
|
architecture bhv of tb_pltbutils is
|
95 |
|
|
|
96 |
|
|
-- Simulation status- and control signals
|
97 |
38 |
pela |
-- for accessing .stop_sim and for viewing in waveform window
|
98 |
|
|
signal pltbs : pltbs_t := C_PLTBS_INIT;
|
99 |
2 |
pela |
|
100 |
|
|
-- Expected number of checks and number of errors to be reported
|
101 |
|
|
-- by pltbutils. The counting is made by variables, but the
|
102 |
|
|
-- variables are copied to these signals for easier viewing in
|
103 |
|
|
-- the simulator's waveform window.
|
104 |
|
|
signal expected_checks_cnt : integer := 0;
|
105 |
|
|
signal expected_errors_cnt : integer := 0;
|
106 |
|
|
|
107 |
|
|
-- DUT stimuli and response signals
|
108 |
|
|
signal clk : std_logic;
|
109 |
|
|
signal clk_cnt : integer := 0;
|
110 |
|
|
signal clk_cnt_clr : boolean := false;
|
111 |
|
|
signal s_i : integer;
|
112 |
|
|
signal s_sl : std_logic;
|
113 |
|
|
signal s_slv : std_logic_vector(7 downto 0);
|
114 |
|
|
signal s_u : unsigned(7 downto 0);
|
115 |
|
|
signal s_s : unsigned(7 downto 0);
|
116 |
99 |
pela |
signal s_b : boolean;
|
117 |
|
|
signal s_time : time;
|
118 |
89 |
pela |
signal s_str_exp : string(1 to 44);
|
119 |
|
|
signal s_str1 : string(1 to 44);
|
120 |
|
|
signal s_str2 : string(1 to 44);
|
121 |
|
|
signal s_str3 : string(1 to 43);
|
122 |
107 |
pela |
signal s_str4 : string(1 to 45);
|
123 |
|
|
|
124 |
|
|
|
125 |
|
|
constant C_EXPECTED_SUCCESS : boolean := false;
|
126 |
|
|
constant C_EXPECTED_FAIL : boolean := true;
|
127 |
|
|
|
128 |
|
|
procedure check_cnt (
|
129 |
|
|
constant C_EXPECT_FAIL : boolean;
|
130 |
|
|
variable v_checks_cnt : inout integer;
|
131 |
|
|
variable v_errors_cnt : inout integer;
|
132 |
|
|
signal checks_cnt : out integer;
|
133 |
|
|
signal errors_cnt : out integer
|
134 |
|
|
) is
|
135 |
|
|
begin
|
136 |
|
|
v_checks_cnt := v_checks_cnt + 1;
|
137 |
|
|
if C_EXPECT_FAIL then
|
138 |
|
|
v_errors_cnt := v_errors_cnt + 1;
|
139 |
|
|
end if;
|
140 |
|
|
checks_cnt <= v_checks_cnt;
|
141 |
|
|
errors_cnt <= v_errors_cnt;
|
142 |
|
|
end procedure check_cnt;
|
143 |
2 |
pela |
|
144 |
|
|
begin
|
145 |
|
|
|
146 |
|
|
-- Clock generator
|
147 |
|
|
clkgen0 : pltbutils_clkgen
|
148 |
|
|
generic map(
|
149 |
|
|
G_PERIOD => G_CLK_PERIOD
|
150 |
|
|
)
|
151 |
|
|
port map(
|
152 |
|
|
clk_o => clk,
|
153 |
38 |
pela |
stop_sim_i => pltbs.stop_sim
|
154 |
2 |
pela |
);
|
155 |
|
|
|
156 |
|
|
-- Clock cycle counter
|
157 |
|
|
p_clk_cnt : process (clk_cnt_clr, clk)
|
158 |
|
|
begin
|
159 |
|
|
if clk_cnt_clr then
|
160 |
|
|
clk_cnt <= 0;
|
161 |
|
|
elsif rising_edge(clk) then
|
162 |
|
|
clk_cnt <= clk_cnt + 1;
|
163 |
|
|
end if;
|
164 |
|
|
end process p_clk_cnt;
|
165 |
|
|
|
166 |
|
|
-- Testcase
|
167 |
|
|
p_tc1 : process
|
168 |
38 |
pela |
variable pltbv : pltbv_t := C_PLTBV_INIT;
|
169 |
25 |
pela |
variable v_expected_tests_cnt : integer := 0;
|
170 |
101 |
pela |
variable v_expected_skiptests_cnt : integer := 0;
|
171 |
2 |
pela |
variable v_expected_checks_cnt : integer := 0;
|
172 |
|
|
variable v_expected_errors_cnt : integer := 0;
|
173 |
107 |
pela |
variable v_expected_data : integer;
|
174 |
|
|
variable v_actual_data : integer;
|
175 |
|
|
variable f_status : file_open_status;
|
176 |
|
|
type charfile is file of character;
|
177 |
|
|
file binfile : charfile;
|
178 |
|
|
variable c : character;
|
179 |
|
|
variable i : integer;
|
180 |
|
|
variable v_errcnt : integer;
|
181 |
2 |
pela |
begin
|
182 |
|
|
|
183 |
107 |
pela |
print(lf & "<Testing startsim()>");
|
184 |
101 |
pela |
startsim("tc1", G_SKIPTESTS, pltbv, pltbs);
|
185 |
2 |
pela |
wait until rising_edge(clk);
|
186 |
38 |
pela |
assert (pltbv.test_num = 0) and (pltbs.test_num = 0)
|
187 |
2 |
pela |
report "test_num after startsim() incorrect"
|
188 |
|
|
severity error;
|
189 |
|
|
print("<Done testing startsim()>");
|
190 |
|
|
|
191 |
107 |
pela |
print(lf & "<Testing starttest() with auto-incrementing test_num>");
|
192 |
101 |
pela |
starttest("StartTest1", pltbv, pltbs);
|
193 |
25 |
pela |
v_expected_tests_cnt := v_expected_tests_cnt + 1;
|
194 |
2 |
pela |
wait until rising_edge(clk);
|
195 |
38 |
pela |
assert (pltbv.test_num = 1) and (pltbs.test_num = 1)
|
196 |
25 |
pela |
report "test_num after starttest() incorrect"
|
197 |
2 |
pela |
severity error;
|
198 |
25 |
pela |
print("<Done testing starttest() with auto-incrementing test_num()>");
|
199 |
2 |
pela |
|
200 |
107 |
pela |
print(lf & "<Testing endtest()>");
|
201 |
38 |
pela |
endtest(pltbv, pltbs);
|
202 |
25 |
pela |
print("<Done testing endtest()>");
|
203 |
|
|
|
204 |
107 |
pela |
print(lf & "<Testing starttest() with explicit test_num>");
|
205 |
101 |
pela |
starttest(3, "StartTest2", pltbv, pltbs);
|
206 |
25 |
pela |
v_expected_tests_cnt := v_expected_tests_cnt + 1;
|
207 |
2 |
pela |
wait until rising_edge(clk);
|
208 |
38 |
pela |
assert (pltbv.test_num = 3) and (pltbs.test_num = 3)
|
209 |
2 |
pela |
report "test_num after startsim() incorrect"
|
210 |
|
|
severity error;
|
211 |
25 |
pela |
print("<Done testing starttest() with explicit test_num>");
|
212 |
101 |
pela |
|
213 |
107 |
pela |
print(lf & "<Testing starttest() and is_test_active() for non-skipped test>");
|
214 |
101 |
pela |
starttest(4, "NoSkipTest", pltbv, pltbs);
|
215 |
|
|
if is_test_active(pltbv) then
|
216 |
|
|
v_expected_tests_cnt := v_expected_tests_cnt + 1;
|
217 |
|
|
wait until rising_edge(clk);
|
218 |
|
|
else
|
219 |
|
|
v_expected_skiptests_cnt := v_expected_skiptests_cnt + 1;
|
220 |
|
|
wait until rising_edge(clk);
|
221 |
|
|
assert false
|
222 |
|
|
report "Executing test that should have been skipped"
|
223 |
|
|
severity error;
|
224 |
|
|
end if;
|
225 |
|
|
endtest(pltbv, pltbs);
|
226 |
|
|
print("<Done testing starttest() and is_test_active() for non-skipped test>");
|
227 |
|
|
|
228 |
107 |
pela |
print(lf & "<Testing starttest() and is_test_active() for skipped test>");
|
229 |
101 |
pela |
starttest(5, "SkipTest", pltbv, pltbs);
|
230 |
|
|
if is_test_active(pltbv) then
|
231 |
|
|
v_expected_tests_cnt := v_expected_tests_cnt + 1;
|
232 |
|
|
wait until rising_edge(clk);
|
233 |
|
|
assert false
|
234 |
|
|
report "Executing test that should have been skipped"
|
235 |
|
|
severity error;
|
236 |
|
|
else
|
237 |
|
|
--check("Checking if check() detects that it should not be called in skipped test", false, pltbv, pltbs);
|
238 |
|
|
v_expected_skiptests_cnt := v_expected_skiptests_cnt + 1;
|
239 |
|
|
end if;
|
240 |
|
|
endtest(pltbv, pltbs);
|
241 |
|
|
print("<Done testing starttest() and is_test_active() for skipped test>");
|
242 |
2 |
pela |
|
243 |
107 |
pela |
print(lf & "<Testing waitclks()>");
|
244 |
2 |
pela |
clk_cnt_clr <= true;
|
245 |
|
|
wait until rising_edge(clk);
|
246 |
|
|
clk_cnt_clr <= false;
|
247 |
|
|
wait until rising_edge(clk);
|
248 |
38 |
pela |
waitclks(10, clk, pltbv, pltbs);
|
249 |
2 |
pela |
assert clk_cnt = 10
|
250 |
|
|
report "clk_cnt after waitclks() incorrect:" & integer'image(clk_cnt) &
|
251 |
|
|
" expected:" & integer'image(10)
|
252 |
|
|
severity error;
|
253 |
|
|
print("<Done testing waitclks()>");
|
254 |
|
|
|
255 |
107 |
pela |
print(lf & "<Testing check() integer>");
|
256 |
2 |
pela |
s_i <= 0;
|
257 |
|
|
wait until rising_edge(clk);
|
258 |
38 |
pela |
check("Testing correct integer = 0", s_i, 0, pltbv, pltbs);
|
259 |
107 |
pela |
check_cnt(C_EXPECTED_SUCCESS, v_expected_checks_cnt, v_expected_errors_cnt, expected_checks_cnt, expected_errors_cnt);
|
260 |
2 |
pela |
s_i <= 1;
|
261 |
|
|
wait until rising_edge(clk);
|
262 |
38 |
pela |
check("Testing correct integer = 1", s_i, 1, pltbv, pltbs);
|
263 |
107 |
pela |
check_cnt(C_EXPECTED_SUCCESS, v_expected_checks_cnt, v_expected_errors_cnt, expected_checks_cnt, expected_errors_cnt);
|
264 |
2 |
pela |
s_i <= 17;
|
265 |
|
|
wait until rising_edge(clk);
|
266 |
38 |
pela |
check("Testing incorrect integer = 17", s_i, 18, pltbv, pltbs);
|
267 |
107 |
pela |
check_cnt(C_EXPECTED_FAIL, v_expected_checks_cnt, v_expected_errors_cnt, expected_checks_cnt, expected_errors_cnt);
|
268 |
2 |
pela |
s_i <= -1;
|
269 |
|
|
wait until rising_edge(clk);
|
270 |
38 |
pela |
check("Testing negative integer = -1", s_i, -1, pltbv, pltbs);
|
271 |
107 |
pela |
check_cnt(C_EXPECTED_SUCCESS, v_expected_checks_cnt, v_expected_errors_cnt, expected_checks_cnt, expected_errors_cnt);
|
272 |
2 |
pela |
print("<Done testing check() integer>");
|
273 |
|
|
|
274 |
107 |
pela |
print(lf & "<Testing check() std_logic>");
|
275 |
2 |
pela |
s_sl <= '0';
|
276 |
|
|
wait until rising_edge(clk);
|
277 |
38 |
pela |
check("Testing correct std_logic = '0'", s_sl, '0', pltbv, pltbs);
|
278 |
107 |
pela |
check_cnt(C_EXPECTED_SUCCESS, v_expected_checks_cnt, v_expected_errors_cnt, expected_checks_cnt, expected_errors_cnt);
|
279 |
2 |
pela |
s_sl <= '1';
|
280 |
|
|
wait until rising_edge(clk);
|
281 |
38 |
pela |
check("Testing correct std_logic = '1'", s_sl, '1', pltbv, pltbs);
|
282 |
107 |
pela |
check_cnt(C_EXPECTED_SUCCESS, v_expected_checks_cnt, v_expected_errors_cnt, expected_checks_cnt, expected_errors_cnt);
|
283 |
2 |
pela |
s_sl <= 'X';
|
284 |
|
|
wait until rising_edge(clk);
|
285 |
38 |
pela |
check("Testing incorrect std_logic = '1'", s_sl, '1', pltbv, pltbs);
|
286 |
107 |
pela |
check_cnt(C_EXPECTED_FAIL, v_expected_checks_cnt, v_expected_errors_cnt, expected_checks_cnt, expected_errors_cnt);
|
287 |
2 |
pela |
print("<Done testing check() std_logic>");
|
288 |
|
|
|
289 |
107 |
pela |
print(lf & "<Testing check() std_logic against integer>");
|
290 |
2 |
pela |
s_sl <= '0';
|
291 |
|
|
wait until rising_edge(clk);
|
292 |
38 |
pela |
check("Testing correct std_logic = '0'", s_sl, 0, pltbv, pltbs);
|
293 |
107 |
pela |
check_cnt(C_EXPECTED_SUCCESS, v_expected_checks_cnt, v_expected_errors_cnt, expected_checks_cnt, expected_errors_cnt);
|
294 |
2 |
pela |
s_sl <= '1';
|
295 |
|
|
wait until rising_edge(clk);
|
296 |
38 |
pela |
check("Testing correct std_logic = '1'", s_sl, 1, pltbv, pltbs);
|
297 |
107 |
pela |
check_cnt(C_EXPECTED_SUCCESS, v_expected_checks_cnt, v_expected_errors_cnt, expected_checks_cnt, expected_errors_cnt);
|
298 |
2 |
pela |
s_sl <= 'X';
|
299 |
|
|
wait until rising_edge(clk);
|
300 |
38 |
pela |
check("Testing incorrect std_logic = '1'", s_sl, 1, pltbv, pltbs);
|
301 |
107 |
pela |
check_cnt(C_EXPECTED_FAIL, v_expected_checks_cnt, v_expected_errors_cnt, expected_checks_cnt, expected_errors_cnt);
|
302 |
2 |
pela |
s_sl <= '1';
|
303 |
|
|
wait until rising_edge(clk);
|
304 |
38 |
pela |
check("Testing std_logic = '1' with incorrect expected", s_sl, 2, pltbv, pltbs);
|
305 |
107 |
pela |
check_cnt(C_EXPECTED_FAIL, v_expected_checks_cnt, v_expected_errors_cnt, expected_checks_cnt, expected_errors_cnt);
|
306 |
2 |
pela |
print("<Done testing check() std_logic against integer>");
|
307 |
|
|
|
308 |
107 |
pela |
print(lf & "<Testing check() std_logic_vector>");
|
309 |
2 |
pela |
s_slv <= x"00";
|
310 |
|
|
wait until rising_edge(clk);
|
311 |
38 |
pela |
check("Testing correct std_logic_vector = x'00'", s_slv, x"00", pltbv, pltbs);
|
312 |
107 |
pela |
check_cnt(C_EXPECTED_SUCCESS, v_expected_checks_cnt, v_expected_errors_cnt, expected_checks_cnt, expected_errors_cnt);
|
313 |
2 |
pela |
s_slv <= x"47";
|
314 |
|
|
wait until rising_edge(clk);
|
315 |
38 |
pela |
check("Testing correct std_logic_vector = x'47'", s_slv, x"47", pltbv, pltbs);
|
316 |
107 |
pela |
check_cnt(C_EXPECTED_SUCCESS, v_expected_checks_cnt, v_expected_errors_cnt, expected_checks_cnt, expected_errors_cnt);
|
317 |
2 |
pela |
s_slv <= x"11";
|
318 |
|
|
wait until rising_edge(clk);
|
319 |
38 |
pela |
check("Testing incorrect std_logic_vector = x'11'", s_slv, x"10", pltbv, pltbs);
|
320 |
107 |
pela |
check_cnt(C_EXPECTED_FAIL, v_expected_checks_cnt, v_expected_errors_cnt, expected_checks_cnt, expected_errors_cnt);
|
321 |
2 |
pela |
print("<Done testing check() std_logic_vector>");
|
322 |
|
|
|
323 |
107 |
pela |
print(lf & "<Testing check() std_logic_vector with mask>");
|
324 |
2 |
pela |
s_slv <= x"47";
|
325 |
|
|
wait until rising_edge(clk);
|
326 |
38 |
pela |
check("Testing std_logic_vector = x'47' with correct nibble mask", s_slv, x"57", x"0F", pltbv, pltbs);
|
327 |
107 |
pela |
check_cnt(C_EXPECTED_SUCCESS, v_expected_checks_cnt, v_expected_errors_cnt, expected_checks_cnt, expected_errors_cnt);
|
328 |
2 |
pela |
s_slv <= x"47";
|
329 |
|
|
wait until rising_edge(clk);
|
330 |
38 |
pela |
check("Testing std_logic_vector = x'47' with incorrect nibble mask", s_slv, x"57", x"F0", pltbv, pltbs);
|
331 |
107 |
pela |
check_cnt(C_EXPECTED_FAIL, v_expected_checks_cnt, v_expected_errors_cnt, expected_checks_cnt, expected_errors_cnt);
|
332 |
2 |
pela |
print("<Done testing check() std_logic_vector with mask>");
|
333 |
|
|
|
334 |
107 |
pela |
print(lf & "<Testing check() std_logic_vector against integer>");
|
335 |
2 |
pela |
s_slv <= x"00";
|
336 |
|
|
wait until rising_edge(clk);
|
337 |
38 |
pela |
check("Testing correct std_logic_vector = x'00'", s_slv, 0, pltbv, pltbs);
|
338 |
107 |
pela |
check_cnt(C_EXPECTED_SUCCESS, v_expected_checks_cnt, v_expected_errors_cnt, expected_checks_cnt, expected_errors_cnt);
|
339 |
2 |
pela |
s_slv <= x"47";
|
340 |
|
|
wait until rising_edge(clk);
|
341 |
38 |
pela |
check("Testing correct std_logic_vector = x'47'", s_slv, 16#47#, pltbv, pltbs);
|
342 |
107 |
pela |
check_cnt(C_EXPECTED_SUCCESS, v_expected_checks_cnt, v_expected_errors_cnt, expected_checks_cnt, expected_errors_cnt);
|
343 |
2 |
pela |
s_slv <= x"11";
|
344 |
|
|
wait until rising_edge(clk);
|
345 |
38 |
pela |
check("Testing incorrect std_logic_vector = x'11'", s_slv, 16#10#, pltbv, pltbs);
|
346 |
107 |
pela |
check_cnt(C_EXPECTED_FAIL, v_expected_checks_cnt, v_expected_errors_cnt, expected_checks_cnt, expected_errors_cnt);
|
347 |
2 |
pela |
s_slv <= x"FF";
|
348 |
|
|
wait until rising_edge(clk);
|
349 |
38 |
pela |
check("Testing negative std_logic_vector = x'FF'", s_slv, -1, pltbv, pltbs);
|
350 |
107 |
pela |
check_cnt(C_EXPECTED_SUCCESS, v_expected_checks_cnt, v_expected_errors_cnt, expected_checks_cnt, expected_errors_cnt);
|
351 |
2 |
pela |
print("<Done testing check() std_logic_vector against integer>");
|
352 |
|
|
|
353 |
107 |
pela |
print(lf & "<Testing check() std_logic_vector with mask against integer>");
|
354 |
2 |
pela |
s_slv <= x"47";
|
355 |
|
|
wait until rising_edge(clk);
|
356 |
38 |
pela |
check("Testing std_logic_vector = x'47' with correct nibble mask", s_slv, 16#57#, x"0F", pltbv, pltbs);
|
357 |
107 |
pela |
check_cnt(C_EXPECTED_SUCCESS, v_expected_checks_cnt, v_expected_errors_cnt, expected_checks_cnt, expected_errors_cnt);
|
358 |
2 |
pela |
s_slv <= x"47";
|
359 |
|
|
wait until rising_edge(clk);
|
360 |
38 |
pela |
check("Testing std_logic_vector = x'47' with incorrect nibble mask", s_slv, 16#57#, x"F0", pltbv, pltbs);
|
361 |
107 |
pela |
check_cnt(C_EXPECTED_FAIL, v_expected_checks_cnt, v_expected_errors_cnt, expected_checks_cnt, expected_errors_cnt);
|
362 |
2 |
pela |
print("<Done testing check() std_logic_vector with mask against integer>");
|
363 |
|
|
|
364 |
107 |
pela |
print(lf & "<Testing check() unsigned>");
|
365 |
2 |
pela |
s_u <= x"00";
|
366 |
|
|
wait until rising_edge(clk);
|
367 |
38 |
pela |
check("Testing correct unsigned = x'00'", s_u, x"00", pltbv, pltbs);
|
368 |
107 |
pela |
check_cnt(C_EXPECTED_SUCCESS, v_expected_checks_cnt, v_expected_errors_cnt, expected_checks_cnt, expected_errors_cnt);
|
369 |
2 |
pela |
s_u <= x"47";
|
370 |
|
|
wait until rising_edge(clk);
|
371 |
38 |
pela |
check("Testing correct unsigned = x'47'", s_u, x"47", pltbv, pltbs);
|
372 |
107 |
pela |
check_cnt(C_EXPECTED_SUCCESS, v_expected_checks_cnt, v_expected_errors_cnt, expected_checks_cnt, expected_errors_cnt);
|
373 |
2 |
pela |
s_u <= x"11";
|
374 |
|
|
wait until rising_edge(clk);
|
375 |
38 |
pela |
check("Testing incorrect unsigned = x'11'", s_u, x"10", pltbv, pltbs);
|
376 |
107 |
pela |
check_cnt(C_EXPECTED_FAIL, v_expected_checks_cnt, v_expected_errors_cnt, expected_checks_cnt, expected_errors_cnt);
|
377 |
2 |
pela |
print("<Done testing check() unsigned>");
|
378 |
|
|
|
379 |
107 |
pela |
print(lf & "<Testing check() unsigned against integer>");
|
380 |
2 |
pela |
s_u <= x"00";
|
381 |
|
|
wait until rising_edge(clk);
|
382 |
38 |
pela |
check("Testing correct unsigned = x'00'", s_u, 0, pltbv, pltbs);
|
383 |
107 |
pela |
check_cnt(C_EXPECTED_SUCCESS, v_expected_checks_cnt, v_expected_errors_cnt, expected_checks_cnt, expected_errors_cnt);
|
384 |
2 |
pela |
s_u <= x"47";
|
385 |
|
|
wait until rising_edge(clk);
|
386 |
38 |
pela |
check("Testing correct unsigned = x'47'", s_u, 16#47#, pltbv, pltbs);
|
387 |
107 |
pela |
check_cnt(C_EXPECTED_SUCCESS, v_expected_checks_cnt, v_expected_errors_cnt, expected_checks_cnt, expected_errors_cnt);
|
388 |
2 |
pela |
s_u <= x"11";
|
389 |
|
|
wait until rising_edge(clk);
|
390 |
38 |
pela |
check("Testing incorrect unsigned = x'11'", s_u, 16#10#, pltbv, pltbs);
|
391 |
107 |
pela |
check_cnt(C_EXPECTED_FAIL, v_expected_checks_cnt, v_expected_errors_cnt, expected_checks_cnt, expected_errors_cnt);
|
392 |
2 |
pela |
print("<Done testing check() unsigned against integer>");
|
393 |
|
|
|
394 |
107 |
pela |
print(lf & "<Testing check() signed>");
|
395 |
2 |
pela |
s_s <= x"00";
|
396 |
|
|
wait until rising_edge(clk);
|
397 |
38 |
pela |
check("Testing correct signed = x'00'", s_s, x"00", pltbv, pltbs);
|
398 |
107 |
pela |
check_cnt(C_EXPECTED_SUCCESS, v_expected_checks_cnt, v_expected_errors_cnt, expected_checks_cnt, expected_errors_cnt);
|
399 |
2 |
pela |
s_s <= x"47";
|
400 |
|
|
wait until rising_edge(clk);
|
401 |
38 |
pela |
check("Testing correct signed = x'47'", s_s, x"47", pltbv, pltbs);
|
402 |
107 |
pela |
check_cnt(C_EXPECTED_SUCCESS, v_expected_checks_cnt, v_expected_errors_cnt, expected_checks_cnt, expected_errors_cnt);
|
403 |
2 |
pela |
s_s <= x"11";
|
404 |
|
|
wait until rising_edge(clk);
|
405 |
38 |
pela |
check("Testing incorrect signed = x'11'", s_s, x"10", pltbv, pltbs);
|
406 |
107 |
pela |
check_cnt(C_EXPECTED_FAIL, v_expected_checks_cnt, v_expected_errors_cnt, expected_checks_cnt, expected_errors_cnt);
|
407 |
2 |
pela |
s_s <= x"FF";
|
408 |
|
|
wait until rising_edge(clk);
|
409 |
38 |
pela |
check("Testing negative signed = x'FF'", s_s, x"FF", pltbv, pltbs);
|
410 |
107 |
pela |
check_cnt(C_EXPECTED_SUCCESS, v_expected_checks_cnt, v_expected_errors_cnt, expected_checks_cnt, expected_errors_cnt);
|
411 |
2 |
pela |
print("<Done testing check() signed>");
|
412 |
|
|
|
413 |
107 |
pela |
print(lf & "<Testing check() signed against integer>");
|
414 |
2 |
pela |
s_s <= x"00";
|
415 |
|
|
wait until rising_edge(clk);
|
416 |
38 |
pela |
check("Testing correct signed = x'00'", s_s, 0, pltbv, pltbs);
|
417 |
107 |
pela |
check_cnt(C_EXPECTED_SUCCESS, v_expected_checks_cnt, v_expected_errors_cnt, expected_checks_cnt, expected_errors_cnt);
|
418 |
2 |
pela |
s_s <= x"47";
|
419 |
|
|
wait until rising_edge(clk);
|
420 |
38 |
pela |
check("Testing correct signed = x'47'", s_s, 16#47#, pltbv, pltbs);
|
421 |
107 |
pela |
check_cnt(C_EXPECTED_SUCCESS, v_expected_checks_cnt, v_expected_errors_cnt, expected_checks_cnt, expected_errors_cnt);
|
422 |
2 |
pela |
s_s <= x"11";
|
423 |
|
|
wait until rising_edge(clk);
|
424 |
38 |
pela |
check("Testing incorrect signed = x'11'", s_s, 16#10#, pltbv, pltbs);
|
425 |
107 |
pela |
check_cnt(C_EXPECTED_FAIL, v_expected_checks_cnt, v_expected_errors_cnt, expected_checks_cnt, expected_errors_cnt);
|
426 |
2 |
pela |
s_s <= x"FF";
|
427 |
|
|
wait until rising_edge(clk);
|
428 |
99 |
pela |
print("NOTE: Skipping test with negative signed. There seem to be a bug in ModelSim.");
|
429 |
97 |
pela |
--print("The following check fails in ModelSim for unknown reason." &
|
430 |
|
|
-- " It causes mismatch between expected number of errors" &
|
431 |
|
|
-- " and the number presented by endsim()");
|
432 |
|
|
--check("Testing negative signed = x'FF'", s_s, -1, pltbv, pltbs);
|
433 |
107 |
pela |
--check_cnt(C_EXPECTED_SUCCESS, v_expected_checks_cnt, v_expected_errors_cnt, expected_checks_cnt, expected_errors_cnt);
|
434 |
99 |
pela |
print("<Done testing check() signed against integer>");
|
435 |
2 |
pela |
|
436 |
107 |
pela |
print(lf & "<Testing check() boolean>");
|
437 |
99 |
pela |
s_b <= false;
|
438 |
|
|
wait until rising_edge(clk);
|
439 |
|
|
check("Testing correct boolean = false", s_b, false, pltbv, pltbs);
|
440 |
107 |
pela |
check_cnt(C_EXPECTED_SUCCESS, v_expected_checks_cnt, v_expected_errors_cnt, expected_checks_cnt, expected_errors_cnt);
|
441 |
99 |
pela |
s_b <= true;
|
442 |
|
|
wait until rising_edge(clk);
|
443 |
|
|
check("Testing correct boolean = true", s_b, true, pltbv, pltbs);
|
444 |
107 |
pela |
check_cnt(C_EXPECTED_SUCCESS, v_expected_checks_cnt, v_expected_errors_cnt, expected_checks_cnt, expected_errors_cnt);
|
445 |
99 |
pela |
s_b <= false;
|
446 |
|
|
wait until rising_edge(clk);
|
447 |
|
|
check("Testing incorrect boolean = true", s_b, true, pltbv, pltbs);
|
448 |
107 |
pela |
check_cnt(C_EXPECTED_FAIL, v_expected_checks_cnt, v_expected_errors_cnt, expected_checks_cnt, expected_errors_cnt);
|
449 |
99 |
pela |
print("<Done testing check() boolean>");
|
450 |
|
|
|
451 |
107 |
pela |
print(lf & "<Testing check() boolean against integer>");
|
452 |
99 |
pela |
s_b <= false;
|
453 |
|
|
wait until rising_edge(clk);
|
454 |
|
|
check("Testing correct boolean = false", s_b, 0, pltbv, pltbs);
|
455 |
107 |
pela |
check_cnt(C_EXPECTED_SUCCESS, v_expected_checks_cnt, v_expected_errors_cnt, expected_checks_cnt, expected_errors_cnt);
|
456 |
99 |
pela |
s_b <= true;
|
457 |
|
|
wait until rising_edge(clk);
|
458 |
|
|
check("Testing correct boolean = true", s_b, 1, pltbv, pltbs);
|
459 |
107 |
pela |
check_cnt(C_EXPECTED_SUCCESS, v_expected_checks_cnt, v_expected_errors_cnt, expected_checks_cnt, expected_errors_cnt);
|
460 |
99 |
pela |
s_b <= false;
|
461 |
|
|
wait until rising_edge(clk);
|
462 |
|
|
check("Testing incorrect boolean = true", s_b, 1, pltbv, pltbs);
|
463 |
107 |
pela |
check_cnt(C_EXPECTED_FAIL, v_expected_checks_cnt, v_expected_errors_cnt, expected_checks_cnt, expected_errors_cnt);
|
464 |
99 |
pela |
s_b <= true;
|
465 |
|
|
wait until rising_edge(clk);
|
466 |
|
|
check("Testing boolean = true with incorrect expected", s_b, 2, pltbv, pltbs);
|
467 |
107 |
pela |
check_cnt(C_EXPECTED_FAIL, v_expected_checks_cnt, v_expected_errors_cnt, expected_checks_cnt, expected_errors_cnt);
|
468 |
99 |
pela |
print("<Done testing check() boolean against integer>");
|
469 |
|
|
|
470 |
107 |
pela |
print(lf & "<Testing check() time>");
|
471 |
99 |
pela |
s_time <= 0 sec;
|
472 |
|
|
wait until rising_edge(clk);
|
473 |
|
|
check("Testing correct time = 0 sec", s_time, 0 sec, pltbv, pltbs);
|
474 |
107 |
pela |
check_cnt(C_EXPECTED_SUCCESS, v_expected_checks_cnt, v_expected_errors_cnt, expected_checks_cnt, expected_errors_cnt);
|
475 |
99 |
pela |
s_time <= 47 ns;
|
476 |
|
|
wait until rising_edge(clk);
|
477 |
|
|
check("Testing correct time = 47 ns", s_time, 47 ns, pltbv, pltbs);
|
478 |
107 |
pela |
check_cnt(C_EXPECTED_SUCCESS, v_expected_checks_cnt, v_expected_errors_cnt, expected_checks_cnt, expected_errors_cnt);
|
479 |
99 |
pela |
s_time <= 11 us;
|
480 |
|
|
wait until rising_edge(clk);
|
481 |
|
|
check("Testing incorrect time = 10 us", s_time, 10 us, pltbv, pltbs);
|
482 |
107 |
pela |
check_cnt(C_EXPECTED_FAIL, v_expected_checks_cnt, v_expected_errors_cnt, expected_checks_cnt, expected_errors_cnt);
|
483 |
99 |
pela |
print("<Done testing check() time>");
|
484 |
|
|
|
485 |
107 |
pela |
print(lf & "<Testing check() time with tolerance>");
|
486 |
99 |
pela |
s_time <= 0 sec;
|
487 |
|
|
wait until rising_edge(clk);
|
488 |
|
|
check("Testing correct unsigned = 0 sec +/- 0 sec", s_time, 0 sec, 0 sec, pltbv, pltbs);
|
489 |
107 |
pela |
check_cnt(C_EXPECTED_SUCCESS, v_expected_checks_cnt, v_expected_errors_cnt, expected_checks_cnt, expected_errors_cnt);
|
490 |
99 |
pela |
s_time <= 47 ns - 3 ns;
|
491 |
|
|
wait until rising_edge(clk);
|
492 |
|
|
check("Testing correct time = 47 ns +/- 5 ns", s_time, 47 ns, 5 ns, pltbv, pltbs);
|
493 |
107 |
pela |
check_cnt(C_EXPECTED_SUCCESS, v_expected_checks_cnt, v_expected_errors_cnt, expected_checks_cnt, expected_errors_cnt);
|
494 |
99 |
pela |
s_time <= 10 us + 7 us;
|
495 |
|
|
wait until rising_edge(clk);
|
496 |
|
|
check("Testing incorrect time = 10 us +/- 5 us", s_time, 10 us, 5 us, pltbv, pltbs);
|
497 |
107 |
pela |
check_cnt(C_EXPECTED_FAIL, v_expected_checks_cnt, v_expected_errors_cnt, expected_checks_cnt, expected_errors_cnt);
|
498 |
99 |
pela |
print("<Done testing check() time with tolerance>");
|
499 |
|
|
|
500 |
107 |
pela |
print(lf & "<Testing check() string>");
|
501 |
89 |
pela |
s_str_exp <= string'("The quick brown fox jumps over the lazy dog.");
|
502 |
|
|
s_str1 <= string'("The quick brown fox jumps over the lazy dog.");
|
503 |
|
|
s_str2 <= string'("The quick brown dog jumps over the lazy fox.");
|
504 |
|
|
s_str3 <= string'("The quick brown fox jumps over the lazy dog");
|
505 |
|
|
s_str4 <= string'("The quick brown fox jumps over the lazy dog..");
|
506 |
|
|
wait until rising_edge(clk);
|
507 |
|
|
check("Testing correct string", s_str1, s_str_exp, pltbv, pltbs);
|
508 |
107 |
pela |
check_cnt(C_EXPECTED_SUCCESS, v_expected_checks_cnt, v_expected_errors_cnt, expected_checks_cnt, expected_errors_cnt);
|
509 |
89 |
pela |
s_s <= x"47";
|
510 |
|
|
wait until rising_edge(clk);
|
511 |
|
|
check("Testing incorrect string with correct length", s_str2, s_str_exp, pltbv, pltbs);
|
512 |
107 |
pela |
check_cnt(C_EXPECTED_FAIL, v_expected_checks_cnt, v_expected_errors_cnt, expected_checks_cnt, expected_errors_cnt);
|
513 |
89 |
pela |
s_s <= x"11";
|
514 |
|
|
wait until rising_edge(clk);
|
515 |
|
|
check("Testing too short string", s_str3, s_str_exp, pltbv, pltbs);
|
516 |
107 |
pela |
check_cnt(C_EXPECTED_FAIL, v_expected_checks_cnt, v_expected_errors_cnt, expected_checks_cnt, expected_errors_cnt);
|
517 |
89 |
pela |
wait until rising_edge(clk);
|
518 |
|
|
check("Testing too long string", s_str4, s_str_exp, pltbv, pltbs);
|
519 |
107 |
pela |
check_cnt(C_EXPECTED_FAIL, v_expected_checks_cnt, v_expected_errors_cnt, expected_checks_cnt, expected_errors_cnt);
|
520 |
89 |
pela |
print("<Done testing check() string>");
|
521 |
|
|
|
522 |
107 |
pela |
print(lf & "<Testing check() boolean expression>");
|
523 |
2 |
pela |
s_i <= 0;
|
524 |
|
|
wait until rising_edge(clk);
|
525 |
38 |
pela |
check("Testing correct boolean expression 0 = 16#00#", s_i = 16#00#, pltbv, pltbs);
|
526 |
107 |
pela |
check_cnt(C_EXPECTED_SUCCESS, v_expected_checks_cnt, v_expected_errors_cnt, expected_checks_cnt, expected_errors_cnt);
|
527 |
2 |
pela |
s_i <= 47;
|
528 |
|
|
wait until rising_edge(clk);
|
529 |
38 |
pela |
check("Testing incorrect boolean expression 47 < 16#10#", s_i < 16#10#, pltbv, pltbs);
|
530 |
107 |
pela |
check_cnt(C_EXPECTED_FAIL, v_expected_checks_cnt, v_expected_errors_cnt, expected_checks_cnt, expected_errors_cnt);
|
531 |
2 |
pela |
print("<Done testing check() boolean expresson>");
|
532 |
25 |
pela |
|
533 |
107 |
pela |
print(lf & "<Test reading binary files>");
|
534 |
|
|
-- Check if the current simulator running on the current operating system supports
|
535 |
|
|
-- reading binary files as file of character.
|
536 |
|
|
-- That is a requirement for check_binfile().
|
537 |
|
|
file_open(f_status, binfile, G_BINTESTFILE_REFERENCE, read_mode);
|
538 |
|
|
print("DEBUG: file_open_status: " & file_open_status'image(f_status));
|
539 |
|
|
--check("Status of opening binary file", f_status = open_ok, file_open_status'image(f_status), "open_ok", pltbv, pltbs);
|
540 |
|
|
--check_cnt(C_EXPECTED_SUCCESS, v_expected_checks_cnt, v_expected_errors_cnt, expected_checks_cnt, expected_errors_cnt);
|
541 |
|
|
if f_status = open_ok then
|
542 |
|
|
i := 0;
|
543 |
|
|
v_errcnt := 0;
|
544 |
|
|
while not endfile(binfile) loop
|
545 |
|
|
read(binfile, c);
|
546 |
|
|
v_actual_data := character'pos(c);
|
547 |
|
|
if i < G_BINTESTFILE_HEADER'length then
|
548 |
|
|
v_expected_data := character'pos(G_BINTESTFILE_HEADER(i+1));
|
549 |
|
|
else
|
550 |
|
|
v_expected_data := (i - G_BINTESTFILE_HEADER'length) mod 256;
|
551 |
|
|
end if;
|
552 |
|
|
if v_actual_data /= v_expected_data then
|
553 |
|
|
v_errcnt := v_errcnt + 1;
|
554 |
|
|
print("Error at offset " & str(i) & ": actual " & str(v_actual_data) & " expected " & str(v_expected_data));
|
555 |
|
|
end if;
|
556 |
|
|
i := i + 1;
|
557 |
|
|
end loop;
|
558 |
|
|
file_close(binfile);
|
559 |
|
|
check("Number of errors while reading binary file", v_errcnt, 0, pltbv, pltbs);
|
560 |
|
|
check_cnt(C_EXPECTED_SUCCESS, v_expected_checks_cnt, v_expected_errors_cnt, expected_checks_cnt, expected_errors_cnt);
|
561 |
|
|
check("Number of bytes read from binary file", i, G_BINTESTFILE_LEN, pltbv, pltbs);
|
562 |
|
|
check_cnt(C_EXPECTED_SUCCESS, v_expected_checks_cnt, v_expected_errors_cnt, expected_checks_cnt, expected_errors_cnt);
|
563 |
|
|
end if;
|
564 |
|
|
print("<Done testing reading binary files");
|
565 |
|
|
|
566 |
|
|
print(lf & "<Testing check_binfile()");
|
567 |
|
|
check_binfile("Testing correct binary file", G_BINTESTFILE_CORRECT, G_BINTESTFILE_REFERENCE, G_CHECKFILE_VERBOSITY, pltbv, pltbs);
|
568 |
|
|
check_cnt(C_EXPECTED_SUCCESS, v_expected_checks_cnt, v_expected_errors_cnt, expected_checks_cnt, expected_errors_cnt);
|
569 |
|
|
check_binfile("Testing binary file with error", G_BINTESTFILE_ERROR, G_BINTESTFILE_REFERENCE, G_CHECKFILE_VERBOSITY, pltbv, pltbs);
|
570 |
|
|
check_cnt(C_EXPECTED_FAIL, v_expected_checks_cnt, v_expected_errors_cnt, expected_checks_cnt, expected_errors_cnt);
|
571 |
|
|
check_binfile("Testing shorter binary file", G_BINTESTFILE_SHORTER, G_BINTESTFILE_REFERENCE, G_CHECKFILE_VERBOSITY, pltbv, pltbs);
|
572 |
|
|
check_cnt(C_EXPECTED_FAIL, v_expected_checks_cnt, v_expected_errors_cnt, expected_checks_cnt, expected_errors_cnt);
|
573 |
|
|
check_binfile("Testing longer binary file", G_BINTESTFILE_LONGER, G_BINTESTFILE_REFERENCE, G_CHECKFILE_VERBOSITY, pltbv, pltbs);
|
574 |
|
|
check_cnt(C_EXPECTED_FAIL, v_expected_checks_cnt, v_expected_errors_cnt, expected_checks_cnt, expected_errors_cnt);
|
575 |
|
|
print("<Done testing check_binfile()");
|
576 |
|
|
|
577 |
|
|
print(lf & "<Testing check_txtfile()");
|
578 |
|
|
check_txtfile("Testing correct text file", G_TEXTTESTFILE_CORRECT, G_TEXTTESTFILE_REFERENCE, G_CHECKFILE_VERBOSITY, pltbv, pltbs);
|
579 |
|
|
check_cnt(C_EXPECTED_SUCCESS, v_expected_checks_cnt, v_expected_errors_cnt, expected_checks_cnt, expected_errors_cnt);
|
580 |
|
|
check_txtfile("Testing text file with error", G_TEXTTESTFILE_ERROR, G_TEXTTESTFILE_REFERENCE, G_CHECKFILE_VERBOSITY, pltbv, pltbs);
|
581 |
|
|
check_cnt(C_EXPECTED_FAIL, v_expected_checks_cnt, v_expected_errors_cnt, expected_checks_cnt, expected_errors_cnt);
|
582 |
|
|
check_txtfile("Testing shorter text file", G_TEXTTESTFILE_SHORTER, G_TEXTTESTFILE_REFERENCE, G_CHECKFILE_VERBOSITY, pltbv, pltbs);
|
583 |
|
|
check_cnt(C_EXPECTED_FAIL, v_expected_checks_cnt, v_expected_errors_cnt, expected_checks_cnt, expected_errors_cnt);
|
584 |
|
|
check_txtfile("Testing longer text file", G_TEXTTESTFILE_LONGER, G_TEXTTESTFILE_REFERENCE, G_CHECKFILE_VERBOSITY, pltbv, pltbs);
|
585 |
|
|
check_cnt(C_EXPECTED_FAIL, v_expected_checks_cnt, v_expected_errors_cnt, expected_checks_cnt, expected_errors_cnt);
|
586 |
|
|
print("<Done testing check_txtfile()");
|
587 |
|
|
|
588 |
|
|
print(lf & "<Testing check_datfile()");
|
589 |
|
|
check_datfile("Testing correct data file", G_DATTESTFILE_CORRECT, G_DATTESTFILE_REFERENCE, G_CHECKFILE_VERBOSITY, pltbv, pltbs);
|
590 |
|
|
check_cnt(C_EXPECTED_SUCCESS, v_expected_checks_cnt, v_expected_errors_cnt, expected_checks_cnt, expected_errors_cnt);
|
591 |
|
|
check_datfile("Testing data file with error", G_DATTESTFILE_ERROR, G_DATTESTFILE_REFERENCE, G_CHECKFILE_VERBOSITY, pltbv, pltbs);
|
592 |
|
|
check_cnt(C_EXPECTED_FAIL, v_expected_checks_cnt, v_expected_errors_cnt, expected_checks_cnt, expected_errors_cnt);
|
593 |
|
|
check_datfile("Testing shorter data file", G_DATTESTFILE_SHORTER, G_DATTESTFILE_REFERENCE, G_CHECKFILE_VERBOSITY, pltbv, pltbs);
|
594 |
|
|
check_cnt(C_EXPECTED_FAIL, v_expected_checks_cnt, v_expected_errors_cnt, expected_checks_cnt, expected_errors_cnt);
|
595 |
|
|
check_datfile("Testing longer data file", G_DATTESTFILE_LONGER, G_DATTESTFILE_REFERENCE, G_CHECKFILE_VERBOSITY, pltbv, pltbs);
|
596 |
|
|
check_cnt(C_EXPECTED_FAIL, v_expected_checks_cnt, v_expected_errors_cnt, expected_checks_cnt, expected_errors_cnt);
|
597 |
|
|
print("<Done testing check_datfile()");
|
598 |
|
|
|
599 |
|
|
print(lf & "<Testing endtest()>");
|
600 |
38 |
pela |
endtest(pltbv, pltbs);
|
601 |
25 |
pela |
print("<Done testing endtest()>");
|
602 |
2 |
pela |
|
603 |
|
|
wait until rising_edge(clk);
|
604 |
107 |
pela |
print(lf & "<Testing endsim()>");
|
605 |
99 |
pela |
print("");
|
606 |
101 |
pela |
print("Expected number of tests: " & str(v_expected_tests_cnt));
|
607 |
|
|
print("Expected number of skipped tests: " & str(v_expected_skiptests_cnt));
|
608 |
|
|
print("Expected number of checks: " & str(v_expected_checks_cnt));
|
609 |
|
|
print("Expected number of errors: " & str(v_expected_errors_cnt));
|
610 |
99 |
pela |
if v_expected_errors_cnt = 0 then
|
611 |
107 |
pela |
print("Expected result: SUCCESS");
|
612 |
99 |
pela |
else
|
613 |
107 |
pela |
print("Expected result: FAIL");
|
614 |
99 |
pela |
end if;
|
615 |
2 |
pela |
wait until rising_edge(clk);
|
616 |
38 |
pela |
endsim(pltbv, pltbs, true);
|
617 |
2 |
pela |
wait until rising_edge(clk);
|
618 |
|
|
print("<Done testing endsim()>");
|
619 |
107 |
pela |
|
620 |
2 |
pela |
wait;
|
621 |
|
|
end process p_tc1;
|
622 |
|
|
end architecture bhv;
|