00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050 #if !defined(sc_cthread_process_h_INCLUDED)
00051 #define sc_cthread_process_h_INCLUDED
00052
00053 #include "sysc/kernel/sc_thread_process.h"
00054
00055 namespace sc_core {
00056
00057
00058
00059 void wait( sc_simcontext* );
00060 void wait( const sc_event&,
00061 sc_simcontext* );
00062 void wait( sc_event_or_list&,
00063 sc_simcontext* );
00064 void wait( sc_event_and_list&,
00065 sc_simcontext* );
00066 void wait( const sc_time&,
00067 sc_simcontext* );
00068 void wait( const sc_time&, const sc_event&,
00069 sc_simcontext* );
00070 void wait( const sc_time&, sc_event_or_list&,
00071 sc_simcontext* );
00072 void wait( const sc_time&, sc_event_and_list&,
00073 sc_simcontext* );
00074
00075 void sc_cthread_cor_fn( void* );
00076
00077 void halt( sc_simcontext* );
00078 void wait( int,
00079 sc_simcontext* );
00080
00081
00082
00083
00084
00085 class sc_cthread_process : public sc_thread_process {
00086
00087 friend class sc_module;
00088 friend class sc_process_handle;
00089 friend class sc_process_table;
00090 friend class sc_thread_process;
00091 friend class sc_simcontext;
00092
00093 friend void wait( sc_simcontext* );
00094 friend void wait( const sc_event&,
00095 sc_simcontext* );
00096 friend void wait( sc_event_or_list&,
00097 sc_simcontext* );
00098 friend void wait( sc_event_and_list&,
00099 sc_simcontext* );
00100 friend void wait( const sc_time&,
00101 sc_simcontext* );
00102 friend void wait( const sc_time&, const sc_event&,
00103 sc_simcontext* );
00104 friend void wait( const sc_time&, sc_event_or_list&,
00105 sc_simcontext* );
00106 friend void wait( const sc_time&, sc_event_and_list&,
00107 sc_simcontext* );
00108
00109 friend void sc_cthread_cor_fn( void* );
00110
00111 friend void halt( sc_simcontext* );
00112 friend void wait( int,
00113 sc_simcontext* );
00114
00115 public:
00116 sc_cthread_process( const char* name_p, bool free_host,
00117 SC_ENTRY_FUNC method_p, sc_process_host* host_p,
00118 const sc_spawn_options* opt_p );
00119 virtual ~sc_cthread_process();
00120
00121 virtual void dont_initialize( bool dont );
00122 virtual const char* kind() const
00123 { return "sc_cthread_process"; }
00124
00125 protected:
00126 sc_cthread_handle next_exist();
00127 void set_next_exist( sc_cthread_handle next_p );
00128
00129 private:
00130
00131 sc_cthread_process( const char* nm,
00132 SC_ENTRY_FUNC fn,
00133 sc_process_host* host );
00134
00135 virtual void prepare_for_simulation();
00136
00137
00138 bool eval_watchlist();
00139 bool eval_watchlist_curr_level();
00140
00141 void wait_halt();
00142
00143 };
00144
00145
00146
00147
00148
00149 inline sc_cthread_handle sc_cthread_process::next_exist()
00150 {
00151 return (sc_cthread_handle)m_exist_p;
00152 }
00153
00154 inline void sc_cthread_process::set_next_exist(sc_cthread_handle next_p)
00155 {
00156 m_exist_p = next_p;
00157 }
00158
00159
00160
00161
00162
00163 inline void sc_cthread_process::wait_halt()
00164 {
00165 m_wait_cycle_n = 0;
00166 suspend_me();
00167 throw sc_halt();
00168 }
00169
00170 }
00171
00172 #endif // !defined(sc_cthread_process_h_INCLUDED)