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/] [c9/] [c953003.a] - Blame information for rev 294

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 294 jeremybenn
-- C953003.A
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
--
26
-- OBJECTIVE:
27
--      Check that the servicing of entry queues of a protected object
28
--      continues until there are no open entries with queued (or
29
--      requeued) calls and that internal requeues are handled
30
--      as part of a single protected operation.
31
--
32
-- TEST DESCRIPTION:
33
--      A number of tasks are created and blocked on a protected object
34
--      so that they can all be released at one time.  When released,
35
--      these tasks make an entry call to an entry in the Main_PO
36
--      protected object.  As part of the servicing of this entry
37
--      call the call is passed through the remaining entries of the
38
--      protected object by using internal requeues.  The protected
39
--      object checks that no other entry call is accepted until
40
--      after all the internal requeuing has completed.
41
--
42
--
43
-- CHANGE HISTORY:
44
--      12 JAN 96   SAIC    Initial version for 2.1
45
--
46
--!
47
 
48
with Report;
49
procedure C953003 is
50
  Verbose : constant Boolean := False;
51
 
52
  Order_Error : Boolean := False;
53
 
54
  Max_Tasks : constant := 10;  -- total number of tasks
55
  Max_Entries : constant := 4;  -- number of entries in Main_PO
56
  Note_Cnt : Integer := 0;
57
  Note_Order : array (1..Max_Tasks*Max_Entries) of Integer;
58
begin
59
  Report.Test ("C953003",
60
               "Check that the servicing of entry queues handles all" &
61
               " open entries as part of a single protected operation," &
62
               " including those resulting from an internal requeue");
63
  declare
64
     task type Assault_PO is
65
        entry Take_ID (Id : Integer);
66
     end Assault_PO;
67
 
68
     Marines  : array (1 .. Max_Tasks) of Assault_PO;
69
 
70
     protected Main_PO is
71
        entry E0 (Who : Integer);
72
     private
73
        entry E3 (Who : Integer);
74
        entry E2 (Who : Integer);
75
        entry E1 (Who : Integer);
76
        Expected_Next : Integer := 0;
77
     end Main_PO;
78
 
79
 
80
     protected body Main_PO is
81
 
82
        entry E0 (Who : Integer) when True is
83
        begin
84
           Order_Error := Order_Error or Expected_Next /= 0;
85
           Expected_Next := 1;
86
           Note_Cnt := Note_Cnt + 1;
87
           Note_Order (Note_Cnt) := Who;
88
           requeue E1;
89
        end E0;
90
 
91
        entry E1 (Who : Integer) when True is
92
        begin
93
           Order_Error := Order_Error or Expected_Next /= 1;
94
           Expected_Next := 2;
95
           Note_Cnt := Note_Cnt + 1;
96
           Note_Order (Note_Cnt) := Who;
97
           requeue E2;
98
        end E1;
99
 
100
        entry E3 (Who : Integer) when True is
101
        begin
102
           Order_Error := Order_Error or Expected_Next /= 3;
103
           Expected_Next := 0;
104
           Note_Cnt := Note_Cnt + 1;
105
           Note_Order (Note_Cnt) := Who;
106
           -- all done - return now
107
        end E3;
108
 
109
        entry E2 (Who : Integer) when True is
110
        begin
111
           Order_Error := Order_Error or Expected_Next /= 2;
112
           Expected_Next := 3;
113
           Note_Cnt := Note_Cnt + 1;
114
           Note_Order (Note_Cnt) := Who;
115
           requeue E3;
116
        end E2;
117
     end Main_PO;
118
 
119
     protected Holding_Pen is
120
        entry Wait_For_All_Present;
121
        entry Wait;
122
     private
123
        Open : Boolean := False;
124
     end Holding_Pen;
125
 
126
     protected body Holding_Pen is
127
        entry Wait_For_All_Present when Wait'Count = Max_Tasks is
128
        begin
129
           Open := True;
130
        end Wait_For_All_Present;
131
 
132
        entry Wait when Open is
133
        begin
134
           null;  -- just go
135
        end Wait;
136
     end Holding_Pen;
137
 
138
 
139
     task body Assault_PO is
140
        Me : Integer;
141
     begin
142
        accept Take_Id (Id : Integer) do
143
           Me := Id;
144
        end Take_Id;
145
        Holding_Pen.Wait;
146
        Main_PO.E0 (Me);
147
        if Verbose then
148
           Report.Comment ("task" & Integer'Image (Me) &
149
                           " done");
150
        end if;
151
     exception
152
        when others =>
153
           Report.Failed ("exception in task");
154
     end Assault_PO;
155
 
156
  begin   -- test encapsulation
157
     for I in Marines'Range loop
158
        Marines (I).Take_ID (100 + I);
159
     end loop;
160
 
161
     -- let all the tasks get blocked so we can release them all
162
     -- at one time
163
     Holding_Pen.Wait_For_All_Present;
164
 
165
     -- wait for all the tasks to complete
166
     if Verbose then
167
        Report.Comment ("waiting for tasks to complete");
168
     end if;
169
  end;
170
 
171
  -- make sure all tasks registered their order
172
  if Note_Cnt /= Max_Tasks * Max_Entries then
173
     Report.Failed ("task registration count wrong. " &
174
                    Integer'Image (Note_Cnt));
175
  end if;
176
 
177
  if Order_Error then
178
     Report.Failed ("internal requeue not handled as part of operation");
179
  end if;
180
 
181
  if Verbose or Order_Error then
182
     for I in 1..Max_Tasks * Max_Entries loop
183
        Report.Comment ("order" & Integer'Image (I) & " is" &
184
                        Integer'Image (Note_Order (I)));
185
     end loop;
186
  end if;
187
 
188
  Report.Result;
189
end C953003;

powered by: WebSVN 2.1.0

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