src/sysc/kernel/sc_wait_cthread.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_wait_cthread.h -- Wait() and related functions for SC_CTHREADs.
00021 
00022   Original Author: Stan Y. Liao, Synopsys, Inc.
00023                    Martin Janssen, Synopsys, Inc.
00024 
00025  *****************************************************************************/
00026 
00027 /******************************************************************************
00028 
00029   MODIFICATION LOG - modifiers, enter your name, affiliation, date and
00030   changes you are making here.
00031 
00032       Name, Affiliation, Date:
00033   Description of Modification:
00034 
00035 ******************************************************************************/
00036 
00037 /* 
00038 $Log: sc_wait_cthread.h,v $
00039 Revision 1.6  2005/01/10 17:52:20  acg
00040 Addition of namespace specifications.
00041 
00042 Revision 1.5  2004/09/27 20:49:10  acg
00043 Andy Goodrich, Forte Design Systems, Inc.
00044    - Added a $Log comment so that CVS checkin comments appear in the
00045      checkout source.
00046 
00047 */
00048 
00049 #ifndef SC_WAIT_CTHREAD_H
00050 #define SC_WAIT_CTHREAD_H
00051 
00052 
00053 #include "sysc/kernel/sc_lambda.h"
00054 #include "sysc/kernel/sc_simcontext.h"
00055 
00056 namespace sc_core 
00057 {
00058 
00059 // for SC_CTHREADs
00060 
00061 extern
00062 void
00063 halt( sc_simcontext* = sc_get_curr_simcontext() );
00064 
00065 
00066 extern
00067 void
00068 wait( int,
00069       sc_simcontext* = sc_get_curr_simcontext() );
00070 
00071 
00072 extern
00073 void
00074 wait_until( const sc_lambda_ptr&,
00075             sc_simcontext* = sc_get_curr_simcontext() );
00076 
00077 inline
00078 void
00079 wait_until( const sc_signal_bool_deval& s,
00080             sc_simcontext* simc = sc_get_curr_simcontext() )
00081 {
00082     wait_until( sc_lambda_ptr( s ), simc );
00083 }
00084 
00085 
00086 extern
00087 void
00088 at_posedge( const sc_signal_in_if<bool>&,
00089             sc_simcontext* = sc_get_curr_simcontext() );
00090 
00091 extern
00092 void
00093 at_posedge( const sc_signal_in_if<sc_dt::sc_logic>&,
00094             sc_simcontext* = sc_get_curr_simcontext() );
00095 
00096 extern
00097 void
00098 at_negedge( const sc_signal_in_if<bool>&,
00099             sc_simcontext* = sc_get_curr_simcontext() );
00100 
00101 extern
00102 void
00103 at_negedge( const sc_signal_in_if<sc_dt::sc_logic>&,
00104             sc_simcontext* = sc_get_curr_simcontext() );
00105 
00106 
00107 
00108 inline
00109 void
00110 watching( const sc_lambda_ptr& lambda,
00111           sc_simcontext* simc = sc_get_curr_simcontext() )
00112 {
00113     (*simc->m_watching_fn)( lambda, simc );
00114 }
00115 
00116 inline
00117 void
00118 watching( const sc_signal_bool_deval& s,
00119           sc_simcontext* simc = sc_get_curr_simcontext() )
00120 {
00121     (*simc->m_watching_fn)( sc_lambda_ptr( s ), simc );
00122 }
00123 
00124 
00125 extern
00126 void
00127 __open_watching( sc_cthread_handle );
00128 
00129 extern
00130 void
00131 __close_watching( sc_cthread_handle );
00132 
00133 extern
00134 int
00135 __watch_level( sc_cthread_handle );
00136 
00137 extern
00138 void
00139 __watching_first( sc_cthread_handle );
00140 
00141 extern
00142 void
00143 __sanitycheck_watchlists( sc_cthread_handle );
00144 
00145 
00146 class sc_watch
00147 {
00148 public:
00149 
00150     sc_cthread_handle cthread_h;
00151 
00152     sc_watch( sc_simcontext* simc )
00153     {
00154         sc_curr_proc_handle cpi = simc->get_curr_proc_info();
00155         assert( SC_CTHREAD_PROC_ == cpi->kind );
00156         cthread_h = RCAST<sc_cthread_handle>( cpi->process_handle );
00157         __open_watching( cthread_h );
00158     }
00159 
00160     ~sc_watch()
00161     {
00162         __close_watching( cthread_h );
00163     }
00164 };
00165 
00166 } // namespace sc_core
00167 
00168 #endif

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