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 #ifndef SC_WAIT_CTHREAD_H
00038 #define SC_WAIT_CTHREAD_H
00039
00040
00041 #include "systemc/kernel/sc_lambda.h"
00042 #include "systemc/kernel/sc_simcontext.h"
00043
00044
00045
00046
00047 extern
00048 void
00049 halt( sc_simcontext* = sc_get_curr_simcontext() );
00050
00051
00052 extern
00053 void
00054 wait( int,
00055 sc_simcontext* = sc_get_curr_simcontext() );
00056
00057
00058 extern
00059 void
00060 wait_until( const sc_lambda_ptr&,
00061 sc_simcontext* = sc_get_curr_simcontext() );
00062
00063 inline
00064 void
00065 wait_until( const sc_signal_bool_deval& s,
00066 sc_simcontext* simc = sc_get_curr_simcontext() )
00067 {
00068 wait_until( sc_lambda_ptr( s ), simc );
00069 }
00070
00071
00072 extern
00073 void
00074 at_posedge( const sc_signal_in_if<bool>&,
00075 sc_simcontext* = sc_get_curr_simcontext() );
00076
00077 extern
00078 void
00079 at_posedge( const sc_signal_in_if<sc_logic>&,
00080 sc_simcontext* = sc_get_curr_simcontext() );
00081
00082 extern
00083 void
00084 at_negedge( const sc_signal_in_if<bool>&,
00085 sc_simcontext* = sc_get_curr_simcontext() );
00086
00087 extern
00088 void
00089 at_negedge( const sc_signal_in_if<sc_logic>&,
00090 sc_simcontext* = sc_get_curr_simcontext() );
00091
00092
00093 inline
00094 void
00095 watching( const sc_lambda_ptr& lambda,
00096 sc_simcontext* simc = sc_get_curr_simcontext() )
00097 {
00098 (*simc->m_watching_fn)( lambda, simc );
00099 }
00100
00101 inline
00102 void
00103 watching( const sc_signal_bool_deval& s,
00104 sc_simcontext* simc = sc_get_curr_simcontext() )
00105 {
00106 (*simc->m_watching_fn)( sc_lambda_ptr( s ), simc );
00107 }
00108
00109
00110 extern
00111 void
00112 __open_watching( sc_cthread_handle );
00113
00114 extern
00115 void
00116 __close_watching( sc_cthread_handle );
00117
00118 extern
00119 int
00120 __watch_level( sc_cthread_handle );
00121
00122 extern
00123 void
00124 __watching_first( sc_cthread_handle );
00125
00126 extern
00127 void
00128 __sanitycheck_watchlists( sc_cthread_handle );
00129
00130
00131 class sc_watch
00132 {
00133 public:
00134
00135 sc_cthread_handle cthread_h;
00136
00137 sc_watch( sc_simcontext* simc )
00138 {
00139 sc_curr_proc_handle cpi = simc->get_curr_proc_info();
00140 assert( SC_CTHREAD_PROC_ == cpi->kind );
00141 cthread_h = RCAST<sc_cthread_handle>( cpi->process_handle );
00142 __open_watching( cthread_h );
00143 }
00144
00145 ~sc_watch()
00146 {
00147 __close_watching( cthread_h );
00148 }
00149 };
00150
00151
00152 #endif