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_module.h -- Base class of all hierarchical modules and channels. 2312027Sjungma@eit.uni-kl.de 2412027Sjungma@eit.uni-kl.de Original Author: Stan Y. Liao, Synopsys, Inc. 2512027Sjungma@eit.uni-kl.de Martin Janssen, Synopsys, Inc. 2612027Sjungma@eit.uni-kl.de 2712027Sjungma@eit.uni-kl.de CHANGE LOG AT THE END OF THE FILE 2812027Sjungma@eit.uni-kl.de *****************************************************************************/ 2912027Sjungma@eit.uni-kl.de 3012027Sjungma@eit.uni-kl.de 3112027Sjungma@eit.uni-kl.de#ifndef SC_MODULE_H 3212027Sjungma@eit.uni-kl.de#define SC_MODULE_H 3312027Sjungma@eit.uni-kl.de 3412027Sjungma@eit.uni-kl.de#include "sysc/kernel/sc_kernel_ids.h" 3512027Sjungma@eit.uni-kl.de#include "sysc/kernel/sc_process.h" 3612027Sjungma@eit.uni-kl.de#include "sysc/kernel/sc_module_name.h" 3712027Sjungma@eit.uni-kl.de#include "sysc/kernel/sc_sensitive.h" 3812027Sjungma@eit.uni-kl.de#include "sysc/kernel/sc_time.h" 3912027Sjungma@eit.uni-kl.de#include "sysc/kernel/sc_wait.h" 4012027Sjungma@eit.uni-kl.de#include "sysc/kernel/sc_wait_cthread.h" 4112027Sjungma@eit.uni-kl.de#include "sysc/kernel/sc_process.h" 4212027Sjungma@eit.uni-kl.de#include "sysc/kernel/sc_process_handle.h" 4312027Sjungma@eit.uni-kl.de#include "sysc/utils/sc_list.h" 4412027Sjungma@eit.uni-kl.de 4512027Sjungma@eit.uni-kl.denamespace sc_core { 4612027Sjungma@eit.uni-kl.de 4712027Sjungma@eit.uni-kl.declass sc_name_gen; 4812027Sjungma@eit.uni-kl.detemplate<class T> class sc_in; 4912027Sjungma@eit.uni-kl.detemplate<class T> class sc_inout; 5012027Sjungma@eit.uni-kl.detemplate<class T> class sc_out; 5112027Sjungma@eit.uni-kl.de 5212027Sjungma@eit.uni-kl.de// ---------------------------------------------------------------------------- 5312027Sjungma@eit.uni-kl.de// STRUCT : sc_bind_proxy 5412027Sjungma@eit.uni-kl.de// 5512027Sjungma@eit.uni-kl.de// Struct for temporarily storing a pointer to an interface or port. 5612027Sjungma@eit.uni-kl.de// Used for positional binding. 5712027Sjungma@eit.uni-kl.de// ---------------------------------------------------------------------------- 5812027Sjungma@eit.uni-kl.de 5912027Sjungma@eit.uni-kl.destruct sc_bind_proxy 6012027Sjungma@eit.uni-kl.de{ 6112027Sjungma@eit.uni-kl.de sc_interface* iface; 6212027Sjungma@eit.uni-kl.de sc_port_base* port; 6312027Sjungma@eit.uni-kl.de 6412027Sjungma@eit.uni-kl.de sc_bind_proxy(); 6512027Sjungma@eit.uni-kl.de sc_bind_proxy( sc_interface& ); 6612027Sjungma@eit.uni-kl.de sc_bind_proxy( sc_port_base& ); 6712027Sjungma@eit.uni-kl.de}; 6812027Sjungma@eit.uni-kl.de 6912027Sjungma@eit.uni-kl.de 7012027Sjungma@eit.uni-kl.deextern const sc_bind_proxy SC_BIND_PROXY_NIL; 7112027Sjungma@eit.uni-kl.de 7212027Sjungma@eit.uni-kl.de 7312027Sjungma@eit.uni-kl.de// ---------------------------------------------------------------------------- 7412027Sjungma@eit.uni-kl.de// CLASS : sc_module 7512027Sjungma@eit.uni-kl.de// 7612027Sjungma@eit.uni-kl.de// Base class for all structural entities. 7712027Sjungma@eit.uni-kl.de// ---------------------------------------------------------------------------- 7812027Sjungma@eit.uni-kl.de 7912027Sjungma@eit.uni-kl.declass sc_module 8012027Sjungma@eit.uni-kl.de: public sc_object, public sc_process_host 8112027Sjungma@eit.uni-kl.de{ 8212027Sjungma@eit.uni-kl.de friend class sc_module_name; 8312027Sjungma@eit.uni-kl.de friend class sc_module_registry; 8412027Sjungma@eit.uni-kl.de friend class sc_object; 8512027Sjungma@eit.uni-kl.de friend class sc_port_registry; 8612027Sjungma@eit.uni-kl.de friend class sc_process_b; 8712027Sjungma@eit.uni-kl.de friend class sc_simcontext; 8812027Sjungma@eit.uni-kl.de 8912027Sjungma@eit.uni-kl.depublic: 9012027Sjungma@eit.uni-kl.de 9112027Sjungma@eit.uni-kl.de sc_simcontext* sc_get_curr_simcontext() 9212027Sjungma@eit.uni-kl.de { return simcontext(); } 9312027Sjungma@eit.uni-kl.de 9412027Sjungma@eit.uni-kl.de // to generate unique names for objects in an MT-Safe way 9512027Sjungma@eit.uni-kl.de const char* gen_unique_name( const char* basename_, bool preserve_first ); 9612027Sjungma@eit.uni-kl.de 9712027Sjungma@eit.uni-kl.de virtual const char* kind() const 9812027Sjungma@eit.uni-kl.de { return "sc_module"; } 9912027Sjungma@eit.uni-kl.de 10012027Sjungma@eit.uni-kl.deprotected: 10112027Sjungma@eit.uni-kl.de 10212027Sjungma@eit.uni-kl.de // called by construction_done 10312027Sjungma@eit.uni-kl.de virtual void before_end_of_elaboration(); 10412027Sjungma@eit.uni-kl.de 10512027Sjungma@eit.uni-kl.de void construction_done(); 10612027Sjungma@eit.uni-kl.de 10712027Sjungma@eit.uni-kl.de // called by elaboration_done (does nothing by default) 10812027Sjungma@eit.uni-kl.de virtual void end_of_elaboration(); 10912027Sjungma@eit.uni-kl.de 11012027Sjungma@eit.uni-kl.de void elaboration_done( bool& ); 11112027Sjungma@eit.uni-kl.de 11212027Sjungma@eit.uni-kl.de // called by start_simulation (does nothing by default) 11312027Sjungma@eit.uni-kl.de virtual void start_of_simulation(); 11412027Sjungma@eit.uni-kl.de 11512027Sjungma@eit.uni-kl.de void start_simulation(); 11612027Sjungma@eit.uni-kl.de 11712027Sjungma@eit.uni-kl.de // called by simulation_done (does nothing by default) 11812027Sjungma@eit.uni-kl.de virtual void end_of_simulation(); 11912027Sjungma@eit.uni-kl.de 12012027Sjungma@eit.uni-kl.de void simulation_done(); 12112027Sjungma@eit.uni-kl.de 12212027Sjungma@eit.uni-kl.de void sc_module_init(); 12312027Sjungma@eit.uni-kl.de 12412027Sjungma@eit.uni-kl.de // constructor 12512027Sjungma@eit.uni-kl.de sc_module(); 12612027Sjungma@eit.uni-kl.de sc_module( const sc_module_name& nm ); /* for those used to old style */ 12712027Sjungma@eit.uni-kl.de 12812027Sjungma@eit.uni-kl.de /* DEPRECATED */ sc_module( const char* nm ); 12912027Sjungma@eit.uni-kl.de /* DEPRECATED */ sc_module( const std::string& nm ); 13012027Sjungma@eit.uni-kl.de 13112027Sjungma@eit.uni-kl.depublic: 13212027Sjungma@eit.uni-kl.de 13312027Sjungma@eit.uni-kl.de // destructor 13412027Sjungma@eit.uni-kl.de virtual ~sc_module(); 13512027Sjungma@eit.uni-kl.de 13612027Sjungma@eit.uni-kl.de // positional binding methods 13712027Sjungma@eit.uni-kl.de 13812027Sjungma@eit.uni-kl.de sc_module& operator << ( sc_interface& ); 13912027Sjungma@eit.uni-kl.de sc_module& operator << ( sc_port_base& ); 14012027Sjungma@eit.uni-kl.de 14112027Sjungma@eit.uni-kl.de sc_module& operator , ( sc_interface& interface_ ) 14212027Sjungma@eit.uni-kl.de { return operator << ( interface_ ); } 14312027Sjungma@eit.uni-kl.de 14412027Sjungma@eit.uni-kl.de sc_module& operator , ( sc_port_base& port_ ) 14512027Sjungma@eit.uni-kl.de { return operator << ( port_ ); } 14612027Sjungma@eit.uni-kl.de 14712027Sjungma@eit.uni-kl.de // operator() is declared at the end of the class. 14812027Sjungma@eit.uni-kl.de 14912027Sjungma@eit.uni-kl.de const ::std::vector<sc_object*>& get_child_objects() const; 15012027Sjungma@eit.uni-kl.de 15112027Sjungma@eit.uni-kl.deprotected: 15212027Sjungma@eit.uni-kl.de 15312027Sjungma@eit.uni-kl.de // this must be called by user-defined modules 15412027Sjungma@eit.uni-kl.de void end_module(); 15512027Sjungma@eit.uni-kl.de 15612027Sjungma@eit.uni-kl.de 15712027Sjungma@eit.uni-kl.de // to prevent initialization for SC_METHODs and SC_THREADs 15812027Sjungma@eit.uni-kl.de void dont_initialize(); 15912027Sjungma@eit.uni-kl.de 16012027Sjungma@eit.uni-kl.de // positional binding code - used by operator () 16112027Sjungma@eit.uni-kl.de 16212027Sjungma@eit.uni-kl.de void positional_bind( sc_interface& ); 16312027Sjungma@eit.uni-kl.de void positional_bind( sc_port_base& ); 16412027Sjungma@eit.uni-kl.de 16512027Sjungma@eit.uni-kl.de // set reset sensitivity for SC_xTHREADs 16612027Sjungma@eit.uni-kl.de void async_reset_signal_is( const sc_in<bool>& port, bool level ); 16712027Sjungma@eit.uni-kl.de void async_reset_signal_is( const sc_inout<bool>& port, bool level ); 16812027Sjungma@eit.uni-kl.de void async_reset_signal_is( const sc_out<bool>& port, bool level ); 16912027Sjungma@eit.uni-kl.de void async_reset_signal_is( const sc_signal_in_if<bool>& iface, bool level); 17012027Sjungma@eit.uni-kl.de void reset_signal_is( const sc_in<bool>& port, bool level ); 17112027Sjungma@eit.uni-kl.de void reset_signal_is( const sc_inout<bool>& port, bool level ); 17212027Sjungma@eit.uni-kl.de void reset_signal_is( const sc_out<bool>& port, bool level ); 17312027Sjungma@eit.uni-kl.de void reset_signal_is( const sc_signal_in_if<bool>& iface, bool level ); 17412027Sjungma@eit.uni-kl.de 17512027Sjungma@eit.uni-kl.de // static sensitivity for SC_THREADs and SC_CTHREADs 17612027Sjungma@eit.uni-kl.de 17712027Sjungma@eit.uni-kl.de void wait() 17812027Sjungma@eit.uni-kl.de { ::sc_core::wait( simcontext() ); } 17912027Sjungma@eit.uni-kl.de 18012027Sjungma@eit.uni-kl.de // dynamic sensitivity for SC_THREADs and SC_CTHREADs 18112027Sjungma@eit.uni-kl.de 18212027Sjungma@eit.uni-kl.de void wait( const sc_event& e ) 18312027Sjungma@eit.uni-kl.de { ::sc_core::wait( e, simcontext() ); } 18412027Sjungma@eit.uni-kl.de 18512027Sjungma@eit.uni-kl.de void wait( const sc_event_or_list& el ) 18612027Sjungma@eit.uni-kl.de { ::sc_core::wait( el, simcontext() ); } 18712027Sjungma@eit.uni-kl.de 18812027Sjungma@eit.uni-kl.de void wait( const sc_event_and_list& el ) 18912027Sjungma@eit.uni-kl.de { ::sc_core::wait( el, simcontext() ); } 19012027Sjungma@eit.uni-kl.de 19112027Sjungma@eit.uni-kl.de void wait( const sc_time& t ) 19212027Sjungma@eit.uni-kl.de { ::sc_core::wait( t, simcontext() ); } 19312027Sjungma@eit.uni-kl.de 19412027Sjungma@eit.uni-kl.de void wait( double v, sc_time_unit tu ) 19512027Sjungma@eit.uni-kl.de { ::sc_core::wait( sc_time( v, tu, simcontext() ), simcontext() ); } 19612027Sjungma@eit.uni-kl.de 19712027Sjungma@eit.uni-kl.de void wait( const sc_time& t, const sc_event& e ) 19812027Sjungma@eit.uni-kl.de { ::sc_core::wait( t, e, simcontext() ); } 19912027Sjungma@eit.uni-kl.de 20012027Sjungma@eit.uni-kl.de void wait( double v, sc_time_unit tu, const sc_event& e ) 20112027Sjungma@eit.uni-kl.de { ::sc_core::wait( 20212027Sjungma@eit.uni-kl.de sc_time( v, tu, simcontext() ), e, simcontext() ); } 20312027Sjungma@eit.uni-kl.de 20412027Sjungma@eit.uni-kl.de void wait( const sc_time& t, const sc_event_or_list& el ) 20512027Sjungma@eit.uni-kl.de { ::sc_core::wait( t, el, simcontext() ); } 20612027Sjungma@eit.uni-kl.de 20712027Sjungma@eit.uni-kl.de void wait( double v, sc_time_unit tu, const sc_event_or_list& el ) 20812027Sjungma@eit.uni-kl.de { ::sc_core::wait( sc_time( v, tu, simcontext() ), el, simcontext() ); } 20912027Sjungma@eit.uni-kl.de 21012027Sjungma@eit.uni-kl.de void wait( const sc_time& t, const sc_event_and_list& el ) 21112027Sjungma@eit.uni-kl.de { ::sc_core::wait( t, el, simcontext() ); } 21212027Sjungma@eit.uni-kl.de 21312027Sjungma@eit.uni-kl.de void wait( double v, sc_time_unit tu, const sc_event_and_list& el ) 21412027Sjungma@eit.uni-kl.de { ::sc_core::wait( sc_time( v, tu, simcontext() ), el, simcontext() ); } 21512027Sjungma@eit.uni-kl.de 21612027Sjungma@eit.uni-kl.de 21712027Sjungma@eit.uni-kl.de // static sensitivity for SC_METHODs 21812027Sjungma@eit.uni-kl.de 21912027Sjungma@eit.uni-kl.de void next_trigger() 22012027Sjungma@eit.uni-kl.de { ::sc_core::next_trigger( simcontext() ); } 22112027Sjungma@eit.uni-kl.de 22212027Sjungma@eit.uni-kl.de 22312027Sjungma@eit.uni-kl.de // dynamic sensitivty for SC_METHODs 22412027Sjungma@eit.uni-kl.de 22512027Sjungma@eit.uni-kl.de void next_trigger( const sc_event& e ) 22612027Sjungma@eit.uni-kl.de { ::sc_core::next_trigger( e, simcontext() ); } 22712027Sjungma@eit.uni-kl.de 22812027Sjungma@eit.uni-kl.de void next_trigger( const sc_event_or_list& el ) 22912027Sjungma@eit.uni-kl.de { ::sc_core::next_trigger( el, simcontext() ); } 23012027Sjungma@eit.uni-kl.de 23112027Sjungma@eit.uni-kl.de void next_trigger( const sc_event_and_list& el ) 23212027Sjungma@eit.uni-kl.de { ::sc_core::next_trigger( el, simcontext() ); } 23312027Sjungma@eit.uni-kl.de 23412027Sjungma@eit.uni-kl.de void next_trigger( const sc_time& t ) 23512027Sjungma@eit.uni-kl.de { ::sc_core::next_trigger( t, simcontext() ); } 23612027Sjungma@eit.uni-kl.de 23712027Sjungma@eit.uni-kl.de void next_trigger( double v, sc_time_unit tu ) 23812027Sjungma@eit.uni-kl.de { ::sc_core::next_trigger( 23912027Sjungma@eit.uni-kl.de sc_time( v, tu, simcontext() ), simcontext() ); } 24012027Sjungma@eit.uni-kl.de 24112027Sjungma@eit.uni-kl.de void next_trigger( const sc_time& t, const sc_event& e ) 24212027Sjungma@eit.uni-kl.de { ::sc_core::next_trigger( t, e, simcontext() ); } 24312027Sjungma@eit.uni-kl.de 24412027Sjungma@eit.uni-kl.de void next_trigger( double v, sc_time_unit tu, const sc_event& e ) 24512027Sjungma@eit.uni-kl.de { ::sc_core::next_trigger( 24612027Sjungma@eit.uni-kl.de sc_time( v, tu, simcontext() ), e, simcontext() ); } 24712027Sjungma@eit.uni-kl.de 24812027Sjungma@eit.uni-kl.de void next_trigger( const sc_time& t, const sc_event_or_list& el ) 24912027Sjungma@eit.uni-kl.de { ::sc_core::next_trigger( t, el, simcontext() ); } 25012027Sjungma@eit.uni-kl.de 25112027Sjungma@eit.uni-kl.de void next_trigger( double v, sc_time_unit tu, const sc_event_or_list& el ) 25212027Sjungma@eit.uni-kl.de { ::sc_core::next_trigger( 25312027Sjungma@eit.uni-kl.de sc_time( v, tu, simcontext() ), el, simcontext() ); } 25412027Sjungma@eit.uni-kl.de 25512027Sjungma@eit.uni-kl.de void next_trigger( const sc_time& t, const sc_event_and_list& el ) 25612027Sjungma@eit.uni-kl.de { ::sc_core::next_trigger( t, el, simcontext() ); } 25712027Sjungma@eit.uni-kl.de 25812027Sjungma@eit.uni-kl.de void next_trigger( double v, sc_time_unit tu, const sc_event_and_list& el ) 25912027Sjungma@eit.uni-kl.de { ::sc_core::next_trigger( 26012027Sjungma@eit.uni-kl.de sc_time( v, tu, simcontext() ), el, simcontext() ); } 26112027Sjungma@eit.uni-kl.de 26212027Sjungma@eit.uni-kl.de 26312027Sjungma@eit.uni-kl.de // for SC_METHODs and SC_THREADs and SC_CTHREADs 26412027Sjungma@eit.uni-kl.de 26512027Sjungma@eit.uni-kl.de bool timed_out() 26612027Sjungma@eit.uni-kl.de { return ::sc_core::timed_out(); } 26712027Sjungma@eit.uni-kl.de 26812027Sjungma@eit.uni-kl.de 26912027Sjungma@eit.uni-kl.de // for SC_CTHREADs 27012027Sjungma@eit.uni-kl.de 27112027Sjungma@eit.uni-kl.de void halt() 27212027Sjungma@eit.uni-kl.de { ::sc_core::halt( simcontext() ); } 27312027Sjungma@eit.uni-kl.de 27412027Sjungma@eit.uni-kl.de void wait( int n ) 27512027Sjungma@eit.uni-kl.de { ::sc_core::wait( n, simcontext() ); } 27612027Sjungma@eit.uni-kl.de 27712027Sjungma@eit.uni-kl.de void at_posedge( const sc_signal_in_if<bool>& s ) 27812027Sjungma@eit.uni-kl.de { ::sc_core::at_posedge( s, simcontext() ); } 27912027Sjungma@eit.uni-kl.de 28012027Sjungma@eit.uni-kl.de void at_posedge( const sc_signal_in_if<sc_dt::sc_logic>& s ) 28112027Sjungma@eit.uni-kl.de { ::sc_core::at_posedge( s, simcontext() ); } 28212027Sjungma@eit.uni-kl.de 28312027Sjungma@eit.uni-kl.de void at_negedge( const sc_signal_in_if<bool>& s ) 28412027Sjungma@eit.uni-kl.de { ::sc_core::at_negedge( s, simcontext() ); } 28512027Sjungma@eit.uni-kl.de 28612027Sjungma@eit.uni-kl.de void at_negedge( const sc_signal_in_if<sc_dt::sc_logic>& s ) 28712027Sjungma@eit.uni-kl.de { ::sc_core::at_negedge( s, simcontext() ); } 28812027Sjungma@eit.uni-kl.de 28912027Sjungma@eit.uni-kl.de // Catch uses of watching: 29012027Sjungma@eit.uni-kl.de void watching( bool /* expr */ ) 29112027Sjungma@eit.uni-kl.de { SC_REPORT_ERROR(SC_ID_WATCHING_NOT_ALLOWED_,""); } 29212027Sjungma@eit.uni-kl.de 29312027Sjungma@eit.uni-kl.de // These are protected so that user derived classes can refer to them. 29412027Sjungma@eit.uni-kl.de sc_sensitive sensitive; 29512027Sjungma@eit.uni-kl.de sc_sensitive_pos sensitive_pos; 29612027Sjungma@eit.uni-kl.de sc_sensitive_neg sensitive_neg; 29712027Sjungma@eit.uni-kl.de 29812027Sjungma@eit.uni-kl.de // Function to set the stack size of the current (c)thread process. 29912027Sjungma@eit.uni-kl.de void set_stack_size( std::size_t ); 30012027Sjungma@eit.uni-kl.de 30112027Sjungma@eit.uni-kl.de int append_port( sc_port_base* ); 30212027Sjungma@eit.uni-kl.de 30312027Sjungma@eit.uni-kl.deprivate: 30412027Sjungma@eit.uni-kl.de sc_module( const sc_module& ); 30512027Sjungma@eit.uni-kl.de const sc_module& operator = ( const sc_module& ); 30612027Sjungma@eit.uni-kl.de 30712027Sjungma@eit.uni-kl.deprivate: 30812027Sjungma@eit.uni-kl.de 30912027Sjungma@eit.uni-kl.de bool m_end_module_called; 31012027Sjungma@eit.uni-kl.de std::vector<sc_port_base*>* m_port_vec; 31112027Sjungma@eit.uni-kl.de int m_port_index; 31212027Sjungma@eit.uni-kl.de sc_name_gen* m_name_gen; 31312027Sjungma@eit.uni-kl.de sc_module_name* m_module_name_p; 31412027Sjungma@eit.uni-kl.de 31512027Sjungma@eit.uni-kl.depublic: 31612027Sjungma@eit.uni-kl.de 31712027Sjungma@eit.uni-kl.de void defunct() { } 31812027Sjungma@eit.uni-kl.de 31912027Sjungma@eit.uni-kl.de // positional binding methods (cont'd) 32012027Sjungma@eit.uni-kl.de 32112027Sjungma@eit.uni-kl.de void operator () ( const sc_bind_proxy& p001, 32212027Sjungma@eit.uni-kl.de const sc_bind_proxy& p002 = SC_BIND_PROXY_NIL, 32312027Sjungma@eit.uni-kl.de const sc_bind_proxy& p003 = SC_BIND_PROXY_NIL, 32412027Sjungma@eit.uni-kl.de const sc_bind_proxy& p004 = SC_BIND_PROXY_NIL, 32512027Sjungma@eit.uni-kl.de const sc_bind_proxy& p005 = SC_BIND_PROXY_NIL, 32612027Sjungma@eit.uni-kl.de const sc_bind_proxy& p006 = SC_BIND_PROXY_NIL, 32712027Sjungma@eit.uni-kl.de const sc_bind_proxy& p007 = SC_BIND_PROXY_NIL, 32812027Sjungma@eit.uni-kl.de const sc_bind_proxy& p008 = SC_BIND_PROXY_NIL, 32912027Sjungma@eit.uni-kl.de const sc_bind_proxy& p009 = SC_BIND_PROXY_NIL, 33012027Sjungma@eit.uni-kl.de const sc_bind_proxy& p010 = SC_BIND_PROXY_NIL, 33112027Sjungma@eit.uni-kl.de const sc_bind_proxy& p011 = SC_BIND_PROXY_NIL, 33212027Sjungma@eit.uni-kl.de const sc_bind_proxy& p012 = SC_BIND_PROXY_NIL, 33312027Sjungma@eit.uni-kl.de const sc_bind_proxy& p013 = SC_BIND_PROXY_NIL, 33412027Sjungma@eit.uni-kl.de const sc_bind_proxy& p014 = SC_BIND_PROXY_NIL, 33512027Sjungma@eit.uni-kl.de const sc_bind_proxy& p015 = SC_BIND_PROXY_NIL, 33612027Sjungma@eit.uni-kl.de const sc_bind_proxy& p016 = SC_BIND_PROXY_NIL, 33712027Sjungma@eit.uni-kl.de const sc_bind_proxy& p017 = SC_BIND_PROXY_NIL, 33812027Sjungma@eit.uni-kl.de const sc_bind_proxy& p018 = SC_BIND_PROXY_NIL, 33912027Sjungma@eit.uni-kl.de const sc_bind_proxy& p019 = SC_BIND_PROXY_NIL, 34012027Sjungma@eit.uni-kl.de const sc_bind_proxy& p020 = SC_BIND_PROXY_NIL, 34112027Sjungma@eit.uni-kl.de const sc_bind_proxy& p021 = SC_BIND_PROXY_NIL, 34212027Sjungma@eit.uni-kl.de const sc_bind_proxy& p022 = SC_BIND_PROXY_NIL, 34312027Sjungma@eit.uni-kl.de const sc_bind_proxy& p023 = SC_BIND_PROXY_NIL, 34412027Sjungma@eit.uni-kl.de const sc_bind_proxy& p024 = SC_BIND_PROXY_NIL, 34512027Sjungma@eit.uni-kl.de const sc_bind_proxy& p025 = SC_BIND_PROXY_NIL, 34612027Sjungma@eit.uni-kl.de const sc_bind_proxy& p026 = SC_BIND_PROXY_NIL, 34712027Sjungma@eit.uni-kl.de const sc_bind_proxy& p027 = SC_BIND_PROXY_NIL, 34812027Sjungma@eit.uni-kl.de const sc_bind_proxy& p028 = SC_BIND_PROXY_NIL, 34912027Sjungma@eit.uni-kl.de const sc_bind_proxy& p029 = SC_BIND_PROXY_NIL, 35012027Sjungma@eit.uni-kl.de const sc_bind_proxy& p030 = SC_BIND_PROXY_NIL, 35112027Sjungma@eit.uni-kl.de const sc_bind_proxy& p031 = SC_BIND_PROXY_NIL, 35212027Sjungma@eit.uni-kl.de const sc_bind_proxy& p032 = SC_BIND_PROXY_NIL, 35312027Sjungma@eit.uni-kl.de const sc_bind_proxy& p033 = SC_BIND_PROXY_NIL, 35412027Sjungma@eit.uni-kl.de const sc_bind_proxy& p034 = SC_BIND_PROXY_NIL, 35512027Sjungma@eit.uni-kl.de const sc_bind_proxy& p035 = SC_BIND_PROXY_NIL, 35612027Sjungma@eit.uni-kl.de const sc_bind_proxy& p036 = SC_BIND_PROXY_NIL, 35712027Sjungma@eit.uni-kl.de const sc_bind_proxy& p037 = SC_BIND_PROXY_NIL, 35812027Sjungma@eit.uni-kl.de const sc_bind_proxy& p038 = SC_BIND_PROXY_NIL, 35912027Sjungma@eit.uni-kl.de const sc_bind_proxy& p039 = SC_BIND_PROXY_NIL, 36012027Sjungma@eit.uni-kl.de const sc_bind_proxy& p040 = SC_BIND_PROXY_NIL, 36112027Sjungma@eit.uni-kl.de const sc_bind_proxy& p041 = SC_BIND_PROXY_NIL, 36212027Sjungma@eit.uni-kl.de const sc_bind_proxy& p042 = SC_BIND_PROXY_NIL, 36312027Sjungma@eit.uni-kl.de const sc_bind_proxy& p043 = SC_BIND_PROXY_NIL, 36412027Sjungma@eit.uni-kl.de const sc_bind_proxy& p044 = SC_BIND_PROXY_NIL, 36512027Sjungma@eit.uni-kl.de const sc_bind_proxy& p045 = SC_BIND_PROXY_NIL, 36612027Sjungma@eit.uni-kl.de const sc_bind_proxy& p046 = SC_BIND_PROXY_NIL, 36712027Sjungma@eit.uni-kl.de const sc_bind_proxy& p047 = SC_BIND_PROXY_NIL, 36812027Sjungma@eit.uni-kl.de const sc_bind_proxy& p048 = SC_BIND_PROXY_NIL, 36912027Sjungma@eit.uni-kl.de const sc_bind_proxy& p049 = SC_BIND_PROXY_NIL, 37012027Sjungma@eit.uni-kl.de const sc_bind_proxy& p050 = SC_BIND_PROXY_NIL, 37112027Sjungma@eit.uni-kl.de const sc_bind_proxy& p051 = SC_BIND_PROXY_NIL, 37212027Sjungma@eit.uni-kl.de const sc_bind_proxy& p052 = SC_BIND_PROXY_NIL, 37312027Sjungma@eit.uni-kl.de const sc_bind_proxy& p053 = SC_BIND_PROXY_NIL, 37412027Sjungma@eit.uni-kl.de const sc_bind_proxy& p054 = SC_BIND_PROXY_NIL, 37512027Sjungma@eit.uni-kl.de const sc_bind_proxy& p055 = SC_BIND_PROXY_NIL, 37612027Sjungma@eit.uni-kl.de const sc_bind_proxy& p056 = SC_BIND_PROXY_NIL, 37712027Sjungma@eit.uni-kl.de const sc_bind_proxy& p057 = SC_BIND_PROXY_NIL, 37812027Sjungma@eit.uni-kl.de const sc_bind_proxy& p058 = SC_BIND_PROXY_NIL, 37912027Sjungma@eit.uni-kl.de const sc_bind_proxy& p059 = SC_BIND_PROXY_NIL, 38012027Sjungma@eit.uni-kl.de const sc_bind_proxy& p060 = SC_BIND_PROXY_NIL, 38112027Sjungma@eit.uni-kl.de const sc_bind_proxy& p061 = SC_BIND_PROXY_NIL, 38212027Sjungma@eit.uni-kl.de const sc_bind_proxy& p062 = SC_BIND_PROXY_NIL, 38312027Sjungma@eit.uni-kl.de const sc_bind_proxy& p063 = SC_BIND_PROXY_NIL, 38412027Sjungma@eit.uni-kl.de const sc_bind_proxy& p064 = SC_BIND_PROXY_NIL ); 38512027Sjungma@eit.uni-kl.de 38612027Sjungma@eit.uni-kl.de}; 38712027Sjungma@eit.uni-kl.de 38812027Sjungma@eit.uni-kl.deextern sc_module* sc_module_dynalloc(sc_module*); 38912027Sjungma@eit.uni-kl.de#define SC_NEW(x) ::sc_core::sc_module_dynalloc(new x); 39012027Sjungma@eit.uni-kl.de 39112027Sjungma@eit.uni-kl.de 39212027Sjungma@eit.uni-kl.de// ----------------------------------------------------------------------------- 39312027Sjungma@eit.uni-kl.de// SOME MACROS TO SIMPLIFY SYNTAX: 39412027Sjungma@eit.uni-kl.de// ----------------------------------------------------------------------------- 39512027Sjungma@eit.uni-kl.de 39612027Sjungma@eit.uni-kl.de#define SC_MODULE(user_module_name) \ 39712027Sjungma@eit.uni-kl.de struct user_module_name : ::sc_core::sc_module 39812027Sjungma@eit.uni-kl.de 39912027Sjungma@eit.uni-kl.de#define SC_CTOR(user_module_name) \ 40012027Sjungma@eit.uni-kl.de typedef user_module_name SC_CURRENT_USER_MODULE; \ 40112027Sjungma@eit.uni-kl.de user_module_name( ::sc_core::sc_module_name ) 40212027Sjungma@eit.uni-kl.de 40312027Sjungma@eit.uni-kl.de// the SC_HAS_PROCESS macro call must be followed by a ; 40412027Sjungma@eit.uni-kl.de#define SC_HAS_PROCESS(user_module_name) \ 40512027Sjungma@eit.uni-kl.de typedef user_module_name SC_CURRENT_USER_MODULE 40612027Sjungma@eit.uni-kl.de 40712027Sjungma@eit.uni-kl.de// The this-> construct on sensitive operators in the macros below is 40812027Sjungma@eit.uni-kl.de// required for gcc 4.x when a templated class has a templated parent that is 40912027Sjungma@eit.uni-kl.de// derived from sc_module: 41012027Sjungma@eit.uni-kl.de// 41112027Sjungma@eit.uni-kl.de// template<typename X> 41212027Sjungma@eit.uni-kl.de// class B : public sc_module; 41312027Sjungma@eit.uni-kl.de// template<typename X> 41412027Sjungma@eit.uni-kl.de// class A : public B<X> 41512027Sjungma@eit.uni-kl.de 41612027Sjungma@eit.uni-kl.de#define declare_method_process(handle, name, host_tag, func) \ 41712027Sjungma@eit.uni-kl.de { \ 41812027Sjungma@eit.uni-kl.de ::sc_core::sc_process_handle handle = \ 41912027Sjungma@eit.uni-kl.de sc_core::sc_get_curr_simcontext()->create_method_process( \ 42012027Sjungma@eit.uni-kl.de name, false, SC_MAKE_FUNC_PTR( host_tag, func ), \ 42112027Sjungma@eit.uni-kl.de this, 0 ); \ 42212027Sjungma@eit.uni-kl.de this->sensitive << handle; \ 42312027Sjungma@eit.uni-kl.de this->sensitive_pos << handle; \ 42412027Sjungma@eit.uni-kl.de this->sensitive_neg << handle; \ 42512027Sjungma@eit.uni-kl.de } 42612027Sjungma@eit.uni-kl.de 42712027Sjungma@eit.uni-kl.de#define declare_thread_process(handle, name, host_tag, func) \ 42812027Sjungma@eit.uni-kl.de { \ 42912027Sjungma@eit.uni-kl.de ::sc_core::sc_process_handle handle = \ 43012027Sjungma@eit.uni-kl.de sc_core::sc_get_curr_simcontext()->create_thread_process( \ 43112027Sjungma@eit.uni-kl.de name, false, \ 43212027Sjungma@eit.uni-kl.de SC_MAKE_FUNC_PTR( host_tag, func ), this, 0 ); \ 43312027Sjungma@eit.uni-kl.de this->sensitive << handle; \ 43412027Sjungma@eit.uni-kl.de this->sensitive_pos << handle; \ 43512027Sjungma@eit.uni-kl.de this->sensitive_neg << handle; \ 43612027Sjungma@eit.uni-kl.de } 43712027Sjungma@eit.uni-kl.de 43812027Sjungma@eit.uni-kl.de#define declare_cthread_process(handle, name, host_tag, func, edge) \ 43912027Sjungma@eit.uni-kl.de { \ 44012027Sjungma@eit.uni-kl.de ::sc_core::sc_process_handle handle = \ 44112027Sjungma@eit.uni-kl.de sc_core::sc_get_curr_simcontext()->create_cthread_process( \ 44212027Sjungma@eit.uni-kl.de name, false, \ 44312027Sjungma@eit.uni-kl.de SC_MAKE_FUNC_PTR( host_tag, func ), this, 0 ); \ 44412027Sjungma@eit.uni-kl.de this->sensitive.operator() ( handle, edge );\ 44512027Sjungma@eit.uni-kl.de } 44612027Sjungma@eit.uni-kl.de 44712027Sjungma@eit.uni-kl.de#define SC_CTHREAD(func, edge) \ 44812027Sjungma@eit.uni-kl.de declare_cthread_process( func ## _handle, \ 44912027Sjungma@eit.uni-kl.de #func, \ 45012027Sjungma@eit.uni-kl.de SC_CURRENT_USER_MODULE, \ 45112027Sjungma@eit.uni-kl.de func, \ 45212027Sjungma@eit.uni-kl.de edge ) 45312027Sjungma@eit.uni-kl.de 45412027Sjungma@eit.uni-kl.de#define SC_METHOD(func) \ 45512027Sjungma@eit.uni-kl.de declare_method_process( func ## _handle, \ 45612027Sjungma@eit.uni-kl.de #func, \ 45712027Sjungma@eit.uni-kl.de SC_CURRENT_USER_MODULE, \ 45812027Sjungma@eit.uni-kl.de func ) 45912027Sjungma@eit.uni-kl.de 46012027Sjungma@eit.uni-kl.de#define SC_THREAD(func) \ 46112027Sjungma@eit.uni-kl.de declare_thread_process( func ## _handle, \ 46212027Sjungma@eit.uni-kl.de #func, \ 46312027Sjungma@eit.uni-kl.de SC_CURRENT_USER_MODULE, \ 46412027Sjungma@eit.uni-kl.de func ) 46512027Sjungma@eit.uni-kl.de 46612027Sjungma@eit.uni-kl.de 46712027Sjungma@eit.uni-kl.de 46812027Sjungma@eit.uni-kl.de// ---------------------------------------------------------------------------- 46912027Sjungma@eit.uni-kl.de// TYPEDEFS 47012027Sjungma@eit.uni-kl.de// ---------------------------------------------------------------------------- 47112027Sjungma@eit.uni-kl.de 47212027Sjungma@eit.uni-kl.detypedef sc_module sc_channel; 47312027Sjungma@eit.uni-kl.detypedef sc_module sc_behavior; 47412027Sjungma@eit.uni-kl.de 47512027Sjungma@eit.uni-kl.de} // namespace sc_core 47612027Sjungma@eit.uni-kl.de 47712027Sjungma@eit.uni-kl.de/***************************************************************************** 47812027Sjungma@eit.uni-kl.de 47912027Sjungma@eit.uni-kl.de MODIFICATION LOG - modifiers, enter your name, affiliation, date and 48012027Sjungma@eit.uni-kl.de changes you are making here. 48112027Sjungma@eit.uni-kl.de 48212027Sjungma@eit.uni-kl.de Name, Affiliation, Date: Ali Dasdan, Synopsys, Inc. 48312027Sjungma@eit.uni-kl.de Description of Modification: - Implementation of operator() and operator, 48412027Sjungma@eit.uni-kl.de positional connection method. 48512027Sjungma@eit.uni-kl.de - Implementation of error checking in 48612027Sjungma@eit.uni-kl.de operator<<'s. 48712027Sjungma@eit.uni-kl.de - Implementation of the function test_module_prm. 48812027Sjungma@eit.uni-kl.de - Implementation of set_stack_size(). 48912027Sjungma@eit.uni-kl.de 49012027Sjungma@eit.uni-kl.de Name, Affiliation, Date: Gene Bushuyev, Synopsys, Inc. 49112027Sjungma@eit.uni-kl.de Description of Modification: - Change implementation for VC6. 49212027Sjungma@eit.uni-kl.de 49312027Sjungma@eit.uni-kl.de Name, Affiliation, Date: Andy Godorich, Forte 49412027Sjungma@eit.uni-kl.de Bishnupriya Bhattacharya, Cadence Design Systems, 49512027Sjungma@eit.uni-kl.de 25 August, 2003 49612027Sjungma@eit.uni-kl.de Description of Modification: inherit from sc_process_host as a part of 49712027Sjungma@eit.uni-kl.de implementing dynamic processes 49812027Sjungma@eit.uni-kl.de 49912027Sjungma@eit.uni-kl.de *****************************************************************************/ 50012027Sjungma@eit.uni-kl.de 50112027Sjungma@eit.uni-kl.de// $Log: sc_module.h,v $ 50212027Sjungma@eit.uni-kl.de// Revision 1.11 2011/08/26 20:46:10 acg 50312027Sjungma@eit.uni-kl.de// Andy Goodrich: moved the modification log to the end of the file to 50412027Sjungma@eit.uni-kl.de// eliminate source line number skew when check-ins are done. 50512027Sjungma@eit.uni-kl.de// 50612027Sjungma@eit.uni-kl.de// Revision 1.10 2011/08/15 16:43:24 acg 50712027Sjungma@eit.uni-kl.de// Torsten Maehne: changes to remove unused argument warnings. 50812027Sjungma@eit.uni-kl.de// 50912027Sjungma@eit.uni-kl.de// Revision 1.9 2011/03/05 19:44:20 acg 51012027Sjungma@eit.uni-kl.de// Andy Goodrich: changes for object and event naming and structures. 51112027Sjungma@eit.uni-kl.de// 51212027Sjungma@eit.uni-kl.de// Revision 1.8 2011/02/18 20:27:14 acg 51312027Sjungma@eit.uni-kl.de// Andy Goodrich: Updated Copyrights. 51412027Sjungma@eit.uni-kl.de// 51512027Sjungma@eit.uni-kl.de// Revision 1.7 2011/02/13 21:47:37 acg 51612027Sjungma@eit.uni-kl.de// Andy Goodrich: update copyright notice. 51712027Sjungma@eit.uni-kl.de// 51812027Sjungma@eit.uni-kl.de// Revision 1.6 2011/01/18 20:10:44 acg 51912027Sjungma@eit.uni-kl.de// Andy Goodrich: changes for IEEE1666_2011 semantics. 52012027Sjungma@eit.uni-kl.de// 52112027Sjungma@eit.uni-kl.de// Revision 1.5 2010/12/07 20:09:12 acg 52212027Sjungma@eit.uni-kl.de// Andy Goodrich: remove unused signal declaration 52312027Sjungma@eit.uni-kl.de// 52412027Sjungma@eit.uni-kl.de// Revision 1.4 2009/05/22 16:06:29 acg 52512027Sjungma@eit.uni-kl.de// Andy Goodrich: process control updates. 52612027Sjungma@eit.uni-kl.de// 52712027Sjungma@eit.uni-kl.de// Revision 1.3 2008/05/22 17:06:25 acg 52812027Sjungma@eit.uni-kl.de// Andy Goodrich: updated copyright notice to include 2008. 52912027Sjungma@eit.uni-kl.de// 53012027Sjungma@eit.uni-kl.de// Revision 1.2 2007/01/24 20:14:40 acg 53112027Sjungma@eit.uni-kl.de// Andy Goodrich: improved comments about the use of this-> in the macros 53212027Sjungma@eit.uni-kl.de// that access sensitive. 53312027Sjungma@eit.uni-kl.de// 53412027Sjungma@eit.uni-kl.de// Revision 1.1.1.1 2006/12/15 20:20:05 acg 53512027Sjungma@eit.uni-kl.de// SystemC 2.3 53612027Sjungma@eit.uni-kl.de// 53712027Sjungma@eit.uni-kl.de// Revision 1.10 2006/12/02 20:58:18 acg 53812027Sjungma@eit.uni-kl.de// Andy Goodrich: updates from 2.2 for IEEE 1666 support. 53912027Sjungma@eit.uni-kl.de// 54012027Sjungma@eit.uni-kl.de// Revision 1.7 2006/04/11 23:13:21 acg 54112027Sjungma@eit.uni-kl.de// Andy Goodrich: Changes for reduced reset support that only includes 54212027Sjungma@eit.uni-kl.de// sc_cthread, but has preliminary hooks for expanding to method and thread 54312027Sjungma@eit.uni-kl.de// processes also. 54412027Sjungma@eit.uni-kl.de// 54512027Sjungma@eit.uni-kl.de// Revision 1.6 2006/03/15 17:53:34 acg 54612027Sjungma@eit.uni-kl.de// Andy Goodrich, Forte Design 54712027Sjungma@eit.uni-kl.de// Reordered includes to pick up <cassert> for use by sc_process_name.h 54812027Sjungma@eit.uni-kl.de// 54912027Sjungma@eit.uni-kl.de// Revision 1.5 2006/03/14 23:56:58 acg 55012027Sjungma@eit.uni-kl.de// Andy Goodrich: This fixes a bug when an exception is thrown in 55112027Sjungma@eit.uni-kl.de// sc_module::sc_module() for a dynamically allocated sc_module 55212027Sjungma@eit.uni-kl.de// object. We are calling sc_module::end_module() on a module that has 55312027Sjungma@eit.uni-kl.de// already been deleted. The scenario runs like this: 55412027Sjungma@eit.uni-kl.de// 55512027Sjungma@eit.uni-kl.de// a) the sc_module constructor is entered 55612027Sjungma@eit.uni-kl.de// b) the exception is thrown 55712027Sjungma@eit.uni-kl.de// c) the exception processor deletes the storage for the sc_module 55812027Sjungma@eit.uni-kl.de// d) the stack is unrolled causing the sc_module_name instance to be deleted 55912027Sjungma@eit.uni-kl.de// e) ~sc_module_name() calls end_module() with its pointer to the sc_module 56012027Sjungma@eit.uni-kl.de// f) because the sc_module has been deleted its storage is corrupted, 56112027Sjungma@eit.uni-kl.de// either by linking it to a free space chain, or by reuse of some sort 56212027Sjungma@eit.uni-kl.de// g) the m_simc field is garbage 56312027Sjungma@eit.uni-kl.de// h) the m_object_manager field is also garbage 56412027Sjungma@eit.uni-kl.de// i) an exception occurs 56512027Sjungma@eit.uni-kl.de// 56612027Sjungma@eit.uni-kl.de// This does not happen for automatic sc_module instances since the 56712027Sjungma@eit.uni-kl.de// storage for the module is not reclaimed its just part of the stack. 56812027Sjungma@eit.uni-kl.de// 56912027Sjungma@eit.uni-kl.de// I am fixing this by having the destructor for sc_module clear the 57012027Sjungma@eit.uni-kl.de// module pointer in its sc_module_name instance. That cuts things at 57112027Sjungma@eit.uni-kl.de// step (e) above, since the pointer will be null if the module has 57212027Sjungma@eit.uni-kl.de// already been deleted. To make sure the module stack is okay, I call 57312027Sjungma@eit.uni-kl.de// end-module() in ~sc_module in the case where there is an 57412027Sjungma@eit.uni-kl.de// sc_module_name pointer lying around. 57512027Sjungma@eit.uni-kl.de// 57612027Sjungma@eit.uni-kl.de// Revision 1.4 2006/01/24 20:49:05 acg 57712027Sjungma@eit.uni-kl.de// Andy Goodrich: changes to remove the use of deprecated features within the 57812027Sjungma@eit.uni-kl.de// simulator, and to issue warning messages when deprecated features are used. 57912027Sjungma@eit.uni-kl.de// 58012027Sjungma@eit.uni-kl.de// Revision 1.3 2006/01/13 18:44:30 acg 58112027Sjungma@eit.uni-kl.de// Added $Log to record CVS changes into the source. 58212027Sjungma@eit.uni-kl.de 58312027Sjungma@eit.uni-kl.de#endif 584