OpenCores
URL https://opencores.org/ocsvn/openrisc_2011-10-31/openrisc_2011-10-31/trunk

Subversion Repositories openrisc_2011-10-31

[/] [openrisc/] [trunk/] [gnu-src/] [gcc-4.5.1/] [gcc/] [testsuite/] [ada/] [acats/] [tests/] [c4/] [c45531k.ada] - Blame information for rev 294

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 294 jeremybenn
-- C45531K.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 THE OPERATOR "*" PRODUCES CORRECT RESULTS
27
--     FOR MIXED FIXED POINT AND INTEGER TYPES USING 4 SUBTESTS.
28
--       THIS TEST REQUIRES MIN_WORD_LENGTH = 32.
29
--       THIS TEST USES VALUES OF DELTA WHICH ARE GREATER THAN OR
30
--       EQUAL TO 0.5.
31
--
32
--     TEST CASES ARE:
33
--       A) INTEGER * FIXED WHEN ALL VALUES ARE MODEL NUMBERS.
34
--       B) FIXED * INTEGER WHEN ALL VALUES ARE MODEL NUMBERS.
35
--       C) INTEGER * FIXED FOR NON-MODEL NUMBERS.
36
--       D) FIXED * INTEGER FOR NON-MODEL NUMBERS.
37
--
38
--     REPEAT FOR MINIMUM REQUIRED WORD LENGTHS OF 12, 16, 32 AND 48,
39
--     WITH RANGE <, =, AND > THAN 1.0 AND
40
--     WITH DELTA <, =, AND > THAN 1.0.
41
 
42
-- HISTORY:
43
--     NTW 09/08/86 CREATED ORIGINAL TEST.
44
--     RJW 11/05/86 REVISED COMMENTS.
45
--     DHH 01/13/88 ADDED APPLICABILITY CRITERIA AND STANDARD HEADER.
46
--     BCB 04/27/90 REVISED APPLICABILITY CRITERIA.
47
--     BCB 10/03/90 REMOVED APPLICABILITY CRITERIA AND N/A => ERROR
48
--                  LINE.  CHANGED EXTENSION FROM '.DEP' TO '.ADA'.
49
 
50
 
51
WITH REPORT;
52
PROCEDURE C45531K IS
53
 
54
     USE REPORT;
55
 
56
     MIN_WORD_LENGTH : CONSTANT := 32;
57
     FULL_SCALE      : CONSTANT := 2 ** (MIN_WORD_LENGTH - 1);
58
     FORTH           : CONSTANT := FULL_SCALE / 4;
59
     RNG1            : CONSTANT := FULL_SCALE * 0.5;
60
     TYPE FX_0P5  IS DELTA 0.5 RANGE -RNG1 * 1 .. RNG1 * 1 - 0.5;
61
     TYPE FX_1    IS DELTA 1.0 RANGE -RNG1 * 2 .. RNG1 * 2 - 1.0;
62
     TYPE FX_RNG1 IS DELTA RNG1
63
                    RANGE -RNG1 * FULL_SCALE .. RNG1 * (FULL_SCALE - 1);
64
 
65
BEGIN TEST ("C45531K", "MIXED FIXED POINT AND INTEGER ""*"" "
66
                    &  "FOR DELTA <, =, > 1.0");
67
 
68
     --------------------------------------------------
69
 
70
     -- CASE A) INTEGER * FIXED WHEN ALL VALUES ARE MODEL NUMBERS.
71
 
72
A:   DECLARE
73
          A              : INTEGER := 0;
74
          B              : FX_0P5  := 0.0;
75
          RESULT_VALUE   : FX_0P5  := 0.0;
76
          LOWEST_ACCEPTABLE_VALUE  : FX_0P5 := FX_0P5 (7.5);
77
          HIGHEST_ACCEPTABLE_VALUE : FX_0P5 := FX_0P5 (7.5);
78
     BEGIN
79
          IF EQUAL (3, 3) THEN
80
               A := 3;
81
               B := FX_0P5 (2.5);               -- A MODEL NUMBER
82
          END IF;
83
 
84
          RESULT_VALUE := A * B;
85
 
86
          IF    (RESULT_VALUE < LOWEST_ACCEPTABLE_VALUE)
87
             OR (RESULT_VALUE > HIGHEST_ACCEPTABLE_VALUE) THEN
88
               FAILED ("RESULT OF ""*"" OUTSIDE RESULT MODEL INTERVAL "
89
                    &  "FOR INTEGER * FIXED "
90
                    &  "WHEN ALL VALUES ARE MODEL NUMBERS");
91
          END IF;
92
     END A;
93
 
94
     --------------------------------------------------
95
 
96
     -- CASE B) FIXED * INTEGER WHEN ALL VALUES ARE MODEL NUMBERS.
97
 
98
B:   DECLARE
99
          A              : FX_1    := 0.0;
100
          B              : INTEGER := 0;
101
          RESULT_VALUE   : FX_1    := 0.0;
102
          LOWEST_ACCEPTABLE_VALUE  : FX_1 := FX_1 (3 * FORTH);
103
          HIGHEST_ACCEPTABLE_VALUE : FX_1 := FX_1 (3 * FORTH);
104
     BEGIN
105
          IF EQUAL (3, 3) THEN
106
               A := FX_1 (FULL_SCALE / 8);        -- A MODEL NUMBER
107
               B := 6;
108
          END IF;
109
 
110
          RESULT_VALUE := A * B;
111
 
112
          IF    (RESULT_VALUE < LOWEST_ACCEPTABLE_VALUE)
113
             OR (RESULT_VALUE > HIGHEST_ACCEPTABLE_VALUE) THEN
114
               FAILED ("RESULT OF ""*"" OUTSIDE RESULT MODEL INTERVAL "
115
                    &  "FOR FIXED * INTEGER "
116
                    &  "WHEN ALL VALUES ARE MODEL NUMBERS");
117
          END IF;
118
     END B;
119
 
120
     --------------------------------------------------
121
 
122
     -- CASE C) INTEGER * FIXED FOR NON-MODEL NUMBERS.
123
 
124
C:   DECLARE
125
          A              : INTEGER := 0;
126
          B              : FX_RNG1 := 0.0;
127
          RESULT_VALUE   : FX_RNG1 := 0.0;
128
          LOW_COUNT     : CONSTANT := (3 * (FORTH + 0) );
129
          HIGH_COUNT    : CONSTANT := (3 * (FORTH + 1) );
130
          LOWEST_ACCEPTABLE_VALUE  :  FX_RNG1
131
                                   := FX_RNG1 (RNG1 * LOW_COUNT );
132
          HIGHEST_ACCEPTABLE_VALUE :  FX_RNG1
133
                                   := FX_RNG1 (RNG1 * HIGH_COUNT);
134
     BEGIN
135
          IF EQUAL (3, 3) THEN        -- B NOT A MODEL NUMBER
136
               A := 3;
137
               B := FX_RNG1 (RNG1 * FORTH + 0.5);
138
          END IF;
139
 
140
          RESULT_VALUE := A * B;
141
 
142
          IF    (RESULT_VALUE < LOWEST_ACCEPTABLE_VALUE)
143
             OR (RESULT_VALUE > HIGHEST_ACCEPTABLE_VALUE) THEN
144
               FAILED ("RESULT OF ""*"" OUTSIDE RESULT MODEL INTERVAL "
145
                    &  "FOR INTEGER * FIXED FOR NON-MODEL NUMBERS");
146
 
147
          END IF;
148
     END C;
149
 
150
     --------------------------------------------------
151
 
152
     -- CASE D) FIXED * INTEGER FOR NON-MODEL NUMBERS.
153
 
154
D:   DECLARE
155
          A              : FX_RNG1 := 0.0;
156
          B              : INTEGER := 0;
157
          RESULT_VALUE   : FX_RNG1 := 0.0;
158
          LOW_COUNT     : CONSTANT := (3 * (FORTH + 0) );
159
          HIGH_COUNT    : CONSTANT := (3 * (FORTH + 1) );
160
          LOWEST_ACCEPTABLE_VALUE  :  FX_RNG1
161
                                   := FX_RNG1 (RNG1 * LOW_COUNT );
162
          HIGHEST_ACCEPTABLE_VALUE :  FX_RNG1
163
                                   := FX_RNG1 (RNG1 * HIGH_COUNT);
164
     BEGIN
165
          IF EQUAL (3, 3) THEN        -- A NOT A MODEL NUMBER
166
               A := FX_RNG1 (RNG1 * FORTH + 0.5);
167
               B := 3;
168
          END IF;
169
 
170
          RESULT_VALUE := A * B;
171
 
172
          IF    (RESULT_VALUE < LOWEST_ACCEPTABLE_VALUE)
173
             OR (RESULT_VALUE > HIGHEST_ACCEPTABLE_VALUE) THEN
174
               FAILED ("RESULT OF ""*"" OUTSIDE RESULT MODEL INTERVAL "
175
                    &  "FOR FIXED * INTEGER FOR NON-MODEL NUMBERS");
176
          END IF;
177
     END D;
178
 
179
     --------------------------------------------------
180
 
181
 
182
     RESULT;
183
 
184
END C45531K;

powered by: WebSVN 2.1.0

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