00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045 #ifndef SC_PROCESS_B_H
00046 #define SC_PROCESS_B_H
00047
00048 #include "sysc/kernel/sc_event.h"
00049 #include "sysc/kernel/sc_object.h"
00050 #include "sysc/kernel/sc_process.h"
00051
00052 namespace sc_core {
00053
00054 class sc_name_gen;
00055 class sc_report;
00056
00057
00058
00059
00060
00061
00062
00063 class sc_process_b
00064 : public sc_object
00065 {
00066 friend class sc_object;
00067 friend class sc_port_base;
00068 friend class sc_runnable;
00069 friend class sc_sensitive;
00070 friend class sc_sensitive_pos;
00071 friend class sc_sensitive_neg;
00072 friend class sc_module;
00073 friend class sc_report_handler;
00074 friend const char* sc_gen_unique_name( const char*, bool preserve_first );
00075
00076 friend bool timed_out( sc_simcontext* );
00077
00078 void add_child_object( sc_object* );
00079 void remove_child_object( sc_object* );
00080
00081 public:
00082
00083 SC_ENTRY_FUNC entry_fn;
00084 sc_process_host* host;
00085 const char* file;
00086 int lineno;
00087 int proc_id;
00088
00089
00090 virtual const char* kind() const
00091 { return "sc_process_b"; }
00092
00093 virtual bool is_cthread() const;
00094
00095 static sc_process_b* get_last_created_process();
00096
00097 const ::std::vector<sc_object*>& get_child_objects() const;
00098
00099 protected:
00100
00101 sc_process_b( const char* nm,
00102 SC_ENTRY_FUNC fn,
00103 sc_process_host* host );
00104 virtual ~sc_process_b();
00105
00106 bool do_initialize() const;
00107 void do_initialize( bool );
00108
00109 void add_static_event( const sc_event& );
00110 void remove_static_events();
00111
00112 const char* gen_unique_name( const char* basename_, bool preserve_first );
00113
00114 bool trigger_static();
00115
00116 inline sc_report* get_last_report() { return m_last_report; }
00117 inline void set_last_report( sc_report* last_p )
00118 {
00119 if ( m_last_report ) delete m_last_report;
00120 m_last_report = last_p;
00121 }
00122
00123 bool is_runnable();
00124
00125 void execute();
00126
00127 bool timed_out() const;
00128
00129 protected:
00130
00131 enum trigger_t
00132 {
00133 STATIC,
00134 EVENT,
00135 OR_LIST,
00136 AND_LIST,
00137 TIMEOUT,
00138 EVENT_TIMEOUT,
00139 OR_LIST_TIMEOUT,
00140 AND_LIST_TIMEOUT
00141 };
00142
00143 sc_pvector<sc_object*> m_child_objects;
00144 bool m_do_initialize;
00145 const sc_event* m_event;
00146 int m_event_count;
00147 sc_event_list* m_event_list;
00148 sc_process_b* m_exist_p;
00149 static sc_process_b* m_last_created_p;
00150 sc_report* m_last_report;
00151 sc_name_gen* m_name_gen_p;
00152 sc_process_b* m_runnable_p;
00153 sc_pvector<const sc_event*> m_static_events;
00154 bool m_timed_out;
00155 sc_event m_timeout_event;
00156 trigger_t m_trigger_type;
00157 };
00158
00159 }
00160
00161 #endif
00162
00163