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

Subversion Repositories pltbutils

[/] [pltbutils/] [branches/] [dev0007/] [examples/] [vhdl/] [tb_example2/] [tc1.vhd] - Blame information for rev 62

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 pela
----------------------------------------------------------------------
2
----                                                              ----
3
---- PlTbUtils Example Testcase Architecture for                  ----
4
---- Example Testbench                                            ----
5
----                                                              ----
6
---- This file is part of the PlTbUtils project                   ----
7
---- http://opencores.org/project,pltbutils                       ----
8
----                                                              ----
9
---- Description:                                                  ----
10
---- PlTbUtils is a collection of functions, procedures and       ----
11
---- components for easily creating stimuli and checking response ----
12
---- in automatic self-checking testbenches.                      ----
13
----                                                              ----
14
---- This file is a template, which can be used as a base when    ----
15
---- testbenches which use PlTbUtils.                             ----
16
---- Copy this file to your preferred location and rename the     ----
17
---- copied file and its contents, by replacing the word          ---- 
18
---- "template" with a name for your design.                      ----
19
---- Also remove informative comments enclosed in < ... > .       ----
20
----                                                              ----
21
----                                                              ----
22
---- To Do:                                                       ----
23
---- -                                                            ----
24
----                                                              ----
25
---- Author(s):                                                   ----
26
---- - Per Larsson, pela@opencores.org                            ----
27
----                                                              ----
28
----------------------------------------------------------------------
29
----                                                              ----
30 41 pela
---- Copyright (C) 2013-2014 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 41 pela
use work.txt_util.all;
58 2 pela
use work.pltbutils_func_pkg.all;
59
 
60
-- NOTE: The purpose of the following code is to demonstrate some of the 
61 41 pela
-- features of PlTbUtils, not to do a thorough verification.
62 2 pela
architecture tc1 of tc_example is
63
begin
64
  p_tc1 : process
65 41 pela
    variable pltbv  : pltbv_t := C_PLTBV_INIT;
66 2 pela
  begin
67 41 pela
    startsim("tc1", pltbv, pltbs);
68 2 pela
    rst         <= '1';
69
    carry_in    <= '0';
70
    x           <= (others => '0');
71
    y           <= (others => '0');
72
 
73 41 pela
    starttest(1, "Reset test", pltbv, pltbs);
74
    waitclks(2, clk, pltbv, pltbs);
75
    check("Sum during reset",       sum,         0, pltbv, pltbs);
76
    check("Carry out during reset", carry_out, '0', pltbv, pltbs);
77 2 pela
    rst         <= '0';
78 41 pela
    endtest(pltbv, pltbs);
79 2 pela
 
80 41 pela
    starttest(2, "Simple sum test", pltbv, pltbs);
81 2 pela
    carry_in <= '0';
82
    x <= std_logic_vector(to_unsigned(1, x'length));
83
    y <= std_logic_vector(to_unsigned(2, x'length));
84 41 pela
    waitclks(2, clk, pltbv, pltbs);
85
    check("Sum",       sum,         3, pltbv, pltbs);
86
    check("Carry out", carry_out, '0', pltbv, pltbs);
87
    endtest(pltbv, pltbs);
88 2 pela
 
89 41 pela
    starttest(3, "Simple carry in test", pltbv, pltbs);
90
    print(G_DISABLE_BUGS=0, pltbv, pltbs, "Bug here somewhere");
91 2 pela
    carry_in <= '1';
92
    x <= std_logic_vector(to_unsigned(1, x'length));
93
    y <= std_logic_vector(to_unsigned(2, x'length));
94 41 pela
    waitclks(2, clk, pltbv, pltbs);
95
    check("Sum",       sum,         4, pltbv, pltbs);
96
    check("Carry out", carry_out, '0', pltbv, pltbs);
97
    print(G_DISABLE_BUGS=0, pltbv, pltbs, "");
98
    endtest(pltbv, pltbs);
99 2 pela
 
100 41 pela
    starttest(4, "Simple carry out test", pltbv, pltbs);
101 2 pela
    carry_in <= '0';
102
    x <= std_logic_vector(to_unsigned(2**G_WIDTH-1, x'length));
103
    y <= std_logic_vector(to_unsigned(1, x'length));
104 41 pela
    waitclks(2, clk, pltbv, pltbs);
105
    check("Sum",       sum,         0, pltbv, pltbs);
106
    check("Carry out", carry_out, '1', pltbv, pltbs);
107
    endtest(pltbv, pltbs);
108 2 pela
 
109 41 pela
    endsim(pltbv, pltbs, true);
110 2 pela
    wait;
111
  end process p_tc1;
112 41 pela
end architecture tc1;

powered by: WebSVN 2.1.0

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