SystemC 3.0.0
Accellera SystemC proof-of-concept library
sc_sensitive.h
Go to the documentation of this file.
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_sensitive.h -- Sensitivity classes. Requires "sc_process.h"
23 for declarations of sc_method_handle, &.c.
24
25 Original Author: Stan Y. Liao, Synopsys, Inc.
26 Martin Janssen, Synopsys, Inc.
27
28 CHANGE LOG AT THE END OF THE FILE
29 *****************************************************************************/
30
31
32#ifndef SC_SENSITIVE_H
33#define SC_SENSITIVE_H
34
36
37namespace sc_dt
38{
39 class sc_logic;
40}
41
42namespace sc_core {
43
44class sc_process_handle;
45class sc_event;
46class sc_event_finder;
47class sc_interface;
48class sc_module;
49class sc_port_base;
50template <class T> class sc_in;
51template <class T> class sc_inout;
52template <class T> class sc_signal_in_if;
53
54
55// ----------------------------------------------------------------------------
56// CLASS : sc_sensitive
57//
58// Static sensitivity class for events.
59// ----------------------------------------------------------------------------
60
62{
63 friend class sc_module;
64
65public:
66
67 // typedefs
74
75private:
76
77 // constructor
78 explicit sc_sensitive( sc_module* );
79
80 // destructor
82
83public:
84
85 // changing between process handles
87#if 0
90#endif // 0
91
92 sc_sensitive& operator () ( const sc_event& );
93 sc_sensitive& operator () ( const sc_interface& );
94 sc_sensitive& operator () ( const sc_port_base& );
95 sc_sensitive& operator () ( sc_event_finder& );
96
101 template <typename C, typename =
102 // enable if element of collection C can be added to sensitivity
103 decltype(std::declval<sc_sensitive&>() << *std::begin(std::declval<C&>()))>
104 sc_sensitive& operator << ( const C& collection)
105 {
106 for (auto it = std::begin(collection); it != std::end(collection); ++ it)
107 *this << *it;
108 return *this;
109 }
110
111
119
124
125 void reset();
126
127private:
128
129 sc_module* m_module;
130 enum { SC_NONE_, SC_METHOD_, SC_THREAD_ } m_mode;
131 sc_process_b* m_handle;
132
133private:
134
135 // disabled
136
137 sc_sensitive();
138 sc_sensitive( const sc_sensitive& );
139 sc_sensitive& operator = ( const sc_sensitive& );
140};
141
142
143// ----------------------------------------------------------------------------
144// CLASS : sc_sensitive_pos
145//
146// Static sensitivity class for positive edge events.
147// ----------------------------------------------------------------------------
148
150{
151 friend class sc_module;
152
153public:
154
155 // typedefs
162
163private:
164
165 // constructor
166 explicit sc_sensitive_pos( sc_module* );
167
168 // destructor
170
171public:
172
173 // changing between process handles
177
178 sc_sensitive_pos& operator () ( const in_if_b_type& );
179 sc_sensitive_pos& operator () ( const in_if_l_type& );
180 sc_sensitive_pos& operator () ( const in_port_b_type& );
181 sc_sensitive_pos& operator () ( const in_port_l_type& );
182 sc_sensitive_pos& operator () ( const inout_port_b_type& );
183 sc_sensitive_pos& operator () ( const inout_port_l_type& );
184
191
192 void reset();
193
194private:
195
196 sc_module* m_module;
197 enum { SC_NONE_, SC_METHOD_, SC_THREAD_ } m_mode;
198 sc_process_b* m_handle;
199
200private:
201
202 // disabled
205 sc_sensitive_pos& operator = ( const sc_sensitive_pos& );
206};
207
208
209// ----------------------------------------------------------------------------
210// CLASS : sc_sensitive_neg
211//
212// Static sensitivity class for negative edge events.
213// ----------------------------------------------------------------------------
214
216{
217 friend class sc_module;
218
219public:
220
221 // typedefs
228
229private:
230
231 // constructor
232 explicit sc_sensitive_neg( sc_module* );
233
234 // destructor
236
237public:
238
239 // changing between process handles
243
244 sc_sensitive_neg& operator () ( const in_if_b_type& );
245 sc_sensitive_neg& operator () ( const in_if_l_type& );
246 sc_sensitive_neg& operator () ( const in_port_b_type& );
247 sc_sensitive_neg& operator () ( const in_port_l_type& );
248 sc_sensitive_neg& operator () ( const inout_port_b_type& );
249 sc_sensitive_neg& operator () ( const inout_port_l_type& );
250
257
258 void reset();
259
260private:
261
262 sc_module* m_module;
263 enum { SC_NONE_, SC_METHOD_, SC_THREAD_ } m_mode;
264 sc_process_b* m_handle;
265
266private:
267
268 // disabled
271 sc_sensitive_neg& operator = ( const sc_sensitive_neg& );
272};
273
274} // namespace sc_core
275
276#endif
277
278/*****************************************************************************
279
280 MODIFICATION LOG - modifiers, enter your name, affiliation, date and
281 changes you are making here.
282
283 Name, Affiliation, Date: Bishnupriya Bhattacharya, Cadence Design Systems,
284 25 August, 2003
285 Description of Modification: Add make_static_sensitivity() methods to enable
286 dynamic method process creation with static
287 sensitivity.
288
289 *****************************************************************************/
290
291// $Log: sc_sensitive.h,v $
292// Revision 1.5 2011/08/26 20:46:10 acg
293// Andy Goodrich: moved the modification log to the end of the file to
294// eliminate source line number skew when check-ins are done.
295//
296// Revision 1.4 2011/02/18 20:27:14 acg
297// Andy Goodrich: Updated Copyrights.
298//
299// Revision 1.3 2011/02/13 21:47:38 acg
300// Andy Goodrich: update copyright notice.
301//
302// Revision 1.2 2008/05/22 17:06:26 acg
303// Andy Goodrich: updated copyright notice to include 2008.
304//
305// Revision 1.1.1.1 2006/12/15 20:20:05 acg
306// SystemC 2.3
307//
308// Revision 1.4 2006/04/11 23:13:21 acg
309// Andy Goodrich: Changes for reduced reset support that only includes
310// sc_cthread, but has preliminary hooks for expanding to method and thread
311// processes also.
312//
313// Revision 1.3 2006/01/13 18:44:30 acg
314// Added $Log to record CVS changes into the source.
315
316// Taf!
#define SC_API
Definition: sc_cmnhdr.h:148
class sc_cthread_process * sc_cthread_handle
Definition: sc_process.h:60
class sc_method_process * sc_method_handle
Definition: sc_process.h:61
class SC_API sc_port_base
Definition: sc_interface.h:37
class SC_API sc_event
Definition: sc_interface.h:36
inline::std::ostream & operator<<(::std::ostream &os, const sc_fifo< T > &a)
Definition: sc_fifo.h:428
class sc_thread_process * sc_thread_handle
Definition: sc_process.h:62
class SC_API sc_module
Definition: sc_object.h:44
class SC_API sc_logic
Definition: sc_signal_ifs.h:39
static void make_static_sensitivity(sc_process_b *, const sc_port_base &)
sc_in< bool > in_port_b_type
Definition: sc_sensitive.h:70
sc_signal_in_if< bool > in_if_b_type
Definition: sc_sensitive.h:68
static void make_static_sensitivity(sc_process_b *, const sc_interface &)
static void make_static_sensitivity(sc_process_b *, sc_event_finder &)
sc_in< sc_dt::sc_logic > in_port_l_type
Definition: sc_sensitive.h:71
sc_signal_in_if< sc_dt::sc_logic > in_if_l_type
Definition: sc_sensitive.h:69
static void make_static_sensitivity(sc_process_b *, const sc_event &)
sc_inout< bool > inout_port_b_type
Definition: sc_sensitive.h:72
sc_inout< sc_dt::sc_logic > inout_port_l_type
Definition: sc_sensitive.h:73
sc_in< sc_dt::sc_logic > in_port_l_type
Definition: sc_sensitive.h:159
sc_inout< bool > inout_port_b_type
Definition: sc_sensitive.h:160
sc_signal_in_if< sc_dt::sc_logic > in_if_l_type
Definition: sc_sensitive.h:157
sc_in< bool > in_port_b_type
Definition: sc_sensitive.h:158
sc_inout< sc_dt::sc_logic > inout_port_l_type
Definition: sc_sensitive.h:161
sc_signal_in_if< bool > in_if_b_type
Definition: sc_sensitive.h:156
sc_in< sc_dt::sc_logic > in_port_l_type
Definition: sc_sensitive.h:225
sc_in< bool > in_port_b_type
Definition: sc_sensitive.h:224
sc_signal_in_if< sc_dt::sc_logic > in_if_l_type
Definition: sc_sensitive.h:223
sc_inout< bool > inout_port_b_type
Definition: sc_sensitive.h:226
sc_signal_in_if< bool > in_if_b_type
Definition: sc_sensitive.h:222
sc_inout< sc_dt::sc_logic > inout_port_l_type
Definition: sc_sensitive.h:227