1/*****************************************************************************
2
3  Licensed to Accellera Systems Initiative Inc. (Accellera) under one or
4  more contributor license agreements.  See the NOTICE file distributed
5  with this work for additional information regarding copyright ownership.
6  Accellera licenses this file to you under the Apache License, Version 2.0
7  (the "License"); you may not use this file except in compliance with the
8  License.  You may obtain a copy of the License at
9
10    http://www.apache.org/licenses/LICENSE-2.0
11
12  Unless required by applicable law or agreed to in writing, software
13  distributed under the License is distributed on an "AS IS" BASIS,
14  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
15  implied.  See the License for the specific language governing
16  permissions and limitations under the License.
17
18 *****************************************************************************/
19
20/*****************************************************************************
21
22  sc_runnable.h --
23
24  Original Author: Martin Janssen, Synopsys, Inc., 2001-05-21
25
26  CHANGE LOG AT THE END OF THE FILE
27 *****************************************************************************/
28
29
30#ifndef SC_RUNNABLE_H
31#define SC_RUNNABLE_H
32
33
34#include "sysc/kernel/sc_process.h"
35
36namespace sc_core {
37
38//=============================================================================
39//  CLASS : sc_runnable
40//
41//  Class that manages the ready-to-run queues.
42//=============================================================================
43
44class sc_runnable
45{
46
47  public:
48    sc_runnable();
49    ~sc_runnable();
50
51    inline void init();
52    inline void toggle_methods();
53    inline void toggle_threads();
54
55    inline void remove_method( sc_method_handle );
56    inline void remove_thread( sc_thread_handle );
57
58    inline void execute_method_next( sc_method_handle );
59    inline void execute_thread_next( sc_thread_handle );
60
61    inline void push_back_method( sc_method_handle );
62    inline void push_back_thread( sc_thread_handle );
63    inline void push_front_method( sc_method_handle );
64    inline void push_front_thread( sc_thread_handle );
65
66    inline bool is_initialized() const;
67    inline bool is_empty() const;
68
69    inline sc_method_handle pop_method();
70    inline sc_thread_handle pop_thread();
71
72  public: // diagnostics:
73    void dump() const;
74
75  private:
76    sc_method_handle m_methods_push_head;
77    sc_method_handle m_methods_push_tail;
78    sc_method_handle m_methods_pop;
79    sc_thread_handle m_threads_push_head;
80    sc_thread_handle m_threads_push_tail;
81    sc_thread_handle m_threads_pop;
82
83  private:
84    // disabled
85    sc_runnable( const sc_runnable& );
86    sc_runnable& operator = ( const sc_runnable& );
87};
88
89} // namespace sc_core
90
91#endif
92
93/*****************************************************************************
94
95  MODIFICATION LOG - modifiers, enter your name, affiliation, date and
96  changes you are making here.
97
98      Name, Affiliation, Date: Andy Goodrich, 30 June 2003, Forte Design Systems
99  Description of Modification: Total rewrite using linked list rather than
100                               fixed vector.
101
102
103      Name, Affiliation, Date: Bishnupriya Bhattacharya, Cadence Design Systems,
104                               25 August, 2003
105  Description of Modification: Add tail pointers for m_methods_push and
106                               m_threads_push to maintain the same scheduler
107                               ordering as 2.0.1
108
109 *****************************************************************************/
110
111// $Log: sc_runnable.h,v $
112// Revision 1.9  2011/08/26 20:46:10  acg
113//  Andy Goodrich: moved the modification log to the end of the file to
114//  eliminate source line number skew when check-ins are done.
115//
116// Revision 1.8  2011/04/08 18:26:07  acg
117//  Andy Goodrich: added execute_method_next() to handle method dispatch
118//   for asynchronous notifications that occur outside the evaluation phase.
119//
120// Revision 1.7  2011/02/18 20:27:14  acg
121//  Andy Goodrich: Updated Copyrights.
122//
123// Revision 1.6  2011/02/13 21:47:38  acg
124//  Andy Goodrich: update copyright notice.
125//
126// Revision 1.5  2011/02/02 06:37:03  acg
127//  Andy Goodrich: removed toggle() method since it is no longer used.
128//
129// Revision 1.4  2011/02/01 21:09:13  acg
130//  Andy Goodrich: addition of toggle_methods() and toggle_threads() calls.
131//
132// Revision 1.3  2011/01/25 20:50:37  acg
133//  Andy Goodrich: changes for IEEE 1666 2011.
134//
135// Revision 1.2  2008/05/22 17:06:26  acg
136//  Andy Goodrich: updated copyright notice to include 2008.
137//
138// Revision 1.1.1.1  2006/12/15 20:20:05  acg
139// SystemC 2.3
140//
141// Revision 1.3  2006/01/13 18:44:30  acg
142// Added $Log to record CVS changes into the source.
143
144// Taf!
145