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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-old/] [gcc-4.2.2/] [gcc/] [testsuite/] [ada/] [acats/] [tests/] [cd/] [cd2d11a.ada] - Blame information for rev 816

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 149 jeremybenn
-- CD2D11A.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 IF A SMALL SPECIFICATION IS GIVEN FOR A
27
--     FIXED POINT TYPE, THEN ARITHMETIC OPERATIONS ON VALUES OF THE
28
--     TYPE ARE NOT AFFECTED BY THE REPRESENTATION CLAUSE.
29
 
30
-- HISTORY:
31
--     BCB 09/01/87  CREATED ORIGINAL TEST.
32
--     PWB 05/11/89  CHANGED EXTENSION FROM '.DEP' TO '.ADA'.
33
 
34
WITH REPORT; USE REPORT;
35
PROCEDURE CD2D11A IS
36
 
37
     BASIC_SMALL : CONSTANT := 2.0 ** (-4);
38
 
39
     TYPE BASIC_TYPE IS DELTA 2.0 ** (-4) RANGE -4.0 .. 4.0;
40
 
41
     TYPE CHECK_TYPE IS DELTA 1.0 RANGE -4.0 .. 4.0;
42
 
43
     FOR CHECK_TYPE'SMALL USE BASIC_SMALL;
44
 
45
     CNEG1 : CHECK_TYPE := -3.5;
46
     CNEG2 : CHECK_TYPE := CHECK_TYPE (-1.0/3.0);
47
     CPOS1 : CHECK_TYPE := CHECK_TYPE (4.0/6.0);
48
     CPOS2 : CHECK_TYPE :=  3.5;
49
     CZERO : CHECK_TYPE;
50
 
51
     TYPE ARRAY_TYPE IS ARRAY (0 .. 3) OF CHECK_TYPE;
52
     CHARRAY : ARRAY_TYPE :=
53
          (-3.5, CHECK_TYPE (-1.0/3.0), CHECK_TYPE (4.0/6.0), 3.5);
54
 
55
     TYPE REC_TYPE IS RECORD
56
          COMPN1 : CHECK_TYPE := -3.5;
57
          COMPN2 : CHECK_TYPE := CHECK_TYPE (-1.0/3.0);
58
          COMPP1 : CHECK_TYPE := CHECK_TYPE (4.0/6.0);
59
          COMPP2 : CHECK_TYPE :=  3.5;
60
     END RECORD;
61
 
62
     CHREC : REC_TYPE;
63
 
64
     FUNCTION IDENT (FX : CHECK_TYPE) RETURN CHECK_TYPE IS
65
     BEGIN
66
          IF EQUAL (3, 3) THEN
67
               RETURN FX;
68
          ELSE
69
               RETURN 0.0;
70
          END IF;
71
     END IDENT;
72
 
73
     PROCEDURE PROC (N1_IN, P1_IN      :        CHECK_TYPE;
74
                     N2_INOUT,P2_INOUT : IN OUT CHECK_TYPE;
75
                     CZOUT             :    OUT CHECK_TYPE) IS
76
     BEGIN
77
 
78
          IF IDENT (N1_IN) + P1_IN NOT IN
79
                  -2.875 .. -2.8125 OR
80
             P2_INOUT  - IDENT (P1_IN) NOT IN
81
                  2.8125 .. 2.875 THEN
82
               FAILED ("INCORRECT RESULTS FOR " &
83
                       "BINARY ADDING OPERATORS - 1");
84
          END IF;
85
 
86
          IF +IDENT (N2_INOUT) NOT IN -0.375 .. -0.3125 OR
87
             IDENT (-P1_IN) NOT IN -0.6875 .. -0.625 THEN
88
               FAILED ("INCORRECT RESULTS FOR " &
89
                       "UNARY ADDING OPERATORS - 1");
90
          END IF;
91
 
92
          IF CHECK_TYPE (N1_IN * IDENT (P1_IN)) NOT IN
93
               -2.4375 .. -2.1875 OR
94
             CHECK_TYPE (IDENT (N2_INOUT) / P2_INOUT) NOT IN
95
               -0.125 .. -0.0625 THEN
96
               FAILED ("INCORRECT RESULTS FOR " &
97
                       "MULTIPLYING OPERATORS - 1");
98
          END IF;
99
 
100
          IF ABS IDENT (N2_INOUT) NOT IN 0.3125 .. 0.375 OR
101
             IDENT (ABS P1_IN) NOT IN 0.625 .. 0.6875 THEN
102
               FAILED ("INCORRECT RESULTS FOR " &
103
                       "ABSOLUTE VALUE OPERATORS - 1");
104
          END IF;
105
 
106
          CZOUT := 0.0;
107
 
108
     END PROC;
109
 
110
BEGIN
111
     TEST ("CD2D11A", "CHECK THAT IF A SMALL SPECIFICATION IS " &
112
                      "GIVEN FOR AN FIXED POINT TYPE, THEN " &
113
                      "ARITHMETIC OPERATIONS ON VALUES OF THE " &
114
                      "TYPE ARE NOT AFFECTED BY THE REPRESENTATION " &
115
                      "CLAUSE");
116
 
117
     PROC (CNEG1, CPOS1, CNEG2, CPOS2, CZERO);
118
 
119
     IF IDENT (CZERO) /= 0.0 THEN
120
          FAILED ("INCORRECT VALUE FOR OUT PARAMETER");
121
     END IF;
122
 
123
     IF IDENT (CNEG1) + CPOS1 NOT IN -2.875 .. -2.8125 OR
124
        CPOS2  - IDENT (CPOS1) NOT IN 2.8125 .. 2.875 THEN
125
          FAILED ("INCORRECT RESULTS FOR BINARY ADDING OPERATORS - 2");
126
     END IF;
127
 
128
     IF +IDENT (CNEG2) NOT IN -0.375 .. -0.3125 OR
129
        IDENT (-CPOS1) NOT IN -0.6875 .. -0.625 THEN
130
          FAILED ("INCORRECT RESULTS FOR UNARY ADDING OPERATORS - 2");
131
     END IF;
132
 
133
     IF CHECK_TYPE (CNEG1 * IDENT (CPOS1)) NOT IN -2.4375 .. -2.1875 OR
134
        CHECK_TYPE (IDENT (CNEG2) / CPOS2) NOT IN
135
               -0.125 .. -0.0625 THEN
136
          FAILED ("INCORRECT RESULTS FOR MULTIPLYING OPERATORS - 2");
137
     END IF;
138
 
139
     IF ABS IDENT (CNEG2) NOT IN 0.3125 .. 0.375 OR
140
        IDENT (ABS CPOS1) NOT IN 0.625 .. 0.6875 THEN
141
          FAILED ("INCORRECT RESULTS FOR ABSOLUTE VALUE " &
142
                  "OPERATORS - 2");
143
     END IF;
144
 
145
     IF IDENT (CPOS1) NOT IN 0.625 .. 0.6875 OR
146
            CNEG2 IN -0.25 .. 0.0 OR
147
            IDENT (CNEG2) IN -1.0 .. -0.4375 THEN
148
          FAILED ("INCORRECT RESULTS FOR MEMBERSHIP OPERATORS - 2");
149
     END IF;
150
 
151
     IF IDENT (CHARRAY (0)) + CHARRAY (2) NOT IN
152
             -2.875 .. -2.8125 OR
153
        CHARRAY (3)  - IDENT (CHARRAY (2)) NOT IN
154
             2.8125 .. 2.875 THEN
155
          FAILED ("INCORRECT RESULTS FOR BINARY ADDING OPERATORS - 3");
156
     END IF;
157
 
158
     IF +IDENT (CHARRAY (1)) NOT IN -0.375 .. -0.3125 OR
159
        IDENT (-CHARRAY (2)) NOT IN -0.6875 .. -0.625 THEN
160
          FAILED ("INCORRECT RESULTS FOR UNARY ADDING OPERATORS - 3");
161
     END IF;
162
 
163
     IF CHECK_TYPE (CHARRAY (0) * IDENT (CHARRAY (2))) NOT IN
164
          -2.4375 .. -2.1875 OR
165
        CHECK_TYPE (IDENT (CHARRAY (1)) / CHARRAY (3)) NOT IN
166
          -0.125 .. -0.0625 THEN
167
          FAILED ("INCORRECT RESULTS FOR MULTIPLYING OPERATORS - 3");
168
     END IF;
169
 
170
     IF ABS IDENT (CHARRAY (1)) NOT IN 0.3125 .. 0.375 OR
171
        IDENT (ABS CHARRAY (2)) NOT IN 0.625 .. 0.6875 THEN
172
          FAILED ("INCORRECT RESULTS FOR ABSOLUTE VALUE " &
173
                  "OPERATORS - 3");
174
     END IF;
175
 
176
     IF IDENT (CHARRAY (2)) NOT IN 0.625 .. 0.6875 OR
177
            CHARRAY (1) IN -0.25 .. 0.0 OR
178
            IDENT (CHARRAY (1)) IN -1.0 .. -0.4375 THEN
179
          FAILED ("INCORRECT RESULTS FOR MEMBERSHIP OPERATORS - 3");
180
     END IF;
181
 
182
     IF IDENT (CHREC.COMPN1) + CHREC.COMPP1 NOT IN
183
             -2.875 .. -2.8125 OR
184
        CHREC.COMPP2  - IDENT (CHREC.COMPP1) NOT IN
185
             2.8125 .. 2.875 THEN
186
          FAILED ("INCORRECT RESULTS FOR BINARY ADDING OPERATORS - 4");
187
     END IF;
188
 
189
     IF +IDENT (CHREC.COMPN2) NOT IN -0.375 .. -0.3125 OR
190
        IDENT (-CHREC.COMPP1) NOT IN -0.6875 .. -0.625 THEN
191
          FAILED ("INCORRECT RESULTS FOR UNARY ADDING OPERATORS - 4");
192
     END IF;
193
 
194
     IF CHECK_TYPE (CHREC.COMPN1 * IDENT (CHREC.COMPP1)) NOT IN
195
          -2.4375 .. -2.1875 OR
196
        CHECK_TYPE (IDENT (CHREC.COMPN2) / CHREC.COMPP2) NOT IN
197
          -0.125 .. -0.0625 THEN
198
          FAILED ("INCORRECT RESULTS FOR MULTIPLYING OPERATORS - 4");
199
     END IF;
200
 
201
     IF ABS IDENT (CHREC.COMPN2) NOT IN 0.3125 .. 0.375 OR
202
        IDENT (ABS CHREC.COMPP1) NOT IN 0.625 .. 0.6875 THEN
203
          FAILED ("INCORRECT RESULTS FOR ABSOLUTE VALUE " &
204
                  "OPERATORS - 4");
205
     END IF;
206
 
207
     IF IDENT (CHREC.COMPP1) NOT IN 0.625 .. 0.6875 OR
208
           CHREC.COMPN2 IN -0.25 .. 0.0 OR
209
           IDENT (CHREC.COMPN2) IN -1.0 .. -0.4375 THEN
210
          FAILED ("INCORRECT RESULTS FOR MEMBERSHIP OPERATORS - 4");
211
     END IF;
212
 
213
     RESULT;
214
END CD2D11A;

powered by: WebSVN 2.1.0

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