1
|
|
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: tc1362.vhd,v 1.2 2001-10-26 16:29:40 paw Exp $
|
27
|
-- $Revision: 1.2 $
|
28
|
--
|
29
|
-- ---------------------------------------------------------------------
|
30
|
|
31
|
ENTITY c08s05b00x00p03n01i01362ent IS
|
32
|
END c08s05b00x00p03n01i01362ent;
|
33
|
|
34
|
ARCHITECTURE c08s05b00x00p03n01i01362arch OF c08s05b00x00p03n01i01362ent IS
|
35
|
|
36
|
BEGIN
|
37
|
TESTING: PROCESS
|
38
|
--
|
39
|
-- Define constants for package
|
40
|
--
|
41
|
constant lowb : integer := 1 ;
|
42
|
constant highb : integer := 5 ;
|
43
|
constant lowb_i2 : integer := 0 ;
|
44
|
constant highb_i2 : integer := 1000 ;
|
45
|
constant lowb_p : integer := -100 ;
|
46
|
constant highb_p : integer := 1000 ;
|
47
|
constant lowb_r : real := 0.0 ;
|
48
|
constant highb_r : real := 1000.0 ;
|
49
|
constant lowb_r2 : real := 8.0 ;
|
50
|
constant highb_r2 : real := 80.0 ;
|
51
|
|
52
|
constant c_boolean_1 : boolean := false ;
|
53
|
constant c_boolean_2 : boolean := true ;
|
54
|
--
|
55
|
-- bit
|
56
|
constant c_bit_1 : bit := '0' ;
|
57
|
constant c_bit_2 : bit := '1' ;
|
58
|
|
59
|
-- severity_level
|
60
|
constant c_severity_level_1 : severity_level := NOTE ;
|
61
|
constant c_severity_level_2 : severity_level := WARNING ;
|
62
|
--
|
63
|
-- character
|
64
|
constant c_character_1 : character := 'A' ;
|
65
|
constant c_character_2 : character := 'a' ;
|
66
|
|
67
|
-- integer types
|
68
|
-- predefined
|
69
|
constant c_integer_1 : integer := lowb ;
|
70
|
constant c_integer_2 : integer := highb ;
|
71
|
--
|
72
|
-- user defined integer type
|
73
|
type t_int1 is range 0 to 100 ;
|
74
|
constant c_t_int1_1 : t_int1 := 0 ;
|
75
|
constant c_t_int1_2 : t_int1 := 10 ;
|
76
|
subtype st_int1 is t_int1 range 8 to 60 ;
|
77
|
constant c_st_int1_1 : st_int1 := 8 ;
|
78
|
constant c_st_int1_2 : st_int1 := 9 ;
|
79
|
--
|
80
|
-- physical types
|
81
|
-- predefined
|
82
|
constant c_time_1 : time := 1 ns ;
|
83
|
constant c_time_2 : time := 2 ns ;
|
84
|
--
|
85
|
--
|
86
|
-- floating point types
|
87
|
-- predefined
|
88
|
constant c_real_1 : real := 0.0 ;
|
89
|
constant c_real_2 : real := 1.0 ;
|
90
|
--
|
91
|
-- simple record
|
92
|
type t_rec1 is record
|
93
|
f1 : integer range lowb_i2 to highb_i2 ;
|
94
|
f2 : time ;
|
95
|
f3 : boolean ;
|
96
|
f4 : real ;
|
97
|
end record ;
|
98
|
constant c_t_rec1_1 : t_rec1 :=
|
99
|
(c_integer_1, c_time_1, c_boolean_1, c_real_1) ;
|
100
|
constant c_t_rec1_2 : t_rec1 :=
|
101
|
(c_integer_2, c_time_2, c_boolean_2, c_real_2) ;
|
102
|
subtype st_rec1 is t_rec1 ;
|
103
|
constant c_st_rec1_1 : st_rec1 := c_t_rec1_1 ;
|
104
|
constant c_st_rec1_2 : st_rec1 := c_t_rec1_2 ;
|
105
|
--
|
106
|
-- more complex record
|
107
|
type t_rec2 is record
|
108
|
f1 : boolean ;
|
109
|
f2 : st_rec1 ;
|
110
|
f3 : time ;
|
111
|
end record ;
|
112
|
constant c_t_rec2_1 : t_rec2 :=
|
113
|
(c_boolean_1, c_st_rec1_1, c_time_1) ;
|
114
|
constant c_t_rec2_2 : t_rec2 :=
|
115
|
(c_boolean_2, c_st_rec1_2, c_time_2) ;
|
116
|
subtype st_rec2 is t_rec2 ;
|
117
|
constant c_st_rec2_1 : st_rec2 := c_t_rec2_1 ;
|
118
|
constant c_st_rec2_2 : st_rec2 := c_t_rec2_2 ;
|
119
|
--
|
120
|
-- simple array
|
121
|
type t_arr1 is array (integer range <>) of st_int1 ;
|
122
|
subtype t_arr1_range1 is integer range lowb to highb ;
|
123
|
subtype st_arr1 is t_arr1 (t_arr1_range1) ;
|
124
|
constant c_st_arr1_1 : st_arr1 := (others => c_st_int1_1) ;
|
125
|
constant c_st_arr1_2 : st_arr1 := (others => c_st_int1_2) ;
|
126
|
constant c_t_arr1_1 : st_arr1 := c_st_arr1_1 ;
|
127
|
constant c_t_arr1_2 : st_arr1 := c_st_arr1_2 ;
|
128
|
--
|
129
|
-- more complex array
|
130
|
type t_arr2 is array (integer range <>, boolean range <>) of st_arr1 ;
|
131
|
subtype t_arr2_range1 is integer range lowb to highb ;
|
132
|
subtype t_arr2_range2 is boolean range false to true ;
|
133
|
subtype st_arr2 is t_arr2 (t_arr2_range1, t_arr2_range2);
|
134
|
constant c_st_arr2_1 : st_arr2 := (others => (others => c_st_arr1_1)) ;
|
135
|
constant c_st_arr2_2 : st_arr2 := (others => (others => c_st_arr1_2)) ;
|
136
|
constant c_t_arr2_1 : st_arr2 := c_st_arr2_1 ;
|
137
|
constant c_t_arr2_2 : st_arr2 := c_st_arr2_2 ;
|
138
|
--
|
139
|
-- most complex record
|
140
|
type t_rec3 is record
|
141
|
f1 : boolean ;
|
142
|
f2 : st_rec2 ;
|
143
|
f3 : st_arr2 ;
|
144
|
end record ;
|
145
|
constant c_t_rec3_1 : t_rec3 :=
|
146
|
(c_boolean_1, c_st_rec2_1, c_st_arr2_1) ;
|
147
|
constant c_t_rec3_2 : t_rec3 :=
|
148
|
(c_boolean_2, c_st_rec2_2, c_st_arr2_2) ;
|
149
|
subtype st_rec3 is t_rec3 ;
|
150
|
constant c_st_rec3_1 : st_rec3 := c_t_rec3_1 ;
|
151
|
constant c_st_rec3_2 : st_rec3 := c_t_rec3_2 ;
|
152
|
--
|
153
|
-- most complex array
|
154
|
type t_arr3 is array (integer range <>, boolean range <>) of st_rec3 ;
|
155
|
subtype t_arr3_range1 is integer range lowb to highb ;
|
156
|
subtype t_arr3_range2 is boolean range true downto false ;
|
157
|
subtype st_arr3 is t_arr3 (t_arr3_range1, t_arr3_range2) ;
|
158
|
constant c_st_arr3_1 : st_arr3 := (others => (others => c_st_rec3_1)) ;
|
159
|
constant c_st_arr3_2 : st_arr3 := (others => (others => c_st_rec3_2)) ;
|
160
|
constant c_t_arr3_1 : st_arr3 := c_st_arr3_1 ;
|
161
|
constant c_t_arr3_2 : st_arr3 := c_st_arr3_2 ;
|
162
|
--
|
163
|
variable v_st_arr3 : st_arr3 := c_st_arr3_1 ;
|
164
|
--
|
165
|
BEGIN
|
166
|
v_st_arr3(st_arr3'Left(1),st_arr3'Left(2)) :=
|
167
|
c_st_arr3_2(st_arr3'Right(1),st_arr3'Right(2)) ;
|
168
|
assert NOT(v_st_arr3(st_arr3'Left(1),st_arr3'Left(2)) = c_st_rec3_2)
|
169
|
report "***PASSED TEST: c08s05b00x00p03n01i01362"
|
170
|
severity NOTE;
|
171
|
assert (v_st_arr3(st_arr3'Left(1),st_arr3'Left(2)) = c_st_rec3_2)
|
172
|
report "***FAILED TEST: c08s05b00x00p03n01i01362 - The types of the variable and the assigned variable must match."
|
173
|
severity ERROR;
|
174
|
wait;
|
175
|
END PROCESS TESTING;
|
176
|
|
177
|
END c08s05b00x00p03n01i01362arch;
|