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 #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
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 }
00167
00168 #endif