112027Sjungma@eit.uni-kl.de/***************************************************************************** 212027Sjungma@eit.uni-kl.de 312027Sjungma@eit.uni-kl.de Licensed to Accellera Systems Initiative Inc. (Accellera) under one or 412027Sjungma@eit.uni-kl.de more contributor license agreements. See the NOTICE file distributed 512027Sjungma@eit.uni-kl.de with this work for additional information regarding copyright ownership. 612027Sjungma@eit.uni-kl.de Accellera licenses this file to you under the Apache License, Version 2.0 712027Sjungma@eit.uni-kl.de (the "License"); you may not use this file except in compliance with the 812027Sjungma@eit.uni-kl.de License. You may obtain a copy of the License at 912027Sjungma@eit.uni-kl.de 1012027Sjungma@eit.uni-kl.de http://www.apache.org/licenses/LICENSE-2.0 1112027Sjungma@eit.uni-kl.de 1212027Sjungma@eit.uni-kl.de Unless required by applicable law or agreed to in writing, software 1312027Sjungma@eit.uni-kl.de distributed under the License is distributed on an "AS IS" BASIS, 1412027Sjungma@eit.uni-kl.de WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 1512027Sjungma@eit.uni-kl.de implied. See the License for the specific language governing 1612027Sjungma@eit.uni-kl.de permissions and limitations under the License. 1712027Sjungma@eit.uni-kl.de 1812027Sjungma@eit.uni-kl.de *****************************************************************************/ 1912027Sjungma@eit.uni-kl.de 2012027Sjungma@eit.uni-kl.de/***************************************************************************** 2112027Sjungma@eit.uni-kl.de 2212027Sjungma@eit.uni-kl.de sc_object.h -- Abstract base class of all SystemC `simulation' objects. 2312027Sjungma@eit.uni-kl.de 2412027Sjungma@eit.uni-kl.de Original Author: Stan Y. Liao, Synopsys, Inc. 2512027Sjungma@eit.uni-kl.de 2612027Sjungma@eit.uni-kl.de CHANGE LOG AT THE END OF THE FILE 2712027Sjungma@eit.uni-kl.de *****************************************************************************/ 2812027Sjungma@eit.uni-kl.de 2912027Sjungma@eit.uni-kl.de 3012027Sjungma@eit.uni-kl.de#ifndef SC_OBJECT_H 3112027Sjungma@eit.uni-kl.de#define SC_OBJECT_H 3212027Sjungma@eit.uni-kl.de 3312027Sjungma@eit.uni-kl.de 3412027Sjungma@eit.uni-kl.de#include "sysc/utils/sc_iostream.h" 3512027Sjungma@eit.uni-kl.de#include "sysc/kernel/sc_attribute.h" 3612027Sjungma@eit.uni-kl.de 3712027Sjungma@eit.uni-kl.denamespace sc_core { 3812027Sjungma@eit.uni-kl.de 3912027Sjungma@eit.uni-kl.declass sc_event; 4012027Sjungma@eit.uni-kl.declass sc_module; 4112027Sjungma@eit.uni-kl.declass sc_phase_callback_registry; 4212027Sjungma@eit.uni-kl.declass sc_runnable; 4312027Sjungma@eit.uni-kl.declass sc_simcontext; 4412027Sjungma@eit.uni-kl.declass sc_trace_file; 4512027Sjungma@eit.uni-kl.declass sc_trace_file_base; 4612027Sjungma@eit.uni-kl.de 4712027Sjungma@eit.uni-kl.de// ---------------------------------------------------------------------------- 4812027Sjungma@eit.uni-kl.de// CLASS : sc_object 4912027Sjungma@eit.uni-kl.de// 5012027Sjungma@eit.uni-kl.de// Abstract base class of all SystemC `simulation' objects. 5112027Sjungma@eit.uni-kl.de// ---------------------------------------------------------------------------- 5212027Sjungma@eit.uni-kl.de 5312027Sjungma@eit.uni-kl.declass sc_object 5412027Sjungma@eit.uni-kl.de{ 5512027Sjungma@eit.uni-kl.de friend class sc_event; 5612027Sjungma@eit.uni-kl.de friend class sc_module; 5712027Sjungma@eit.uni-kl.de friend struct sc_invoke_method; 5812027Sjungma@eit.uni-kl.de friend class sc_module_dynalloc_list; 5912027Sjungma@eit.uni-kl.de friend class sc_object_manager; 6012027Sjungma@eit.uni-kl.de friend class sc_phase_callback_registry; 6112027Sjungma@eit.uni-kl.de friend class sc_process_b; 6212027Sjungma@eit.uni-kl.de friend class sc_runnable; 6312027Sjungma@eit.uni-kl.de friend class sc_simcontext; 6412027Sjungma@eit.uni-kl.de friend class sc_trace_file_base; 6512027Sjungma@eit.uni-kl.de 6612027Sjungma@eit.uni-kl.depublic: 6712027Sjungma@eit.uni-kl.de typedef unsigned phase_cb_mask; 6812027Sjungma@eit.uni-kl.de 6912027Sjungma@eit.uni-kl.de const char* name() const 7012027Sjungma@eit.uni-kl.de { return m_name.c_str(); } 7112027Sjungma@eit.uni-kl.de 7212027Sjungma@eit.uni-kl.de const char* basename() const; 7312027Sjungma@eit.uni-kl.de 7412027Sjungma@eit.uni-kl.de virtual void print(::std::ostream& os=::std::cout ) const; 7512027Sjungma@eit.uni-kl.de 7612027Sjungma@eit.uni-kl.de // dump() is more detailed than print() 7712027Sjungma@eit.uni-kl.de virtual void dump(::std::ostream& os=::std::cout ) const; 7812027Sjungma@eit.uni-kl.de 7912027Sjungma@eit.uni-kl.de virtual void trace( sc_trace_file* tf ) const; 8012027Sjungma@eit.uni-kl.de 8112027Sjungma@eit.uni-kl.de virtual const char* kind() const { return "sc_object"; } 8212027Sjungma@eit.uni-kl.de 8312027Sjungma@eit.uni-kl.de sc_simcontext* simcontext() const 8412027Sjungma@eit.uni-kl.de { return m_simc; } 8512027Sjungma@eit.uni-kl.de 8612027Sjungma@eit.uni-kl.de // add attribute 8712027Sjungma@eit.uni-kl.de bool add_attribute( sc_attr_base& ); 8812027Sjungma@eit.uni-kl.de 8912027Sjungma@eit.uni-kl.de // get attribute by name 9012027Sjungma@eit.uni-kl.de sc_attr_base* get_attribute( const std::string& name_ ); 9112027Sjungma@eit.uni-kl.de const sc_attr_base* get_attribute( const std::string& name_ ) const; 9212027Sjungma@eit.uni-kl.de 9312027Sjungma@eit.uni-kl.de // remove attribute by name 9412027Sjungma@eit.uni-kl.de sc_attr_base* remove_attribute( const std::string& name_ ); 9512027Sjungma@eit.uni-kl.de 9612027Sjungma@eit.uni-kl.de // remove all attributes 9712027Sjungma@eit.uni-kl.de void remove_all_attributes(); 9812027Sjungma@eit.uni-kl.de 9912027Sjungma@eit.uni-kl.de // get the number of attributes 10012027Sjungma@eit.uni-kl.de int num_attributes() const; 10112027Sjungma@eit.uni-kl.de 10212027Sjungma@eit.uni-kl.de // get the attribute collection 10312027Sjungma@eit.uni-kl.de sc_attr_cltn& attr_cltn(); 10412027Sjungma@eit.uni-kl.de const sc_attr_cltn& attr_cltn() const; 10512027Sjungma@eit.uni-kl.de 10612027Sjungma@eit.uni-kl.de virtual const std::vector<sc_event*>& get_child_events() const 10712027Sjungma@eit.uni-kl.de { return m_child_events; } 10812027Sjungma@eit.uni-kl.de 10912027Sjungma@eit.uni-kl.de virtual const std::vector<sc_object*>& get_child_objects() const 11012027Sjungma@eit.uni-kl.de { return m_child_objects; } 11112027Sjungma@eit.uni-kl.de 11212027Sjungma@eit.uni-kl.de sc_object* get_parent() const; 11312027Sjungma@eit.uni-kl.de sc_object* get_parent_object() const { return m_parent; } 11412027Sjungma@eit.uni-kl.de 11512027Sjungma@eit.uni-kl.deprotected: 11612027Sjungma@eit.uni-kl.de 11712027Sjungma@eit.uni-kl.de sc_object(); 11812027Sjungma@eit.uni-kl.de sc_object(const char* nm); 11912027Sjungma@eit.uni-kl.de 12012027Sjungma@eit.uni-kl.de sc_object( const sc_object& ); 12112027Sjungma@eit.uni-kl.de sc_object& operator=( const sc_object& ); 12212027Sjungma@eit.uni-kl.de 12312027Sjungma@eit.uni-kl.de 12412027Sjungma@eit.uni-kl.de virtual ~sc_object(); 12512027Sjungma@eit.uni-kl.de 12612027Sjungma@eit.uni-kl.de virtual void add_child_event( sc_event* event_p ); 12712027Sjungma@eit.uni-kl.de virtual void add_child_object( sc_object* object_p ); 12812027Sjungma@eit.uni-kl.de virtual bool remove_child_event( sc_event* event_p ); 12912027Sjungma@eit.uni-kl.de virtual bool remove_child_object( sc_object* object_p ); 13012027Sjungma@eit.uni-kl.de 13112027Sjungma@eit.uni-kl.de phase_cb_mask register_simulation_phase_callback( phase_cb_mask ); 13212027Sjungma@eit.uni-kl.de phase_cb_mask unregister_simulation_phase_callback( phase_cb_mask ); 13312027Sjungma@eit.uni-kl.de 13412027Sjungma@eit.uni-kl.de class hierarchy_scope; 13512027Sjungma@eit.uni-kl.de 13612027Sjungma@eit.uni-kl.deprivate: 13712027Sjungma@eit.uni-kl.de void do_simulation_phase_callback(); 13812027Sjungma@eit.uni-kl.de virtual void simulation_phase_callback(); 13912027Sjungma@eit.uni-kl.de 14012027Sjungma@eit.uni-kl.de void detach(); 14112027Sjungma@eit.uni-kl.de virtual void orphan_child_events(); 14212027Sjungma@eit.uni-kl.de virtual void orphan_child_objects(); 14312027Sjungma@eit.uni-kl.de void sc_object_init(const char* nm); 14412027Sjungma@eit.uni-kl.de 14512027Sjungma@eit.uni-kl.deprivate: 14612027Sjungma@eit.uni-kl.de 14712027Sjungma@eit.uni-kl.de /* Each simulation object is associated with a simulation context */ 14812027Sjungma@eit.uni-kl.de mutable sc_attr_cltn* m_attr_cltn_p; // attributes for this object. 14912027Sjungma@eit.uni-kl.de std::vector<sc_event*> m_child_events; // list of child events. 15012027Sjungma@eit.uni-kl.de std::vector<sc_object*> m_child_objects; // list of child objects. 15112027Sjungma@eit.uni-kl.de std::string m_name; // name of this object. 15212027Sjungma@eit.uni-kl.de sc_object* m_parent; // parent for this object. 15312027Sjungma@eit.uni-kl.de sc_simcontext* m_simc; // simcontext ptr / empty indicator 15412027Sjungma@eit.uni-kl.de}; 15512027Sjungma@eit.uni-kl.de 15612027Sjungma@eit.uni-kl.deinline 15712027Sjungma@eit.uni-kl.desc_object& 15812027Sjungma@eit.uni-kl.desc_object::operator=( sc_object const & ) 15912027Sjungma@eit.uni-kl.de{ 16012027Sjungma@eit.uni-kl.de // deliberately do nothing 16112027Sjungma@eit.uni-kl.de return *this; 16212027Sjungma@eit.uni-kl.de} 16312027Sjungma@eit.uni-kl.de 16412027Sjungma@eit.uni-kl.de// ---------------------------------------------------------------------------- 16512027Sjungma@eit.uni-kl.de 16612027Sjungma@eit.uni-kl.deextern const char SC_HIERARCHY_CHAR; 16712027Sjungma@eit.uni-kl.deextern bool sc_enable_name_checking; 16812027Sjungma@eit.uni-kl.de 16912027Sjungma@eit.uni-kl.de 17012027Sjungma@eit.uni-kl.deinline 17112027Sjungma@eit.uni-kl.desc_object* sc_get_parent( const sc_object* obj_p ) 17212027Sjungma@eit.uni-kl.de{ 17312027Sjungma@eit.uni-kl.de return obj_p->get_parent_object(); 17412027Sjungma@eit.uni-kl.de} 17512027Sjungma@eit.uni-kl.de 17612027Sjungma@eit.uni-kl.de} // namespace sc_core 17712027Sjungma@eit.uni-kl.de 17812027Sjungma@eit.uni-kl.de/***************************************************************************** 17912027Sjungma@eit.uni-kl.de 18012027Sjungma@eit.uni-kl.de MODIFICATION LOG - modifiers, enter your name, affiliation, date and 18112027Sjungma@eit.uni-kl.de changes you are making here. 18212027Sjungma@eit.uni-kl.de 18312027Sjungma@eit.uni-kl.de Name, Affiliation, Date: Andy Goodrich, Forte Design Systems 18412027Sjungma@eit.uni-kl.de 5 September 2003 18512027Sjungma@eit.uni-kl.de Description of Modification: - Made creation of attributes structure 18612027Sjungma@eit.uni-kl.de conditional on its being used. This eliminates 18712027Sjungma@eit.uni-kl.de 100 bytes of storage for each normal sc_object. 18812027Sjungma@eit.uni-kl.de 18912027Sjungma@eit.uni-kl.de *****************************************************************************/ 19012027Sjungma@eit.uni-kl.de 19112027Sjungma@eit.uni-kl.de// $Log: sc_object.h,v $ 19212027Sjungma@eit.uni-kl.de// Revision 1.13 2011/08/29 18:04:32 acg 19312027Sjungma@eit.uni-kl.de// Philipp A. Hartmann: miscellaneous clean ups. 19412027Sjungma@eit.uni-kl.de// 19512027Sjungma@eit.uni-kl.de// Revision 1.12 2011/08/26 20:46:10 acg 19612027Sjungma@eit.uni-kl.de// Andy Goodrich: moved the modification log to the end of the file to 19712027Sjungma@eit.uni-kl.de// eliminate source line number skew when check-ins are done. 19812027Sjungma@eit.uni-kl.de// 19912027Sjungma@eit.uni-kl.de// Revision 1.11 2011/03/06 15:55:11 acg 20012027Sjungma@eit.uni-kl.de// Andy Goodrich: Changes for named events. 20112027Sjungma@eit.uni-kl.de// 20212027Sjungma@eit.uni-kl.de// Revision 1.10 2011/03/05 19:44:20 acg 20312027Sjungma@eit.uni-kl.de// Andy Goodrich: changes for object and event naming and structures. 20412027Sjungma@eit.uni-kl.de// 20512027Sjungma@eit.uni-kl.de// Revision 1.9 2011/03/05 01:39:21 acg 20612027Sjungma@eit.uni-kl.de// Andy Goodrich: changes for named events. 20712027Sjungma@eit.uni-kl.de// 20812027Sjungma@eit.uni-kl.de// Revision 1.8 2011/02/18 20:27:14 acg 20912027Sjungma@eit.uni-kl.de// Andy Goodrich: Updated Copyrights. 21012027Sjungma@eit.uni-kl.de// 21112027Sjungma@eit.uni-kl.de// Revision 1.7 2011/02/13 21:47:37 acg 21212027Sjungma@eit.uni-kl.de// Andy Goodrich: update copyright notice. 21312027Sjungma@eit.uni-kl.de// 21412027Sjungma@eit.uni-kl.de// Revision 1.6 2011/01/25 20:50:37 acg 21512027Sjungma@eit.uni-kl.de// Andy Goodrich: changes for IEEE 1666 2011. 21612027Sjungma@eit.uni-kl.de// 21712027Sjungma@eit.uni-kl.de// Revision 1.5 2011/01/18 20:10:44 acg 21812027Sjungma@eit.uni-kl.de// Andy Goodrich: changes for IEEE1666_2011 semantics. 21912027Sjungma@eit.uni-kl.de// 22012027Sjungma@eit.uni-kl.de// Revision 1.4 2010/07/22 20:02:33 acg 22112027Sjungma@eit.uni-kl.de// Andy Goodrich: bug fixes. 22212027Sjungma@eit.uni-kl.de// 22312027Sjungma@eit.uni-kl.de// Revision 1.3 2009/02/28 00:26:58 acg 22412027Sjungma@eit.uni-kl.de// Andy Goodrich: changed boost name space to sc_boost to allow use with 22512027Sjungma@eit.uni-kl.de// full boost library applications. 22612027Sjungma@eit.uni-kl.de// 22712027Sjungma@eit.uni-kl.de// Revision 1.2 2008/05/22 17:06:26 acg 22812027Sjungma@eit.uni-kl.de// Andy Goodrich: updated copyright notice to include 2008. 22912027Sjungma@eit.uni-kl.de// 23012027Sjungma@eit.uni-kl.de// Revision 1.1.1.1 2006/12/15 20:20:05 acg 23112027Sjungma@eit.uni-kl.de// SystemC 2.3 23212027Sjungma@eit.uni-kl.de// 23312027Sjungma@eit.uni-kl.de// Revision 1.5 2006/04/20 17:08:17 acg 23412027Sjungma@eit.uni-kl.de// Andy Goodrich: 3.0 style process changes. 23512027Sjungma@eit.uni-kl.de// 23612027Sjungma@eit.uni-kl.de// Revision 1.4 2006/04/11 23:13:21 acg 23712027Sjungma@eit.uni-kl.de// Andy Goodrich: Changes for reduced reset support that only includes 23812027Sjungma@eit.uni-kl.de// sc_cthread, but has preliminary hooks for expanding to method and thread 23912027Sjungma@eit.uni-kl.de// processes also. 24012027Sjungma@eit.uni-kl.de// 24112027Sjungma@eit.uni-kl.de// Revision 1.3 2006/01/13 18:44:30 acg 24212027Sjungma@eit.uni-kl.de// Added $Log to record CVS changes into the source. 24312027Sjungma@eit.uni-kl.de 24412027Sjungma@eit.uni-kl.de#endif // SC_OBJECT_H 245