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
35#include "sysc/kernel/sc_process.h"
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
61class sc_sensitive
62{
63    friend class sc_module;
64
65public:
66
67    // typedefs
68    typedef sc_signal_in_if<bool>            in_if_b_type;
69    typedef sc_signal_in_if<sc_dt::sc_logic> in_if_l_type;
70    typedef sc_in<bool>                      in_port_b_type;
71    typedef sc_in<sc_dt::sc_logic>           in_port_l_type;
72    typedef sc_inout<bool>                   inout_port_b_type;
73    typedef sc_inout<sc_dt::sc_logic>        inout_port_l_type;
74
75private:
76
77    // constructor
78    explicit sc_sensitive( sc_module* );
79
80    // destructor
81    ~sc_sensitive();
82
83public:
84
85    // changing between process handles
86    sc_sensitive& operator << ( sc_process_handle );
87#if 0
88    sc_sensitive& operator << ( sc_method_handle );
89    sc_sensitive& operator << ( sc_thread_handle );
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
97    sc_sensitive& operator << ( const sc_event& );
98    sc_sensitive& operator << ( const sc_interface& );
99    sc_sensitive& operator << ( const sc_port_base& );
100    sc_sensitive& operator << ( sc_event_finder& );
101
102    sc_sensitive& operator () ( sc_cthread_handle, sc_event_finder& );
103    sc_sensitive& operator () ( sc_cthread_handle, const in_if_b_type& );
104    sc_sensitive& operator () ( sc_cthread_handle, const in_if_l_type& );
105    sc_sensitive& operator () ( sc_cthread_handle, const in_port_b_type& );
106    sc_sensitive& operator () ( sc_cthread_handle, const in_port_l_type& );
107    sc_sensitive& operator () ( sc_cthread_handle, const inout_port_b_type& );
108    sc_sensitive& operator () ( sc_cthread_handle, const inout_port_l_type& );
109
110    static void make_static_sensitivity( sc_process_b*, const sc_event& );
111    static void make_static_sensitivity( sc_process_b*, const sc_interface& );
112    static void make_static_sensitivity( sc_process_b*, const sc_port_base&);
113    static void make_static_sensitivity( sc_process_b*, sc_event_finder& );
114
115    void reset();
116
117private:
118
119    sc_module*                                m_module;
120    enum { SC_NONE_, SC_METHOD_, SC_THREAD_ } m_mode;
121    sc_process_b*                          m_handle;
122
123private:
124
125    // disabled
126
127    sc_sensitive();
128    sc_sensitive( const sc_sensitive& );
129    sc_sensitive& operator = ( const sc_sensitive& );
130};
131
132
133// ----------------------------------------------------------------------------
134//  CLASS : sc_sensitive_pos
135//
136//  Static sensitivity class for positive edge events.
137// ----------------------------------------------------------------------------
138
139class sc_sensitive_pos
140{
141    friend class sc_module;
142
143public:
144
145    // typedefs
146    typedef sc_signal_in_if<bool>            in_if_b_type;
147    typedef sc_signal_in_if<sc_dt::sc_logic> in_if_l_type;
148    typedef sc_in<bool>                      in_port_b_type;
149    typedef sc_in<sc_dt::sc_logic>           in_port_l_type;
150    typedef sc_inout<bool>                   inout_port_b_type;
151    typedef sc_inout<sc_dt::sc_logic>        inout_port_l_type;
152
153private:
154
155    // constructor
156    explicit sc_sensitive_pos( sc_module* );
157
158    // destructor
159    ~sc_sensitive_pos();
160
161public:
162
163    // changing between process handles
164    sc_sensitive_pos& operator << ( sc_process_handle );
165    sc_sensitive_pos& operator << ( sc_method_handle );
166    sc_sensitive_pos& operator << ( sc_thread_handle );
167
168    sc_sensitive_pos& operator () ( const in_if_b_type& );
169    sc_sensitive_pos& operator () ( const in_if_l_type& );
170    sc_sensitive_pos& operator () ( const in_port_b_type& );
171    sc_sensitive_pos& operator () ( const in_port_l_type& );
172    sc_sensitive_pos& operator () ( const inout_port_b_type& );
173    sc_sensitive_pos& operator () ( const inout_port_l_type& );
174
175    sc_sensitive_pos& operator << ( const in_if_b_type& );
176    sc_sensitive_pos& operator << ( const in_if_l_type& );
177    sc_sensitive_pos& operator << ( const in_port_b_type& );
178    sc_sensitive_pos& operator << ( const in_port_l_type& );
179    sc_sensitive_pos& operator << ( const inout_port_b_type& );
180    sc_sensitive_pos& operator << ( const inout_port_l_type& );
181
182    void reset();
183
184private:
185
186    sc_module*                                m_module;
187    enum { SC_NONE_, SC_METHOD_, SC_THREAD_ } m_mode;
188    sc_process_b*                          m_handle;
189
190private:
191
192    // disabled
193    sc_sensitive_pos();
194    sc_sensitive_pos( const sc_sensitive_pos& );
195    sc_sensitive_pos& operator = ( const sc_sensitive_pos& );
196};
197
198
199// ----------------------------------------------------------------------------
200//  CLASS : sc_sensitive_neg
201//
202//  Static sensitivity class for negative edge events.
203// ----------------------------------------------------------------------------
204
205class sc_sensitive_neg
206{
207    friend class sc_module;
208
209public:
210
211    // typedefs
212    typedef sc_signal_in_if<bool>            in_if_b_type;
213    typedef sc_signal_in_if<sc_dt::sc_logic> in_if_l_type;
214    typedef sc_in<bool>                      in_port_b_type;
215    typedef sc_in<sc_dt::sc_logic>           in_port_l_type;
216    typedef sc_inout<bool>                   inout_port_b_type;
217    typedef sc_inout<sc_dt::sc_logic>        inout_port_l_type;
218
219private:
220
221    // constructor
222    explicit sc_sensitive_neg( sc_module* );
223
224    // destructor
225    ~sc_sensitive_neg();
226
227public:
228
229    // changing between process handles
230    sc_sensitive_neg& operator << ( sc_process_handle );
231    sc_sensitive_neg& operator << ( sc_method_handle );
232    sc_sensitive_neg& operator << ( sc_thread_handle );
233
234    sc_sensitive_neg& operator () ( const in_if_b_type& );
235    sc_sensitive_neg& operator () ( const in_if_l_type& );
236    sc_sensitive_neg& operator () ( const in_port_b_type& );
237    sc_sensitive_neg& operator () ( const in_port_l_type& );
238    sc_sensitive_neg& operator () ( const inout_port_b_type& );
239    sc_sensitive_neg& operator () ( const inout_port_l_type& );
240
241    sc_sensitive_neg& operator << ( const in_if_b_type& );
242    sc_sensitive_neg& operator << ( const in_if_l_type& );
243    sc_sensitive_neg& operator << ( const in_port_b_type& );
244    sc_sensitive_neg& operator << ( const in_port_l_type& );
245    sc_sensitive_neg& operator << ( const inout_port_b_type& );
246    sc_sensitive_neg& operator << ( const inout_port_l_type& );
247
248    void reset();
249
250private:
251
252    sc_module*                                m_module;
253    enum { SC_NONE_, SC_METHOD_, SC_THREAD_ } m_mode;
254    sc_process_b*                          m_handle;
255
256private:
257
258    // disabled
259    sc_sensitive_neg();
260    sc_sensitive_neg( const sc_sensitive_neg& );
261    sc_sensitive_neg& operator = ( const sc_sensitive_neg& );
262};
263
264} // namespace sc_core
265
266#endif
267
268/*****************************************************************************
269
270  MODIFICATION LOG - modifiers, enter your name, affiliation, date and
271  changes you are making here.
272
273      Name, Affiliation, Date: Bishnupriya Bhattacharya, Cadence Design Systems,
274                               25 August, 2003
275  Description of Modification: Add make_static_sensitivity() methods to enable
276                               dynamic method process creation with static
277                               sensitivity.
278
279 *****************************************************************************/
280
281// $Log: sc_sensitive.h,v $
282// Revision 1.5  2011/08/26 20:46:10  acg
283//  Andy Goodrich: moved the modification log to the end of the file to
284//  eliminate source line number skew when check-ins are done.
285//
286// Revision 1.4  2011/02/18 20:27:14  acg
287//  Andy Goodrich: Updated Copyrights.
288//
289// Revision 1.3  2011/02/13 21:47:38  acg
290//  Andy Goodrich: update copyright notice.
291//
292// Revision 1.2  2008/05/22 17:06:26  acg
293//  Andy Goodrich: updated copyright notice to include 2008.
294//
295// Revision 1.1.1.1  2006/12/15 20:20:05  acg
296// SystemC 2.3
297//
298// Revision 1.4  2006/04/11 23:13:21  acg
299//   Andy Goodrich: Changes for reduced reset support that only includes
300//   sc_cthread, but has preliminary hooks for expanding to method and thread
301//   processes also.
302//
303// Revision 1.3  2006/01/13 18:44:30  acg
304// Added $Log to record CVS changes into the source.
305
306// Taf!
307