1 |
2 |
pela |
----------------------------------------------------------------------
|
2 |
|
|
---- ----
|
3 |
|
|
---- PlTbUtils Testbench Template ----
|
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 file is a template, which can be used as a base when ----
|
14 |
|
|
---- testbenches which use PlTbUtils. ----
|
15 |
|
|
---- Copy this file to your preferred location and rename the ----
|
16 |
|
|
---- copied file and its contents, by replacing the word ----
|
17 |
|
|
---- "template" with a name for your design. ----
|
18 |
|
|
---- Also remove informative comments enclosed in < ... > . ----
|
19 |
|
|
---- ----
|
20 |
|
|
---- ----
|
21 |
|
|
---- To Do: ----
|
22 |
|
|
---- - ----
|
23 |
|
|
---- ----
|
24 |
|
|
---- Author(s): ----
|
25 |
|
|
---- - Per Larsson, pela@opencores.org ----
|
26 |
|
|
---- ----
|
27 |
|
|
----------------------------------------------------------------------
|
28 |
|
|
---- ----
|
29 |
42 |
pela |
---- Copyright (C) 2013-2014 Authors and OPENCORES.ORG ----
|
30 |
2 |
pela |
---- ----
|
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 |
|
|
library ieee;
|
54 |
|
|
use ieee.std_logic_1164.all;
|
55 |
|
|
use std.textio.all;
|
56 |
|
|
use work.txt_util.all;
|
57 |
|
|
use work.pltbutils_func_pkg.all;
|
58 |
|
|
use work.pltbutils_comp_pkg.all;
|
59 |
|
|
-- < Template info: add more libraries here, if needed >
|
60 |
|
|
|
61 |
|
|
entity tb_template is
|
62 |
|
|
generic (
|
63 |
|
|
-- < Template info: add generics here if needed, or remove the generic block >
|
64 |
|
|
);
|
65 |
|
|
end entity tb_template;
|
66 |
|
|
|
67 |
|
|
architecture bhv of tb_template is
|
68 |
|
|
|
69 |
|
|
-- Simulation status- and control signals
|
70 |
42 |
pela |
-- for accessing .stop_sim and for viewing in waveform window
|
71 |
|
|
signal pltbs : pltbs_t := C_PLTBS_INIT;
|
72 |
2 |
pela |
|
73 |
|
|
-- DUT stimuli and response signals
|
74 |
|
|
signal clk : std_logic;
|
75 |
|
|
signal rst : std_logic;
|
76 |
|
|
-- < Template info: add more DUT stimuli and response signals here. >
|
77 |
|
|
|
78 |
|
|
begin
|
79 |
|
|
|
80 |
|
|
dut0 : entity work.template
|
81 |
|
|
generic map (
|
82 |
|
|
-- < Template info: add DUT generics here, if any. >
|
83 |
|
|
)
|
84 |
|
|
port map (
|
85 |
|
|
clk_i => clk, -- Template example
|
86 |
|
|
rst_i => rst, -- Template example
|
87 |
|
|
-- < Template info: add more DUT ports here. >
|
88 |
|
|
);
|
89 |
|
|
|
90 |
|
|
clkgen0 : pltbutils_clkgen
|
91 |
|
|
generic map(
|
92 |
|
|
G_PERIOD => G_CLK_PERIOD
|
93 |
|
|
)
|
94 |
|
|
port map(
|
95 |
|
|
clk_o => clk,
|
96 |
42 |
pela |
stop_sim_i => pltbs.stop_sim
|
97 |
2 |
pela |
);
|
98 |
|
|
|
99 |
|
|
tc0 : entity work.tc_example
|
100 |
|
|
generic map (
|
101 |
|
|
-- < Template info: add generics for testcase component here, if any. >
|
102 |
|
|
)
|
103 |
|
|
port map(
|
104 |
|
|
clk => clk, -- Template example
|
105 |
|
|
rst => rst, -- Template example
|
106 |
|
|
-- < Template info: add more ports for testcase component here. >
|
107 |
|
|
);
|
108 |
|
|
|
109 |
|
|
end architecture bhv;
|