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