37 #ifndef SC_PHASE_CALLBACK_REGISTRY_H_INCLUDED_ 38 #define SC_PHASE_CALLBACK_REGISTRY_H_INCLUDED_ 40 #if defined( SC_ENABLE_SIMULATION_PHASE_CALLBACKS ) \ 41 || defined( SC_ENABLE_SIMULATION_PHASE_CALLBACKS_TRACING ) 42 # define SC_HAS_PHASE_CALLBACKS_ 1 44 # define SC_HAS_PHASE_CALLBACKS_ 0 83 bool construction_done()
const;
84 void elaboration_done()
const;
85 void initialization_done()
const;
86 void start_simulation()
const;
88 void evaluation_done()
const;
89 void update_done()
const;
90 void before_timestep()
const;
92 void simulation_paused()
const;
93 void simulation_stopped()
const;
94 void simulation_done()
const;
99 mask_type register_callback( cb_type&, mask_type
mask );
100 mask_type unregister_callback( cb_type&, mask_type
mask );
106 typedef std::vector<entry> storage_type;
107 typedef std::vector<cb_type*> single_storage_type;
109 #if SC_HAS_PHASE_CALLBACKS_ 115 : ref_(ref), prev_(ref) { ref_ = s;}
116 ~scoped_status() { ref_ = prev_; }
122 mask_type validate_mask( cb_type&, mask_type,
bool warn );
127 storage_type m_cb_vec;
129 single_storage_type m_cb_eval_vec;
131 single_storage_type m_cb_update_vec;
132 single_storage_type m_cb_timestep_vec;
134 #endif // SC_HAS_PHASE_CALLBACKS_ 139 this_type& operator=(
const this_type&);
148 sc_phase_callback_registry::construction_done()
const 150 #if SC_HAS_PHASE_CALLBACKS_ 157 sc_phase_callback_registry::elaboration_done()
const 159 #if SC_HAS_PHASE_CALLBACKS_ 165 sc_phase_callback_registry::start_simulation()
const 167 #if SC_HAS_PHASE_CALLBACKS_ 173 sc_phase_callback_registry::initialization_done()
const 175 #if SC_HAS_PHASE_CALLBACKS_ 176 scoped_status scope( m_simc->m_simulation_status
184 sc_phase_callback_registry::simulation_paused()
const 186 #if SC_HAS_PHASE_CALLBACKS_ 192 sc_phase_callback_registry::simulation_stopped()
const 194 #if SC_HAS_PHASE_CALLBACKS_ 200 sc_phase_callback_registry::simulation_done()
const 202 #if SC_HAS_PHASE_CALLBACKS_ 211 sc_phase_callback_registry::evaluation_done()
const 213 #if SC_HAS_PHASE_CALLBACKS_ 215 if( !m_cb_eval_vec.size() )
return;
217 typedef single_storage_type::const_iterator it_type;
218 single_storage_type
const & vec = m_cb_eval_vec;
220 scoped_status scope( m_simc->m_simulation_status
221 , SC_END_OF_EVALUATION );
223 for(it_type it = vec.begin(), end = vec.end(); it != end; ++it)
224 (*it)->do_simulation_phase_callback();
230 sc_phase_callback_registry::update_done()
const 232 #if SC_HAS_PHASE_CALLBACKS_ 234 if( !m_cb_update_vec.size() )
return;
236 typedef single_storage_type::const_iterator it_type;
237 single_storage_type
const & vec = m_cb_update_vec;
239 scoped_status scope( m_simc->m_simulation_status
242 for(it_type it = vec.begin(), end = vec.end(); it != end; ++it)
243 (*it)->do_simulation_phase_callback();
248 sc_phase_callback_registry::before_timestep()
const 250 #if SC_HAS_PHASE_CALLBACKS_ 252 if( !m_cb_timestep_vec.size() )
return;
254 typedef single_storage_type::const_iterator it_type;
255 single_storage_type
const & vec = m_cb_timestep_vec;
257 scoped_status scope( m_simc->m_simulation_status
260 for(it_type it = vec.begin(), end = vec.end(); it != end; ++it)
261 (*it)->do_simulation_phase_callback();
Abstract base class of all SystemC `simulation' objects.
Definition of the simulation phases.
For inline definitions of some utility functions.
during start_of_simulation()
when scheduler stopped by sc_stop()
after update/notify phase
sc_phase_callback_registry this_type
during before_end_of_elaboration()
during end_of_simulation()
when scheduler stopped by sc_pause()
Definition of the simulation context class.
during end_of_elaboration()
class SC_API sc_simcontext
cb_type::phase_cb_mask mask_type