31 #ifndef SC_PHASE_CALLBACK_REGISTRY_H_INCLUDED_
32 #define SC_PHASE_CALLBACK_REGISTRY_H_INCLUDED_
34 #if defined( SC_ENABLE_SIMULATION_PHASE_CALLBACKS ) \
35 || defined( SC_ENABLE_SIMULATION_PHASE_CALLBACKS_TRACING )
36 # define SC_HAS_PHASE_CALLBACKS_ 1
38 # define SC_HAS_PHASE_CALLBACKS_ 0
77 bool construction_done()
const;
78 void elaboration_done()
const;
79 void initialization_done()
const;
80 void start_simulation()
const;
82 void evaluation_done()
const;
83 void update_done()
const;
84 void before_timestep()
const;
86 void simulation_paused()
const;
87 void simulation_stopped()
const;
88 void simulation_done()
const;
100 typedef std::vector<entry> storage_type;
101 typedef std::vector<cb_type*> single_storage_type;
103 #if SC_HAS_PHASE_CALLBACKS_
109 : ref_(ref), prev_(ref) { ref_ = s;}
110 ~scoped_status() { ref_ = prev_; }
121 storage_type m_cb_vec;
123 single_storage_type m_cb_eval_vec;
125 single_storage_type m_cb_update_vec;
126 single_storage_type m_cb_timestep_vec;
128 #endif // SC_HAS_PHASE_CALLBACKS_
132 sc_phase_callback_registry(
const this_type& );
142 sc_phase_callback_registry::construction_done()
const
144 #if SC_HAS_PHASE_CALLBACKS_
151 sc_phase_callback_registry::elaboration_done()
const
153 #if SC_HAS_PHASE_CALLBACKS_
159 sc_phase_callback_registry::start_simulation()
const
161 #if SC_HAS_PHASE_CALLBACKS_
167 sc_phase_callback_registry::initialization_done()
const
169 #if SC_HAS_PHASE_CALLBACKS_
170 scoped_status scope( m_simc->m_simulation_status
178 sc_phase_callback_registry::simulation_paused()
const
180 #if SC_HAS_PHASE_CALLBACKS_
186 sc_phase_callback_registry::simulation_stopped()
const
188 #if SC_HAS_PHASE_CALLBACKS_
194 sc_phase_callback_registry::simulation_done()
const
196 #if SC_HAS_PHASE_CALLBACKS_
205 sc_phase_callback_registry::evaluation_done()
const
207 #if SC_HAS_PHASE_CALLBACKS_
209 if( !m_cb_eval_vec.size() )
return;
211 typedef single_storage_type::const_iterator it_type;
212 single_storage_type
const & vec = m_cb_eval_vec;
214 scoped_status scope( m_simc->m_simulation_status
215 , SC_END_OF_EVALUATION );
217 for(it_type it = vec.begin(), end = vec.end(); it != end; ++it)
218 (*it)->do_simulation_phase_callback();
224 sc_phase_callback_registry::update_done()
const
226 #if SC_HAS_PHASE_CALLBACKS_
228 if( !m_cb_update_vec.size() )
return;
230 typedef single_storage_type::const_iterator it_type;
231 single_storage_type
const & vec = m_cb_update_vec;
233 scoped_status scope( m_simc->m_simulation_status
236 for(it_type it = vec.begin(), end = vec.end(); it != end; ++it)
237 (*it)->do_simulation_phase_callback();
242 sc_phase_callback_registry::before_timestep()
const
244 #if SC_HAS_PHASE_CALLBACKS_
246 if( !m_cb_timestep_vec.size() )
return;
248 typedef single_storage_type::const_iterator it_type;
249 single_storage_type
const & vec = m_cb_timestep_vec;
251 scoped_status scope( m_simc->m_simulation_status
254 for(it_type it = vec.begin(), end = vec.end(); it != end; ++it)
255 (*it)->do_simulation_phase_callback();
cb_type::phase_cb_mask mask_type
friend class sc_simcontext
sc_phase_callback_registry this_type
Abstract base class of all SystemC `simulation' objects.