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/] [c9/] [c97114a.ada] - Blame information for rev 816

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 149 jeremybenn
-- C97114A.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
-- CHECK WHETHER A DELAY EXPRESSION FOLLOWING AN OPEN GUARD IS EVALUATED
26
-- DIRECTLY AFTER THE GUARD OR ONLY AFTER ALL GUARDS HAVE BEEN
27
-- EVALUATED, OR IN SOME MIXED ORDER SUCH THAT DELAY EXPRESSIONS ARE
28
-- EVALUATED AFTER THEIR GUARDS ARE DETERMINED TO BE OPEN.
29
 
30
-- RM 5/10/82
31
-- SPS 11/21/82
32
-- JBG 10/24/83
33
-- PWN 09/11/94  REMOVED PRAGMA PRIORITY FOR ADA 9X.
34
 
35
with Impdef;
36
WITH REPORT; USE REPORT;
37
WITH SYSTEM; USE SYSTEM;
38
PROCEDURE C97114A IS
39
 
40
 
41
     -- THE TASK WILL HAVE LAST PRIORITY ( PRIORITY'FIRST )
42
 
43
     EVAL_ORDER  :  STRING (1..6)       := ( 1..6 => '*' );
44
     EVAL_ORD    :  STRING (1..6)       := ( 1..6 => '*' );
45
     INDEX       :  INTEGER             := 0;
46
     DUMMY       :  INTEGER             := 0;
47
 
48
 
49
     FUNCTION F1 (X:INTEGER) RETURN INTEGER IS
50
     BEGIN
51
          INDEX := INDEX + 1;
52
          EVAL_ORDER (INDEX) := 'F';    -- 123: FGH
53
          EVAL_ORD   (INDEX) := 'G';    -- 123: GGG ( 'G' FOR 'GUARD' )
54
          RETURN ( IDENT_INT(7) );
55
     END F1;
56
 
57
 
58
     FUNCTION F2 (X:INTEGER) RETURN INTEGER IS
59
     BEGIN
60
          INDEX := INDEX + 1;
61
          EVAL_ORDER (INDEX) := 'G';
62
          EVAL_ORD   (INDEX) := 'G';
63
          RETURN ( IDENT_INT(7) );
64
     END F2;
65
 
66
 
67
     FUNCTION F3 (X:INTEGER) RETURN INTEGER IS
68
     BEGIN
69
          INDEX := INDEX + 1;
70
          EVAL_ORDER (INDEX) := 'H';
71
          EVAL_ORD   (INDEX) := 'G';
72
          RETURN ( IDENT_INT(7) );
73
     END F3;
74
 
75
 
76
     FUNCTION  D1( X:INTEGER )  RETURN DURATION IS
77
     BEGIN
78
          INDEX := INDEX + 1;
79
          EVAL_ORDER (INDEX) := 'A';    -- 123: ABC
80
          EVAL_ORD   (INDEX) := 'D';    -- 123: DDD ( 'D' FOR 'DELAY' )
81
          RETURN ( 1.0 );
82
     END D1;
83
 
84
 
85
     FUNCTION  D2( X:INTEGER )  RETURN DURATION IS
86
     BEGIN
87
          INDEX := INDEX + 1;
88
          EVAL_ORDER (INDEX) := 'B';
89
          EVAL_ORD   (INDEX) := 'D';
90
          RETURN ( 2.0 );
91
     END D2;
92
 
93
 
94
     FUNCTION  D3( X:INTEGER )  RETURN DURATION IS
95
     BEGIN
96
          INDEX := INDEX + 1;
97
          EVAL_ORDER (INDEX) := 'C';
98
          EVAL_ORD   (INDEX) := 'D';
99
          RETURN ( 3.0 );
100
     END D3;
101
 
102
     FUNCTION POS_OF (FUNC : CHARACTER) RETURN INTEGER  IS
103
     BEGIN
104
          FOR I IN EVAL_ORDER'RANGE LOOP
105
               IF EVAL_ORDER(I) = FUNC THEN
106
                    RETURN I;
107
               END IF;
108
          END LOOP;
109
          FAILED ("DID NOT FIND LETTER " & FUNC);
110
          RETURN 0;
111
     END POS_OF;
112
 
113
BEGIN
114
 
115
 
116
     TEST ("C97114A", "CHECK THAT THE DELAY EXPRESSIONS ARE" &
117
                      " EVALUATED AFTER THE GUARDS BUT"      &
118
                      " BEFORE THE RENDEZVOUS IS ATTEMPTED"  );
119
 
120
 
121
     DECLARE
122
 
123
 
124
          TASK T IS
125
 
126
 
127
               ENTRY E1;
128
 
129
          END T;
130
 
131
 
132
          TASK BODY T IS
133
          BEGIN
134
 
135
 
136
               WHILE  E1'COUNT = 0  -- IF  E1  NOT YET CALLED, THEN GIVE
137
               LOOP                 --     THE MAIN TASK AN OPPORTUNITY
138
                    DELAY  10.01 * Impdef.One_Second;   --     TO ISSUE THE CALL.
139
               END LOOP;
140
 
141
 
142
               SELECT
143
 
144
                         ACCEPT  E1;
145
 
146
               OR
147
 
148
                    WHEN  6 + F1(7) = 13  =>
149
                         DELAY  D1( DUMMY ) * Impdef.One_Second;
150
 
151
               OR
152
 
153
                    WHEN  6 + F2(7) = 13  =>
154
                         DELAY  D2( DUMMY ) * Impdef.One_Second;
155
 
156
               OR
157
 
158
                    WHEN  6 + F3(7) = 13  =>
159
                         DELAY  D3( DUMMY ) * Impdef.One_Second;
160
 
161
               END SELECT;
162
 
163
 
164
          END T;
165
 
166
 
167
     BEGIN
168
 
169
          T.E1;
170
 
171
     END; -- END OF BLOCK CONTAINING THE ENTRY CALLS
172
 
173
 
174
     COMMENT ("EVALUATIONS WERE DONE IN THE ORDER " & EVAL_ORD);
175
     COMMENT ("FUNCTIONS WERE CALLED IN THE ORDER " & EVAL_ORDER);
176
 
177
     IF EVAL_ORD = "GGGDDD" THEN
178
          COMMENT ("ALL GUARDS EVALUATED FIRST");
179
     ELSIF EVAL_ORD = "GDGDGD" THEN
180
          COMMENT ("DELAY EXPRESSION EVALUATED AFTER EACH GUARD");
181
     END IF;
182
 
183
-- CHECK THAT GUARDS ARE ALWAYS EVALUATED BEFORE DELAY EXPRESSIONS
184
 
185
     IF   POS_OF ('F') > POS_OF ('A') OR
186
          POS_OF ('G') > POS_OF ('B') OR
187
          POS_OF ('H') > POS_OF ('C') THEN
188
               FAILED ("A DELAY EXPRESSION WAS EVALUATED BEFORE ITS " &
189
                       "GUARD");
190
     END IF;
191
 
192
 
193
     RESULT;
194
 
195
 
196
END  C97114A;

powered by: WebSVN 2.1.0

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