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-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_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 #ifndef SC_SIMCONTEXT_INT_H
00040 #define SC_SIMCONTEXT_INT_H
00041 
00042 #include "sysc/kernel/sc_simcontext.h"
00043 #include "sysc/kernel/sc_runnable.h"
00044 #include "sysc/kernel/sc_runnable_int.h"
00045 
00046 namespace sc_core {
00047 
00048 inline
00049 void
00050 sc_simcontext::set_curr_proc( sc_method_handle method_h )
00051 {
00052     m_curr_proc_info.process_handle = method_h;
00053     m_curr_proc_info.kind           = SC_METHOD_PROC_;
00054 }
00055 
00056 inline void
00057 sc_simcontext::set_curr_proc( sc_thread_handle thread_h )
00058 {
00059     m_curr_proc_info.process_handle = thread_h;
00060     if( thread_h->is_cthread() ) {
00061         m_curr_proc_info.kind = SC_CTHREAD_PROC_;
00062     } else {
00063         m_curr_proc_info.kind = SC_THREAD_PROC_;
00064     }
00065 }
00066 
00067 inline
00068 void
00069 sc_simcontext::reset_curr_proc()
00070 {
00071     m_curr_proc_info.process_handle = 0;
00072     m_curr_proc_info.kind           = SC_NO_PROC_;
00073 }
00074 
00075 
00076 inline
00077 void
00078 sc_simcontext::push_runnable_method( sc_method_handle method_h )
00079 {
00080         m_runnable->push_back_method( method_h );
00081 }
00082 
00083 inline
00084 void
00085 sc_simcontext::push_runnable_method_front( sc_method_handle method_h )
00086 {
00087         m_runnable->push_front_method( method_h );
00088 }
00089 
00090 inline
00091 void
00092 sc_simcontext::push_runnable_thread( sc_thread_handle thread_h )
00093 {
00094         m_runnable->push_back_thread( thread_h );
00095 }
00096 
00097 inline
00098 void
00099 sc_simcontext::push_runnable_thread_front( sc_thread_handle thread_h )
00100 {
00101         m_runnable->push_front_thread( thread_h );
00102 }
00103 
00104 
00105 inline
00106 sc_method_handle
00107 sc_simcontext::pop_runnable_method()
00108 {
00109     sc_method_handle method_h = m_runnable->pop_method();
00110     if( method_h == 0 ) {
00111         reset_curr_proc();
00112         return 0;
00113     }
00114     set_curr_proc( method_h );
00115     return method_h;
00116 }
00117 
00118 inline
00119 sc_thread_handle
00120 sc_simcontext::pop_runnable_thread()
00121 {
00122     sc_thread_handle thread_h = m_runnable->pop_thread();
00123     if( thread_h == 0 ) {
00124         reset_curr_proc();
00125         return 0;
00126     }
00127     set_curr_proc( thread_h );
00128     return thread_h;
00129 }
00130 
00131 inline
00132 void
00133 sc_simcontext::remove_runnable_method( sc_method_handle method_h )
00134 {
00135     m_runnable->remove_method( method_h );
00136 }
00137 
00138 inline
00139 void
00140 sc_simcontext::remove_runnable_thread( sc_thread_handle thread_h )
00141 {
00142     m_runnable->remove_thread( thread_h );
00143 }
00144 
00145 
00146 
00147 // ----------------------------------------------------------------------------
00148 
00149 extern void sc_defunct_process_function( sc_module* );
00150 
00151 extern void watching_before_simulation( const sc_lambda_ptr&,
00152                                         sc_simcontext* );
00153 extern void watching_during_simulation( const sc_lambda_ptr&,
00154                                         sc_simcontext* );
00155 
00156 } // namespace sc_core
00157 
00158 #endif
Generated by
Matthieu Moy <Matthieu.Moy@st.com>
Back to Pinapa Home Page