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 65

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 65 pela
---- Description:                                                 ----
10 2 pela
---- 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 65 pela
---- This file is an example which demonstrates how PlTbUtils     ----
15
---- can be used.                                                 ----                                                              ----
16 2 pela
----                                                              ----
17
---- To Do:                                                       ----
18
---- -                                                            ----
19
----                                                              ----
20
---- Author(s):                                                   ----
21
---- - Per Larsson, pela@opencores.org                            ----
22
----                                                              ----
23
----------------------------------------------------------------------
24
----                                                              ----
25 41 pela
---- Copyright (C) 2013-2014 Authors and OPENCORES.ORG            ----
26 2 pela
----                                                              ----
27
---- This source file may be used and distributed without         ----
28
---- restriction provided that this copyright statement is not    ----
29
---- removed from the file and that any derivative work contains  ----
30
---- the original copyright notice and the associated disclaimer. ----
31
----                                                              ----
32
---- This source file is free software; you can redistribute it   ----
33
---- and/or modify it under the terms of the GNU Lesser General   ----
34
---- Public License as published by the Free Software Foundation; ----
35
---- either version 2.1 of the License, or (at your option) any   ----
36
---- later version.                                               ----
37
----                                                              ----
38
---- This source is distributed in the hope that it will be       ----
39
---- useful, but WITHOUT ANY WARRANTY; without even the implied   ----
40
---- warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR      ----
41
---- PURPOSE. See the GNU Lesser General Public License for more  ----
42
---- details.                                                     ----
43
----                                                              ----
44
---- You should have received a copy of the GNU Lesser General    ----
45
---- Public License along with this source; if not, download it   ----
46
---- from http://www.opencores.org/lgpl.shtml                     ----
47
----                                                              ----
48
----------------------------------------------------------------------
49
library ieee;
50
use ieee.std_logic_1164.all;
51
use ieee.numeric_std.all;
52 41 pela
use work.txt_util.all;
53 2 pela
use work.pltbutils_func_pkg.all;
54
 
55
-- NOTE: The purpose of the following code is to demonstrate some of the 
56 41 pela
-- features of PlTbUtils, not to do a thorough verification.
57 65 pela
architecture tc1 of tc_example2 is
58 2 pela
begin
59
  p_tc1 : process
60 41 pela
    variable pltbv  : pltbv_t := C_PLTBV_INIT;
61 2 pela
  begin
62 41 pela
    startsim("tc1", pltbv, pltbs);
63 2 pela
    rst         <= '1';
64
    carry_in    <= '0';
65
    x           <= (others => '0');
66
    y           <= (others => '0');
67
 
68 41 pela
    starttest(1, "Reset test", pltbv, pltbs);
69
    waitclks(2, clk, pltbv, pltbs);
70
    check("Sum during reset",       sum,         0, pltbv, pltbs);
71
    check("Carry out during reset", carry_out, '0', pltbv, pltbs);
72 2 pela
    rst         <= '0';
73 41 pela
    endtest(pltbv, pltbs);
74 2 pela
 
75 41 pela
    starttest(2, "Simple sum test", pltbv, pltbs);
76 2 pela
    carry_in <= '0';
77
    x <= std_logic_vector(to_unsigned(1, x'length));
78
    y <= std_logic_vector(to_unsigned(2, x'length));
79 41 pela
    waitclks(2, clk, pltbv, pltbs);
80
    check("Sum",       sum,         3, pltbv, pltbs);
81
    check("Carry out", carry_out, '0', pltbv, pltbs);
82
    endtest(pltbv, pltbs);
83 2 pela
 
84 41 pela
    starttest(3, "Simple carry in test", pltbv, pltbs);
85
    print(G_DISABLE_BUGS=0, pltbv, pltbs, "Bug here somewhere");
86 2 pela
    carry_in <= '1';
87
    x <= std_logic_vector(to_unsigned(1, x'length));
88
    y <= std_logic_vector(to_unsigned(2, x'length));
89 41 pela
    waitclks(2, clk, pltbv, pltbs);
90
    check("Sum",       sum,         4, pltbv, pltbs);
91
    check("Carry out", carry_out, '0', pltbv, pltbs);
92
    print(G_DISABLE_BUGS=0, pltbv, pltbs, "");
93
    endtest(pltbv, pltbs);
94 2 pela
 
95 41 pela
    starttest(4, "Simple carry out test", pltbv, pltbs);
96 2 pela
    carry_in <= '0';
97
    x <= std_logic_vector(to_unsigned(2**G_WIDTH-1, x'length));
98
    y <= std_logic_vector(to_unsigned(1, x'length));
99 41 pela
    waitclks(2, clk, pltbv, pltbs);
100
    check("Sum",       sum,         0, pltbv, pltbs);
101
    check("Carry out", carry_out, '1', pltbv, pltbs);
102
    endtest(pltbv, pltbs);
103 2 pela
 
104 41 pela
    endsim(pltbv, pltbs, true);
105 2 pela
    wait;
106
  end process p_tc1;
107 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.