クラス sc_core::sc_simcontext

#include <sc_simcontext.h>

すべてのメンバ一覧

Public メソッド

 sc_simcontext ()
 ~sc_simcontext ()
void initialize (bool=false)
void cycle (const sc_time &)
void simulate (const sc_time &duration)
void stop ()
void end ()
void reset ()
int sim_status () const
bool elaboration_done () const
sc_object_managerget_object_manager ()
void hierarchy_push (sc_module *)
sc_modulehierarchy_pop ()
sc_modulehierarchy_curr () const
sc_objectfirst_object ()
sc_objectnext_object ()
sc_objectfind_object (const char *name)
sc_module_registryget_module_registry ()
sc_port_registryget_port_registry ()
sc_export_registryget_export_registry ()
sc_prim_channel_registryget_prim_channel_registry ()
const char * gen_unique_name (const char *basename_, bool preserve_first=false)
sc_process_handle create_cthread_process (const char *name_p, bool free_host, SC_ENTRY_FUNC method_p, sc_process_host *host_p, const sc_spawn_options *opt_p)
sc_process_handle create_method_process (const char *name_p, bool free_host, SC_ENTRY_FUNC method_p, sc_process_host *host_p, const sc_spawn_options *opt_p)
sc_process_handle create_thread_process (const char *name_p, bool free_host, SC_ENTRY_FUNC method_p, sc_process_host *host_p, const sc_spawn_options *opt_p)
sc_curr_proc_handle get_curr_proc_info ()
sc_objectget_current_writer () const
bool write_check () const
void set_curr_proc (sc_process_b *)
void reset_curr_proc ()
int next_proc_id ()
void add_trace_file (sc_trace_file *)
const sc_timetime_stamp () const
sc_dt::uint64 delta_count () const
bool event_occurred (sc_dt::uint64 last_change_count) const
bool is_running () const
bool update_phase () const
bool get_error ()
void set_error ()
sc_cor_pkgcor_pkg ()
sc_cornext_cor ()
const ::std::vector< sc_object * > & get_child_objects () const
void elaborate ()
void prepare_to_simulate ()
void initial_crunch (bool no_crunch)
const sc_time next_time ()

Private 型

enum  execution_phases { phase_initialize = 0, phase_evaluate, phase_update, phase_notify }

Private メソッド

void init ()
void clean ()
void add_child_object (sc_object *)
void remove_child_object (sc_object *)
void crunch (bool once=false)
int add_delta_event (sc_event *)
void remove_delta_event (sc_event *)
void add_timed_event (sc_event_timed *)
void trace_cycle (bool delta_cycle)
const ::std::vector< sc_object * > & get_child_objects_internal () const
void push_runnable_method (sc_method_handle)
void push_runnable_thread (sc_thread_handle)
void push_runnable_method_front (sc_method_handle)
void push_runnable_thread_front (sc_thread_handle)
sc_method_handle pop_runnable_method ()
sc_thread_handle pop_runnable_thread ()
void remove_runnable_method (sc_method_handle)
void remove_runnable_thread (sc_thread_handle)
void do_sc_stop_action ()
 sc_simcontext (const sc_simcontext &)
sc_simcontextoperator= (const sc_simcontext &)

Private 変数

sc_object_managerm_object_manager
sc_module_registrym_module_registry
sc_port_registrym_port_registry
sc_export_registrym_export_registry
sc_prim_channel_registrym_prim_channel_registry
sc_name_genm_name_gen
sc_process_tablem_process_table
sc_curr_proc_info m_curr_proc_info
sc_objectm_current_writer
bool m_write_check
int m_next_proc_id
std::vector< sc_object * > m_child_objects
std::vector< sc_event * > m_delta_events
sc_ppq< sc_event_timed * > * m_timed_events
std::vector< sc_trace_file * > m_trace_files
bool m_something_to_trace
sc_runnablem_runnable
sc_time_paramsm_time_params
sc_time m_curr_time
sc_dt::uint64 m_delta_count
bool m_forced_stop
bool m_ready_to_simulate
bool m_elaboration_done
execution_phases m_execution_phase
bool m_error
bool m_in_simulator_control
bool m_end_of_simulation_called
bool m_start_of_simulation_called
sc_eventm_until_event
sc_cor_pkgm_cor_pkg
sc_corm_cor

フレンド

class sc_event
class sc_module
class sc_object
class sc_time
class sc_clock
class sc_method_process
class sc_process_b
class sc_prim_channel
class sc_thread_process
sc_dt::uint64 sc_delta_count ()
const std::vector< sc_object * > & sc_get_top_level_objects (const sc_simcontext *simc_p)
bool sc_is_running (const sc_simcontext *simc_p)
bool sc_end_of_simulation_invoked ()
bool sc_pending_activity_at_current_time ()
bool sc_start_of_simulation_invoked ()
void sc_set_time_resolution (double, sc_time_unit)
sc_time sc_get_time_resolution ()
void sc_set_default_time_unit (double, sc_time_unit)
sc_time sc_get_default_time_unit ()


説明

sc_simcontext.h175 行で定義されています。


列挙型

列挙型の値:
phase_initialize 
phase_evaluate 
phase_update 
phase_notify 

sc_simcontext.h311 行で定義されています。

00311                           {
00312             phase_initialize = 0,
00313             phase_evaluate,
00314             phase_update,
00315             phase_notify
00316         };


コンストラクタとデストラクタ

sc_core::sc_simcontext::sc_simcontext (  ) 

sc_simcontext.cpp488 行で定義されています。

00489 {
00490     init();
00491 }

sc_core::sc_simcontext::~sc_simcontext (  ) 

sc_simcontext.cpp493 行で定義されています。

00494 {
00495     clean();
00496 }

sc_core::sc_simcontext::sc_simcontext ( const sc_simcontext  )  [private]


関数

void sc_core::sc_simcontext::init (  )  [private]

sc_simcontext.cpp415 行で定義されています。

00416 {
00417 
00418     // ALLOCATE VARIOUS MANAGERS AND REGISTRIES:
00419 
00420     m_object_manager = new sc_object_manager;
00421     m_module_registry = new sc_module_registry( *this );
00422     m_port_registry = new sc_port_registry( *this );
00423     m_export_registry = new sc_export_registry( *this );
00424     m_prim_channel_registry = new sc_prim_channel_registry( *this );
00425     m_name_gen = new sc_name_gen;
00426     m_process_table = new sc_process_table;
00427     m_current_writer = 0;
00428 
00429 
00430     // CHECK FOR ENVIRONMENT VARIABLES THAT MODIFY SIMULATOR EXECUTION:
00431 
00432     const char* write_check = std::getenv("SC_SIGNAL_WRITE_CHECK");
00433     m_write_check = ( (write_check==0) || strcmp(write_check,"DISABLE") ) ?
00434       true : false;
00435 
00436 
00437     // FINISH INITIALIZATIONS:
00438 
00439     reset_curr_proc();
00440     m_next_proc_id = -1;
00441     m_timed_events = new sc_ppq<sc_event_timed*>( 128, sc_notify_time_compare );
00442     m_something_to_trace = false;
00443     m_runnable = new sc_runnable;
00444     m_time_params = new sc_time_params;
00445     m_curr_time = SC_ZERO_TIME;
00446     m_delta_count = 0;
00447     m_forced_stop = false;
00448     m_ready_to_simulate = false;
00449     m_elaboration_done = false;
00450     m_execution_phase = phase_initialize;
00451     m_error = false;
00452     m_until_event = 0;
00453     m_cor_pkg = 0;
00454     m_cor = 0;
00455     m_in_simulator_control = false;
00456     m_start_of_simulation_called = false;
00457     m_end_of_simulation_called = false;
00458 }

void sc_core::sc_simcontext::clean (  )  [private]

sc_simcontext.cpp461 行で定義されています。

00462 {
00463     delete m_object_manager;
00464     delete m_module_registry;
00465     delete m_port_registry;
00466     delete m_export_registry;
00467     delete m_prim_channel_registry;
00468     delete m_name_gen;
00469     delete m_process_table;
00470     m_child_objects.resize(0);
00471     m_delta_events.resize(0);
00472     delete m_timed_events;
00473     for( int i = m_trace_files.size() - 1; i >= 0; -- i ) {
00474         delete m_trace_files[i];
00475     }
00476     m_trace_files.resize(0);
00477     delete m_runnable;
00478     delete m_time_params;
00479     if( m_until_event != 0 ) {
00480         delete m_until_event;
00481     }
00482     if( m_cor_pkg != 0 ) {
00483         delete m_cor_pkg;
00484     }
00485 }

void sc_core::sc_simcontext::initialize ( bool  no_crunch = false  ) 

sc_simcontext.cpp798 行で定義されています。

00799 {
00800     m_in_simulator_control = true;
00801     elaborate();
00802     prepare_to_simulate();
00803     initial_crunch(no_crunch);
00804     m_in_simulator_control = false;
00805 }

void sc_core::sc_simcontext::cycle ( const sc_time t  )  [inline]

sc_simcontext.cpp616 行で定義されています。

00617 {
00618     sc_time next_event_time;
00619 
00620     m_in_simulator_control = true;
00621     m_runnable->toggle();
00622     crunch(); 
00623     trace_cycle( /* delta cycle? */ false );
00624     m_curr_time += t;
00625     next_event_time = next_time();
00626     if ( next_event_time != SC_ZERO_TIME && next_event_time <= m_curr_time) {
00627         SC_REPORT_WARNING(SC_ID_CYCLE_MISSES_EVENTS_, "");
00628     }
00629     m_in_simulator_control = false;
00630 }

void sc_core::sc_simcontext::simulate ( const sc_time duration  ) 

sc_simcontext.cpp808 行で定義されています。

00809 {
00810     initialize( true );
00811 
00812     if (sim_status() != SC_SIM_OK) {
00813         return;
00814     }
00815 
00816     sc_time non_overflow_time = 
00817         sc_time(~sc_dt::UINT64_ZERO, false) - m_curr_time;
00818     if ( duration > non_overflow_time )
00819     {
00820         SC_REPORT_ERROR(SC_ID_SIMULATION_TIME_OVERFLOW_, "");
00821         return;
00822     }
00823     else if ( duration < SC_ZERO_TIME )
00824     {
00825         SC_REPORT_ERROR(SC_ID_NEGATIVE_SIMULATION_TIME_,"");
00826     }
00827     m_in_simulator_control = true;
00828 
00829     sc_time until_t = m_curr_time + duration;
00830 
00831     m_until_event->cancel();  // to be on the safe side
00832     m_until_event->notify_internal( duration );
00833 
00834     sc_time t;
00835 
00836     // IF DURATION WAS ZERO WE ONLY CRUNCH:
00837     //
00838     // We duplicate the code so that we don't add the overhead of the
00839     // check to each loop in the do below.
00840     if ( duration == SC_ZERO_TIME ) 
00841     {
00842         m_runnable->toggle();
00843         crunch( true );
00844         if( m_error ) return;
00845         if( m_something_to_trace ) trace_cycle( /* delta cycle? */ false );
00846         if( m_forced_stop ) 
00847             do_sc_stop_action(); 
00848         return;
00849     }
00850 
00851 
00852     // NON-ZERO DURATION: EXECUTE UP TO THAT TIME:
00853     do {
00854         m_runnable->toggle();
00855 
00856         crunch();
00857         if( m_error ) {
00858             m_in_simulator_control = false;
00859             return;
00860         }
00861         if( m_something_to_trace ) {
00862             trace_cycle( false );
00863         }
00864         // check for call(s) to sc_stop
00865         if( m_forced_stop ) {
00866             do_sc_stop_action();
00867             return;
00868         }
00869         
00870         do {
00871             t = next_time();
00872 
00873             // PROCESS TIMED NOTIFICATIONS
00874 
00875             do {
00876                 sc_event_timed* et = m_timed_events->extract_top();
00877                 sc_event* e = et->event();
00878                 delete et;
00879                 if( e != 0 ) {
00880                     e->trigger();
00881                 }
00882             } while( m_timed_events->size() &&
00883                      m_timed_events->top()->notify_time() == t );
00884 
00885         } while( m_runnable->is_empty() && t != until_t );
00886         if ( t > m_curr_time ) m_curr_time = t;
00887 
00888     } while( t != until_t );
00889     m_in_simulator_control = false;
00890 }

void sc_core::sc_simcontext::stop (  ) 

sc_simcontext.cpp920 行で定義されています。

00921 {
00922     static bool stop_warning_issued = false;
00923     if (m_forced_stop)
00924     {
00925         if ( !stop_warning_issued )
00926         {
00927             stop_warning_issued = true; // This must be before the WARNING!!!
00928             SC_REPORT_WARNING(SC_ID_SIMULATION_STOP_CALLED_TWICE_, "");
00929         }
00930         return;
00931     }
00932     if ( stop_mode == SC_STOP_IMMEDIATE ) m_runnable->init();
00933     m_forced_stop = true;
00934     if ( !m_in_simulator_control  )
00935     {
00936         do_sc_stop_action();
00937     } 
00938 }

void sc_core::sc_simcontext::end (  ) 

sc_simcontext.cpp948 行で定義されています。

00949 {
00950     m_ready_to_simulate = false;
00951     m_port_registry->simulation_done();
00952     m_export_registry->simulation_done();
00953     m_prim_channel_registry->simulation_done();
00954     m_module_registry->simulation_done();
00955     m_end_of_simulation_called = true;
00956 }

void sc_core::sc_simcontext::reset (  ) 

sc_simcontext.cpp941 行で定義されています。

00942 {
00943     clean();
00944     init();
00945 }

int sc_core::sc_simcontext::sim_status (  )  const [inline]

sc_simcontext.h402 行で定義されています。

00403 {
00404     if( m_error ) {
00405         return SC_SIM_ERROR;
00406     }
00407     if( m_forced_stop ) {
00408         return SC_SIM_USER_STOP;
00409     }
00410     return SC_SIM_OK;
00411 }

bool sc_core::sc_simcontext::elaboration_done (  )  const [inline]

sc_simcontext.h394 行で定義されています。

00395 {
00396     return m_elaboration_done;
00397 }

sc_object_manager * sc_core::sc_simcontext::get_object_manager (  )  [inline]

sc_simcontext.h416 行で定義されています。

00417 {
00418     return m_object_manager;
00419 }

void sc_core::sc_simcontext::hierarchy_push ( sc_module mod  ) 

sc_simcontext.cpp959 行で定義されています。

00960 {
00961     m_object_manager->hierarchy_push( mod );
00962 }

sc_module * sc_core::sc_simcontext::hierarchy_pop (  ) 

sc_simcontext.cpp965 行で定義されています。

00966 {
00967         return DCAST<sc_module*>( m_object_manager->hierarchy_pop() );
00968 }

sc_module * sc_core::sc_simcontext::hierarchy_curr (  )  const

sc_simcontext.cpp971 行で定義されています。

00972 {
00973     return DCAST<sc_module*>( m_object_manager->hierarchy_curr() );
00974 }

sc_object * sc_core::sc_simcontext::first_object (  ) 

sc_simcontext.cpp977 行で定義されています。

00978 {
00979     return m_object_manager->first_object();
00980 }

sc_object * sc_core::sc_simcontext::next_object (  ) 

sc_simcontext.cpp983 行で定義されています。

00984 {
00985     return m_object_manager->next_object();
00986 }

sc_object * sc_core::sc_simcontext::find_object ( const char *  name  ) 

sc_simcontext.cpp989 行で定義されています。

00990 {
00991     static bool warn_find_object=true;
00992     if ( warn_find_object )
00993     {
00994         warn_find_object = false;
00995         SC_REPORT_INFO(SC_ID_IEEE_1666_DEPRECATION_,
00996             "sc_simcontext::find_object() is deprecated,\n" \
00997             " use sc_find_object()" );
00998     }
00999     return m_object_manager->find_object( name );
01000 }

sc_module_registry * sc_core::sc_simcontext::get_module_registry (  )  [inline]

sc_simcontext.h423 行で定義されています。

00424 {
00425     return m_module_registry;
00426 }

sc_port_registry * sc_core::sc_simcontext::get_port_registry (  )  [inline]

sc_simcontext.h430 行で定義されています。

00431 {
00432     return m_port_registry;
00433 }

sc_export_registry * sc_core::sc_simcontext::get_export_registry (  )  [inline]

sc_simcontext.h437 行で定義されています。

00438 {
00439     return m_export_registry;
00440 }

sc_prim_channel_registry * sc_core::sc_simcontext::get_prim_channel_registry (  )  [inline]

sc_simcontext.h444 行で定義されています。

00445 {
00446     return m_prim_channel_registry;
00447 }

const char * sc_core::sc_simcontext::gen_unique_name ( const char *  basename_,
bool  preserve_first = false 
)

sc_simcontext.cpp1005 行で定義されています。

01006 {
01007     return m_name_gen->gen_unique_name( basename_, preserve_first );
01008 }

sc_process_handle sc_core::sc_simcontext::create_cthread_process ( const char *  name_p,
bool  free_host,
SC_ENTRY_FUNC  method_p,
sc_process_host host_p,
const sc_spawn_options opt_p 
)

sc_simcontext.cpp1012 行で定義されています。

01015 {
01016     sc_cthread_handle handle = 
01017         new sc_cthread_process(name_p, free_host, method_p, host_p, opt_p);
01018     if ( m_ready_to_simulate ) 
01019     {
01020         handle->prepare_for_simulation();
01021     } else {
01022         m_process_table->push_front( handle );
01023     }
01024     return sc_process_handle(handle);
01025 }

sc_process_handle sc_core::sc_simcontext::create_method_process ( const char *  name_p,
bool  free_host,
SC_ENTRY_FUNC  method_p,
sc_process_host host_p,
const sc_spawn_options opt_p 
)

sc_simcontext.cpp1029 行で定義されています。

01032 {
01033     sc_method_handle handle = 
01034         new sc_method_process(name_p, free_host, method_p, host_p, opt_p);
01035     if ( m_ready_to_simulate ) {
01036         if ( !handle->dont_initialize() ) {
01037             push_runnable_method( handle );
01038         }
01039     } else {
01040         m_process_table->push_front( handle );
01041     }
01042     return sc_process_handle(handle);
01043 }

sc_process_handle sc_core::sc_simcontext::create_thread_process ( const char *  name_p,
bool  free_host,
SC_ENTRY_FUNC  method_p,
sc_process_host host_p,
const sc_spawn_options opt_p 
)

sc_simcontext.cpp1047 行で定義されています。

01050 {
01051     sc_thread_handle handle = 
01052         new sc_thread_process(name_p, free_host, method_p, host_p, opt_p);
01053     if ( m_ready_to_simulate ) {
01054         handle->prepare_for_simulation();
01055         if ( !handle->dont_initialize() ) {
01056             push_runnable_thread( handle );
01057         }
01058     } else {
01059         m_process_table->push_front( handle );
01060     }
01061     return sc_process_handle(handle);
01062 }

sc_curr_proc_handle sc_core::sc_simcontext::get_curr_proc_info (  )  [inline]

sc_simcontext.h452 行で定義されています。

00453 {
00454     return &m_curr_proc_info;
00455 }

sc_object * sc_core::sc_simcontext::get_current_writer (  )  const [inline]

sc_simcontext.h519 行で定義されています。

00520 {
00521     return m_current_writer;
00522 }

bool sc_core::sc_simcontext::write_check (  )  const [inline]

sc_simcontext.h525 行で定義されています。

00526 {
00527     return m_write_check;
00528 }

void sc_core::sc_simcontext::set_curr_proc ( sc_process_b process_h  )  [inline]

sc_simcontext_int.h72 行で定義されています。

00073 {
00074     m_curr_proc_info.process_handle = process_h;
00075     m_curr_proc_info.kind           = process_h->proc_kind();
00076         m_current_writer = m_write_check ? process_h : (sc_object*)0;
00077 }

void sc_core::sc_simcontext::reset_curr_proc (  )  [inline]

sc_simcontext_int.h81 行で定義されています。

00082 {
00083     m_curr_proc_info.process_handle = 0;
00084     m_curr_proc_info.kind           = SC_NO_PROC_;
00085     m_current_writer                = 0;
00086     sc_process_b::m_last_created_process_p = 0; 
00087 }

int sc_core::sc_simcontext::next_proc_id (  )  [inline]

sc_simcontext.h460 行で定義されています。

00461 {
00462     return ( ++ m_next_proc_id );
00463 }

void sc_core::sc_simcontext::add_trace_file ( sc_trace_file tf  ) 

sc_simcontext.cpp1065 行で定義されています。

01066 {
01067     m_trace_files.push_back( tf );
01068     m_something_to_trace = true;
01069 }

const sc_time & sc_core::sc_simcontext::time_stamp (  )  const [inline]

sc_simcontext.h468 行で定義されています。

00469 {
00470     return m_curr_time;
00471 }

sc_dt::uint64 sc_core::sc_simcontext::delta_count (  )  const

sc_simcontext.cpp1129 行で定義されています。

01130 {
01131     static bool warn_delta_count=true;
01132     if ( warn_delta_count )
01133     {
01134         warn_delta_count = false;
01135         SC_REPORT_INFO(SC_ID_IEEE_1666_DEPRECATION_,
01136             "sc_simcontext::delta_count() is deprecated, use sc_delta_count()" );
01137     }
01138     return m_delta_count;
01139 }

bool sc_core::sc_simcontext::event_occurred ( sc_dt::uint64  last_change_count  )  const [inline]

sc_simcontext.h476 行で定義されています。

00477 {
00478         return m_delta_count == last_change_count;
00479 }

bool sc_core::sc_simcontext::is_running (  )  const

sc_simcontext.cpp1142 行で定義されています。

01143 {
01144     static bool warn_is_running=true;
01145     if ( warn_is_running )
01146     {
01147         warn_is_running = false;
01148         SC_REPORT_INFO(SC_ID_IEEE_1666_DEPRECATION_,
01149             "sc_simcontext::is_running() is deprecated, use sc_is_running()" );
01150     }
01151     return m_ready_to_simulate;
01152 }

bool sc_core::sc_simcontext::update_phase (  )  const [inline]

sc_simcontext.h483 行で定義されています。

00484 {
00485     return m_execution_phase == phase_update;
00486 }

bool sc_core::sc_simcontext::get_error (  )  [inline]

sc_simcontext.h498 行で定義されています。

00499 {
00500     return m_error;
00501 }

void sc_core::sc_simcontext::set_error (  )  [inline]

sc_simcontext.h490 行で定義されています。

00491 {
00492     m_error = true;
00493 }

sc_cor_pkg* sc_core::sc_simcontext::cor_pkg (  )  [inline]

sc_simcontext.h269 行で定義されています。

00270         { return m_cor_pkg; }

sc_cor * sc_core::sc_simcontext::next_cor (  ) 

sc_simcontext.cpp1073 行で定義されています。

01074 {
01075     if( m_error ) {
01076         return m_cor;
01077     }
01078     
01079     sc_thread_handle thread_h = pop_runnable_thread();
01080     while( thread_h != 0 ) {
01081         if ( thread_h->ready_to_run() ) break;
01082         thread_h = pop_runnable_thread();
01083     }
01084     
01085     if( thread_h != 0 ) {
01086         return thread_h->m_cor_p;
01087     } else {
01088         return m_cor;
01089     }
01090 }

const ::std::vector< sc_object * > & sc_core::sc_simcontext::get_child_objects (  )  const

sc_simcontext.cpp1094 行で定義されています。

01095 {
01096     static bool warn_get_child_objects=true;
01097     if ( warn_get_child_objects )
01098     {
01099         warn_get_child_objects = false;
01100         SC_REPORT_INFO(SC_ID_IEEE_1666_DEPRECATION_,
01101             "sc_simcontext::get_child_objects() is deprecated,\n" \
01102             " use sc_get_top_level_objects()" );
01103     }
01104     return m_child_objects;
01105 }

void sc_core::sc_simcontext::elaborate (  ) 

sc_simcontext.cpp633 行で定義されています。

00634 {
00635     if( m_elaboration_done || sim_status() != SC_SIM_OK ) {
00636         return;
00637     }
00638 
00639     m_port_registry->construction_done();
00640     m_export_registry->construction_done();
00641     m_prim_channel_registry->construction_done();
00642     m_module_registry->construction_done();
00643 
00644     // check for call(s) to sc_stop
00645     if( m_forced_stop ) {
00646         do_sc_stop_action();
00647         return;
00648     }
00649 
00650     // SIGNAL THAT ELABORATION IS DONE
00651     //
00652     // We set the switch before the calls in case someone creates a process 
00653     // in an end_of_elaboration callback. We need the information to flag 
00654     // the process as being dynamic.
00655 
00656     m_elaboration_done = true;
00657 
00658     m_port_registry->elaboration_done();
00659     m_export_registry->elaboration_done();
00660     m_prim_channel_registry->elaboration_done();
00661     m_module_registry->elaboration_done();
00662     sc_reset::reconcile_resets();
00663 
00664     // check for call(s) to sc_stop
00665     if( m_forced_stop ) {
00666         do_sc_stop_action();
00667         return;
00668     }
00669 }

void sc_core::sc_simcontext::prepare_to_simulate (  ) 

sc_simcontext.cpp672 行で定義されています。

00673 {
00674     sc_cthread_handle cthread_p; // Pointer to cthread process accessing.
00675     sc_method_handle  method_p;  // Pointer to method process accessing.
00676     sc_thread_handle  thread_p;  // Pointer to thread process accessing.
00677 
00678     if( m_ready_to_simulate || sim_status() != SC_SIM_OK ) {
00679         return;
00680     }
00681 
00682     // instantiate the coroutine package
00683 #   if defined(WIN32)
00684         m_cor_pkg = new sc_cor_pkg_fiber( this );
00685 #   else
00686 #       if defined(SC_USE_PTHREADS)
00687             m_cor_pkg = new sc_cor_pkg_pthread( this );
00688 #       else
00689                         m_cor_pkg = new sc_cor_pkg_qt( this );
00690 #       endif
00691 #   endif
00692     m_cor = m_cor_pkg->get_main();
00693 
00694     // NOTIFY ALL OBJECTS THAT SIMULATION IS ABOUT TO START:
00695 
00696     m_port_registry->start_simulation();
00697     m_export_registry->start_simulation();
00698     m_prim_channel_registry->start_simulation();
00699     m_module_registry->start_simulation();
00700     m_start_of_simulation_called = true;
00701 
00702     // CHECK FOR CALL(S) TO sc_stop 
00703 
00704     if( m_forced_stop ) {
00705         do_sc_stop_action();
00706         return;
00707     }
00708 
00709     // PREPARE ALL (C)THREAD PROCESSES FOR SIMULATION:
00710 
00711     for ( thread_p = m_process_table->thread_q_head(); 
00712           thread_p; thread_p = thread_p->next_exist() )
00713     {
00714         thread_p->prepare_for_simulation();
00715     }
00716 
00717     for ( cthread_p = m_process_table->cthread_q_head(); 
00718           cthread_p; cthread_p = cthread_p->next_exist() )
00719     {
00720         cthread_p->prepare_for_simulation();
00721     }
00722 
00723     m_ready_to_simulate = true;
00724     m_runnable->init();
00725 
00726     // update phase
00727 
00728     m_execution_phase = phase_update;
00729     m_prim_channel_registry->perform_update();
00730     m_execution_phase = phase_notify;
00731 
00732     int size;
00733 
00734     // make all method processes runnable
00735 
00736     for ( method_p = m_process_table->method_q_head(); 
00737           method_p; method_p = method_p->next_exist() )
00738     {
00739         if( !method_p->dont_initialize() ) {
00740             push_runnable_method_front( method_p );
00741         }
00742     }
00743 
00744     // make all thread processes runnable
00745 
00746     for ( thread_p = m_process_table->thread_q_head(); 
00747           thread_p; thread_p = thread_p->next_exist() )
00748     {
00749         if( !thread_p->dont_initialize() ) {
00750             push_runnable_thread_front( thread_p );
00751         }
00752     }
00753 
00754 
00755     // process delta notifications
00756 
00757     if( ( size = m_delta_events.size() ) != 0 ) {
00758         sc_event** l_delta_events = &m_delta_events[0];
00759         int i = size - 1;
00760         do {
00761             l_delta_events[i]->trigger();
00762         } while( -- i >= 0 );
00763         m_delta_events.resize(0);
00764     }
00765 
00766     // used in 'simulate()'
00767     m_until_event = new sc_event;
00768 
00769     if( m_runnable->is_empty() ) {
00770         m_delta_count++;
00771     }
00772 }

void sc_core::sc_simcontext::initial_crunch ( bool  no_crunch  )  [inline]

sc_simcontext.cpp775 行で定義されています。

00776 {
00777     if( no_crunch || m_runnable->is_empty() ) {
00778         return;
00779     }
00780     m_runnable->toggle();
00781 
00782     // run the delta cycle loop
00783 
00784     crunch();
00785     if( m_error ) {
00786         return;
00787     }
00788     if( m_something_to_trace ) {
00789         trace_cycle( false );
00790     }
00791     // check for call(s) to sc_stop
00792     if( m_forced_stop ) {
00793         do_sc_stop_action();
00794     }
00795 }

const sc_time sc_core::sc_simcontext::next_time (  ) 

sc_simcontext.cpp1155 行で定義されています。

01156 {
01157     while( m_timed_events->size() ) {
01158         sc_event_timed* et = m_timed_events->top();
01159         if( et->event() != 0 ) {
01160             return et->notify_time();
01161         }
01162         delete m_timed_events->extract_top();
01163     }
01164     return SC_ZERO_TIME;
01165 }

void sc_core::sc_simcontext::add_child_object ( sc_object object_  )  [private]

sc_simcontext.cpp1108 行で定義されています。

01109 {
01110     // no check if object_ is already in the set
01111     m_child_objects.push_back( object_ );
01112 }

void sc_core::sc_simcontext::remove_child_object ( sc_object object_  )  [private]

sc_simcontext.cpp1115 行で定義されています。

01116 {
01117     int size = m_child_objects.size();
01118     for( int i = 0; i < size; ++ i ) {
01119         if( object_ == m_child_objects[i] ) {
01120             m_child_objects[i] = m_child_objects[size - 1];
01121             m_child_objects.resize(size-1);
01122             return;
01123         }
01124     }
01125     // no check if object_ is really in the set
01126 }

void sc_core::sc_simcontext::crunch ( bool  once = false  )  [inline, private]

sc_simcontext.cpp499 行で定義されています。

00500 {
00501 #ifdef DEBUG_SYSTEMC
00502     int num_deltas = 0;  // number of delta cycles
00503 #endif
00504 
00505     while ( true ) {
00506 
00507         // EVALUATE PHASE
00508         
00509         m_execution_phase = phase_evaluate;
00510         while( true ) {
00511 
00512 
00513             // execute method processes
00514 
00515             sc_method_handle method_h = pop_runnable_method();
00516             while( method_h != 0 ) {
00517                 try {
00518                     method_h->semantics();
00519                 }
00520                 catch( const sc_report& ex ) {
00521                     ::std::cout << "\n" << ex.what() << ::std::endl;
00522                     m_error = true;
00523                     return;
00524                 }
00525                 method_h = pop_runnable_method();
00526             }
00527 
00528             // execute (c)thread processes
00529 
00530             sc_thread_handle thread_h = pop_runnable_thread();
00531             while( thread_h != 0 ) {
00532                 if ( thread_h->ready_to_run() ) break;
00533                 thread_h = pop_runnable_thread();
00534             }
00535             if( thread_h != 0 ) {
00536                 m_cor_pkg->yield( thread_h->m_cor_p );
00537             }
00538             if( m_error ) {
00539                 return;
00540             }
00541 
00542             // check for call(s) to sc_stop
00543             if( m_forced_stop ) {
00544                 if ( stop_mode == SC_STOP_IMMEDIATE ) return;
00545             }
00546 
00547             if( m_runnable->is_empty() ) {
00548                 // no more runnable processes
00549                 break;
00550             }
00551             m_runnable->toggle();
00552         }
00553 
00554         // UPDATE PHASE
00555         //
00556         // The delta count must be updated first so that event_occurred()
00557         // will work.
00558 
00559         m_execution_phase = phase_update;
00560         m_delta_count ++;
00561         m_prim_channel_registry->perform_update();
00562         m_execution_phase = phase_notify;
00563         
00564         if( m_something_to_trace ) {
00565             trace_cycle( /* delta cycle? */ true );
00566         }
00567 
00568         // m_delta_count ++;
00569 
00570         // check for call(s) to sc_stop
00571         if( m_forced_stop ) {
00572             break;
00573         }
00574 
00575 #ifdef DEBUG_SYSTEMC
00576         // check for possible infinite loops
00577         if( ++ num_deltas > SC_MAX_NUM_DELTA_CYCLES ) {
00578             ::std::cerr << "SystemC warning: "
00579                  << "the number of delta cycles exceeds the limit of "
00580                  << SC_MAX_NUM_DELTA_CYCLES
00581                  << ", defined in sc_constants.h.\n"
00582                  << "This is a possible sign of an infinite loop.\n"
00583                  << "Increase the limit if this warning is invalid.\n";
00584             break;
00585         }
00586 #endif
00587 
00588         // PROCESS DELTA NOTIFICATIONS:
00589 
00590         int size = m_delta_events.size();
00591         if ( size != 0 )
00592         {
00593             sc_event** l_events = &m_delta_events[0];
00594             int i = size - 1;
00595             do {
00596                 l_events[i]->trigger();
00597             } while( -- i >= 0 );
00598             m_delta_events.resize(0);
00599         }
00600         
00601         if( m_runnable->is_empty() ) {
00602             // no more runnable processes
00603             break;
00604         }
00605 
00606         // IF ONLY DOING ONE CYCLE, WE ARE DONE. OTHERWISE GET NEW CALLBACKS
00607 
00608         if ( once ) break;
00609 
00610         m_runnable->toggle();
00611     } 
00612 }

int sc_core::sc_simcontext::add_delta_event ( sc_event e  )  [inline, private]

sc_simcontext.h505 行で定義されています。

00506 {
00507     m_delta_events.push_back( e );
00508     return ( m_delta_events.size() - 1 );
00509 }

void sc_core::sc_simcontext::remove_delta_event ( sc_event e  )  [private]

sc_simcontext.cpp1169 行で定義されています。

01170 {
01171     int i = e->m_delta_event_index;
01172     int j = m_delta_events.size() - 1;
01173     assert( i >= 0 && i <= j );
01174     if( i != j ) {
01175         sc_event** l_delta_events = &m_delta_events[0];
01176         l_delta_events[i] = l_delta_events[j];
01177         l_delta_events[i]->m_delta_event_index = i;
01178     }
01179     m_delta_events.resize(m_delta_events.size()-1);
01180     e->m_delta_event_index = -1;
01181 }

void sc_core::sc_simcontext::add_timed_event ( sc_event_timed et  )  [inline, private]

sc_simcontext.h513 行で定義されています。

00514 {
00515     m_timed_events->insert( et );
00516 }

void sc_core::sc_simcontext::trace_cycle ( bool  delta_cycle  )  [private]

sc_simcontext.cpp1185 行で定義されています。

01186 {
01187     int size;
01188     if( ( size = m_trace_files.size() ) != 0 ) {
01189         sc_trace_file** l_trace_files = &m_trace_files[0];
01190         int i = size - 1;
01191         do {
01192             l_trace_files[i]->cycle( delta_cycle );
01193         } while( -- i >= 0 );
01194     }
01195 }

const ::std::vector<sc_object*>& sc_core::sc_simcontext::get_child_objects_internal (  )  const [private]

void sc_core::sc_simcontext::push_runnable_method ( sc_method_handle  method_h  )  [inline, private]

sc_simcontext_int.h91 行で定義されています。

00092 {
00093         m_runnable->push_back_method( method_h );
00094 }

void sc_core::sc_simcontext::push_runnable_thread ( sc_thread_handle  thread_h  )  [inline, private]

sc_simcontext_int.h105 行で定義されています。

00106 {
00107     m_runnable->push_back_thread( thread_h );
00108 }

void sc_core::sc_simcontext::push_runnable_method_front ( sc_method_handle  method_h  )  [inline, private]

sc_simcontext_int.h98 行で定義されています。

00099 {
00100     m_runnable->push_front_method( method_h );
00101 }

void sc_core::sc_simcontext::push_runnable_thread_front ( sc_thread_handle  thread_h  )  [inline, private]

sc_simcontext_int.h112 行で定義されています。

00113 {
00114     m_runnable->push_front_thread( thread_h );
00115 }

sc_method_handle sc_core::sc_simcontext::pop_runnable_method (  )  [inline, private]

sc_simcontext_int.h120 行で定義されています。

00121 {
00122     sc_method_handle method_h = m_runnable->pop_method();
00123     if( method_h == 0 ) {
00124         reset_curr_proc();
00125         return 0;
00126     }
00127     set_curr_proc( (sc_process_b*)method_h );
00128     return method_h;
00129 }

sc_thread_handle sc_core::sc_simcontext::pop_runnable_thread (  )  [inline, private]

sc_simcontext_int.h133 行で定義されています。

00134 {
00135     sc_thread_handle thread_h = m_runnable->pop_thread();
00136     if( thread_h == 0 ) {
00137         reset_curr_proc();
00138         return 0;
00139     }
00140     set_curr_proc( (sc_process_b*)thread_h );
00141     return thread_h;
00142 }

void sc_core::sc_simcontext::remove_runnable_method ( sc_method_handle  method_h  )  [inline, private]

sc_simcontext_int.h146 行で定義されています。

00147 {
00148     m_runnable->remove_method( method_h );
00149 }

void sc_core::sc_simcontext::remove_runnable_thread ( sc_thread_handle  thread_h  )  [inline, private]

sc_simcontext_int.h153 行で定義されています。

00154 {
00155     m_runnable->remove_thread( thread_h );
00156 }

void sc_core::sc_simcontext::do_sc_stop_action (  )  [private]

sc_simcontext.cpp893 行で定義されています。

00894 {
00895     ::std::cout << "SystemC: simulation stopped by user." << ::std::endl;
00896     if (m_start_of_simulation_called) {
00897         end();
00898         m_in_simulator_control = false;
00899     }
00900 }

sc_simcontext& sc_core::sc_simcontext::operator= ( const sc_simcontext  )  [private]


フレンドと関連する関数

friend class sc_event [friend]

sc_simcontext.h177 行で定義されています。

friend class sc_module [friend]

sc_simcontext.h178 行で定義されています。

friend class sc_object [friend]

sc_simcontext.h179 行で定義されています。

friend class sc_time [friend]

sc_simcontext.h180 行で定義されています。

friend class sc_clock [friend]

sc_simcontext.h181 行で定義されています。

friend class sc_method_process [friend]

sc_simcontext.h182 行で定義されています。

friend class sc_process_b [friend]

sc_simcontext.h183 行で定義されています。

friend class sc_prim_channel [friend]

sc_simcontext.h184 行で定義されています。

friend class sc_thread_process [friend]

sc_simcontext.h185 行で定義されています。

sc_dt::uint64 sc_delta_count (  )  [friend]

const std::vector<sc_object*>& sc_get_top_level_objects ( const sc_simcontext simc_p = sc_get_curr_simcontext()  )  [friend]

bool sc_is_running ( const sc_simcontext simc_p = sc_get_curr_simcontext()  )  [friend]

bool sc_end_of_simulation_invoked (  )  [friend]

bool sc_pending_activity_at_current_time (  )  [friend]

sc_simcontext.cpp1285 行で定義されています。

01286 {
01287     sc_simcontext* c_p = sc_get_curr_simcontext();
01288     return (c_p->m_delta_events.size() != 0) ||
01289             !c_p->m_runnable->is_empty() ||
01290             c_p->m_prim_channel_registry->pending_updates();
01291 }

bool sc_start_of_simulation_invoked (  )  [friend]

void sc_set_time_resolution ( double  ,
sc_time_unit   
) [friend]

sc_time sc_get_time_resolution (  )  [friend]

void sc_set_default_time_unit ( double  ,
sc_time_unit   
) [friend]

sc_time sc_get_default_time_unit (  )  [friend]


変数

sc_simcontext.h317 行で定義されています。

sc_simcontext.h319 行で定義されています。

sc_simcontext.h320 行で定義されています。

sc_simcontext.h321 行で定義されています。

sc_simcontext.h322 行で定義されています。

sc_simcontext.h324 行で定義されています。

sc_simcontext.h326 行で定義されています。

sc_simcontext.h327 行で定義されています。

sc_simcontext.h328 行で定義されています。

sc_simcontext.h329 行で定義されています。

sc_simcontext.h330 行で定義されています。

sc_simcontext.h332 行で定義されています。

sc_simcontext.h334 行で定義されています。

sc_simcontext.h335 行で定義されています。

sc_simcontext.h337 行で定義されています。

sc_simcontext.h338 行で定義されています。

sc_simcontext.h340 行で定義されています。

sc_simcontext.h342 行で定義されています。

sc_simcontext.h343 行で定義されています。

sc_simcontext.h345 行で定義されています。

sc_simcontext.h346 行で定義されています。

sc_simcontext.h347 行で定義されています。

sc_simcontext.h348 行で定義されています。

sc_simcontext.h349 行で定義されています。

sc_simcontext.h350 行で定義されています。

sc_simcontext.h351 行で定義されています。

sc_simcontext.h352 行で定義されています。

sc_simcontext.h353 行で定義されています。

sc_simcontext.h356 行で定義されています。

sc_simcontext.h358 行で定義されています。

sc_simcontext.h359 行で定義されています。


このクラスの説明は次のファイルから生成されました:

SystemCに対してFri Jun 6 20:12:03 2008に生成されました。  doxygen 1.5.6