OpenCores
URL https://opencores.org/ocsvn/openrisc_me/openrisc_me/trunk

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [gnu-src/] [gcc-4.5.1/] [gcc/] [testsuite/] [ada/] [acats/] [tests/] [cd/] [cd30002.a] - Blame information for rev 309

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 294 jeremybenn
-- CD30002.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 the implementation supports Alignments for subtypes and
28
--      objects specified as factors and multiples of the number of storage
29
--      elements per word, unless those values cannot be loaded and stored.
30
--      Check that the largest alignment returned by default is supported.
31
--
32
--      Check that the implementation supports Alignments supported by the
33
--      target linker for stand-alone library-level objects of statically
34
--      constrained subtypes.
35
--
36
-- TEST DESCRIPTION:
37
--      This test defines several types and objects, specifying various
38
--      alignments for them (as factors and multiples of the number of
39
--      storage elements per word).  It then checks the alignments by
40
--      declaring some objects, and checking that the integer values of
41
--      their addresses is mod the specified alignment.  This will not
42
--      prevent false passes where the lucky compiler gets it right by
43
--      chance, but will catch compilers that specifically do not obey
44
--      the alignment clauses.
45
--
46
-- APPLICABILITY CRITERIA:
47
--      All implementations must attempt to compile this test.
48
--
49
--      For implementations validating against Systems Programming Annex (C):
50
--        this test must execute and report PASSED.
51
--
52
--      For implementations not validating against Annex C:
53
--        this test may report compile time errors at one or more points
54
--        indicated by "-- ANX-C RQMT", in which case it may be graded as inapplicable.
55
--        Otherwise, the test must execute and report PASSED.
56
--
57
--
58
-- CHANGE HISTORY:
59
--      22 JUL 95   SAIC   Initial version
60
--      09 MAY 96   SAIC   Strengthened for 2.1
61
--      26 FEB 97   PWB.CTA Allowed for unexpected word sizes
62
--      16 FEB 98   EDS    Modified documentation.
63
--      26 SEP 98   RLB    Fixed value on line 130 so check and dec. match.
64
--      30 OCT 98   RLB    Split Multiple_Alignment and revised the
65
--                         calculation to work on all targets.
66
--      18 JAN 99   RLB    Repaired again to work on targets where word size
67
--                         equals storage unit.
68
--!
69
 
70
----------------------------------------------------------------- CD30002_0
71
 
72
with Impdef;
73
with System.Storage_Elements;
74
package CD30002_0 is
75
 
76
  S_Units_per_Word : constant := System.Word_Size/System.Storage_Unit;
77
        -- Must be 1 or greater.
78
 
79
  Multiple_Type_Alignment : constant :=
80
      Integer'Min ( Impdef.Max_Default_Alignment,
81
                    2 * S_Units_per_Word );
82
      -- Calculate a reasonable alignment, but not larger than the
83
      -- implementation is required to support.
84
 
85
  Multiple_Object_Alignment : constant :=
86
      Integer'Min ( Impdef.Max_Linker_Alignment,
87
                    2 * S_Units_per_Word );
88
      -- Calculate a reasonable object alignment, but not larger than
89
      -- the implementation is required to support.
90
 
91
  Small_Alignment : constant :=
92
      Integer'Max ( S_Units_per_Word / 2, 1);
93
      -- Calculate a reasonable small alignment, but not less than 1.
94
      -- (If S_Units_per_Word = 1, 1/2 => 0 which causes problems
95
      -- verifying alignment.)
96
 
97
  subtype Storage_Element is System.Storage_Elements.Storage_Element;
98
 
99
  type Some_Stuff is array(1..S_Units_Per_Word) of Storage_Element;
100
    for Some_Stuff'Alignment
101
      use Impdef.Max_Default_Alignment;                       -- ANX-C RQMT.
102
 
103
  Library_Level_Object : Some_Stuff;
104
    for Library_Level_Object'Alignment
105
      use Impdef.Max_Linker_Alignment;                        -- ANX-C RQMT.
106
 
107
  type Quarter is mod 4; -- two bits
108
    for Quarter'Alignment use Small_Alignment;                -- ANX-C RQMT.
109
 
110
  type Half is mod 16; -- nibble
111
    for Half'Alignment use Multiple_Type_Alignment;                -- ANX-C RQMT.
112
 
113
  type O_Some_Stuff is array(1..S_Units_Per_Word) of Storage_Element;
114
 
115
  type O_Quarter is mod 4; -- two bits
116
 
117
  type O_Half is mod 16; -- nibble
118
 
119
end CD30002_0;
120
 
121
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
122
 
123
-- there is no package body CD30002_0
124
 
125
------------------------------------------------------------------- CD30002
126
 
127
with Report;
128
with Impdef;
129
with CD30002_0;
130
with System.Storage_Elements;
131
procedure CD30002 is
132
 
133
  My_Stuff   : CD30002_0.Some_Stuff;
134
    -- Impdef.Max_Default_Alignment
135
 
136
  My_Quarter : CD30002_0.Quarter;
137
    -- CD30002_0.S_Units_per_Word / 2
138
 
139
  My_Half    : CD30002_0.Half;
140
    -- CD30002_0.S_Units_per_Word * 2
141
 
142
  Stuff_Object   : CD30002_0.O_Some_Stuff;
143
    for Stuff_Object'Alignment
144
      use Impdef.Max_Default_Alignment;                       -- ANX-C RQMT.
145
 
146
  Quarter_Object : CD30002_0.O_Quarter;
147
    for Quarter_Object'Alignment
148
        use CD30002_0.Small_Alignment;                        -- ANX-C RQMT.
149
 
150
  Half_Object    : CD30002_0.O_Half;
151
    for Half_Object'Alignment
152
        use CD30002_0.Multiple_Object_Alignment;              -- ANX-C RQMT.
153
 
154
  subtype IntAdd is System.Storage_Elements.Integer_Address;
155
    use type System.Storage_Elements.Integer_Address;
156
 
157
  function A2I(Value: System.Address) return IntAdd renames
158
    System.Storage_Elements.To_Integer;
159
 
160
  NAC : constant String := " not aligned correctly";
161
 
162
begin  -- Main test procedure.
163
 
164
  Report.Test ("CD30002", "Check that the implementation supports " &
165
                          "Alignments for subtypes and objects specified " &
166
                          "as factors and multiples of the number of " &
167
                          "storage elements per word, unless those values " &
168
                          "cannot be loaded and stored. Check that the " &
169
                          "largest alignment returned by default is " &
170
                          "supported. Check that the implementation " &
171
                          "supports Alignments supported by the target " &
172
                          "linker for stand-alone library-level objects " &
173
                          "of statically constrained subtypes" );
174
 
175
  if A2I(CD30002_0.Library_Level_Object'Address)
176
     mod Impdef.Max_Linker_Alignment /= 0 then
177
    Report.Failed("Library_Level_Object" & NAC);
178
  end if;
179
 
180
  if A2I(My_Stuff'Address) mod Impdef.Max_Default_Alignment /= 0 then
181
    Report.Failed("Max alignment subtype" & NAC);
182
  end if;
183
 
184
  if A2I(My_Quarter'Address) mod (CD30002_0.Small_Alignment) /= 0 then
185
    Report.Failed("Factor of words subtype" & NAC);
186
  end if;
187
 
188
  if A2I(My_Half'Address) mod (CD30002_0.Multiple_Type_Alignment) /= 0 then
189
    Report.Failed("Multiple of words subtype" & NAC);
190
  end if;
191
 
192
  if A2I(Stuff_Object'Address) mod Impdef.Max_Default_Alignment /= 0 then
193
    Report.Failed("Stuff alignment object" & NAC);
194
  end if;
195
 
196
  if A2I(Quarter_Object'Address)
197
       mod (CD30002_0.Small_Alignment) /= 0 then
198
    Report.Failed("Factor of words object" & NAC);
199
  end if;
200
 
201
  if A2I(Half_Object'Address) mod (CD30002_0.Multiple_Object_Alignment) /= 0 then
202
    Report.Failed("Multiple of words object" & NAC);
203
  end if;
204
 
205
  Report.Result;
206
 
207
end CD30002;

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.