📄 sc_process.h
字号:
{ STATIC, EVENT, OR_LIST, AND_LIST, TIMEOUT, EVENT_TIMEOUT, OR_LIST_TIMEOUT, AND_LIST_TIMEOUT }; public: sc_process_b( const char* name_p, bool free_host, SC_ENTRY_FUNC method_p, sc_process_host* host_p, const sc_spawn_options* opt_p ); virtual ~sc_process_b(); public: bool dont_initialize() const { return m_dont_init; } virtual void dont_initialize( bool dont ); const ::std::vector<sc_object*>& get_child_objects() const; inline sc_curr_proc_kind proc_kind() const; sc_event& terminated_event(); public: static inline sc_process_handle last_created_process_handle(); protected: void add_static_event( const sc_event& ); bool dynamic() const { return m_dynamic_proc; } const char* gen_unique_name( const char* basename_, bool preserve_first ); inline sc_report* get_last_report() { return m_last_report_p; } inline bool is_runnable(); static inline sc_process_b* last_created_process_base(); inline void set_last_report( sc_report* last_p ) { if ( m_last_report_p ) delete m_last_report_p; m_last_report_p = last_p; } void remove_static_events(); bool trigger_static(); inline bool timed_out() const; private: // structure support: void add_child_object( sc_object* ); void remove_child_object( sc_object* ); protected: // process control methods: virtual void kill_process(); inline void reset_changed(); virtual bool terminated() const; private: inline void reference_decrement(); inline void reference_increment(); protected: inline void semantics(); // debugging stuff: public: const char* file; int lineno; int proc_id; protected: std::vector<sc_object*> m_child_objects; // Child processes. bool m_dont_init; // True: no initialize call. bool m_dynamic_proc; // True: after elaboration. const sc_event* m_event_p; // Dynamic event waiting on. int m_event_count; // Number of events. sc_event_list* m_event_list_p; // Event list waiting on. sc_process_b* m_exist_p; // Process existence link. bool m_free_host; // Free sc_semantic_host_p. sc_report* m_last_report_p; // Last report this process. sc_name_gen* m_name_gen_p; // Subprocess name generator. sc_curr_proc_kind m_process_kind; // Type of process. int m_references_n; // Outstanding handles. bool m_reset_level; // Level for reset. sc_reset* m_reset_p; // Reset object. sc_process_b* m_runnable_p; // sc_runnable link sc_process_host* m_semantics_host_p; // Host for semantics. SC_ENTRY_FUNC m_semantics_method_p; // Method for semantics. std::vector<const sc_event*> m_static_events; // Static events waiting on. sc_event* m_term_event_p; // Terminated event. process_throw_type m_throw_type; // Throw type. bool m_timed_out; // True if we timed out. sc_event* m_timeout_event_p; // Timeout event. trigger_t m_trigger_type; // Type of trigger using. bool m_zombie; // True if terminated. protected: static sc_process_b* m_delete_next_p; // Next process to delete. static sc_process_b* m_last_created_process_p; // Last process created.};typedef sc_process_b sc_process_b; // For compatibility.//------------------------------------------------------------------------------//"sc_process_b::XXXX_child_YYYYY"//// These methods provide child object support.//------------------------------------------------------------------------------inline voidsc_process_b::add_child_object( sc_object* object_ ){ // no check if object_ is already in the set m_child_objects.push_back( object_ );}inline voidsc_process_b::remove_child_object( sc_object* object_ ){ int size = m_child_objects.size(); for( int i = 0; i < size; ++ i ) { if( object_ == m_child_objects[i] ) { m_child_objects[i] = m_child_objects[size - 1]; m_child_objects.resize(size-1); return; } } // no check if object_ is really in the set}inline const ::std::vector<sc_object*>&sc_process_b::get_child_objects() const{ return m_child_objects;}//------------------------------------------------------------------------------//"sc_process_b::is_runnable"//// This method returns true if this process is runnable. That is indicated// by a non-zero m_runnable_p field.//------------------------------------------------------------------------------inline bool sc_process_b::is_runnable(){ return m_runnable_p != 0;}//------------------------------------------------------------------------------//"sc_process_b::last_created_process_base"//// This virtual method returns the sc_process_b pointer for the last// created process. It is only used internally by the simulator.//------------------------------------------------------------------------------inline sc_process_b* sc_process_b::last_created_process_base(){ return m_last_created_process_p;}//------------------------------------------------------------------------------//"sc_process_b::proc_kind"//// This method returns the kind of this process.//------------------------------------------------------------------------------inline sc_curr_proc_kind sc_process_b::proc_kind() const{ return m_process_kind;}//------------------------------------------------------------------------------//"sc_process_b::reference_decrement"//// This inline method decrements the number of outstanding references to this// object instance. If the number of references goes to zero, this object// instance is placed on the deletion queue, after deleting any process that// is already there. The reason for the two step deletion process is that the// process from which reference_decrement() is called is likely to be the// running process, so we have to wait until it goes idle.//------------------------------------------------------------------------------inline void sc_process_b::reference_decrement(){ m_references_n--; if ( m_references_n == 0 ) { if ( m_delete_next_p ) delete m_delete_next_p; assert(m_delete_next_p != this); m_delete_next_p = this; }}//------------------------------------------------------------------------------//"sc_process_b::reference_increment"//// This inline method increments the number of outstanding references to this// object instance.//------------------------------------------------------------------------------inline void sc_process_b::reference_increment(){ assert(m_references_n != 0); m_references_n++;}//------------------------------------------------------------------------------//"sc_process_b::reset_changed"//// This method is called when there is a change in the value of the// signal specified via reset_signal_is. If reset_signal_is was not// called this method won't be either.//------------------------------------------------------------------------------inline void sc_process_b::reset_changed(){ m_throw_type = ( m_reset_p->read() == m_reset_level ) ? THROW_RESET : THROW_NONE;}//------------------------------------------------------------------------------//"sc_process_b::semantics"//// This inline method invokes the semantics for this object instance.// We check to see if we are initially in reset and then invoke the// process semantics.//------------------------------------------------------------------------------inline void sc_process_b::semantics(){ assert( m_process_kind != SC_NO_PROC_ ); m_throw_type = ( m_reset_p && m_reset_p->read() == m_reset_level ) ? THROW_RESET : THROW_NONE;# ifndef SC_USE_MEMBER_FUNC_PTR m_semantics_method_p->invoke( m_semantics_host_p );# else (m_semantics_host_p->*m_semantics_method_p)();# endif}//------------------------------------------------------------------------------//"sc_process_b::terminated"//// This inline method returns true if this object has terminated.//------------------------------------------------------------------------------inline bool sc_process_b::terminated() const{ return m_zombie;}//------------------------------------------------------------------------------//"sc_process_b::timed_out"//// This inline method returns true if this object instance timed out.//------------------------------------------------------------------------------inline bool sc_process_b::timed_out() const{ return m_timed_out;}//------------------------------------------------------------------------------//"sc_process_b::trigger_static"//// This inline method returns true if this object instance is waiting on// a static trigger and is not runnable. If there trigger is not static// then the process is waiting on a dynamically specified event, so the// static trigger should be ignored until that dynamic event occurs.//------------------------------------------------------------------------------inlineboolsc_process_b::trigger_static(){ return ( !is_runnable() && m_trigger_type == STATIC );}} // namespace sc_core#endif // !defined(sc_process_h_INCLUDED)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -