OpenCores
URL https://opencores.org/ocsvn/pltbutils/pltbutils/trunk

Subversion Repositories pltbutils

[/] [pltbutils/] [trunk/] [templates/] [vhdl/] [template1/] [tb_template1.vhd] - Blame information for rev 107

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 75 pela
----------------------------------------------------------------------
2
----                                                              ----
3
---- PlTbUtils Testbench Template 1                               ----
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 97 pela
---- - Per Larsson, pela.opencores@gmail.com                      ----
26 75 pela
----                                                              ----
27
----------------------------------------------------------------------
28 101 pela
 
29 75 pela
library ieee;
30
use ieee.std_logic_1164.all;
31
use std.textio.all;
32
use work.txt_util.all;
33
use work.pltbutils_func_pkg.all;
34
use work.pltbutils_comp_pkg.all;
35
-- < Template info: add more libraries here, if needed >
36
 
37
entity tb_template1 is
38
  generic (
39 101 pela
     G_CLK_PERIOD  : time := 10 ns; -- < Template info: change value if needed >
40
     G_SKIPTESTS   : std_logic_vector := (
41
                       '0', -- Dummy
42
                       '0', -- Test 1
43
                       '0'  -- Test 2
44
                           -- ... etc
45 107 pela
                     )
46 101 pela
    -- < Template info: add more generics here if needed >    
47 75 pela
  );
48
end entity tb_template1;
49
 
50
architecture bhv of tb_template1 is
51
 
52
  -- Simulation status- and control signals
53
  -- for accessing .stop_sim and for viewing in waveform window
54
  signal pltbs          : pltbs_t := C_PLTBS_INIT;
55
 
56
  -- DUT stimuli and response signals
57
  signal clk            : std_logic;
58
  signal rst            : std_logic;
59
  -- < Template info: add more DUT stimuli and response signals here. >
60
 
61
begin
62
 
63
  dut0 : entity work.template
64
    generic map (
65
      -- < Template info: add DUT generics here, if any. >      
66
    )
67
    port map (
68
      clk_i             => clk, -- Template example
69
      rst_i             => rst, -- Template example
70
      -- < Template info: add more DUT ports here. >
71
    );
72
 
73
  clkgen0 : pltbutils_clkgen
74
    generic map(
75
      G_PERIOD          => G_CLK_PERIOD
76
    )
77
    port map(
78
      clk_o             => clk,
79
      stop_sim_i        => pltbs.stop_sim
80
    );
81
 
82
  -- Testcase process 
83
  p_tc1 : process
84
    variable pltbv  : pltbv_t := C_PLTBV_INIT;
85
  begin
86 101 pela
    startsim("tc1", G_SKIPTESTS, pltbv, pltbs);
87 75 pela
    rst         <= '1'; -- Template example
88
    -- < Template info: initialize other DUT stimuli here. >
89
 
90
    starttest(1, "Reset test", pltbv, pltbs); -- Template example
91 101 pela
    if is_test_active(pltbv) then
92
      waitclks(2, clk, pltbv, pltbs); -- Template example
93
      check("template_signal during reset", template_signal, 0, pltbv, pltbs); -- Template example
94
      -- < Template info: check other DUT outputs here. 
95
      rst  <= '0'; -- Template example
96
    end if; -- is_test_active
97 75 pela
    endtest(pltbv, pltbs);
98
 
99
    starttest(2, "Template test", pltbv, pltbs);
100 101 pela
    if is_test_active(pltbv) then
101
      -- < Template info: set all relevant DUT inputs here. >
102
      waitclks(2, clk, pltbv, pltbs); -- Template example
103
      -- < Template info: check all relevant DUT outputs here. >
104
    end if; -- is_test_active
105 75 pela
    endtest(pltbv, pltbs);
106 101 pela
 
107 75 pela
    -- < Template info: add more tests here. >
108
 
109
    endsim(pltbv, pltbs, true);
110
    wait;
111
  end process p_tc1;
112
 
113
end architecture bhv;

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.