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

📄 sc_signal_ports.h

📁 system C源码 一种替代verilog的语言
💻 H
📖 第 1 页 / 共 4 页
字号:
    void operator () ( const in_if_type& interface_ )	{ sc_port_base::bind( CCAST<in_if_type&>( interface_ ) ); }    // bind to parent in port    void bind( in_port_type& parent_ )        { sc_port_base::bind( parent_ ); }    void operator () ( in_port_type& parent_ )        { sc_port_base::bind( parent_ ); }    // bind to parent inout port    void bind( inout_port_type& parent_ )	{ sc_port_base::bind( parent_ ); }    void operator () ( inout_port_type& parent_ )	{ sc_port_base::bind( parent_ ); }    // interface access shortcut methods    // get the default event    const sc_event& default_event() const	{ return (*this)->default_event(); }    // get the value changed event    const sc_event& value_changed_event() const	{ return (*this)->value_changed_event(); }    // get the positive edge event    const sc_event& posedge_event() const	{ return (*this)->posedge_event(); }    // get the negative edge event    const sc_event& negedge_event() const	{ return (*this)->negedge_event(); }    // read the current value    const data_type& read() const	{ return (*this)->read(); }    operator const data_type& () const	{ return (*this)->read(); }    // use for positive edge sensitivity    sc_event_finder& pos() const    {        if ( !m_pos_finder_p )	{	    m_pos_finder_p = new sc_event_finder_t<in_if_type>(	        *this, &in_if_type::posedge_event );	} 	return *m_pos_finder_p;    }    // use for negative edge sensitivity    sc_event_finder& neg() const    {        if ( !m_neg_finder_p )	{	    m_neg_finder_p = new sc_event_finder_t<in_if_type>(	        *this, &in_if_type::negedge_event );	} 	return *m_neg_finder_p;    }    // was there a value changed event?    bool event() const	{ return (*this)->event(); }    // was there a positive edge event?    bool posedge() const        { return (*this)->posedge(); }    // was there a negative edge event?    bool negedge() const        { return (*this)->negedge(); }    // (other) event finder method(s)    sc_event_finder& value_changed() const    {        if ( !m_change_finder_p )	{	    m_change_finder_p = new sc_event_finder_t<in_if_type>(	        *this, &in_if_type::value_changed_event );	}	return *m_change_finder_p;    }    // called when elaboration is done    /*  WHEN DEFINING THIS METHOD IN A DERIVED CLASS, */    /*  MAKE SURE THAT THIS METHOD IS CALLED AS WELL. */    virtual void end_of_elaboration();    virtual const char* kind() const        { return "sc_in"; }    void add_trace( sc_trace_file*, const std::string& ) const;    // called by sc_trace    void add_trace_internal( sc_trace_file*, const std::string& ) const;protected:    void remove_traces() const;    mutable sc_trace_params_vec* m_traces;protected:    // called by pbind (for internal use only)    virtual int vbind( sc_interface& );    virtual int vbind( sc_port_base& );private:  mutable sc_event_finder* m_change_finder_p;  mutable sc_event_finder* m_neg_finder_p;  mutable sc_event_finder* m_pos_finder_p;private:    // disabled#if defined(TESTING)#else    sc_in( const this_type& );#endif     this_type& operator = ( const this_type& );#ifdef __GNUC__    // Needed to circumvent a problem in the g++-2.95.2 compiler:    // This unused variable forces the compiler to instantiate    // an object of T template so an implicit conversion from    // read() to a C++ intrinsic data type will work.    static data_type dummy;#endif};// ----------------------------------------------------------------------------//  CLASS : sc_in<sc_dt::sc_logic>////  Specialization of sc_in<T> for type sc_dt::sc_logic.// ----------------------------------------------------------------------------template <>class sc_in<sc_dt::sc_logic>: public sc_port<sc_signal_in_if<sc_dt::sc_logic>,1,SC_ONE_OR_MORE_BOUND>{public:    // typedefs    typedef sc_dt::sc_logic                               data_type;    typedef sc_signal_in_if<data_type>                    if_type;    typedef sc_port<if_type,1,SC_ONE_OR_MORE_BOUND>       base_type;    typedef sc_in<data_type>                              this_type;    typedef if_type                                       in_if_type;    typedef base_type                                     in_port_type;    typedef sc_signal_inout_if<data_type>                 inout_if_type;    typedef sc_port<inout_if_type,1,SC_ONE_OR_MORE_BOUND> inout_port_type;public:    // constructors    sc_in()	: base_type(), m_traces( 0 ),	  m_change_finder_p(0), m_neg_finder_p(0), m_pos_finder_p(0)	{}    explicit sc_in( const char* name_ )	: base_type( name_ ), m_traces( 0 ),	  m_change_finder_p(0), m_neg_finder_p(0), m_pos_finder_p(0)	{}    explicit sc_in( const in_if_type& interface_ )	: base_type( CCAST<in_if_type&>( interface_ ) ), m_traces( 0 ),	  m_change_finder_p(0), m_neg_finder_p(0), m_pos_finder_p(0)	{}    sc_in( const char* name_, const in_if_type& interface_ )	: base_type( name_, CCAST<in_if_type&>( interface_ ) ), m_traces( 0 ),	  m_change_finder_p(0), m_neg_finder_p(0), m_pos_finder_p(0)	{}    explicit sc_in( in_port_type& parent_ )	: base_type( parent_ ), m_traces( 0 ),	  m_change_finder_p(0), m_neg_finder_p(0), m_pos_finder_p(0)	{}    sc_in( const char* name_, in_port_type& parent_ )	: base_type( name_, parent_ ), m_traces( 0 ),	  m_change_finder_p(0), m_neg_finder_p(0), m_pos_finder_p(0)	{}    explicit sc_in( inout_port_type& parent_ )	: base_type(), m_traces( 0 ),	  m_change_finder_p(0), m_neg_finder_p(0), m_pos_finder_p(0)	{ sc_port_base::bind( parent_ ); }    sc_in( const char* name_, inout_port_type& parent_ )	: base_type( name_ ), m_traces( 0 ),	  m_change_finder_p(0), m_neg_finder_p(0), m_pos_finder_p(0)	{ sc_port_base::bind( parent_ ); }    sc_in( this_type& parent_ )	: base_type( parent_ ), m_traces( 0 ),	  m_change_finder_p(0), m_neg_finder_p(0), m_pos_finder_p(0)	{}    sc_in( const char* name_, this_type& parent_ )	: base_type( name_, parent_ ), m_traces( 0 ),	  m_change_finder_p(0), m_neg_finder_p(0), m_pos_finder_p(0)	{}    // destructor    virtual ~sc_in()	{	    remove_traces();	    if ( m_change_finder_p ) delete m_change_finder_p;	    if ( m_neg_finder_p ) delete m_neg_finder_p;	    if ( m_pos_finder_p ) delete m_pos_finder_p;	}    // bind to in interface    void bind( const in_if_type& interface_ )	{ sc_port_base::bind( CCAST<in_if_type&>( interface_ ) ); }    void operator () ( const in_if_type& interface_ )	{ sc_port_base::bind( CCAST<in_if_type&>( interface_ ) ); }    // bind to parent in port    void bind( in_port_type& parent_ )        { sc_port_base::bind( parent_ ); }    void operator () ( in_port_type& parent_ )        { sc_port_base::bind( parent_ ); }    // bind to parent inout port    void bind( inout_port_type& parent_ )	{ sc_port_base::bind( parent_ ); }    void operator () ( inout_port_type& parent_ )	{ sc_port_base::bind( parent_ ); }    // interface access shortcut methods    // get the default event    const sc_event& default_event() const	{ return (*this)->default_event(); }    // get the value changed event    const sc_event& value_changed_event() const	{ return (*this)->value_changed_event(); }    // get the positive edge event    const sc_event& posedge_event() const	{ return (*this)->posedge_event(); }    // get the negative edge event    const sc_event& negedge_event() const	{ return (*this)->negedge_event(); }    // read the current value    const data_type& read() const	{ return (*this)->read(); }    operator const data_type& () const	{ return (*this)->read(); }    // use for positive edge sensitivity    sc_event_finder& pos() const    {        if ( !m_pos_finder_p )	{	    m_pos_finder_p = new sc_event_finder_t<in_if_type>(	        *this, &in_if_type::posedge_event );	} 	return *m_pos_finder_p;    }    // use for negative edge sensitivity    sc_event_finder& neg() const    {        if ( !m_neg_finder_p )	{	    m_neg_finder_p = new sc_event_finder_t<in_if_type>(	        *this, &in_if_type::negedge_event );	} 	return *m_neg_finder_p;    }    // was there a value changed event?    bool event() const	{ return (*this)->event(); }    // was there a positive edge event?    bool posedge() const        { return (*this)->posedge(); }    // was there a negative edge event?    bool negedge() const        { return (*this)->negedge(); }    // (other) event finder method(s)    sc_event_finder& value_changed() const    {        if ( !m_change_finder_p )	{	    m_change_finder_p = new sc_event_finder_t<in_if_type>(	        *this, &in_if_type::value_changed_event );	}	return *m_change_finder_p;    }    // called when elaboration is done    /*  WHEN DEFINING THIS METHOD IN A DERIVED CLASS, */    /*  MAKE SURE THAT THIS METHOD IS CALLED AS WELL. */    virtual void end_of_elaboration();    virtual const char* kind() const        { return "sc_in"; }    void add_trace( sc_trace_file*, const std::string& ) const;    // called by sc_trace    void add_trace_internal( sc_trace_file*, const std::string& ) const;protected:    void remove_traces() const;    mutable sc_trace_params_vec* m_traces;protected:    // called by pbind (for internal use only)    virtual int vbind( sc_interface& );    virtual int vbind( sc_port_base& );private:  mutable sc_event_finder* m_change_finder_p;  mutable sc_event_finder* m_neg_finder_p;  mutable sc_event_finder* m_pos_finder_p;private:    // disabled    sc_in( const this_type& );    this_type& operator = ( const this_type& );#ifdef __GNUC__    // Needed to circumvent a problem in the g++-2.95.2 compiler:    // This unused variable forces the compiler to instantiate    // an object of T template so an implicit conversion from    // read() to a C++ intrinsic data type will work.    static data_type dummy;#endif};// ----------------------------------------------------------------------------//  CLASS : sc_inout<T>////  The sc_signal<T> input/output port class.// ----------------------------------------------------------------------------template <class T>class sc_inout: public sc_port<sc_signal_inout_if<T>,1,SC_ONE_OR_MORE_BOUND>{public:    // typedefs    typedef T                                          data_type;    typedef sc_signal_inout_if<data_type>              if_type;    typedef sc_port<if_type,1,SC_ONE_OR_MORE_BOUND>    base_type;    typedef sc_inout<data_type>                        this_type;    typedef sc_signal_in_if<data_type>                 in_if_type;    typedef sc_port<in_if_type,1,SC_ONE_OR_MORE_BOUND> in_port_type;    typedef if_type                                    inout_if_type;    typedef base_type                                  inout_port_type;public:    // constructors    sc_inout()	: base_type(), m_init_val( 0 ), m_traces( 0 ),	  m_change_finder_p(0)	{}    explicit sc_inout( const char* name_ )	: base_type( name_ ), m_init_val( 0 ), m_traces( 0 ),	  m_change_finder_p(0)	{}    explicit sc_inout( inout_if_type& interface_ )	: base_type( interface_ ), m_init_val( 0 ), m_traces( 0 ),	  m_change_finder_p(0)	{}    sc_inout( const char* name_, inout_if_type& interface_ )	: base_type( name_, interface_ ), m_init_val( 0 ), m_traces( 0 ),	  m_change_finder_p(0)	{}    explicit sc_inout( inout_port_type& parent_ )	: base_type( parent_ ), m_init_val( 0 ), m_traces( 0 ),	  m_change_finder_p(0)

⌨️ 快捷键说明

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