src/sysc/kernel/sc_sensitive.h

Go to the documentation of this file.
00001 /*****************************************************************************
00002 
00003   The following code is derived, directly or indirectly, from the SystemC
00004   source code Copyright (c) 1996-2005 by all Contributors.
00005   All Rights reserved.
00006 
00007   The contents of this file are subject to the restrictions and limitations
00008   set forth in the SystemC Open Source License Version 2.4 (the "License");
00009   You may not use this file except in compliance with such restrictions and
00010   limitations. You may obtain instructions on how to receive a copy of the
00011   License at http://www.systemc.org/. Software distributed by Contributors
00012   under the License is distributed on an "AS IS" basis, WITHOUT WARRANTY OF
00013   ANY KIND, either express or implied. See the License for the specific
00014   language governing rights and limitations under the License.
00015 
00016  *****************************************************************************/
00017 
00018 /*****************************************************************************
00019 
00020   sc_sensitive.h -- Sensitivity classes. Requires "sc_process.h"
00021   for declarations of sc_method_handle, &.c.
00022 
00023   Original Author: Stan Y. Liao, Synopsys, Inc.
00024                    Martin Janssen, Synopsys, Inc.
00025 
00026  *****************************************************************************/
00027 
00028 /*****************************************************************************
00029 
00030   MODIFICATION LOG - modifiers, enter your name, affiliation, date and
00031   changes you are making here.
00032 
00033       Name, Affiliation, Date: Bishnupriya Bhattacharya, Cadence Design Systems,
00034                                25 August, 2003
00035   Description of Modification: Add make_static_sensitivity() methods to enable
00036                                dynamic method process creation with static 
00037                                sensitivity.
00038 
00039  *****************************************************************************/
00040 
00041 #ifndef SC_SENSITIVE_H
00042 #define SC_SENSITIVE_H
00043 
00044 #include "sysc/kernel/sc_process.h"
00045 
00046 namespace sc_dt
00047 {
00048     class sc_logic;
00049 }
00050 
00051 namespace sc_core {
00052 
00053 class sc_event;
00054 class sc_event_finder;
00055 class sc_interface;
00056 class sc_module;
00057 class sc_port_base;
00058 template <class T> class sc_in;
00059 template <class T> class sc_inout;
00060 template <class T> class sc_signal_in_if;
00061 
00062 
00063 // ----------------------------------------------------------------------------
00064 //  CLASS : sc_sensitive
00065 //
00066 //  Static sensitivity class for events.
00067 // ----------------------------------------------------------------------------
00068 
00069 class sc_sensitive
00070 {
00071     friend class sc_module;
00072 
00073 public:
00074 
00075     // typedefs
00076     typedef sc_signal_in_if<bool>            in_if_b_type;
00077     typedef sc_signal_in_if<sc_dt::sc_logic> in_if_l_type;
00078     typedef sc_in<bool>                      in_port_b_type;
00079     typedef sc_in<sc_dt::sc_logic>           in_port_l_type;
00080     typedef sc_inout<bool>                   inout_port_b_type;
00081     typedef sc_inout<sc_dt::sc_logic>        inout_port_l_type;
00082 
00083 private:
00084 
00085     // constructor
00086     explicit sc_sensitive( sc_module* );
00087 
00088     // destructor
00089     ~sc_sensitive();
00090 
00091 public:
00092 
00093     // changing between process handles
00094     sc_sensitive& operator << ( sc_method_handle );
00095     sc_sensitive& operator << ( sc_thread_handle );
00096 
00097     sc_sensitive& operator () ( const sc_event& );
00098     sc_sensitive& operator () ( const sc_interface& );
00099     sc_sensitive& operator () ( const sc_port_base& );
00100     sc_sensitive& operator () ( sc_event_finder& );
00101 
00102     sc_sensitive& operator << ( const sc_event& );
00103     sc_sensitive& operator << ( const sc_interface& );
00104     sc_sensitive& operator << ( const sc_port_base& );
00105     sc_sensitive& operator << ( sc_event_finder& );
00106 
00107     sc_sensitive& operator () ( sc_cthread_handle, sc_event_finder& );
00108     sc_sensitive& operator () ( sc_cthread_handle, const in_if_b_type& );
00109     sc_sensitive& operator () ( sc_cthread_handle, const in_if_l_type& );
00110     sc_sensitive& operator () ( sc_cthread_handle, const in_port_b_type& );
00111     sc_sensitive& operator () ( sc_cthread_handle, const in_port_l_type& );
00112     sc_sensitive& operator () ( sc_cthread_handle, const inout_port_b_type& );
00113     sc_sensitive& operator () ( sc_cthread_handle, const inout_port_l_type& );
00114 
00115     static void make_static_sensitivity( sc_process_b*, const sc_event& );
00116     static void make_static_sensitivity( sc_process_b*, const sc_interface& );
00117     static void make_static_sensitivity( sc_process_b*, const sc_port_base& );
00118     static void make_static_sensitivity( sc_process_b*, sc_event_finder& );
00119 
00120     void reset();
00121 
00122 private:
00123 
00124     sc_module*                                m_module;
00125     enum { SC_NONE_, SC_METHOD_, SC_THREAD_ } m_mode;
00126     sc_process_b*                             m_handle;
00127 
00128 private:
00129 
00130     // disabled
00131 
00132     sc_sensitive();
00133     sc_sensitive( const sc_sensitive& );
00134     sc_sensitive& operator = ( const sc_sensitive& );
00135 };
00136 
00137 
00138 // ----------------------------------------------------------------------------
00139 //  CLASS : sc_sensitive_pos
00140 //
00141 //  Static sensitivity class for positive edge events.
00142 // ----------------------------------------------------------------------------
00143 
00144 class sc_sensitive_pos
00145 {
00146     friend class sc_module;
00147 
00148 public:
00149 
00150     // typedefs
00151     typedef sc_signal_in_if<bool>            in_if_b_type;
00152     typedef sc_signal_in_if<sc_dt::sc_logic> in_if_l_type;
00153     typedef sc_in<bool>                      in_port_b_type;
00154     typedef sc_in<sc_dt::sc_logic>           in_port_l_type;
00155     typedef sc_inout<bool>                   inout_port_b_type;
00156     typedef sc_inout<sc_dt::sc_logic>        inout_port_l_type;
00157 
00158 private:
00159 
00160     // constructor
00161     explicit sc_sensitive_pos( sc_module* );
00162 
00163     // destructor
00164     ~sc_sensitive_pos();
00165 
00166 public:
00167 
00168     // changing between process handles
00169     sc_sensitive_pos& operator << ( sc_method_handle );
00170     sc_sensitive_pos& operator << ( sc_thread_handle );
00171 
00172     sc_sensitive_pos& operator () ( const in_if_b_type& );
00173     sc_sensitive_pos& operator () ( const in_if_l_type& );
00174     sc_sensitive_pos& operator () ( const in_port_b_type& );
00175     sc_sensitive_pos& operator () ( const in_port_l_type& );
00176     sc_sensitive_pos& operator () ( const inout_port_b_type& );
00177     sc_sensitive_pos& operator () ( const inout_port_l_type& );
00178 
00179     sc_sensitive_pos& operator << ( const in_if_b_type& );
00180     sc_sensitive_pos& operator << ( const in_if_l_type& );
00181     sc_sensitive_pos& operator << ( const in_port_b_type& );
00182     sc_sensitive_pos& operator << ( const in_port_l_type& );
00183     sc_sensitive_pos& operator << ( const inout_port_b_type& );
00184     sc_sensitive_pos& operator << ( const inout_port_l_type& );
00185 
00186     void reset();
00187 
00188 private:
00189 
00190     sc_module*                                m_module;
00191     enum { SC_NONE_, SC_METHOD_, SC_THREAD_ } m_mode;
00192     sc_process_b*                             m_handle;
00193 
00194 private:
00195 
00196     // disabled
00197     sc_sensitive_pos();
00198     sc_sensitive_pos( const sc_sensitive_pos& );
00199     sc_sensitive_pos& operator = ( const sc_sensitive_pos& );
00200 };
00201 
00202 
00203 // ----------------------------------------------------------------------------
00204 //  CLASS : sc_sensitive_neg
00205 //
00206 //  Static sensitivity class for negative edge events.
00207 // ----------------------------------------------------------------------------
00208 
00209 class sc_sensitive_neg
00210 {
00211     friend class sc_module;
00212 
00213 public:
00214 
00215     // typedefs
00216     typedef sc_signal_in_if<bool>            in_if_b_type;
00217     typedef sc_signal_in_if<sc_dt::sc_logic> in_if_l_type;
00218     typedef sc_in<bool>                      in_port_b_type;
00219     typedef sc_in<sc_dt::sc_logic>           in_port_l_type;
00220     typedef sc_inout<bool>                   inout_port_b_type;
00221     typedef sc_inout<sc_dt::sc_logic>        inout_port_l_type;
00222 
00223 private:
00224 
00225     // constructor
00226     explicit sc_sensitive_neg( sc_module* );
00227 
00228     // destructor
00229     ~sc_sensitive_neg();
00230 
00231 public:
00232 
00233     // changing between process handles
00234     sc_sensitive_neg& operator << ( sc_method_handle );
00235     sc_sensitive_neg& operator << ( sc_thread_handle );
00236 
00237     sc_sensitive_neg& operator () ( const in_if_b_type& );
00238     sc_sensitive_neg& operator () ( const in_if_l_type& );
00239     sc_sensitive_neg& operator () ( const in_port_b_type& );
00240     sc_sensitive_neg& operator () ( const in_port_l_type& );
00241     sc_sensitive_neg& operator () ( const inout_port_b_type& );
00242     sc_sensitive_neg& operator () ( const inout_port_l_type& );
00243 
00244     sc_sensitive_neg& operator << ( const in_if_b_type& );
00245     sc_sensitive_neg& operator << ( const in_if_l_type& );
00246     sc_sensitive_neg& operator << ( const in_port_b_type& );
00247     sc_sensitive_neg& operator << ( const in_port_l_type& );
00248     sc_sensitive_neg& operator << ( const inout_port_b_type& );
00249     sc_sensitive_neg& operator << ( const inout_port_l_type& );
00250 
00251     void reset();
00252 
00253 private:
00254 
00255     sc_module*                                m_module;
00256     enum { SC_NONE_, SC_METHOD_, SC_THREAD_ } m_mode;
00257     sc_process_b*                             m_handle;
00258 
00259 private:
00260 
00261     // disabled
00262     sc_sensitive_neg();
00263     sc_sensitive_neg( const sc_sensitive_neg& );
00264     sc_sensitive_neg& operator = ( const sc_sensitive_neg& );
00265 };
00266 
00267 } // namespace sc_core 
00268 
00269 #endif
00270 
00271 // Taf!

Generated on Wed Apr 25 13:53:27 2007 for SystemC by  doxygen 1.5.1