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_spawn_options.h -- Process spawning options specification.
23 
24   Original Authors: Andy Goodrich, Forte Design Systems, 17 June 2003
25                     Stuart Swan, Cadence,
26                     Bishnupriya Bhattacharya, Cadence Design Systems,
27                     25 August, 2003
28 
29   CHANGE LOG AT THE END OF THE FILE
30  *****************************************************************************/
31 
32 #if !defined(sc_spawn_options_h_INCLUDED)
33 #define sc_spawn_options_h_INCLUDED
34 
35 #include <vector>
36 #include "sysc/communication/sc_export.h"
37 #include "sysc/communication/sc_signal_ports.h"
38 
39 #if defined(_MSC_VER) && !defined(SC_WIN_DLL_WARN)
40 #pragma warning(push)
41 #pragma warning(disable: 4251) // DLL import for std::vector
42 #endif
43 
44 namespace sc_core {
45 
46 class sc_event;
47 class sc_port_base;
48 class sc_interface;
49 class sc_event_finder;
50 class sc_process_b;
51 class sc_spawn_reset_base;
52 
53 
54 //=============================================================================
55 // CLASS sc_spawn_options
56 //
57 //=============================================================================
58 class SC_API sc_spawn_options {
59     friend class sc_cthread_process;
60     friend class sc_method_process;
61     friend class sc_process_b;
62     friend class sc_thread_process;
63   public:
sc_spawn_options()64     sc_spawn_options() :
65         m_dont_initialize(false), m_resets(), m_sensitive_events(),
66         m_sensitive_event_finders(), m_sensitive_interfaces(),
67         m_sensitive_port_bases(), m_spawn_method(false), m_stack_size(0)
68         { }
69 
70     ~sc_spawn_options();
71 
72     void async_reset_signal_is( const sc_in<bool>&,           bool level );
73     void async_reset_signal_is( const sc_inout<bool>&,        bool level );
74     void async_reset_signal_is( const sc_out<bool>&,          bool level );
75     void async_reset_signal_is( const sc_signal_in_if<bool>&, bool level );
76 
77     void reset_signal_is( const sc_in<bool>&,           bool level );
78     void reset_signal_is( const sc_inout<bool>&,        bool level );
79     void reset_signal_is( const sc_out<bool>&,          bool level );
80     void reset_signal_is( const sc_signal_in_if<bool>&, bool level );
81 
dont_initialize()82     void dont_initialize()   { m_dont_initialize = true; }
83 
is_method()84     bool is_method() const   { return m_spawn_method; }
85 
set_stack_size(int stack_size)86     void set_stack_size(int stack_size) { m_stack_size = stack_size; }
87 
set_sensitivity(const sc_event * event)88     void set_sensitivity(const sc_event* event)
89         { m_sensitive_events.push_back(event); }
90 
set_sensitivity(sc_port_base * port_base)91     void set_sensitivity(sc_port_base* port_base)
92         { m_sensitive_port_bases.push_back(port_base); }
93 
set_sensitivity(sc_interface * interface_p)94     void set_sensitivity(sc_interface* interface_p)
95         { m_sensitive_interfaces.push_back(interface_p); }
96 
set_sensitivity(sc_export_base * export_base)97     void set_sensitivity(sc_export_base* export_base)
98         { m_sensitive_interfaces.push_back(export_base->get_interface()); }
99 
set_sensitivity(sc_event_finder * event_finder)100     void set_sensitivity(sc_event_finder* event_finder)
101         { m_sensitive_event_finders.push_back(event_finder); }
102 
spawn_method()103     void spawn_method()                 { m_spawn_method = true; }
104 
105   protected:
106     void specify_resets() const;
107 
108   private:
109     sc_spawn_options( const sc_spawn_options& );
110     const sc_spawn_options& operator = ( const sc_spawn_options& );
111 
112   protected:
113     bool                               m_dont_initialize;
114     std::vector<sc_spawn_reset_base*>  m_resets;
115     std::vector<const sc_event*>       m_sensitive_events;
116     std::vector<sc_event_finder*>      m_sensitive_event_finders;
117     std::vector<sc_interface*>         m_sensitive_interfaces;
118     std::vector<sc_port_base*>         m_sensitive_port_bases;
119     bool                               m_spawn_method; // Method not thread.
120     int                                m_stack_size;   // Thread stack size.
121 };
122 
123 } // namespace sc_core
124 
125 #if defined(_MSC_VER) && !defined(SC_WIN_DLL_WARN)
126 #pragma warning(pop)
127 #endif
128 
129 // $Log: sc_spawn_options.h,v $
130 // Revision 1.11  2011/08/26 20:46:11  acg
131 //  Andy Goodrich: moved the modification log to the end of the file to
132 //  eliminate source line number skew when check-ins are done.
133 //
134 // Revision 1.10  2011/08/24 22:05:51  acg
135 //  Torsten Maehne: initialization changes to remove warnings.
136 //
137 // Revision 1.9  2011/02/18 20:27:14  acg
138 //  Andy Goodrich: Updated Copyrights.
139 //
140 // Revision 1.8  2011/02/13 21:47:38  acg
141 //  Andy Goodrich: update copyright notice.
142 //
143 // Revision 1.7  2011/02/07 19:17:20  acg
144 //  Andy Goodrich: changes for IEEE 1666 compatibility.
145 //
146 // Revision 1.6  2010/12/07 20:09:15  acg
147 // Andy Goodrich: replaced sc_signal signatures with sc_signal_in_if signatures for reset methods.
148 //
149 // Revision 1.5  2010/11/20 17:10:57  acg
150 //  Andy Goodrich: reset processing changes for new IEEE 1666 standard.
151 //
152 // Revision 1.4  2009/05/22 16:06:29  acg
153 //  Andy Goodrich: process control updates.
154 //
155 // Revision 1.3  2009/02/28 00:26:58  acg
156 //  Andy Goodrich: changed boost name space to sc_boost to allow use with
157 //  full boost library applications.
158 //
159 // Revision 1.2  2008/05/22 17:06:26  acg
160 //  Andy Goodrich: updated copyright notice to include 2008.
161 //
162 // Revision 1.1.1.1  2006/12/15 20:20:05  acg
163 // SystemC 2.3
164 //
165 // Revision 1.4  2006/04/20 17:08:17  acg
166 //  Andy Goodrich: 3.0 style process changes.
167 //
168 // Revision 1.3  2006/01/13 18:44:30  acg
169 // Added $Log to record CVS changes into the source.
170 
171 #endif // !defined(sc_spawn_options_h_INCLUDED)
172