sc_module.h

来自「基于4个mips核的noc设计」· C头文件 代码 · 共 563 行 · 第 1/2 页

H
563
字号
/*****************************************************************************  The following code is derived, directly or indirectly, from the SystemC  source code Copyright (c) 1996-2002 by all Contributors.  All Rights reserved.  The contents of this file are subject to the restrictions and limitations  set forth in the SystemC Open Source License Version 2.3 (the "License");  You may not use this file except in compliance with such restrictions and  limitations. You may obtain instructions on how to receive a copy of the  License at http://www.systemc.org/. Software distributed by Contributors  under the License is distributed on an "AS IS" basis, WITHOUT WARRANTY OF  ANY KIND, either express or implied. See the License for the specific  language governing rights and limitations under the License. *****************************************************************************//*****************************************************************************  sc_module.h -- Base class of all hierarchical modules and channels.  Original Author: Stan Y. Liao, Synopsys, Inc.                   Martin Janssen, Synopsys, Inc. *****************************************************************************//*****************************************************************************  MODIFICATION LOG - modifiers, enter your name, affiliation, date and  changes you are making here.      Name, Affiliation, Date: Ali Dasdan, Synopsys, Inc.  Description of Modification: - Implementation of operator() and operator,                                 positional connection method.                               - Implementation of error checking in                                 operator<<'s.                               - Implementation of the function test_module_prm.                               - Implementation of set_stack_size().      Name, Affiliation, Date: Gene Bushuyev, Synopsys, Inc.  Description of Modification: - Change implementation for VC6.      Name, Affiliation, Date:  Description of Modification: *****************************************************************************/#ifndef SC_MODULE_H#define SC_MODULE_H#include "systemc/kernel/sc_kernel_ids.h"#include "systemc/kernel/sc_lambda.h"#include "systemc/kernel/sc_module_name.h"#include "systemc/kernel/sc_object.h"#include "systemc/kernel/sc_process.h"#include "systemc/kernel/sc_sensitive.h"#include "systemc/kernel/sc_time.h"#include "systemc/kernel/sc_wait.h"#include "systemc/kernel/sc_wait_cthread.h"#include "systemc/utils/sc_list.h"#include "systemc/utils/sc_string.h"class sc_name_gen;// ----------------------------------------------------------------------------//  STRUCT : sc_bind_proxy////  Struct for temporarily storing a pointer to an interface or port.//  Used for positional binding.// ----------------------------------------------------------------------------struct sc_bind_proxy{    sc_interface* iface;    sc_port_base* port;        sc_bind_proxy();    sc_bind_proxy( sc_interface& );    sc_bind_proxy( sc_port_base& );};extern const sc_bind_proxy SC_BIND_PROXY_NIL;// ----------------------------------------------------------------------------//  CLASS : sc_module////  Base class for all structural entities.// ----------------------------------------------------------------------------class sc_module: public sc_object{    friend class sc_module_name;    friend class sc_module_registry;    friend class sc_object;    friend class sc_port_registry;    friend class sc_simcontext;public:    sc_simcontext* sc_get_curr_simcontext()	{ return simcontext(); }    // to generate unique names for objects in an MT-Safe way    const char* gen_unique_name( const char* basename_ );    static const char* const kind_string;    virtual const char* kind() const        { return kind_string; }protected:    // called by elaboration_done (does nothing by default)    virtual void end_of_elaboration();    void elaboration_done( bool& );    void sc_module_init();    // constructor    sc_module( const char* nm );    sc_module( const sc_string& nm );    sc_module( const sc_module_name& nm ); /* for those used to old style */    sc_module();public:    // destructor    virtual ~sc_module();    // positional binding methods    sc_module& operator << ( sc_interface& );    sc_module& operator << ( sc_port_base& );    sc_module& operator , ( sc_interface& interface_ )        { return operator << ( interface_ ); }    sc_module& operator , ( sc_port_base& port_ )        { return operator << ( port_ ); }    // operator() is declared at the end of the class.    const sc_pvector<sc_object*>& get_child_objects() const;protected:    void add_child_object( sc_object* );    void remove_child_object( sc_object* );    // this must be called by user-defined modules    void end_module();    // to prevent initialization for SC_METHODs and SC_THREADs    void dont_initialize();    // static sensitivity for SC_THREADs and SC_CTHREADs    void wait()        { ::wait( simcontext() ); }    // dynamic sensitivity for SC_THREADs and SC_CTHREADs    void wait( const sc_event& e )        { ::wait( e, simcontext() ); }    void wait( sc_event_or_list& el )	{ ::wait( el, simcontext() ); }    void wait( sc_event_and_list& el )	{ ::wait( el, simcontext() ); }    void wait( const sc_time& t )        { ::wait( t, simcontext() ); }    void wait( double v, sc_time_unit tu )        { ::wait( sc_time( v, tu, simcontext() ), simcontext() ); }    void wait( const sc_time& t, const sc_event& e )        { ::wait( t, e, simcontext() ); }    void wait( double v, sc_time_unit tu, const sc_event& e )        { ::wait( sc_time( v, tu, simcontext() ), e, simcontext() ); }    void wait( const sc_time& t, sc_event_or_list& el )        { ::wait( t, el, simcontext() ); }    void wait( double v, sc_time_unit tu, sc_event_or_list& el )        { ::wait( sc_time( v, tu, simcontext() ), el, simcontext() ); }    void wait( const sc_time& t, sc_event_and_list& el )        { ::wait( t, el, simcontext() ); }    void wait( double v, sc_time_unit tu, sc_event_and_list& el )        { ::wait( sc_time( v, tu, simcontext() ), el, simcontext() ); }    // static sensitivity for SC_METHODs    void next_trigger()	{ ::next_trigger( simcontext() ); }    // dynamic sensitivty for SC_METHODs    void next_trigger( const sc_event& e )        { ::next_trigger( e, simcontext() ); }    void next_trigger( sc_event_or_list& el )        { ::next_trigger( el, simcontext() ); }    void next_trigger( sc_event_and_list& el )        { ::next_trigger( el, simcontext() ); }    void next_trigger( const sc_time& t )        { ::next_trigger( t, simcontext() ); }    void next_trigger( double v, sc_time_unit tu )        { ::next_trigger( sc_time( v, tu, simcontext() ), simcontext() ); }    void next_trigger( const sc_time& t, const sc_event& e )        { ::next_trigger( t, e, simcontext() ); }    void next_trigger( double v, sc_time_unit tu, const sc_event& e )        { ::next_trigger( sc_time( v, tu, simcontext() ), e, simcontext() ); }    void next_trigger( const sc_time& t, sc_event_or_list& el )        { ::next_trigger( t, el, simcontext() ); }    void next_trigger( double v, sc_time_unit tu, sc_event_or_list& el )        { ::next_trigger( sc_time( v, tu, simcontext() ), el, simcontext() ); }    void next_trigger( const sc_time& t, sc_event_and_list& el )        { ::next_trigger( t, el, simcontext() ); }    void next_trigger( double v, sc_time_unit tu, sc_event_and_list& el )        { ::next_trigger( sc_time( v, tu, simcontext() ), el, simcontext() ); }    // for SC_METHODs and SC_THREADs and SC_CTHREADs    bool timed_out()	{ return ::timed_out( simcontext() ); }    // for SC_CTHREADs    void halt()        { ::halt( simcontext() ); }    void wait( int n )        { ::wait( n, simcontext() ); }    void wait_until( const sc_lambda_ptr& l )        { ::wait_until( l, simcontext() ); }    void wait_until( const sc_signal_bool_deval& s )        { ::wait_until( s, simcontext() ); }    void at_posedge( const sc_signal_in_if<bool>& s )	{ ::at_posedge( s, simcontext() ); }    void at_posedge( const sc_signal_in_if<sc_logic>& s )	{ ::at_posedge( s, simcontext() ); }    void at_negedge( const sc_signal_in_if<bool>& s )	{ ::at_negedge( s, simcontext() ); }    void at_negedge( const sc_signal_in_if<sc_logic>& s )	{ ::at_negedge( s, simcontext() ); }    void watching( const sc_lambda_ptr& l )        { ::watching( l, simcontext() ); }

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?