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