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_cthread_process.h -- Clocked thread declarations
23
24  Original Author: Andy Goodrich, Forte Design Systems, 4 August 2005
25
26
27  CHANGE LOG AT THE END OF THE FILE
28 *****************************************************************************/
29
30
31#if !defined(sc_cthread_process_h_INCLUDED)
32#define sc_cthread_process_h_INCLUDED
33
34#include "sysc/kernel/sc_thread_process.h"
35
36namespace sc_core {
37
38// friend function declarations:
39
40void halt( sc_simcontext* );
41void wait( int, sc_simcontext* );
42
43
44//==============================================================================
45// sc_cthread_process -
46//
47//==============================================================================
48class sc_cthread_process : public sc_thread_process {
49
50    friend class sc_module;
51    friend class sc_process_handle;
52    friend class sc_process_table;
53    friend class sc_thread_process;
54    friend class sc_simcontext;
55
56    friend void sc_cthread_cor_fn( void* );
57
58    friend void halt( sc_simcontext* );
59    friend void wait( int, sc_simcontext* );
60
61  public:
62    sc_cthread_process( const char* name_p, bool free_host,
63        SC_ENTRY_FUNC method_p, sc_process_host* host_p,
64        const sc_spawn_options* opt_p );
65
66    virtual void dont_initialize( bool dont );
67    virtual const char* kind() const
68        { return "sc_cthread_process"; }
69
70private:
71
72    sc_cthread_process( const char*   nm,
73            SC_ENTRY_FUNC fn,
74            sc_process_host*    host );
75
76    // may not be deleted manually (called from sc_process_b)
77    virtual ~sc_cthread_process();
78
79    bool eval_watchlist();
80    bool eval_watchlist_curr_level();
81
82    void wait_halt();
83
84};
85
86//------------------------------------------------------------------------------
87//"sc_cthread_process::wait_halt"
88//
89//------------------------------------------------------------------------------
90inline void sc_cthread_process::wait_halt()
91{
92    m_wait_cycle_n = 0;
93    suspend_me();
94    throw sc_halt();
95}
96
97} // namespace sc_core
98
99// $Log: sc_cthread_process.h,v $
100// Revision 1.8  2011/08/26 20:46:09  acg
101//  Andy Goodrich: moved the modification log to the end of the file to
102//  eliminate source line number skew when check-ins are done.
103//
104// Revision 1.7  2011/02/18 20:27:14  acg
105//  Andy Goodrich: Updated Copyrights.
106//
107// Revision 1.6  2011/02/13 21:47:37  acg
108//  Andy Goodrich: update copyright notice.
109//
110// Revision 1.5  2011/02/11 13:25:24  acg
111//  Andy Goodrich: Philipp A. Hartmann's changes:
112//    (1) Removal of SC_CTHREAD method overloads.
113//    (2) New exception processing code.
114//
115// Revision 1.4  2011/02/01 21:01:41  acg
116//  Andy Goodrich: removed throw_reset() as it is now handled by the parent
117//  method sc_thread_process::throw_reset().
118//
119// Revision 1.3  2011/01/18 20:10:44  acg
120//  Andy Goodrich: changes for IEEE1666_2011 semantics.
121//
122// Revision 1.2  2008/05/22 17:06:25  acg
123//  Andy Goodrich: updated copyright notice to include 2008.
124//
125// Revision 1.1.1.1  2006/12/15 20:20:05  acg
126// SystemC 2.3
127//
128// Revision 1.6  2006/05/08 17:57:13  acg
129//  Andy Goodrich: Added David Long's forward declarations for friend functions
130//  to keep the Microsoft C++ compiler happy.
131//
132// Revision 1.5  2006/04/20 17:08:16  acg
133//  Andy Goodrich: 3.0 style process changes.
134//
135// Revision 1.4  2006/04/11 23:13:20  acg
136//   Andy Goodrich: Changes for reduced reset support that only includes
137//   sc_cthread, but has preliminary hooks for expanding to method and thread
138//   processes also.
139//
140// Revision 1.3  2006/01/13 18:44:29  acg
141// Added $Log to record CVS changes into the source.
142//
143
144#endif // !defined(sc_cthread_process_h_INCLUDED)
145