1 |
2 |
sinx |
----------------------------------------------------------------------
|
2 |
|
|
---- ----
|
3 |
|
|
---- VHDL Wishbone TESTBENCH ----
|
4 |
|
|
---- ----
|
5 |
|
|
---- This file is part of the vhdl_wb_tb project ----
|
6 |
|
|
---- http://www.opencores.org/cores/vhdl_wb_tb/ ----
|
7 |
|
|
---- ----
|
8 |
|
|
---- This file contains the highest (top) module of the test ----
|
9 |
|
|
---- bench. ----
|
10 |
|
|
---- It instantiates the design under test (DUT), instantiates ----
|
11 |
|
|
---- the stimulator module for test vector generation, ----
|
12 |
|
|
---- instantiates the verifier module for result comparison, ----
|
13 |
|
|
---- instantiates the test case top (testcase_top) bfm, ----
|
14 |
|
|
---- interconnects all three components, generates DUT-external ----
|
15 |
|
|
---- clocks and resets. ----
|
16 |
|
|
---- ----
|
17 |
|
|
---- To Do: ----
|
18 |
|
|
---- - ----
|
19 |
|
|
---- ----
|
20 |
|
|
---- Author(s): ----
|
21 |
|
|
---- - Sinx, email@opencores.org ----
|
22 |
|
|
---- ----
|
23 |
|
|
----------------------------------------------------------------------
|
24 |
|
|
-- SVN information
|
25 |
|
|
--
|
26 |
|
|
-- $URL: $
|
27 |
|
|
-- $Revision: $
|
28 |
|
|
-- $Date: $
|
29 |
|
|
-- $Author: $
|
30 |
|
|
-- $Id: $
|
31 |
|
|
--
|
32 |
|
|
----------------------------------------------------------------------
|
33 |
|
|
---- ----
|
34 |
|
|
---- Copyright (C) 2018 Authors and OPENCORES.ORG ----
|
35 |
|
|
---- ----
|
36 |
|
|
---- This source file may be used and distributed without ----
|
37 |
|
|
---- restriction provided that this copyright statement is not ----
|
38 |
|
|
---- removed from the file and that any derivative work contains ----
|
39 |
|
|
---- the original copyright notice and the associated disclaimer. ----
|
40 |
|
|
---- ----
|
41 |
|
|
---- This source file is free software; you can redistribute it ----
|
42 |
|
|
---- and/or modify it under the terms of the GNU Lesser General ----
|
43 |
|
|
---- Public License as published by the Free Software Foundation; ----
|
44 |
|
|
---- either version 2.1 of the License, or (at your option) any ----
|
45 |
|
|
---- later version. ----
|
46 |
|
|
---- ----
|
47 |
|
|
---- This source is distributed in the hope that it will be ----
|
48 |
|
|
---- useful, but WITHOUT ANY WARRANTY; without even the implied ----
|
49 |
|
|
---- warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR ----
|
50 |
|
|
---- PURPOSE. See the GNU Lesser General Public License for more ----
|
51 |
|
|
---- details. ----
|
52 |
|
|
---- ----
|
53 |
|
|
---- You should have received a copy of the GNU Lesser General ----
|
54 |
|
|
---- Public License along with this source; if not, download it ----
|
55 |
|
|
---- from http://www.opencores.org/lgpl.shtml ----
|
56 |
|
|
---- ----
|
57 |
|
|
----------------------------------------------------------------------
|
58 |
|
|
|
59 |
|
|
-- library -----------------------------------------------------------
|
60 |
|
|
library ieee;
|
61 |
|
|
use ieee.std_logic_1164.all;
|
62 |
|
|
use ieee.numeric_std.all;
|
63 |
|
|
library work;
|
64 |
|
|
use work.convert_pkg.all;
|
65 |
|
|
use work.wishbone_pkg.all;
|
66 |
|
|
use work.wishbone_bfm_pkg.all;
|
67 |
|
|
use work.my_project_pkg.all;
|
68 |
|
|
use work.tb_pkg.all;
|
69 |
|
|
|
70 |
|
|
-- architecture ------------------------------------------------------
|
71 |
|
|
architecture tc_xxxx of testcase_top is
|
72 |
|
|
--==========================================================================
|
73 |
|
|
-- local constant definitions
|
74 |
|
|
--==========================================================================
|
75 |
|
|
--==========================================================================
|
76 |
|
|
begin
|
77 |
|
|
--==========================================================================
|
78 |
|
|
tc_xxxx_proc : process
|
79 |
|
|
begin
|
80 |
|
|
--==========================================================================
|
81 |
|
|
-- standard signal initialization
|
82 |
|
|
wb_o <= wb_bfm_master_out_idle_c;
|
83 |
|
|
|
84 |
|
|
wait until wb_i.rst = '0';
|
85 |
|
|
wait until rising_edge(wb_i.clk);
|
86 |
|
|
wait until rising_edge(wb_i.clk);
|
87 |
|
|
--
|
88 |
|
|
wait for 400 ns;
|
89 |
|
|
wait until rising_edge(wb_i.clk);
|
90 |
|
|
--
|
91 |
|
|
--==========================================================================
|
92 |
|
|
|
93 |
|
|
report "-----------------------------------------------------------------";
|
94 |
|
|
report "-- tc_xxxx: ADD_DESCRIPTION_HERE --";
|
95 |
|
|
report "-----------------------------------------------------------------";
|
96 |
|
|
--
|
97 |
|
|
report "--configure stimulator";
|
98 |
|
|
report "-----------------------------------------------------------------";
|
99 |
|
|
|
100 |
|
|
wb_write(stimulator_register0_c , 0, wb_i, wb_o);
|
101 |
|
|
|
102 |
|
|
report "--configure verifier";
|
103 |
|
|
report "-----------------------------------------------------------------";
|
104 |
|
|
|
105 |
|
|
wb_write(verifier_register0_c , 2, wb_i, wb_o);
|
106 |
|
|
wb_write(verifier_register1_c , 16#2b#, wb_i, wb_o);
|
107 |
|
|
report "--configuration done";
|
108 |
|
|
report "-----------------------------------------------------------------";
|
109 |
|
|
|
110 |
|
|
report "--starting stimulator";
|
111 |
|
|
report "-----------------------------------------------------------------";
|
112 |
|
|
wb_write(stimulator_register0_c , 3, wb_i, wb_o); -- shift '1' in
|
113 |
|
|
wb_write(stimulator_register0_c , 1, wb_i, wb_o);
|
114 |
|
|
wb_write(stimulator_register0_c , 2, wb_i, wb_o); -- shift '0' in
|
115 |
|
|
wb_write(stimulator_register0_c , 0, wb_i, wb_o);
|
116 |
|
|
wb_read (verifier_register2_c , 2, wb_i, wb_o);
|
117 |
|
|
|
118 |
|
|
wb_write(stimulator_register0_c , 3, wb_i, wb_o); -- shift '1' in
|
119 |
|
|
wb_write(stimulator_register0_c , 1, wb_i, wb_o);
|
120 |
|
|
|
121 |
|
|
wb_read (verifier_register2_c , 5, wb_i, wb_o); -- reads correct
|
122 |
|
|
report "-----------------------------------------------------------------";
|
123 |
|
|
report "-----------------------------------------------------------------";
|
124 |
|
|
report "-- All fine till here. Now we provoke error messages for illustration.";
|
125 |
|
|
wb_read (verifier_register2_c , 6, wb_i, wb_o); -- provoke error (read value is 5)
|
126 |
|
|
wb_read (verifier_register2_c , 6, wb_i, wb_o,0); -- provoke error (read value is 5)
|
127 |
|
|
wb_read (verifier_register2_c , 6, wb_i, wb_o,1); -- provoke error (read value is 5)
|
128 |
|
|
wb_read (verifier_register2_c , 6, wb_i, wb_o,2); -- provoke error (read value is 5)
|
129 |
|
|
wb_read (verifier_register2_c , 6, wb_i, wb_o,2,"<TEXT>"); -- provoke error (read value is 5)
|
130 |
|
|
wb_read (verifier_register2_c , 6, wb_i, wb_o,3,"",7); -- provoke error (read value is 5)
|
131 |
|
|
wb_read (verifier_register2_c , 6, wb_i, wb_o,4); -- provoke error (read value is 5)
|
132 |
|
|
|
133 |
|
|
---------------------------------------------------------------------------
|
134 |
|
|
---------------------------------------------------------------------------
|
135 |
|
|
---------------------------------------------------------------------------
|
136 |
|
|
report "-----------------------------------------------------------------";
|
137 |
|
|
report "--check results";
|
138 |
|
|
report "-----------------------------------------------------------------";
|
139 |
|
|
wait for 6 us;
|
140 |
|
|
wait until rising_edge(wb_i.clk);
|
141 |
|
|
wb_read (verifier_register2_c, 16#0000_0005#, wb_i, wb_o);
|
142 |
|
|
wait for 1 us;
|
143 |
|
|
-- =================================================
|
144 |
|
|
report "-- tc_xxxx finished";
|
145 |
|
|
-- =================================================
|
146 |
|
|
--
|
147 |
|
|
wait for 400 ns;
|
148 |
|
|
--wait;
|
149 |
|
|
--
|
150 |
|
|
report "test case tc_xxxx completed successfully"; --severity failure;
|
151 |
|
|
report "-----------------------------------------------------------------";
|
152 |
|
|
report "-----------------------------------------------------------------";
|
153 |
|
|
std.env.stop; -- pause simulation
|
154 |
|
|
|
155 |
|
|
--std.env.finish; -- stop simulation; end modelsim
|
156 |
|
|
end process tc_xxxx_proc;
|
157 |
|
|
--==========================================================================
|
158 |
|
|
end tc_xxxx;
|
159 |
|
|
--============================================================================
|
160 |
|
|
-- end of file
|
161 |
|
|
--============================================================================
|