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/] [c4/] [c45532a.ada] - Blame information for rev 294

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 294 jeremybenn
-- C45532A.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 FIXED POINT TYPES USING 3 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) THE OPERATOR *, A, B, AND A * B ALL MODEL NUMBERS.
33
--       B) THE OPERATOR *, A, B MODEL NUMBERS A * B NOT.
34
--       C) THE OPERATOR *, USING NO MODEL NUMBERS.
35
--
36
--     REPEAT FOR MINIMUM REQUIRED WORD LENGTHS OF 12, 16, 32 AND 48,
37
--     WITH RANGE <, =, AND > THAN 1.0 AND
38
--     WITH DELTA <, =, AND > THAN 1.0.
39
 
40
-- HISTORY:
41
--     NTW 09/08/86 CREATED ORIGINAL TEST.
42
--     RJW 11/05/86 REVISED COMMENTS.
43
--     DHH 01/13/88 ADDED APPLICABILITY CRITERIA AND STANDARD HEADER.
44
--     RDH 04/27/90 REVISED APPLICABILITY CRITERIA.
45
--     BCB 10/03/90 REMOVED APPLICABILITY CRITERIA AND N/A => ERROR
46
--                  LINE.  CHANGED EXTENSION FROM '.DEP' TO '.ADA'.
47
 
48
WITH REPORT;
49
PROCEDURE C45532A IS
50
 
51
     USE REPORT;
52
 
53
     MIN_WORD_LENGTH : CONSTANT := 12;
54
     FULL_SCALE      : CONSTANT := 2 ** (MIN_WORD_LENGTH - 1);
55
     FORTH           : CONSTANT := FULL_SCALE / 4;
56
     DEL1            : CONSTANT := 0.5 / FULL_SCALE;
57
     TYPE FX_0P5 IS DELTA DEL1 * 1 RANGE -0.5 .. 0.5 - DEL1 * 1;
58
     TYPE FX_1   IS DELTA DEL1 * 2 RANGE -1.0 .. 1.0 - DEL1 * 2;
59
     TYPE FX_2   IS DELTA DEL1 * 4 RANGE -2.0 .. 2.0 - DEL1 * 4;
60
 
61
BEGIN TEST ("C45532A", "FIXED POINT OPERATOR ""*"" "
62
                     & "FOR RANGE <, =, AND > 1.0");
63
 
64
     --------------------------------------------------
65
 
66
     -- CASE A) THE OPERATOR *, A, B, AND A * B ALL MODEL NUMBERS.
67
 
68
A:   DECLARE
69
          A              : FX_0P5  := 0.0;
70
          B              : FX_2    := 0.0;
71
          RESULT_VALUE   : FX_1    := 0.0;
72
          LOWEST_ACCEPTABLE_VALUE  : FX_1 := FX_1 (0.125);
73
          HIGHEST_ACCEPTABLE_VALUE : FX_1 := FX_1 (0.125);
74
     BEGIN
75
          IF EQUAL (3, 3) THEN
76
               A := FX_0P5 (0.25);                -- A MODEL NUMBER
77
               B := FX_2   (0.50);                -- A MODEL NUMBER
78
          END IF;
79
 
80
          RESULT_VALUE := FX_1 (A * B);
81
 
82
          IF    (RESULT_VALUE < LOWEST_ACCEPTABLE_VALUE)
83
             OR (RESULT_VALUE > HIGHEST_ACCEPTABLE_VALUE) THEN
84
               FAILED ("RESULT OF ""*"" OUTSIDE RESULT MODEL INTERVAL "
85
                    &  "WHEN A, B, AND A * B ARE ALL MODEL NUMBERS");
86
          END IF;
87
     END A;
88
 
89
     --------------------------------------------------
90
 
91
     -- CASE B) THE OPERATOR *, A, B MODEL NUMBERS A * B NOT.
92
 
93
B:   DECLARE
94
          A              : FX_0P5  := 0.0;
95
          B              : FX_1    := 0.0;
96
          RESULT_VALUE   : FX_2    := 0.0;
97
          LOW_COUNT     : CONSTANT := FULL_SCALE / 64;
98
          HIGH_COUNT    : CONSTANT := LOW_COUNT + 1;
99
          LOWEST_ACCEPTABLE_VALUE  :  FX_2
100
                                   := FX_2 (4 * DEL1 * LOW_COUNT );
101
          HIGHEST_ACCEPTABLE_VALUE :  FX_2
102
                                   := FX_2 (4 * DEL1 * HIGH_COUNT);
103
     BEGIN
104
          IF EQUAL (3, 3) THEN
105
               A := FX_0P5 (DEL1 * (FORTH + 1) ); -- A MODEL NUMBER
106
               B := FX_1   (DEL1 * (FORTH * 2) ); -- A MODEL NUMBER
107
          END IF;
108
 
109
          RESULT_VALUE := FX_2 (A * B);
110
 
111
          IF    (RESULT_VALUE < LOWEST_ACCEPTABLE_VALUE)
112
             OR (RESULT_VALUE > HIGHEST_ACCEPTABLE_VALUE) THEN
113
               FAILED ("RESULT OF ""*"" OUTSIDE RESULT MODEL INTERVAL "
114
                    &  "WHEN A, B MODEL NUMBERS A * B NOT");
115
          END IF;
116
     END B;
117
 
118
     --------------------------------------------------
119
 
120
     -- CASE C) THE OPERATOR *, USING NO MODEL NUMBERS
121
 
122
C:   DECLARE
123
          A              : FX_1    := 0.0;
124
          B              : FX_1    := 0.0;
125
          RESULT_VALUE   : FX_2    := 0.0;
126
          LOW_COUNT     : CONSTANT := FULL_SCALE / 128 - 1;
127
          HIGH_COUNT    : CONSTANT := FULL_SCALE / 128 + 1;
128
          LOWEST_ACCEPTABLE_VALUE  :  FX_2
129
                                   := FX_2 (4 * DEL1 * LOW_COUNT );
130
          HIGHEST_ACCEPTABLE_VALUE :  FX_2
131
                                   := FX_2 (4 * DEL1 * HIGH_COUNT);
132
     BEGIN
133
          IF EQUAL (3, 3) THEN
134
               A := FX_1 (DEL1 * (FORTH + 1) );   -- NOT MODEL NUMBER
135
               B := FX_1 (DEL1 * (FORTH - 1) );   -- NOT MODEL NUMBER
136
          END IF;
137
 
138
          RESULT_VALUE := FX_2 (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
                    &  "WHEN USING NO MODEL NUMBERS");
144
          END IF;
145
     END C;
146
 
147
     --------------------------------------------------
148
 
149
 
150
     RESULT;
151
 
152
END C45532A;

powered by: WebSVN 2.1.0

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