| 1 |
294 |
jeremybenn |
-- CD33001.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 |
|
|
-- Check that Component_Sizes that are a factor of the word
|
| 28 |
|
|
-- size are supported.
|
| 29 |
|
|
--
|
| 30 |
|
|
-- Check that for such Component_Sizes arrays contain no gaps between
|
| 31 |
|
|
-- components.
|
| 32 |
|
|
--
|
| 33 |
|
|
-- TEST DESCRIPTION:
|
| 34 |
|
|
-- This test defines three array types and specifies their layouts
|
| 35 |
|
|
-- using representation specifications for the 'Component_Size and
|
| 36 |
|
|
-- pragma Packs for each. It then checks that the implied assumptions
|
| 37 |
|
|
-- about the resulting layout actually can be made.
|
| 38 |
|
|
--
|
| 39 |
|
|
-- APPLICABILITY CRITERIA:
|
| 40 |
|
|
-- All implementations must attempt to compile this test.
|
| 41 |
|
|
--
|
| 42 |
|
|
-- For implementations validating against Systems Programming Annex (C):
|
| 43 |
|
|
-- this test must execute and report PASSED.
|
| 44 |
|
|
--
|
| 45 |
|
|
-- For implementations not validating against Annex C:
|
| 46 |
|
|
-- this test may report compile time errors at one or more points
|
| 47 |
|
|
-- indicated by "-- ANX-C RQMT", in which case it may be graded as inapplicable.
|
| 48 |
|
|
-- Otherwise, the test must execute and report PASSED.
|
| 49 |
|
|
--
|
| 50 |
|
|
--
|
| 51 |
|
|
-- CHANGE HISTORY:
|
| 52 |
|
|
-- 22 JUL 95 SAIC Initial version
|
| 53 |
|
|
-- 07 MAY 96 SAIC Revised for 2.1
|
| 54 |
|
|
-- 24 AUG 96 SAIC Additional 2.1 revisions
|
| 55 |
|
|
-- 17 FEB 97 PWB.CTA Corrected prefix of 'Component_Size to name
|
| 56 |
|
|
-- array object instead of array subtype
|
| 57 |
|
|
-- 16 FEB 98 EDS Modified documentation.
|
| 58 |
|
|
--!
|
| 59 |
|
|
|
| 60 |
|
|
----------------------------------------------------------------- CD33001_0
|
| 61 |
|
|
|
| 62 |
|
|
with System;
|
| 63 |
|
|
package CD33001_0 is
|
| 64 |
|
|
|
| 65 |
|
|
S_Units_per_Word : constant := System.Word_Size/System.Storage_Unit;
|
| 66 |
|
|
|
| 67 |
|
|
type Nibble is mod 2**4;
|
| 68 |
|
|
|
| 69 |
|
|
type Byte is mod 2**8;
|
| 70 |
|
|
|
| 71 |
|
|
type Half_Stuff is array(Natural range <>) of Nibble;
|
| 72 |
|
|
for Half_Stuff'Component_Size
|
| 73 |
|
|
use System.Word_Size / 2; -- factor -- ANX-C RQMT.
|
| 74 |
|
|
pragma Pack(Half_Stuff); -- ANX-C RQMT.
|
| 75 |
|
|
|
| 76 |
|
|
type Word_Stuff is array(Natural range <>) of Byte;
|
| 77 |
|
|
for Word_Stuff'Component_Size
|
| 78 |
|
|
use System.Word_Size; -- ANX-C RQMT.
|
| 79 |
|
|
|
| 80 |
|
|
type Address_Calculator is record
|
| 81 |
|
|
Item_1 : Nibble;
|
| 82 |
|
|
Item_2 : Nibble;
|
| 83 |
|
|
end record;
|
| 84 |
|
|
|
| 85 |
|
|
for Address_Calculator use record
|
| 86 |
|
|
Item_1 at 0 range 0..3;
|
| 87 |
|
|
Item_2 at 1 range 0..3;
|
| 88 |
|
|
end record;
|
| 89 |
|
|
|
| 90 |
|
|
-- given that Item_1 is specified to be at 'Position = 0 and
|
| 91 |
|
|
-- Item_2 is specified to be at 'Position = 1
|
| 92 |
|
|
-- by definition (13.5.2(2)) abs(Item_2'Address - Item_1'Address) = 1
|
| 93 |
|
|
|
| 94 |
|
|
end CD33001_0;
|
| 95 |
|
|
|
| 96 |
|
|
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
|
| 97 |
|
|
|
| 98 |
|
|
-- there is no package body CD33001_0
|
| 99 |
|
|
|
| 100 |
|
|
------------------------------------------------------------------- CD33001
|
| 101 |
|
|
|
| 102 |
|
|
with Report;
|
| 103 |
|
|
with System.Storage_Elements;
|
| 104 |
|
|
with CD33001_0;
|
| 105 |
|
|
procedure CD33001 is
|
| 106 |
|
|
|
| 107 |
|
|
use type System.Storage_Elements.Storage_Offset;
|
| 108 |
|
|
|
| 109 |
|
|
A_Half : CD33001_0.Half_Stuff(0..15);
|
| 110 |
|
|
|
| 111 |
|
|
A_Word : CD33001_0.Word_Stuff(0..15);
|
| 112 |
|
|
|
| 113 |
|
|
procedure Unexpected( Message : String; Wanted, Got: Integer ) is
|
| 114 |
|
|
begin
|
| 115 |
|
|
Report.Failed( Message & " Wanted:"
|
| 116 |
|
|
& Integer'Image(Wanted) & " Got:" & Integer'Image(Got) );
|
| 117 |
|
|
end Unexpected;
|
| 118 |
|
|
|
| 119 |
|
|
begin -- Main test procedure.
|
| 120 |
|
|
|
| 121 |
|
|
Report.Test ("CD33001", "Check that Component_Sizes that are factor of " &
|
| 122 |
|
|
"the word size are supported. Check that for " &
|
| 123 |
|
|
"such Component_Sizes arrays contain no gaps " &
|
| 124 |
|
|
"between components" );
|
| 125 |
|
|
|
| 126 |
|
|
if A_Half'Size /= A_Half'Component_Size * 16 then
|
| 127 |
|
|
Unexpected("Half word Size",
|
| 128 |
|
|
CD33001_0.Half_Stuff'Component_Size * 16,
|
| 129 |
|
|
A_Half'Size );
|
| 130 |
|
|
end if;
|
| 131 |
|
|
|
| 132 |
|
|
if A_Word(1)'Size /= System.Word_Size then
|
| 133 |
|
|
Unexpected("Word Size", System.Word_Size, A_Word(1)'Size );
|
| 134 |
|
|
end if;
|
| 135 |
|
|
|
| 136 |
|
|
|
| 137 |
|
|
Report.Result;
|
| 138 |
|
|
|
| 139 |
|
|
end CD33001;
|