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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [ada/] [acats/] [tests/] [c9/] [c97301a.ada] - Blame information for rev 720

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 720 jeremybenn
-- C97301A.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 THAT A TIMED_ENTRY_CALL DELAYS FOR AT LEAST THE SPECIFIED
26
-- AMOUNT OF TIME IF A RENDEVOUS IS NOT POSSIBLE.
27
 
28
-- CASE  A:  THE TASK TO BE CALLED HAS NOT YET BEEN ACTIVATED AS OF THE
29
--           MOMENT OF CALL.
30
 
31
-- RJW 3/31/86
32
 
33
with Impdef;
34
WITH REPORT; USE REPORT;
35
WITH CALENDAR; USE CALENDAR;
36
PROCEDURE C97301A IS
37
 
38
     WAIT_TIME : CONSTANT DURATION := 10.0 * Impdef.One_Second;
39
     OR_BRANCH_TAKEN : INTEGER := 3;
40
 
41
BEGIN
42
 
43
     TEST ("C97301A", "CHECK THAT A TIMED_ENTRY_CALL DELAYS FOR AT " &
44
                      "LEAST THE SPECIFIED AMOUNT OF TIME WHEN THE " &
45
                      "CALLED TASK IS NOT ACTIVE" );
46
 
47
     ------------------------------------------------------------------
48
 
49
     DECLARE
50
 
51
          TASK  T  IS
52
               ENTRY  DO_IT_NOW_OR_WAIT ( AUTHORIZED : IN BOOLEAN );
53
          END  T;
54
 
55
          TASK BODY  T  IS
56
 
57
               PACKAGE       SECOND_ATTEMPT  IS    END  SECOND_ATTEMPT;
58
               PACKAGE BODY  SECOND_ATTEMPT  IS
59
                    START_TIME : TIME;
60
               BEGIN
61
                    START_TIME := CLOCK;
62
                    SELECT
63
                         DO_IT_NOW_OR_WAIT (FALSE); --CALLING OWN ENTRY.
64
                    OR
65
                                      -- THEREFORE THIS BRANCH
66
                                      --    MUST BE CHOSEN.
67
                         DELAY WAIT_TIME;
68
                         IF CLOCK >= (WAIT_TIME + START_TIME) THEN
69
                              NULL;
70
                         ELSE
71
                              FAILED ( "INSUFFICIENT DELAY (#2)" );
72
                         END IF;
73
                         OR_BRANCH_TAKEN := 2 * OR_BRANCH_TAKEN;
74
                         COMMENT( "OR_BRANCH  TAKEN  (#2)" );
75
                    END SELECT;
76
               END  SECOND_ATTEMPT;
77
 
78
          BEGIN
79
 
80
               ACCEPT DO_IT_NOW_OR_WAIT ( AUTHORIZED : IN BOOLEAN )  DO
81
 
82
                    IF  AUTHORIZED  THEN
83
                         COMMENT( "AUTHORIZED ENTRY_CALL" );
84
                    ELSE
85
                         FAILED( "UNAUTHORIZED ENTRY_CALL" );
86
                    END IF;
87
 
88
               END DO_IT_NOW_OR_WAIT;
89
 
90
 
91
          END  T;
92
 
93
 
94
          PACKAGE       FIRST_ATTEMPT  IS      END  FIRST_ATTEMPT;
95
          PACKAGE BODY  FIRST_ATTEMPT  IS
96
               START_TIME : TIME;
97
          BEGIN
98
               START_TIME := CLOCK;
99
               SELECT
100
                    T.DO_IT_NOW_OR_WAIT (FALSE);
101
               OR
102
                                      -- THIS BRANCH MUST BE CHOSEN.
103
                    DELAY WAIT_TIME;
104
                    IF CLOCK >= (WAIT_TIME + START_TIME) THEN
105
                         NULL;
106
                    ELSE
107
                         FAILED ( "INSUFFICIENT DELAY (#1)" );
108
                    END IF;
109
                    OR_BRANCH_TAKEN := 1 + OR_BRANCH_TAKEN;
110
                    COMMENT( "OR_BRANCH  TAKEN  (#1)" );
111
               END SELECT;
112
 
113
          END  FIRST_ATTEMPT;
114
 
115
     BEGIN
116
 
117
          T.DO_IT_NOW_OR_WAIT ( TRUE );   -- TO SATISFY THE SERVER'S
118
                                          --     WAIT FOR SUCH A CALL.
119
 
120
     EXCEPTION
121
 
122
          WHEN  TASKING_ERROR  =>
123
               FAILED( "TASKING ERROR" );
124
 
125
     END ;
126
 
127
 
128
     ------------------------------------------------------------------
129
 
130
 
131
     -- BY NOW, THE TASK IS TERMINATED  (AND THE NONLOCALS UPDATED).
132
 
133
 
134
     CASE  OR_BRANCH_TAKEN  IS
135
 
136
          WHEN  3  =>
137
               FAILED( "NO 'OR'; BOTH (?) RENDEZVOUS ATTEMPTED?" );
138
 
139
          WHEN  4  =>
140
               FAILED( "'OR' #1 ONLY; RENDEZVOUS (#2) ATTEMPTED?" );
141
 
142
          WHEN  6  =>
143
               FAILED( "'OR' #2 ONLY; RENDEZVOUS (#1) ATTEMPTED?" );
144
 
145
          WHEN  7  =>
146
               FAILED( "WRONG ORDER FOR 'OR':  #2,#1" );
147
 
148
          WHEN  8  =>
149
               NULL;
150
 
151
          WHEN  OTHERS  =>
152
               FAILED( "WRONG CASE_VALUE" );
153
 
154
     END CASE;
155
 
156
     RESULT;
157
 
158
END  C97301A;

powered by: WebSVN 2.1.0

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