src/sysc/kernel/sc_process_b.h

Go to the documentation of this file.
00001 /*****************************************************************************
00002 
00003   The following code is derived, directly or indirectly, from the SystemC
00004   source code Copyright (c) 1996-2005 by all Contributors.
00005   All Rights reserved.
00006 
00007   The contents of this file are subject to the restrictions and limitations
00008   set forth in the SystemC Open Source License Version 2.4 (the "License");
00009   You may not use this file except in compliance with such restrictions and
00010   limitations. You may obtain instructions on how to receive a copy of the
00011   License at http://www.systemc.org/. Software distributed by Contributors
00012   under the License is distributed on an "AS IS" basis, WITHOUT WARRANTY OF
00013   ANY KIND, either express or implied. See the License for the specific
00014   language governing rights and limitations under the License.
00015 
00016  *****************************************************************************/
00017 
00018 /*****************************************************************************
00019 
00020   sc_process_b.h -- Process base class.
00021 
00022   Original Author: Stan Y. Liao, Synopsys, Inc.
00023                    Martin Janssen, Synopsys, Inc.
00024 
00025  *****************************************************************************/
00026 
00027 /*****************************************************************************
00028 
00029   MODIFICATION LOG - modifiers, enter your name, affiliation, date and
00030   changes you are making here.
00031 
00032       Name, Affiliation, Date: Andy Goodrich, Forte Design Systems 20 May 2003
00033   Description of Modification: Changes for dynamic processes.
00034 
00035       Name, Affiliation, Date: Bishnupriya Bhattacharya, Cadence Design Systems,
00036                                25 August, 2003
00037   Description of Modification: - provide children sc_objects (dynamic processes)
00038                                - provide integer child count field to 
00039                                  generate unique names for un-named dynamic
00040                                  processes in a scheduler-ordering-independent
00041                                  fashion
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 //  CLASS : sc_process_b
00059 //
00060 //  Process base class.
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;        // existence link
00149     static sc_process_b*        m_last_created_p; // last created process
00150     sc_report*                  m_last_report;
00151     sc_name_gen*                m_name_gen_p;     // Subprocess name generator.
00152     sc_process_b*               m_runnable_p;     // sc_runnable link
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 } // namespace sc_core
00160 
00161 #endif
00162 
00163 // Taf!

Generated on Wed Apr 25 13:53:27 2007 for SystemC by  doxygen 1.5.1