sc_simcontext_int.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-2006 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_simcontext_int.h -- For inline definitions of some utility functions.
00021                          DO NOT EXPORT THIS INCLUDE FILE. Include this file
00022                          after "sc_process_int.h" so that we can get the base
00023                          class right.
00024 
00025   Original Author: Stan Y. Liao, Synopsys, Inc.
00026 
00027  *****************************************************************************/
00028 
00029 /*****************************************************************************
00030 
00031   MODIFICATION LOG - modifiers, enter your name, affiliation, date and
00032   changes you are making here.
00033 
00034       Name, Affiliation, Date:
00035   Description of Modification:
00036 
00037  *****************************************************************************/
00038 
00039 // $Log: sc_simcontext_int.h,v $
00040 // Revision 1.1.1.1  2006/12/15 20:31:37  acg
00041 // SystemC 2.2
00042 //
00043 // Revision 1.5  2006/01/19 00:29:52  acg
00044 // Andy Goodrich: Yet another implementation for signal write checking. This
00045 // one uses an environment variable SC_SIGNAL_WRITE_CHECK, that when set to
00046 // DISABLE will disable write checking on signals.
00047 //
00048 // Revision 1.4  2006/01/18 21:42:37  acg
00049 // Andy Goodrich: Changes for check writer support.
00050 //
00051 // Revision 1.3  2006/01/13 18:44:30  acg
00052 // Added $Log to record CVS changes into the source.
00053 //
00054 
00055 #ifndef SC_SIMCONTEXT_INT_H
00056 #define SC_SIMCONTEXT_INT_H
00057 
00058 #include "sysc/kernel/sc_simcontext.h"
00059 #include "sysc/kernel/sc_runnable.h"
00060 #include "sysc/kernel/sc_runnable_int.h"
00061 
00062 namespace sc_core {
00063 
00064 // We use m_current_writer rather than m_curr_proc_info.process_handle to
00065 // return the active process for sc_signal<T>::check_write since that lets
00066 // us turn it off a library compile time, and only incur the overhead at
00067 // the time of process switches rather than having to interrogate an
00068 // additional switch every time a signal is written.
00069 
00070 inline
00071 void
00072 sc_simcontext::set_curr_proc( sc_process_b* process_h )
00073 {
00074     m_curr_proc_info.process_handle = process_h;
00075     m_curr_proc_info.kind           = process_h->proc_kind();
00076     m_current_writer = m_write_check ? process_h : (sc_object*)0;
00077 }
00078 
00079 inline
00080 void
00081 sc_simcontext::reset_curr_proc()
00082 {
00083     m_curr_proc_info.process_handle = 0;
00084     m_curr_proc_info.kind           = SC_NO_PROC_;
00085     m_current_writer                = 0;
00086     sc_process_b::m_last_created_process_p = 0; 
00087 }
00088 
00089 inline
00090 void
00091 sc_simcontext::push_runnable_method( sc_method_handle method_h )
00092 {
00093     m_runnable->push_back_method( method_h );
00094 }
00095 
00096 inline
00097 void
00098 sc_simcontext::push_runnable_method_front( sc_method_handle method_h )
00099 {
00100     m_runnable->push_front_method( method_h );
00101 }
00102 
00103 inline
00104 void
00105 sc_simcontext::push_runnable_thread( sc_thread_handle thread_h )
00106 {
00107     m_runnable->push_back_thread( thread_h );
00108 }
00109 
00110 inline
00111 void
00112 sc_simcontext::push_runnable_thread_front( sc_thread_handle thread_h )
00113 {
00114     m_runnable->push_front_thread( thread_h );
00115 }
00116 
00117 
00118 inline
00119 sc_method_handle
00120 sc_simcontext::pop_runnable_method()
00121 {
00122     sc_method_handle method_h = m_runnable->pop_method();
00123     if( method_h == 0 ) {
00124     reset_curr_proc();
00125     return 0;
00126     }
00127     set_curr_proc( (sc_process_b*)method_h );
00128     return method_h;
00129 }
00130 
00131 inline
00132 sc_thread_handle
00133 sc_simcontext::pop_runnable_thread()
00134 {
00135     sc_thread_handle thread_h = m_runnable->pop_thread();
00136     if( thread_h == 0 ) {
00137     reset_curr_proc();
00138     return 0;
00139     }
00140     set_curr_proc( (sc_process_b*)thread_h );
00141     return thread_h;
00142 }
00143 
00144 inline
00145 void
00146 sc_simcontext::remove_runnable_method( sc_method_handle method_h )
00147 {
00148     m_runnable->remove_method( method_h );
00149 }
00150 
00151 inline
00152 void
00153 sc_simcontext::remove_runnable_thread( sc_thread_handle thread_h )
00154 {
00155     m_runnable->remove_thread( thread_h );
00156 }
00157 
00158 
00159 
00160 // ----------------------------------------------------------------------------
00161 
00162 extern void sc_defunct_process_function( sc_module* );
00163 
00164 
00165 } // namespace sc_core
00166 
00167 #endif

Generated on Wed Jan 21 15:32:09 2009 for SystemC by  doxygen 1.5.5