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: tc757.vhd,v 1.2 2001-10-26 16:30:00 paw Exp $
27-- $Revision: 1.2 $
28--
29-- ---------------------------------------------------------------------
30
31ENTITY c01s01b01x01p05n02i00757ent IS
32  generic(
33    zero : integer := 0;
34    one  : integer := 1;
35    two  : integer := 2;
36    three: integer := 3;
37    four : integer := 4;
38    five : integer := 5;
39    six  : integer := 6;
40    seven: integer := 7;
41    eight: integer := 8;
42    nine : integer := 9;
43    fifteen:integer:= 15;
44    C1 : boolean := true;
45    C2 : bit := '1';
46    C3 : character := 's';
47    C4 : severity_level := note;
48    C5 : integer := 3;
49    C6 : real := 3.0;
50    C7 : time := 3 ns;
51    C8 : natural := 1;
52    C9 : positive := 1;
53    C10 : string := "shishir";
54    C11 : bit_vector := B"0011"
55    );
56END c01s01b01x01p05n02i00757ent;
57
58ARCHITECTURE c01s01b01x01p05n02i00757arch OF c01s01b01x01p05n02i00757ent IS
59  subtype hi_to_low_range is integer range zero to seven;
60
61  type boolean_vector is array (natural range <>) of boolean;
62  type severity_level_vector is array (natural range <>) of severity_level;
63  type integer_vector is array (natural range <>) of integer;
64  type real_vector is array (natural range <>) of real;
65  type time_vector is array (natural range <>) of time;
66  type natural_vector is array (natural range <>) of natural;
67  type positive_vector is array (natural range <>) of positive;
68
69  subtype boolean_vector_st is boolean_vector(zero to fifteen);
70  subtype severity_level_vector_st is  severity_level_vector(zero to fifteen);
71  subtype integer_vector_st is  integer_vector(zero to fifteen);
72  subtype real_vector_st is  real_vector(zero to fifteen);
73  subtype time_vector_st is  time_vector(zero to fifteen);
74  subtype natural_vector_st is  natural_vector(zero to fifteen);
75  subtype positive_vector_st is  positive_vector(zero to fifteen);
76
77  type boolean_cons_vector is array (fifteen downto zero) of boolean;
78  type severity_level_cons_vector is array (fifteen downto zero) of severity_level;
79  type integer_cons_vector is array (fifteen downto zero) of integer;
80  type real_cons_vector is array (fifteen downto zero) of real;
81  type time_cons_vector is array (fifteen downto zero) of time;
82  type natural_cons_vector is array (fifteen downto zero) of natural;
83  type positive_cons_vector is array (fifteen downto zero) of positive;
84
85  type boolean_cons_vectorofvector is array (zero to fifteen) of boolean_cons_vector;
86  type severity_level_cons_vectorofvector is array (zero to fifteen) of severity_level_cons_vector;
87  type integer_cons_vectorofvector is array (zero to fifteen) of integer_cons_vector ;
88  type real_cons_vectorofvector is array (zero to fifteen) of real_cons_vector;
89  type time_cons_vectorofvector is array (zero to fifteen) of time_cons_vector;
90  type natural_cons_vectorofvector is array (zero to fifteen) of natural_cons_vector;
91  type positive_cons_vectorofvector is array (zero to fifteen) of positive_cons_vector;
92  subtype column is integer range one to two;
93  subtype row is integer range one to eight;
94  type s2boolean_cons_vector is array (row,column) of boolean;
95  type s2bit_cons_vector is array (row,column) of bit;
96  type s2char_cons_vector is array (row,column) of character;
97  type s2severity_level_cons_vector is array (row,column) of severity_level;
98  type s2integer_cons_vector is array (row,column) of integer;
99  type s2real_cons_vector is array (row,column) of real;
100  type s2time_cons_vector is array (row,column) of time;
101  type s2natural_cons_vector is array (row,column) of natural;
102  type s2positive_cons_vector is array (row,column) of positive;
103
104  type record_std_package is record
105                               a: boolean;
106                               b: bit;
107                               c:character;
108                               d:severity_level;
109                               e:integer;
110                               f:real;
111                               g:time;
112                               h:natural;
113                               i:positive;
114                               j:string(one to seven);
115                               k:bit_vector(zero to three);
116                             end record;
117
118  type record_array_st is record
119                            a:boolean_vector_st;
120                            b:severity_level_vector_st;
121                            c:integer_vector_st;
122                            d:real_vector_st;
123                            e:time_vector_st;
124                            f:natural_vector_st;
125                            g:positive_vector_st;
126                          end record;
127
128  type record_cons_array is record
129                              a:boolean_cons_vector;
130                              b:severity_level_cons_vector;
131                              c:integer_cons_vector;
132                              d:real_cons_vector;
133                              e:time_cons_vector;
134                              f:natural_cons_vector;
135                              g:positive_cons_vector;
136                            end record;
137
138  type record_2cons_array is record
139                               a:s2boolean_cons_vector;
140                               b:s2bit_cons_vector;
141                               c:s2char_cons_vector;
142                               d:s2severity_level_cons_vector;
143                               e:s2integer_cons_vector;
144                               f:s2real_cons_vector;
145                               g:s2time_cons_vector;
146                               h:s2natural_cons_vector;
147                               i:s2positive_cons_vector;
148                             end record;
149
150  type record_cons_arrayofarray is record
151                                     a:boolean_cons_vectorofvector;
152                                     b:severity_level_cons_vectorofvector;
153                                     c:integer_cons_vectorofvector;
154                                     d:real_cons_vectorofvector;
155                                     e:time_cons_vectorofvector;
156                                     f:natural_cons_vectorofvector;
157                                     g:positive_cons_vectorofvector;
158                                   end record;
159
160  type record_array_new is record
161                             a:boolean_vector(zero to fifteen);
162                             b:severity_level_vector(zero to fifteen);
163                             c:integer_vector(zero to fifteen);
164                             d:real_vector(zero to fifteen);
165                             e:time_vector(zero to fifteen);
166                             f:natural_vector(zero to fifteen);
167                             g:positive_vector(zero to fifteen);
168                           end record;
169
170  type record_of_records is record
171                              a: record_std_package;
172                              c: record_cons_array;
173                              e: record_2cons_array;
174                              g: record_cons_arrayofarray;
175                              i: record_array_st;
176                              j: record_array_new;
177                            end record;
178  subtype boolean_vector_range is boolean_vector(hi_to_low_range);
179  subtype severity_level_vector_range is severity_level_vector(hi_to_low_range);
180  subtype integer_vector_range is integer_vector(hi_to_low_range);
181  subtype real_vector_range is real_vector(hi_to_low_range);
182  subtype time_vector_range is time_vector(hi_to_low_range);
183  subtype natural_vector_range is natural_vector(hi_to_low_range);
184  subtype positive_vector_range is positive_vector(hi_to_low_range);
185
186  type array_rec_std is array (integer range <>) of record_std_package;
187  type array_rec_cons is array (integer range <>) of record_cons_array;
188  type array_rec_2cons is array (integer range <>) of record_2cons_array;
189  type array_rec_rec is array (integer range <>) of record_of_records;
190
191  subtype array_rec_std_st is array_rec_std (hi_to_low_range);
192  subtype array_rec_cons_st is array_rec_cons (hi_to_low_range);
193  subtype array_rec_2cons_st is  array_rec_2cons (hi_to_low_range);
194  subtype array_rec_rec_st is array_rec_rec (hi_to_low_range);
195
196  type record_of_arr_of_record is record
197                                    a: array_rec_std(zero to seven);
198                                    b: array_rec_cons(zero to seven);
199                                    c: array_rec_2cons(zero to seven);
200                                    d: array_rec_rec(zero to seven);
201                                  end record;
202
203  type four_value is ('Z','0','1','X');                                 --enumerated type
204  type four_value_vector is array (natural range <>) of four_value;
205  subtype four_value_vector_range is four_value_vector(hi_to_low_range);
206
207  type current is range -2147483647 to +2147483647
208    units
209      nA;
210      uA = 1000 nA;
211      mA = 1000 uA;
212      A  = 1000 mA;
213    end units;
214
215  type current_vector is array (natural range <>) of current;
216  subtype current_vector_range is current_vector(hi_to_low_range);
217
218
219  type resistance is range -2147483647 to +2147483647
220    units
221      uOhm;
222      mOhm = 1000 uOhm;
223      Ohm = 1000 mOhm;
224      KOhm  = 1000 Ohm;
225    end units;
226
227  type resistance_vector is array (natural range <>) of resistance;
228  subtype resistance_vector_range is resistance_vector(hi_to_low_range);
229--   function resolution14(i:in four_value_vector) return four_value;        --bus resolution
230--   subtype four_value_state is resolution14 four_value;                    --function type
231  type four_value_map is array(four_value) of boolean;
232  subtype binary is four_value range '0' to '1';
233  type byte is array(zero to seven) of bit;
234  subtype word is bit_vector(zero to fifteen);                                 --constrained array
235  constant size :integer := seven;
236  type primary_memory is array(zero to size) of word;                     --array of an array
237  type primary_memory_module is                                       --record with field
238    record                                                               --as an array
239      enable:binary;
240      memory_number:primary_memory;
241    end record;
242  type whole_memory is array(0 to size) of primary_memory_module;     --array of a complex record
243  subtype delay is integer range one to 10;
244
245
246  constant     C12 : boolean_vector := (C1,false);
247  constant     C13 : severity_level_vector := (C4,error);
248  constant     C14 : integer_vector := (one,two,three,four);
249  constant     C15 : real_vector := (1.0,2.0,C6,4.0);
250  constant     C16 : time_vector := (1 ns, 2 ns,C7, 4 ns);
251  constant     C17 : natural_vector := (one,2,3,4);
252  constant     C18 : positive_vector := (one,2,3,4);
253  constant C19 : boolean_cons_vector := (others => C1);
254  constant C20 : severity_level_cons_vector := (others => C4);
255  constant C21 : integer_cons_vector := (others => C5);
256  constant C22 : real_cons_vector := (others => C6);
257  constant C23 : time_cons_vector :=  (others => C7);
258  constant C24 : natural_cons_vector :=  (others => C8);
259  constant C25 : positive_cons_vector :=  (others => C9);
260  constant C26 : boolean_cons_vectorofvector := (others => (others => C1));
261  constant C27 : severity_level_cons_vectorofvector :=  (others => (others => C4));
262  constant C28 : integer_cons_vectorofvector := (others => (others => C5));
263  constant C29 : real_cons_vectorofvector := (others => (others => C6));
264  constant C30 : time_cons_vectorofvector := (others => (others => C7));
265  constant C31 : natural_cons_vectorofvector := (others => (others => C8));
266  constant C32 : positive_cons_vectorofvector := (others => (others => C9));
267
268BEGIN
269  assert (hi_to_low_range'left = 0) report "generic for left bound of hi_to_low_range not working" severity failure;
270  assert (hi_to_low_range'right = 7) report "generic for right bound of hi_to_low_range not working" severity failure;
271  assert (row'left = 1) report "generic constrained for left bound of row not working" severity failure;
272  assert (row'right = 8) report "generic constrained for right bound of row not working" severity failure;
273  assert (column'left = 1) report "generic constrained for left bound of column not working" severity failure;
274  assert (column'right = 2) report "generic constrained for right bound of column not working" severity failure;
275  assert (boolean_cons_vector'left = 15) report "generic constrained for left bound of array not working" severity failure;
276  assert (severity_level_cons_vector'left = 15) report "generic constrained for left bound of array not working" severity failure;
277  assert (integer_cons_vector'left = 15) report "generic constrained for left bound of array not working" severity failure;
278  assert (real_cons_vector'left = 15) report "generic constrained for left bound of array not working" severity failure;
279  assert (time_cons_vector'left = 15) report "generic constrained for left bound of array not working" severity failure;
280  assert (natural_cons_vector'left = 15) report "generic constrained for left bound of array not working" severity failure;
281  assert (positive_cons_vector'left = 15) report "generic constrained for left bound of array not working" severity failure;
282  assert (boolean_cons_vector'right = 0) report "generic constrained for right bound of array not working" severity failure;
283  assert (severity_level_cons_vector'right = 0) report "generic constrained for right bound of array not working" severity failure;
284  assert (integer_cons_vector'right = 0) report "generic constrained for right bound of array not working" severity failure;
285  assert (real_cons_vector'right = 0) report "generic constrained for right bound of array not working" severity failure;
286  assert (time_cons_vector'right = 0) report "generic constrained for right bound of array not working" severity failure;
287  assert (natural_cons_vector'right = 0) report "generic constrained for right bound of array not working" severity failure;
288  assert (positive_cons_vector'right = 0) report "generic constrained for right bound of array not working" severity failure;
289  assert  (boolean_cons_vectorofvector'left = 0) report "generic constrained for left bound of array not working" severity failure;
290  assert  (severity_level_cons_vectorofvector'left = 0) report "generic constrained for left bound of array not working" severity failure;
291  assert  (integer_cons_vectorofvector'left = 0) report "generic constrained for left bound of array not working" severity failure;
292  assert  (real_cons_vectorofvector'left = 0) report "generic constrained for left bound of array not working" severity failure;
293  assert  (time_cons_vectorofvector'left = 0) report "generic constrained for left bound of array not working" severity failure;
294  assert  (natural_cons_vectorofvector'left = 0) report "generic constrained for left bound of array not working" severity failure;
295  assert  (positive_cons_vectorofvector'left = 0) report "generic constrained for left bound of array not working" severity failure;
296  assert  (boolean_cons_vectorofvector'right = 15) report "generic constrained for right bound of array not working" severity failure;
297  assert  (severity_level_cons_vectorofvector'right = 15) report "generic constrained for right bound of array not working" severity failure;
298  assert  (integer_cons_vectorofvector'right = 15) report "generic constrained for right bound of array not working" severity failure;
299  assert  (real_cons_vectorofvector'right = 15) report "generic constrained for right bound of array not working" severity failure;
300  assert  (time_cons_vectorofvector'right = 15) report "generic constrained for right bound of array not working" severity failure;
301  assert  (natural_cons_vectorofvector'right = 15) report "generic constrained for right bound of array not working" severity failure;
302  assert  (positive_cons_vectorofvector'right = 15) report "generic constrained for right bound of array not working" severity failure;
303
304  TESTING: PROCESS
305  BEGIN
306
307    assert    NOT(    (hi_to_low_range'left = 0) and
308                      (hi_to_low_range'right = 7) and
309                      (row'left = 1) and
310                      (row'right = 8) and
311                      (column'left = 1) and
312                      (column'right = 2) and
313                      (boolean_cons_vector'left = 15) and
314                      (severity_level_cons_vector'left = 15)   and
315                      (integer_cons_vector'left = 15) and
316                      (real_cons_vector'left = 15)    and
317                      (time_cons_vector'left = 15)    and
318                      (natural_cons_vector'left = 15) and
319                      (positive_cons_vector'left = 15) and
320                      (boolean_cons_vector'right = 0) and
321                      (severity_level_cons_vector'right = 0)   and
322                      (integer_cons_vector'right = 0) and
323                      (real_cons_vector'right = 0)    and
324                      (time_cons_vector'right = 0)    and
325                      (natural_cons_vector'right = 0) and
326                      (positive_cons_vector'right = 0) and
327                      (boolean_cons_vectorofvector'left = 0) and
328                      (severity_level_cons_vectorofvector'left = 0) and
329                      (integer_cons_vectorofvector'left = 0) and
330                      (real_cons_vectorofvector'left = 0)    and
331                      (time_cons_vectorofvector'left = 0)    and
332                      (natural_cons_vectorofvector'left = 0) and
333                      (positive_cons_vectorofvector'left = 0) and
334                      (boolean_cons_vectorofvector'right = 15) and
335                      (severity_level_cons_vectorofvector'right = 15) and
336                      (integer_cons_vectorofvector'right = 15) and
337                      (real_cons_vectorofvector'right = 15)    and
338                      (time_cons_vectorofvector'right = 15)    and
339                      (natural_cons_vectorofvector'right = 15) and
340                      (positive_cons_vectorofvector'right = 15)    )
341      report "***PASSED TEST: c01s01b01x01p05n02i00757"
342      severity NOTE;
343    assert    (    (hi_to_low_range'left = 0) and
344                   (hi_to_low_range'right = 7) and
345                   (row'left = 1) and
346                   (row'right = 8) and
347                   (column'left = 1) and
348                   (column'right = 2) and
349                   (boolean_cons_vector'left = 15) and
350                   (severity_level_cons_vector'left = 15)   and
351                   (integer_cons_vector'left = 15) and
352                   (real_cons_vector'left = 15)    and
353                   (time_cons_vector'left = 15)    and
354                   (natural_cons_vector'left = 15) and
355                   (positive_cons_vector'left = 15) and
356                   (boolean_cons_vector'right = 0) and
357                   (severity_level_cons_vector'right = 0)   and
358                   (integer_cons_vector'right = 0) and
359                   (real_cons_vector'right = 0)    and
360                   (time_cons_vector'right = 0)    and
361                   (natural_cons_vector'right = 0) and
362                   (positive_cons_vector'right = 0) and
363                   (boolean_cons_vectorofvector'left = 0) and
364                   (severity_level_cons_vectorofvector'left = 0) and
365                   (integer_cons_vectorofvector'left = 0) and
366                   (real_cons_vectorofvector'left = 0)    and
367                   (time_cons_vectorofvector'left = 0)    and
368                   (natural_cons_vectorofvector'left = 0) and
369                   (positive_cons_vectorofvector'left = 0) and
370                   (boolean_cons_vectorofvector'right = 15) and
371                   (severity_level_cons_vectorofvector'right = 15) and
372                   (integer_cons_vectorofvector'right = 15) and
373                   (real_cons_vectorofvector'right = 15)    and
374                   (time_cons_vectorofvector'right = 15)    and
375                   (natural_cons_vectorofvector'right = 15) and
376                   (positive_cons_vectorofvector'right = 15)    )
377      report "***FAILED TEST: c01s01b01x01p05n02i00757 - Generic can be used to specify the size of ports."
378      severity ERROR;
379    wait;
380  END PROCESS TESTING;
381
382END c01s01b01x01p05n02i00757arch;
383