Project

General

Profile

Download (6.52 KB) Statistics
| Branch: | Tag: | Revision:
1 d93979b7 Arnaud Dieumegard
2
-- Copyright (C) 2001 Bill Billowitch.
3
4
-- Some of the work to develop this test suite was done with Air Force
5
-- support.  The Air Force and Bill Billowitch assume no
6
-- responsibilities for this software.
7
8
-- This file is part of VESTs (Vhdl tESTs).
9
10
-- VESTs is free software; you can redistribute it and/or modify it
11
-- under the terms of the GNU General Public License as published by the
12
-- Free Software Foundation; either version 2 of the License, or (at
13
-- your option) any later version. 
14
15
-- VESTs is distributed in the hope that it will be useful, but WITHOUT
16
-- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
17
-- FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
18
-- for more details. 
19
20
-- You should have received a copy of the GNU General Public License
21
-- along with VESTs; if not, write to the Free Software Foundation,
22
-- Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA 
23
24
-- ---------------------------------------------------------------------
25
--
26
-- $Id: tc1327.vhd,v 1.2 2001-10-26 16:29:40 paw Exp $
27
-- $Revision: 1.2 $
28
--
29
-- ---------------------------------------------------------------------
30
31
ENTITY c08s04b01x00p03n02i01327ent IS
32
END c08s04b01x00p03n02i01327ent;
33
34
ARCHITECTURE c08s04b01x00p03n02i01327arch OF c08s04b01x00p03n02i01327ent IS
35
  -- enumerated types.
36
  type    SWITCH_LEVEL is ('0', '1', 'X');
37
  subtype LOGIC_SWITCH is SWITCH_LEVEL range '0' to '1';
38
39
  -- integer types.
40
  type POSITIVE        is range 0 to INTEGER'HIGH;
41
42
  -- user defined physical types.
43
  type DISTANCE is range 0 to 1E9
44
    units
45
      -- Base units.
46
      A;                    -- angstrom
47
48
      -- Metric lengths.
49
      nm       = 10 A;      -- nanometer
50
      um       = 1000 nm;   -- micrometer (or micron)
51
      mm       = 1000 um;   -- millimeter
52
      cm       = 10 mm;     -- centimeter
53
54
      -- English lengths.
55
      mil      = 254000 A;  -- mil
56
      inch     = 1000 mil;  -- inch
57
    end units;
58
59
  -- floating point types.
60
  type POSITIVE_R    is range 0.0 to REAL'HIGH;
61
62
  -- array types.
63
  type MEMORY is array(INTEGER range <>) of BIT;
64
  type WORD   is array(0 to 31) of BIT;
65
  type BYTE   is array(7 downto 0) of BIT;
66
  
67
  -- record types.
68
  type DATE is
69
    record
70
      DAY           : INTEGER range 1 to 31;
71
      MONTH         : INTEGER range 1 to 12;
72
      YEAR          : INTEGER range -10000 to 1988;
73
    end record;
74
  
75
  -- Signals with no resolution function.
76
  signal SWITCHSIG : SWITCH_LEVEL;
77
  signal LOGICSIG  : LOGIC_SWITCH;
78
  signal CHARSIG   : CHARACTER;
79
  signal BOOLSIG   : BOOLEAN;
80
  signal SEVERSIG  : SEVERITY_LEVEL;
81
  signal INTSIG    : INTEGER;
82
  signal POSSIG    : POSITIVE;
83
  signal DISTSIG   : DISTANCE;
84
  signal TIMESIG   : TIME;
85
  signal REALSIG   : REAL;
86
  signal POSRSIG   : POSITIVE_R;
87
  signal BYTESIG   : BYTE;
88
  signal RECSIG    : DATE;
89
90
  -- Composite signals with resolution functions on the scalar subelements.
91
92
BEGIN
93
  TESTING: PROCESS
94
    -- local variables
95
    variable ShouldBeTime : TIME := 0 ns;
96
97
    variable k : integer := 0;
98
  BEGIN
99
    -- Test each signal assignment.
100
    SWITCHSIG <= '1' after 10 ns;
101
    ShouldBeTime := NOW + 10 ns;
102
    wait on SWITCHSIG;
103
    if (ShouldBeTime /= now or switchsig /= '1') then
104
      k := 1;
105
    end if;
106
    assert (ShouldBeTime = NOW);
107
    assert (SWITCHSIG = '1');
108
    
109
    LOGICSIG <= '1' after 10 ns;
110
    ShouldBeTime := NOW + 10 ns;
111
    wait on LOGICSIG;
112
    if (ShouldBeTime /= now or logicsig /= '1') then
113
      k := 1;
114
    end if;
115
    assert (ShouldBeTime = NOW);
116
    assert (LOGICSIG = '1');
117
    
118
    CHARSIG <= '1' after 10 ns;
119
    ShouldBeTime := NOW + 10 ns;
120
    wait on CHARSIG;
121
    if (ShouldBeTime /= now or charsig /= '1') then
122
      k := 1;
123
    end if;
124
    assert (ShouldBeTime = NOW);
125
    assert (CHARSIG = '1');
126
    
127
    BOOLSIG <= TRUE after 10 ns;
128
    ShouldBeTime := NOW + 10 ns;
129
    wait on BOOLSIG;
130
    if (ShouldBeTime /= now or boolsig /= true) then
131
      k := 1;
132
    end if;
133
    assert (ShouldBeTime = NOW);
134
    assert (BOOLSIG = TRUE);
135
    
136
    SEVERSIG <= ERROR after 10 ns;
137
    ShouldBeTime := NOW + 10 ns;
138
    wait on SEVERSIG;
139
    if (ShouldBeTime /= now or seversig /= error) then
140
      k := 1;
141
    end if;
142
    assert (ShouldBeTime = NOW);
143
    assert (SEVERSIG = ERROR);
144
    
145
    INTSIG <= 47 after 10 ns;
146
    ShouldBeTime := NOW + 10 ns;
147
    wait on INTSIG;
148
    if (ShouldBeTime /= now or intsig /= 47) then
149
      k := 1;
150
    end if;
151
    assert (ShouldBeTime = NOW);
152
    assert (INTSIG = 47);
153
    
154
    POSSIG <= 47 after 10 ns;
155
    ShouldBeTime := NOW + 10 ns;
156
    wait on POSSIG;
157
    if (ShouldBeTime /= now or possig /= 47) then
158
      k := 1;
159
    end if;
160
    assert (ShouldBeTime = NOW);
161
    assert (POSSIG = 47);
162
    
163
    DISTSIG <= 1 A after 10 ns;
164
    ShouldBeTime := NOW + 10 ns;
165
    wait on DISTSIG;
166
    if (ShouldBeTime /= now or distsig /= 1 A) then
167
      k := 1;
168
    end if;
169
    assert (ShouldBeTime = NOW);
170
    assert (DISTSIG = 1 A);
171
    
172
    TIMESIG <= 10 ns after 10 ns;
173
    ShouldBeTime := NOW + 10 ns;
174
    wait on TIMESIG;
175
    if (ShouldBeTime /= now or timesig /= 10 ns) then
176
      k := 1;
177
    end if;
178
    assert (ShouldBeTime = NOW);
179
    assert (TIMESIG = 10 ns);
180
    
181
    REALSIG <= 47.0 after 10 ns;
182
    ShouldBeTime := NOW + 10 ns;
183
    wait on REALSIG;
184
    if (ShouldBeTime /= now or realsig /= 47.0) then
185
      k := 1;
186
    end if;
187
    assert (ShouldBeTime = NOW);
188
    assert (REALSIG = 47.0);
189
    
190
    POSRSIG <= 47.0 after 10 ns;
191
    ShouldBeTime := NOW + 10 ns;
192
    wait on POSRSIG;
193
    if (ShouldBeTime /= now or posrsig /= 47.0) then
194
      k := 1;
195
    end if;
196
    assert (ShouldBeTime = NOW);
197
    assert (POSRSIG = 47.0);
198
    
199
    BYTESIG <= B"10101010" after 10 ns;
200
    ShouldBeTime := NOW + 10 ns;
201
    wait on BYTESIG;
202
    if (ShouldBeTime /= now or bytesig /= B"10101010") then
203
      k := 1;
204
    end if;
205
    assert (ShouldBeTime = NOW);
206
    assert (BYTESIG = B"10101010");
207
    
208
    RECSIG <= ( DAY => 14, MONTH => 2, YEAR => 1988 ) after 10 ns;
209
    ShouldBeTime := NOW + 10 ns;
210
    wait on RECSIG;
211
    if (ShouldBeTime /= now or recsig.day /= 14 or recsig.month /= 2 or recsig.year /= 1988) then
212
      k := 1;
213
    end if;
214
    assert (ShouldBeTime = NOW);
215
    assert (RECSIG.DAY = 14);
216
    assert (RECSIG.MONTH = 2);
217
    assert (RECSIG.YEAR = 1988);
218
219
    assert NOT( k=0 )
220
      report "***PASSED TEST: c08s04b01x00p03n02i01327"
221
      severity NOTE;
222
    assert ( k=0 )
223
      report "***FAILED TEST: c08s04b01x00p03n02i01327 - Evaluation of waveform elements is used to specify that driver is to assign a particular value to a target at the specified time."
224
      severity ERROR;
225
    wait;
226
  END PROCESS TESTING;
227
228
END c08s04b01x00p03n02i01327arch;