00001
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
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055 #ifndef SC_PROCESS_B_H
00056 #define SC_PROCESS_B_H
00057
00058 #include "sysc/kernel/sc_event.h"
00059 #include "sysc/kernel/sc_object.h"
00060 #include "sysc/kernel/sc_process.h"
00061
00062
00063 namespace pinapa {
00064 class process_analyzer;
00065 class st_slave_analyzer;
00066 }
00067
00068
00069 namespace sc_core {
00070
00071 class sc_name_gen;
00072 class sc_report;
00073
00074
00075
00076
00077
00078
00079
00080 class sc_process_b
00081 : public sc_object
00082 {
00083 friend class sc_object;
00084 friend class sc_port_base;
00085 friend class sc_runnable;
00086 friend class sc_sensitive;
00087 friend class sc_sensitive_pos;
00088 friend class sc_sensitive_neg;
00089 friend class sc_module;
00090 friend class sc_report_handler;
00091 friend const char* sc_gen_unique_name( const char*, bool preserve_first );
00092
00093 friend bool timed_out( sc_simcontext* );
00094
00095
00096 friend class ::pinapa::process_analyzer;
00097 friend class ::pinapa::st_slave_analyzer;
00098
00099
00100 void add_child_object( sc_object* );
00101 void remove_child_object( sc_object* );
00102
00103 public:
00104
00105
00109 char * process_name;
00112 char * module_name;
00113
00114
00115 SC_ENTRY_FUNC entry_fn;
00116 sc_process_host* host;
00117 const char* file;
00118 int lineno;
00119 int proc_id;
00120
00121
00122 virtual const char* kind() const
00123 { return "sc_process_b"; }
00124
00125 virtual bool is_cthread() const;
00126
00127 static sc_process_b* get_last_created_process();
00128
00129 const ::std::vector<sc_object*>& get_child_objects() const;
00130
00131 protected:
00132
00133 sc_process_b( const char* nm,
00134 SC_ENTRY_FUNC fn,
00135 sc_process_host* host );
00136 virtual ~sc_process_b();
00137
00138 bool do_initialize() const;
00139 void do_initialize( bool );
00140
00141 void add_static_event( const sc_event& );
00142 void remove_static_events();
00143
00144 const char* gen_unique_name( const char* basename_, bool preserve_first );
00145
00146 bool trigger_static();
00147
00148 inline sc_report* get_last_report() { return m_last_report; }
00149 inline void set_last_report( sc_report* last_p )
00150 {
00151 if ( m_last_report ) delete m_last_report;
00152 m_last_report = last_p;
00153 }
00154
00155 bool is_runnable();
00156
00157 void execute();
00158
00159 bool timed_out() const;
00160
00161 protected:
00162
00163 enum trigger_t
00164 {
00165 STATIC,
00166 EVENT,
00167 OR_LIST,
00168 AND_LIST,
00169 TIMEOUT,
00170 EVENT_TIMEOUT,
00171 OR_LIST_TIMEOUT,
00172 AND_LIST_TIMEOUT
00173 };
00174
00175 sc_pvector<sc_object*> m_child_objects;
00176 bool m_do_initialize;
00177 const sc_event* m_event;
00178 int m_event_count;
00179 sc_event_list* m_event_list;
00180 sc_process_b* m_exist_p;
00181 static sc_process_b* m_last_created_p;
00182 sc_report* m_last_report;
00183 sc_name_gen* m_name_gen_p;
00184 sc_process_b* m_runnable_p;
00185 sc_pvector<const sc_event*> m_static_events;
00186 bool m_timed_out;
00187 sc_event m_timeout_event;
00188 trigger_t m_trigger_type;
00189 };
00190
00191 }
00192
00193 #endif
00194
00195