sc_process_b.h

Go to the documentation of this file.
00001 
00011 /*****************************************************************************
00012 
00013   The following code is derived, directly or indirectly, from the SystemC
00014   source code Copyright (c) 1996-2005 by all Contributors.
00015   All Rights reserved.
00016 
00017   The contents of this file are subject to the restrictions and limitations
00018   set forth in the SystemC Open Source License Version 2.4 (the "License");
00019   You may not use this file except in compliance with such restrictions and
00020   limitations. You may obtain instructions on how to receive a copy of the
00021   License at http://www.systemc.org/. Software distributed by Contributors
00022   under the License is distributed on an "AS IS" basis, WITHOUT WARRANTY OF
00023   ANY KIND, either express or implied. See the License for the specific
00024   language governing rights and limitations under the License.
00025 
00026  *****************************************************************************/
00027 
00028 /*****************************************************************************
00029 
00030   sc_process_b.h -- Process base class.
00031 
00032   Original Author: Stan Y. Liao, Synopsys, Inc.
00033                    Martin Janssen, Synopsys, Inc.
00034 
00035  *****************************************************************************/
00036 
00037 /*****************************************************************************
00038 
00039   MODIFICATION LOG - modifiers, enter your name, affiliation, date and
00040   changes you are making here.
00041 
00042       Name, Affiliation, Date: Andy Goodrich, Forte Design Systems 20 May 2003
00043   Description of Modification: Changes for dynamic processes.
00044 
00045       Name, Affiliation, Date: Bishnupriya Bhattacharya, Cadence Design Systems,
00046                                25 August, 2003
00047   Description of Modification: - provide children sc_objects (dynamic processes)
00048                                - provide integer child count field to 
00049                                  generate unique names for un-named dynamic
00050                                  processes in a scheduler-ordering-independent
00051                                  fashion
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 //  ##PINAPA Integration: BEGIN
00063 namespace pinapa {
00064     class process_analyzer;
00065     class st_slave_analyzer;
00066 }
00067 //  ##PINAPA Integration: END
00068 
00069 namespace sc_core {
00070 
00071 class sc_name_gen;
00072 class sc_report;
00073 
00074 // ----------------------------------------------------------------------------
00075 //  CLASS : sc_process_b
00076 //
00077 //  Process base class.
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     //  ##PINAPA Integration: BEGIN
00096     friend class ::pinapa::process_analyzer;
00097     friend class ::pinapa::st_slave_analyzer;
00098     //  ##PINAPA Integration: END
00099 
00100     void add_child_object( sc_object* );
00101     void remove_child_object( sc_object* );
00102 
00103 public:
00104 
00105     //  ##PINAPA Integration: BEGIN
00109     char *        process_name;
00112     char *        module_name;
00113     //  ##PINAPA Integration: END
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;        // existence link
00181     static sc_process_b*        m_last_created_p; // last created process
00182     sc_report*                  m_last_report;
00183     sc_name_gen*                m_name_gen_p;     // Subprocess name generator.
00184     sc_process_b*               m_runnable_p;     // sc_runnable link
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 } // namespace sc_core
00192 
00193 #endif
00194 
00195 // Taf!
Generated by
Matthieu Moy <Matthieu.Moy@st.com>
Back to Pinapa Home Page