29 #if !defined(sc_thread_process_h_INCLUDED)
30 #define sc_thread_process_h_INCLUDED
47 # define DEBUG_NAME ""
48 # define DEBUG_MSG(NAME,P,MSG) \
50 if ( P && ( (strlen(NAME)==0) || !strcmp(NAME,P->name())) ) \
51 std::cout << "**** " << sc_time_stamp() << " (" \
52 << sc_get_current_process_name() << "): " << MSG \
53 << " - " << P->name() << std::endl; \
56 # define DEBUG_MSG(NAME,P,MSG)
60 #ifndef _SYSC_PRINT_VERBOSE_MESSAGE_ENV_VAR
61 #define _SYSC_PRINT_VERBOSE_MESSAGE_ENV_VAR "SYSC_PRINT_VERBOSE_MESSAGE"
66 class sc_event_and_list;
67 class sc_event_or_list;
74 class sc_process_handle;
75 class sc_process_table;
83 void wait(
int , sc_simcontext* );
84 void wait(
const sc_event&,
int , sc_simcontext* );
85 void wait(
const sc_event_or_list&,
int , sc_simcontext* );
86 void wait(
const sc_event_and_list&,
int , sc_simcontext* );
87 void wait(
const sc_time&,
int , sc_simcontext* );
88 void wait(
const sc_time&,
const sc_event&,
int , sc_simcontext* );
89 void wait(
const sc_time&,
const sc_event_or_list&,
int , sc_simcontext* );
90 void wait(
const sc_time&,
const sc_event_and_list&,
int , sc_simcontext* );
136 virtual const char*
kind()
const
137 {
return "sc_thread_process"; }
253 template <
typename T,
typename U>
254 std::size_t operator()(
const std::pair<T, U> &x)
const
256 return std::hash<T>()(x.first) ^ std::hash<U>()(x.second);
261 std::unordered_set<int> dependency_checked_segs;
263 std::unordered_map<int,std::vector<sc_method_process*> > m_contingent_methods;
266 std::unordered_map<int,std::unordered_set<sc_thread_process*> > m_contingent_threads;
268 std::unordered_map<int,std::unordered_set<sc_method_process*> > dependent_methods;
269 std::unordered_map<int,std::unordered_set<sc_thread_process*> > dependent_threads;
273 std::unordered_map<int, std::unordered_set<sc_method_process*> > combined_data_conflict_methods;
274 std::unordered_map<int, std::unordered_set<sc_thread_process*> > combined_data_conflict_threads;
321 simc_p->new_waiting_proc.push_back(
this);
342 if(cur_kernel_requests == 1) {
358 DEBUG_MSG( DEBUG_NAME ,
this,
"suspending thread");
360 DEBUG_MSG( DEBUG_NAME ,
this,
"resuming thread");
378 DEBUG_MSG( DEBUG_NAME ,
this,
"throwing reset for");
383 DEBUG_MSG( DEBUG_NAME,
this,
"invoking throw_it for");
391 DEBUG_MSG( DEBUG_NAME,
this,
"throwing kill for");
396 DEBUG_MSG( DEBUG_NAME,
this,
"restarting thread");
553 e.add_dynamic(
this );
746 e.add_dynamic(
this );
896 for (
int mon_i = 0; mon_i < mon_n; mon_i++ )
969 #if ! defined( SC_ENABLE_IMMEDIATE_SELF_NOTIFICATIONS )
975 #endif // SC_ENABLE_IMMEDIATE_SELF_NOTIFICATIONS
998 switch( e->m_notify_type )
1000 case sc_event::DELTA:
1010 case sc_event::TIMED:
1013 case sc_event::NONE:
1020 simcontext()->update_oldest_time( curr_time );
1158 #endif // !defined(sc_thread_process_h_INCLUDED)
friend void sc_thread_cor_fn(void *)
void report_immediate_self_notification() const
sc_throw_it_helper * m_throw_helper_p
sc_event * m_reset_event_p
sc_process_b * sc_get_current_process_b()
bool deliver_event_at_time(sc_event *e, sc_timestamp e_delivery_time)
virtual void resume_process(sc_descendant_inclusion_info descendants=SC_NO_DESCENDANTS)
void add_monitor(sc_process_monitor *monitor_p)
friend void wait(int, sc_simcontext *)
virtual void throw_reset(bool async)
void notify()
The immediate notification is not supported by the out-of-order simulation in the current release...
void set_next_runnable(sc_thread_handle next_p)
A scoped mutex for the kernel lock.
process_throw_type m_throw_status
#define SC_REPORT_ERROR(msg_type, msg)
sc_process_b sc_process_b
A time stamp combining timed cycles and delta cycles.
const sc_time & get_time_count() const
Get the value of timed cycles.
void oooschedule(sc_cor *cor)
Scheduling function in the OoO simulation.
virtual void prepare_for_simulation()
sc_descendant_inclusion_info
This class provides access to an sc_process_b object instance in a manner which allows some persisten...
void(sc_process_host::* SC_ENTRY_FUNC)()
sc_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)
void signal_monitors(int type=0)
sc_event * m_timeout_event_p
void wait(int, sc_simcontext *)
sc_cor * get_cor_pointer(sc_process_b *process_p)
friend class sc_process_table
Coroutine abstract base class.
const char * name() const
sc_simcontext * simcontext() const
const sc_event * m_event_p
void sc_thread_cor_fn(void *arg)
void add_dynamic(sc_method_handle) const
User initiated dynamic process support.
virtual void suspend_process(sc_descendant_inclusion_info descendants=SC_NO_DESCENDANTS)
void trigger_static(sc_event *)
A new parameter is added to update the local time stamp in the thread process.
virtual ~sc_thread_process()
void set_stack_size(std::size_t size)
void set_next_exist(sc_thread_handle next_p)
Class that manages the ready-to-run queues.
sc_thread_handle next_exist()
sc_timestamp first_triggerable_time
void lock_all_channels(void)
Acquire all the channel locks.
class sc_thread_process * sc_thread_handle
const sc_timestamp & get_notify_timestamp() const
GET the notification time stamp.
void wait_cycles(int, int n=1)
A new parameter segment ID is added for the out-of-order simulation.
void remove_running_process(sc_process_b *)
Remove a process from the running queue.
virtual void disable_process(sc_descendant_inclusion_info descendants=SC_NO_DESCENDANTS)
#define DEBUG_MSG(NAME, P, MSG)
friend class sc_unwind_exception
Base class for all structural entities.
void unlock_all_channels(void)
Release all the channel locks.
bool is_running_process(sc_process_b *)
Check whether a process is in the running queue.
sc_timestamp m_timestamp
The local time stamp of this process.
friend void sc_set_stack_size(sc_thread_handle, std::size_t)
virtual void throw_user(const sc_throw_it_helper &helper, sc_descendant_inclusion_info descendants=SC_NO_DESCENDANTS)
Base class for all hierarchical channels.
virtual void throw_it()=0
sc_thread_handle next_runnable()
virtual void kill_process(sc_descendant_inclusion_info descendants=SC_NO_DESCENDANTS)
sc_simcontext * sc_get_curr_simcontext()
void set_timestamp(const sc_timestamp &ts)
Get the local time stamp of this process.
void sc_set_stack_size(sc_method_handle, std::size_t)
void update_dependency_set()
friend sc_cor * get_cor_pointer(sc_process_b *process_p)
const sc_time SC_ZERO_TIME
This is the base class for objects which may have processes defined for their methods (e...
void remove_monitor(sc_process_monitor *monitor_p)
bool trigger_dynamic(sc_event *, bool &)
sc_process_b * m_runnable_p
std::vector< sc_process_monitor * > m_monitor_q
virtual const char * kind() const
value_type get_delta_count() const
Get the value of delta cycles.
virtual void enable_process(sc_descendant_inclusion_info descendants=SC_NO_DESCENDANTS)
void suspend_cor(sc_cor *)
Suspend a coroutine.
void set_segment_id(int id)
Get the current segment ID of this process.
int m_process_state
The name of this process.
const sc_event_list * m_event_list_p