⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 sc_module.cpp

📁 system C源码 一种替代verilog的语言
💻 CPP
📖 第 1 页 / 共 2 页
字号:
// set SC_CTHREAD reset sensitivityvoidsc_module::reset_signal_is( const sc_in<bool>& port, bool level ){	sc_reset::reset_signal_is(port, level);}voidsc_module::reset_signal_is( const sc_signal_in_if<bool>& iface, bool level ){	sc_reset::reset_signal_is(iface, level);}// to generate unique names for objects in an MT-Safe wayconst char*sc_module::gen_unique_name( const char* basename_, bool preserve_first ){    return m_name_gen->gen_unique_name( basename_, preserve_first );}// called by construction_done voidsc_module::before_end_of_elaboration(){}// We push the sc_module instance onto the stack of open objects so // that any objects that are created in before_end_of_elaboration have// the proper parent. After the call we pop the hierarchy.voidsc_module::construction_done(){    simcontext()->hierarchy_push( this );    before_end_of_elaboration();    simcontext()->hierarchy_pop();}// called by elaboration_done (does nothing by default)voidsc_module::end_of_elaboration(){}// We push the sc_module instance onto the stack of open objects so // that any objects that are created in end_of_elaboration have// the proper parent. After the call we pop the hierarchy.voidsc_module::elaboration_done( bool& error_ ){    if( ! m_end_module_called ) {	char msg[BUFSIZ];	std::sprintf( msg, "module '%s'", name() );	SC_REPORT_WARNING( SC_ID_END_MODULE_NOT_CALLED_, msg );	if( error_ ) {	    SC_REPORT_WARNING( SC_ID_HIER_NAME_INCORRECT_, 0 );	}	error_ = true;    }    simcontext()->hierarchy_push( this );    end_of_elaboration();    simcontext()->hierarchy_pop();}// called by start_simulation (does nothing by default)voidsc_module::start_of_simulation(){}voidsc_module::start_simulation(){    start_of_simulation();}// called by simulation_done (does nothing by default)voidsc_module::end_of_simulation(){}voidsc_module::simulation_done(){    end_of_simulation();}voidsc_module::set_stack_size( std::size_t size ){    sc_process_handle  proc_h(    	sc_is_running() ?	sc_get_current_process_handle() :	sc_get_last_created_process_handle()    );    sc_thread_handle thread_h;  // Current process as thread.    thread_h = (sc_thread_handle)proc_h;    if ( thread_h )     {	thread_h->set_stack_size( size );    }    else    {	SC_REPORT_WARNING( SC_ID_SET_STACK_SIZE_, 0 );    }}intsc_module::append_port( sc_port_base* port_ ){    int index = m_port_vec->size();    m_port_vec->push_back( port_ );    return index;}// positional binding methodsstatic void sc_warn_arrow_arrow_bind(){    static bool warn_arrow_arrow_bind=true;    if ( warn_arrow_arrow_bind )    {    	warn_arrow_arrow_bind = false;	SC_REPORT_INFO(SC_ID_IEEE_1666_DEPRECATION_,	    "positional binding using << or , is deprecated, use () instead.");    }}sc_module&sc_module::operator << ( sc_interface& interface_ ){    sc_warn_arrow_arrow_bind();    positional_bind(interface_);    return *this;}sc_module&sc_module::operator << ( sc_port_base& port_ ){    sc_warn_arrow_arrow_bind();    positional_bind(port_);    return *this;}voidsc_module::positional_bind( sc_interface& interface_ ){    if( m_port_index == (int)m_port_vec->size() ) {	char msg[BUFSIZ];	if( m_port_index == 0 ) {	    std::sprintf( msg, "module `%s' has no ports", name() );	} else {	    std::sprintf( msg, "all ports of module `%s' are bound", name() );	}	SC_REPORT_ERROR( SC_ID_BIND_IF_TO_PORT_, msg );    }    int status = (*m_port_vec)[m_port_index]->pbind( interface_ );    if( status != 0 ) {	char msg[BUFSIZ];	switch( status ) {	case 1:	    std::sprintf( msg, "port %d of module `%s' is already bound",		     m_port_index, name() );	    break;	case 2:	    std::sprintf( msg, "type mismatch on port %d of module `%s'",		     m_port_index, name() );	    break;	default:	    std::sprintf( msg, "unknown error" );	    break;	}	SC_REPORT_ERROR( SC_ID_BIND_IF_TO_PORT_, msg );    }    ++ m_port_index;}voidsc_module::positional_bind( sc_port_base& port_ ){    if( m_port_index == (int)m_port_vec->size() ) {	char msg[BUFSIZ];	if( m_port_index == 0 ) {	    std::sprintf( msg, "module `%s' has no ports", name() );	} else {	    std::sprintf( msg, "all ports of module `%s' are bound", name() );	}	SC_REPORT_ERROR( SC_ID_BIND_PORT_TO_PORT_, msg );    }    int status = (*m_port_vec)[m_port_index]->pbind( port_ );    if( status != 0 ) {	char msg[BUFSIZ];	switch( status ) {	case 1:	    std::sprintf( msg, "port %d of module `%s' is already bound",		     m_port_index, name() );	    break;	case 2:	    std::sprintf( msg, "type mismatch on port %d of module `%s'",		     m_port_index, name() );	    break;	default:	    std::sprintf( msg, "unknown error" );	    break;	}	SC_REPORT_ERROR( SC_ID_BIND_PORT_TO_PORT_, msg );    }    ++ m_port_index;}#define TRY_BIND( p )                                                         \    if( (p).iface != 0 ) {                                                    \        positional_bind( *(p).iface );                                        \    } else if( (p).port != 0 ) {                                              \        positional_bind( *(p).port );                                         \    } else {                                                                  \        return;                                                               \    }voidsc_module::operator () ( const sc_bind_proxy& p001,			 const sc_bind_proxy& p002,			 const sc_bind_proxy& p003,			 const sc_bind_proxy& p004,			 const sc_bind_proxy& p005,			 const sc_bind_proxy& p006,			 const sc_bind_proxy& p007,			 const sc_bind_proxy& p008,			 const sc_bind_proxy& p009,			 const sc_bind_proxy& p010,			 const sc_bind_proxy& p011,			 const sc_bind_proxy& p012,			 const sc_bind_proxy& p013,			 const sc_bind_proxy& p014,			 const sc_bind_proxy& p015,			 const sc_bind_proxy& p016,			 const sc_bind_proxy& p017,			 const sc_bind_proxy& p018,			 const sc_bind_proxy& p019,			 const sc_bind_proxy& p020,			 const sc_bind_proxy& p021,			 const sc_bind_proxy& p022,			 const sc_bind_proxy& p023,			 const sc_bind_proxy& p024,			 const sc_bind_proxy& p025,			 const sc_bind_proxy& p026,			 const sc_bind_proxy& p027,			 const sc_bind_proxy& p028,			 const sc_bind_proxy& p029,			 const sc_bind_proxy& p030,			 const sc_bind_proxy& p031,			 const sc_bind_proxy& p032,			 const sc_bind_proxy& p033,			 const sc_bind_proxy& p034,			 const sc_bind_proxy& p035,			 const sc_bind_proxy& p036,			 const sc_bind_proxy& p037,			 const sc_bind_proxy& p038,			 const sc_bind_proxy& p039,			 const sc_bind_proxy& p040,			 const sc_bind_proxy& p041,			 const sc_bind_proxy& p042,			 const sc_bind_proxy& p043,			 const sc_bind_proxy& p044,			 const sc_bind_proxy& p045,			 const sc_bind_proxy& p046,			 const sc_bind_proxy& p047,			 const sc_bind_proxy& p048,			 const sc_bind_proxy& p049,			 const sc_bind_proxy& p050,			 const sc_bind_proxy& p051,			 const sc_bind_proxy& p052,			 const sc_bind_proxy& p053,			 const sc_bind_proxy& p054,			 const sc_bind_proxy& p055,			 const sc_bind_proxy& p056,			 const sc_bind_proxy& p057,			 const sc_bind_proxy& p058,			 const sc_bind_proxy& p059,			 const sc_bind_proxy& p060,			 const sc_bind_proxy& p061,			 const sc_bind_proxy& p062,			 const sc_bind_proxy& p063,			 const sc_bind_proxy& p064 ){    static bool warn_only_once=true;    if ( m_port_index > 0 && warn_only_once )    {        warn_only_once = false;	SC_REPORT_INFO(SC_ID_IEEE_1666_DEPRECATION_,	 "multiple () binding depreacted, use explicit port binding instead." );    }    TRY_BIND( p001 );    TRY_BIND( p002 );    TRY_BIND( p003 );    TRY_BIND( p004 );    TRY_BIND( p005 );    TRY_BIND( p006 );    TRY_BIND( p007 );    TRY_BIND( p008 );    TRY_BIND( p009 );    TRY_BIND( p010 );    TRY_BIND( p011 );    TRY_BIND( p012 );    TRY_BIND( p013 );    TRY_BIND( p014 );    TRY_BIND( p015 );    TRY_BIND( p016 );    TRY_BIND( p017 );    TRY_BIND( p018 );    TRY_BIND( p019 );    TRY_BIND( p020 );    TRY_BIND( p021 );    TRY_BIND( p022 );    TRY_BIND( p023 );    TRY_BIND( p024 );    TRY_BIND( p025 );    TRY_BIND( p026 );    TRY_BIND( p027 );    TRY_BIND( p028 );    TRY_BIND( p029 );    TRY_BIND( p030 );    TRY_BIND( p031 );    TRY_BIND( p032 );    TRY_BIND( p033 );    TRY_BIND( p034 );    TRY_BIND( p035 );    TRY_BIND( p036 );    TRY_BIND( p037 );    TRY_BIND( p038 );    TRY_BIND( p039 );    TRY_BIND( p040 );    TRY_BIND( p041 );    TRY_BIND( p042 );    TRY_BIND( p043 );    TRY_BIND( p044 );    TRY_BIND( p045 );    TRY_BIND( p046 );    TRY_BIND( p047 );    TRY_BIND( p048 );    TRY_BIND( p049 );    TRY_BIND( p050 );    TRY_BIND( p051 );    TRY_BIND( p052 );    TRY_BIND( p053 );    TRY_BIND( p054 );    TRY_BIND( p055 );    TRY_BIND( p056 );    TRY_BIND( p057 );    TRY_BIND( p058 );    TRY_BIND( p059 );    TRY_BIND( p060 );    TRY_BIND( p061 );    TRY_BIND( p062 );    TRY_BIND( p063 );    TRY_BIND( p064 );}} // namespace sc_core// Taf!

⌨️ 快捷键说明

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