| 1 |
-- CD30004.A |
| 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 |
-- |
| 26 |
-- OBJECTIVE: |
| 27 |
-- |
| 28 |
-- |
| 29 |
-- Check that the unspecified Size of static discrete |
| 30 |
-- subtypes is the number of bits needed to represent each value |
| 31 |
-- belonging to the subtype using an unbiased representation, where |
| 32 |
-- space for a sign bit is provided only in the event the subtype |
| 33 |
-- contains negative values. Check that for first subtypes specified |
| 34 |
-- Sizes are supported reflecting this representation. [ARM 95 13.3(55)]. |
| 35 |
-- |
| 36 |
-- TEST DESCRIPTION: |
| 37 |
-- This test defines a few types that should have distinctly recognizable |
| 38 |
-- sizes. A packed record which should result in very specific bits |
| 39 |
-- sizes for it's components is used to check the first part of the |
| 40 |
-- objective. The second part of the objective is checked by giving |
| 41 |
-- sizes for a similar set of types. |
| 42 |
-- |
| 43 |
-- APPLICABILITY CRITERIA: |
| 44 |
-- All implementations must attempt to compile this test. |
| 45 |
-- |
| 46 |
-- For implementations validating against Systems Programming Annex (C): |
| 47 |
-- this test must execute and report PASSED. |
| 48 |
-- |
| 49 |
-- For implementations not validating against Annex C: |
| 50 |
-- this test may report compile time errors at one or more points |
| 51 |
-- indicated by "-- ANX-C RQMT", in which case it may be graded as inapplicable. |
| 52 |
-- Otherwise, the test must execute and report PASSED. |
| 53 |
-- |
| 54 |
-- CHANGE HISTORY: |
| 55 |
-- 22 JUL 95 SAIC Initial version |
| 56 |
-- 06 MAY 96 SAIC Revised for 2.1 |
| 57 |
-- 26 FEB 97 PWB.CTA Added pragma Pack for type Check_Record |
| 58 |
-- 16 FEB 98 EDS Modified Documentation. |
| 59 |
-- 06 JUL 99 RLB Repaired comments, removed junk test cases. |
| 60 |
-- Added test cases to test that appropriate Size |
| 61 |
-- clauses are allowed. |
| 62 |
|
| 63 |
--! |
| 64 |
----------------------------------------------------------------- CD30004_0 |
| 65 |
|
| 66 |
package CD30004_0 is |
| 67 |
|
| 68 |
-- Check that the unspecified Size of static discrete and fixed point |
| 69 |
-- subtypes are the number of bits needed to represent each value |
| 70 |
-- belonging to the subtype using an unbiased representation, where |
| 71 |
-- space for a sign bit is provided only in the event the subtype |
| 72 |
-- contains negative values. Check that for first subtypes specified |
| 73 |
-- Sizes are supported reflecting this representation. |
| 74 |
|
| 75 |
type Bits_2 is ( Zeroth_Bit, Fiercest_Bit, Secants_Bit, Threadless_Bit ); |
| 76 |
|
| 77 |
type Bits_3 is range 0..2**3-1; |
| 78 |
|
| 79 |
type Bits_5 is range -2**4+1..2**4-1; -- allow for 1's comp |
| 80 |
|
| 81 |
type Bits_14 is mod 2**14; |
| 82 |
|
| 83 |
type Check_Record is |
| 84 |
record |
| 85 |
B14 : Bits_14; |
| 86 |
B2 : Bits_2; |
| 87 |
B3 : Bits_3; |
| 88 |
B5 : Bits_5; |
| 89 |
C : Character; |
| 90 |
end record; |
| 91 |
pragma Pack ( Check_Record ); |
| 92 |
|
| 93 |
procedure TC_Check_Values; |
| 94 |
procedure TC_Check_Specified_Sizes; |
| 95 |
|
| 96 |
end CD30004_0; |
| 97 |
|
| 98 |
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- |
| 99 |
with Report; |
| 100 |
with Impdef; |
| 101 |
package body CD30004_0 is |
| 102 |
|
| 103 |
procedure TC_Check_Values is |
| 104 |
begin |
| 105 |
|
| 106 |
if Bits_2'Size /= 2 then |
| 107 |
if Impdef.Validating_Annex_C then |
| 108 |
Report.Failed("Bits_2'Size not 2 bits"); |
| 109 |
else -- Recommended levels of support are not binding. |
| 110 |
Report.Comment("Bits_2'Size not 2 bits"); |
| 111 |
end if; |
| 112 |
end if; |
| 113 |
|
| 114 |
if Bits_14'Size /= 14 then |
| 115 |
if Impdef.Validating_Annex_C then |
| 116 |
Report.Failed("Bits_14'Size not 14 bits"); |
| 117 |
else |
| 118 |
Report.Comment("Bits_14'Size not 14 bits"); |
| 119 |
end if; |
| 120 |
end if; |
| 121 |
|
| 122 |
if Bits_3'Size /= 3 then |
| 123 |
if Impdef.Validating_Annex_C then |
| 124 |
Report.Failed("Bits_3'Size not 3 bits"); |
| 125 |
else |
| 126 |
Report.Comment("Bits_3'Size not 3 bits"); |
| 127 |
end if; |
| 128 |
end if; |
| 129 |
|
| 130 |
if Bits_5'Size /= 5 then |
| 131 |
if Impdef.Validating_Annex_C then |
| 132 |
Report.Failed("Bits_5'Size not 5 bits"); |
| 133 |
else |
| 134 |
Report.Comment("Bits_5'Size not 5 bits"); |
| 135 |
end if; |
| 136 |
end if; |
| 137 |
|
| 138 |
if Character'Size /= 8 then |
| 139 |
Report.Failed("Character'Size not 8 bits"); |
| 140 |
end if; |
| 141 |
|
| 142 |
if Wide_Character'Size /= 16 then |
| 143 |
Report.Failed("Wide_Character'Size not 16 bits"); |
| 144 |
end if; |
| 145 |
|
| 146 |
end TC_Check_Values; |
| 147 |
|
| 148 |
type Spec_Bits_2 is ( Zeroth_Bit, Fiercest_Bit, Secants_Bit, Threadless_Bit ); |
| 149 |
for Spec_Bits_2'Size use 2; -- ANX-C RQMT. |
| 150 |
|
| 151 |
type Spec_Bits_3 is range 0..2**3-1; |
| 152 |
for Spec_Bits_3'Size use 3; -- ANX-C RQMT. |
| 153 |
|
| 154 |
type Spec_Bits_5 is range -2**4+1..2**4-1; -- allow for 1's comp |
| 155 |
for Spec_Bits_5'Size use 5; -- ANX-C RQMT. |
| 156 |
|
| 157 |
type Spec_Bits_14 is mod 2**14; |
| 158 |
for Spec_Bits_14'Size use 14; -- ANX-C RQMT. |
| 159 |
|
| 160 |
type Spec_Record is new Check_Record; |
| 161 |
for Spec_Record'Size use 64; -- ANX-C RQMT. |
| 162 |
|
| 163 |
procedure TC_Check_Specified_Sizes is |
| 164 |
|
| 165 |
begin |
| 166 |
|
| 167 |
if Spec_Record'Size /= 64 then |
| 168 |
Report.Failed("Spec_Record'Size not 64 bits"); |
| 169 |
end if; |
| 170 |
|
| 171 |
if Spec_Bits_2'Size /= 2 then |
| 172 |
Report.Failed("Spec_Bits_2'Size not 2 bits"); |
| 173 |
end if; |
| 174 |
|
| 175 |
if Spec_Bits_14'Size /= 14 then |
| 176 |
Report.Failed("Spec_Bits_14'Size not 14 bits"); |
| 177 |
end if; |
| 178 |
|
| 179 |
if Spec_Bits_3'Size /= 3 then |
| 180 |
Report.Failed("Spec_Bits_3'Size not 3 bits"); |
| 181 |
end if; |
| 182 |
|
| 183 |
if Spec_Bits_5'Size /= 5 then |
| 184 |
Report.Failed("Spec_Bits_5'Size not 5 bits"); |
| 185 |
end if; |
| 186 |
|
| 187 |
end TC_Check_Specified_Sizes; |
| 188 |
|
| 189 |
end CD30004_0; |
| 190 |
|
| 191 |
------------------------------------------------------------------- CD30004 |
| 192 |
|
| 193 |
with Report; |
| 194 |
with CD30004_0; |
| 195 |
|
| 196 |
procedure CD30004 is |
| 197 |
|
| 198 |
begin -- Main test procedure. |
| 199 |
|
| 200 |
Report.Test ("CD30004", "Check that the unspecified Size of static " & |
| 201 |
"discrete and fixed point subtypes is the number of bits " & |
| 202 |
"needed to represent each value belonging to the subtype " & |
| 203 |
"using an unbiased representation, where space for a sign " & |
| 204 |
"bit is provided only in the event the subtype contains " & |
| 205 |
"negative values. Check that for first subtypes " & |
| 206 |
"specified Sizes are supported reflecting this " & |
| 207 |
"representation."); |
| 208 |
|
| 209 |
CD30004_0.TC_Check_Values; |
| 210 |
|
| 211 |
CD30004_0.TC_Check_Specified_Sizes; |
| 212 |
|
| 213 |
Report.Result; |
| 214 |
|
| 215 |
end CD30004; |