1 |
12 |
jlechner |
-- CD4051D.ADA
|
2 |
|
|
|
3 |
|
|
-- Grant of Unlimited Rights
|
4 |
|
|
--
|
5 |
|
|
-- Under contracts F33600-87-D-0337, F33600-84-D-0280, MDA903-79-C-0687,
|
6 |
|
|
-- F08630-91-C-0015, and DCA100-97-D-0025, the U.S. Government obtained
|
7 |
|
|
-- unlimited rights in the software and documentation contained herein.
|
8 |
|
|
-- Unlimited rights are defined in DFAR 252.227-7013(a)(19). By making
|
9 |
|
|
-- this public release, the Government intends to confer upon all
|
10 |
|
|
-- recipients unlimited rights equal to those held by the Government.
|
11 |
|
|
-- These rights include rights to use, duplicate, release or disclose the
|
12 |
|
|
-- released technical data and computer software in whole or in part, in
|
13 |
|
|
-- any manner and for any purpose whatsoever, and to have or permit others
|
14 |
|
|
-- to do so.
|
15 |
|
|
--
|
16 |
|
|
-- DISCLAIMER
|
17 |
|
|
--
|
18 |
|
|
-- ALL MATERIALS OR INFORMATION HEREIN RELEASED, MADE AVAILABLE OR
|
19 |
|
|
-- DISCLOSED ARE AS IS. THE GOVERNMENT MAKES NO EXPRESS OR IMPLIED
|
20 |
|
|
-- WARRANTY AS TO ANY MATTER WHATSOEVER, INCLUDING THE CONDITIONS OF THE
|
21 |
|
|
-- SOFTWARE, DOCUMENTATION OR OTHER INFORMATION RELEASED, MADE AVAILABLE
|
22 |
|
|
-- OR DISCLOSED, OR THE OWNERSHIP, MERCHANTABILITY, OR FITNESS FOR A
|
23 |
|
|
-- PARTICULAR PURPOSE OF SAID MATERIAL.
|
24 |
|
|
--*
|
25 |
|
|
-- OBJECTIVE:
|
26 |
|
|
-- CHECK THAT A RECORD REPRESENTATION CLAUSE CAN BE GIVEN FOR
|
27 |
|
|
-- A DERIVED SUBTYPE WHOSE PARENT TYPE IS A RECORD TYPE WITH
|
28 |
|
|
-- VARIANTS AND THE REPRESENTATION CLAUSE MENTIONS COMPONENTS THAT
|
29 |
|
|
-- DO NOT EXIST IN THE DERIVED SUBTYPE.
|
30 |
|
|
|
31 |
|
|
-- HISTORY:
|
32 |
|
|
-- RJW 08/25/87 CREATED ORIGINAL TEST.
|
33 |
|
|
-- DHH 03/27/89 CHANGED EXTENSION FROM '.DEP' TO '.ADA' AND
|
34 |
|
|
-- ADDED CHECK FOR REPRESENTATION CLAUSE.
|
35 |
|
|
-- RJW 10/26/89 REMOVED REFERENCES TO LENGTH_CHECK.
|
36 |
|
|
-- THS 09/18/90 MADE CALLS TO IDENT_INT TO DEFEAT OPTIMIZATION.
|
37 |
|
|
-- JRL 10/13/96 Adjusted ranges in type definitions to allow 1's
|
38 |
|
|
-- complement machines to represent all values in
|
39 |
|
|
-- the specified number of bits.
|
40 |
|
|
|
41 |
|
|
WITH REPORT; USE REPORT;
|
42 |
|
|
WITH SYSTEM;
|
43 |
|
|
PROCEDURE CD4051D IS
|
44 |
|
|
|
45 |
|
|
TYPE INT IS RANGE -3 .. 3;
|
46 |
|
|
TYPE LARGE_INT IS RANGE -7 .. 7;
|
47 |
|
|
|
48 |
|
|
TYPE BASIC_CLAUSE (DISC : BOOLEAN) IS RECORD
|
49 |
|
|
BOOL_COMP : BOOLEAN;
|
50 |
|
|
CASE DISC IS
|
51 |
|
|
WHEN FALSE =>
|
52 |
|
|
INT_COMP : LARGE_INT;
|
53 |
|
|
WHEN TRUE =>
|
54 |
|
|
CH_COMP_1 : INT;
|
55 |
|
|
CH_COMP_2 : INT;
|
56 |
|
|
END CASE;
|
57 |
|
|
END RECORD;
|
58 |
|
|
|
59 |
|
|
TYPE CHECK_CLAUSE IS NEW BASIC_CLAUSE (TRUE);
|
60 |
|
|
|
61 |
|
|
FOR CHECK_CLAUSE USE
|
62 |
|
|
RECORD
|
63 |
|
|
DISC AT 0
|
64 |
|
|
RANGE 0 .. 0;
|
65 |
|
|
BOOL_COMP AT 0
|
66 |
|
|
RANGE 1 .. 1;
|
67 |
|
|
INT_COMP AT 0
|
68 |
|
|
RANGE 2 .. 5;
|
69 |
|
|
CH_COMP_1 AT 0
|
70 |
|
|
RANGE 2 .. 4;
|
71 |
|
|
CH_COMP_2 AT 0
|
72 |
|
|
RANGE 5 .. 7;
|
73 |
|
|
END RECORD;
|
74 |
|
|
|
75 |
|
|
CHECK_RECORD : CHECK_CLAUSE := (TRUE, TRUE, -2, -2);
|
76 |
|
|
|
77 |
|
|
BEGIN
|
78 |
|
|
TEST ("CD4051D", "CHECK THAT A RECORD REPRESENTATION " &
|
79 |
|
|
"CLAUSE CAN BE GIVEN FOR A DERIVED TYPE " &
|
80 |
|
|
"WHOSE PARENT TYPE IS A RECORD TYPE " &
|
81 |
|
|
"WITH VARIANTS AND WHERE THE RECORD " &
|
82 |
|
|
"REPRESENTATION CLAUSE MENTIONS COMPONENTS " &
|
83 |
|
|
"THAT DO NOT EXIST IN THE DERIVED SUBTYPE");
|
84 |
|
|
|
85 |
|
|
IF CHECK_RECORD.DISC'FIRST_BIT /= IDENT_INT (0) THEN
|
86 |
|
|
FAILED ("INCORRECT VALUE FOR FIRST_BIT OF DISC");
|
87 |
|
|
END IF;
|
88 |
|
|
|
89 |
|
|
IF CHECK_RECORD.DISC'LAST_BIT /= IDENT_INT (0) THEN
|
90 |
|
|
FAILED ("INCORRECT VALUE FOR LAST_BIT OF DISC");
|
91 |
|
|
END IF;
|
92 |
|
|
|
93 |
|
|
IF CHECK_RECORD.DISC'POSITION /= IDENT_INT (0) THEN
|
94 |
|
|
FAILED ("INCORRECT VALUE FOR POSITION OF DISC");
|
95 |
|
|
END IF;
|
96 |
|
|
|
97 |
|
|
IF CHECK_RECORD.BOOL_COMP'FIRST_BIT /= IDENT_INT (1) THEN
|
98 |
|
|
FAILED ("INCORRECT VALUE FOR FIRST_BIT OF BOOL_COMP");
|
99 |
|
|
END IF;
|
100 |
|
|
|
101 |
|
|
IF CHECK_RECORD.BOOL_COMP'LAST_BIT /= IDENT_INT (1) THEN
|
102 |
|
|
FAILED ("INCORRECT VALUE FOR LAST_BIT OF BOOL_COMP");
|
103 |
|
|
END IF;
|
104 |
|
|
|
105 |
|
|
IF CHECK_RECORD.BOOL_COMP'POSITION /= IDENT_INT (0) THEN
|
106 |
|
|
FAILED ("INCORRECT VALUE FOR POSITION OF BOOL_COMP");
|
107 |
|
|
END IF;
|
108 |
|
|
|
109 |
|
|
IF CHECK_RECORD.CH_COMP_1'FIRST_BIT /= IDENT_INT (2) THEN
|
110 |
|
|
FAILED ("INCORRECT VALUE FOR FIRST_BIT OF CH_COMP_1");
|
111 |
|
|
END IF;
|
112 |
|
|
|
113 |
|
|
IF CHECK_RECORD.CH_COMP_1'LAST_BIT /= IDENT_INT (4) THEN
|
114 |
|
|
FAILED ("INCORRECT VALUE FOR LAST_BIT OF CH_COMP_1");
|
115 |
|
|
END IF;
|
116 |
|
|
|
117 |
|
|
IF CHECK_RECORD.CH_COMP_1'POSITION /= IDENT_INT (0) THEN
|
118 |
|
|
FAILED ("INCORRECT VALUE FOR POSITION OF CH_COMP_1");
|
119 |
|
|
END IF;
|
120 |
|
|
|
121 |
|
|
IF CHECK_RECORD.CH_COMP_2'FIRST_BIT /= IDENT_INT (5) THEN
|
122 |
|
|
FAILED ("INCORRECT VALUE FOR FIRST_BIT OF CH_COMP_2");
|
123 |
|
|
END IF;
|
124 |
|
|
|
125 |
|
|
IF CHECK_RECORD.CH_COMP_2'LAST_BIT /= IDENT_INT (7) THEN
|
126 |
|
|
FAILED ("INCORRECT VALUE FOR LAST_BIT OF CH_COMP_2");
|
127 |
|
|
END IF;
|
128 |
|
|
|
129 |
|
|
IF CHECK_RECORD.CH_COMP_2'POSITION /= IDENT_INT (0) THEN
|
130 |
|
|
FAILED ("INCORRECT VALUE FOR POSITION OF CH_COMP_2");
|
131 |
|
|
END IF;
|
132 |
|
|
|
133 |
|
|
RESULT;
|
134 |
|
|
END CD4051D;
|