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

📄 scx_signal_int.h

📁 system C源码 一种替代verilog的语言
💻 H
📖 第 1 页 / 共 4 页
字号:
        { return (*this)->read().and_reduce(); }    inline bool nand_reduce() const        { return (*this)->read().nand_reduce(); }    inline bool nor_reduce() const        { return (*this)->read().nor_reduce(); }    inline bool or_reduce() const        { return (*this)->read().or_reduce(); }    inline bool xnor_reduce() const        { return (*this)->read().xnor_reduce(); }    inline bool xor_reduce() const        { return (*this)->read().xor_reduce(); }    // called when elaboration is done    /*  WHEN DEFINING THIS METHOD IN A DERIVED CLASS, */    /*  MAKE SURE THAT THIS METHOD IS CALLED AS WELL. */    virtual inline void end_of_elaboration()        {            if( m_init_val_p != 0 ) {                (*this)->write( (sc_dt::int64) *m_init_val_p );                delete m_init_val_p;                m_init_val_p = 0;            }            if( m_traces != 0 ) {                for( unsigned int i = 0; i < m_traces->size(); ++ i ) {                    sc_trace_params* p = (*m_traces)[i];                    sc_trace( p->tf, read(), p->name );                }                remove_traces();            }        }    virtual inline const char* kind() const         { return "sc_inout"; }    // value initialization    inline void initialize( const sc_dt::sc_int<W>& value_ )    {        inout_if_type* iface = this->get_interface(0);        if( iface != 0 ) {            iface->write( value_ );        } else {            if( m_init_val_p == 0 ) {                m_init_val_p = new sc_dt::int64;            }            *m_init_val_p = value_;        }    }    // called by sc_trace    void add_trace( sc_trace_file* tf_, const std::string& name_ ) const        {             if( tf_ != 0 ) {                if( m_traces == 0 ) {                    m_traces = new sc_trace_params_vec;                }                m_traces->push_back( new sc_trace_params( tf_, name_ ) );            }        }    // concatenation methods    virtual inline int concat_length(bool* xz_present_p) const        { return (*this)->read().concat_length( xz_present_p ); }    virtual inline sc_dt::uint64 concat_get_uint64() const        { return (*this)->read().concat_get_uint64(); }    virtual 	inline bool concat_get_ctrl( sc_dt::sc_digit* dst_p, int low_i ) const        { return (*this)->read().concat_get_ctrl(dst_p, low_i); }    virtual 	inline bool concat_get_data( sc_dt::sc_digit* dst_p, int low_i ) const        { return (*this)->read().concat_get_data(dst_p, low_i); }    virtual inline void concat_set(sc_dt::int64 src, int low_i)        { *this = src >> (( low_i < 64 ) ? low_i : 63); }#if 0 // ####    virtual inline void concat_set(const sc_dt::sc_lv_base& src, int low_i)        { *this = src >> low_i; }#endif // 0 ####    virtual inline void concat_set(const sc_dt::sc_signed& src, int low_i)        { *this = src >> low_i; }    virtual inline void concat_set(const sc_dt::sc_unsigned& src, int low_i)        { *this = src >> low_i; }    virtual inline void concat_set(sc_dt::uint64 src, int low_i)        { *this = ( low_i < 64 ) ? src >> low_i : (sc_dt::uint64)0; }    // assignment operators:  public:	inline void operator = ( const this_type& new_val )		{ (*this)->write( (sc_dt::int64)new_val ); }    inline void operator = ( const char* new_val )        { (*this)->write( this_type(new_val) ); }    inline void operator = ( sc_dt::uint64 new_val )        { (*this)->write(new_val); }    inline void operator = ( sc_dt::int64 new_val )        { (*this)->write((sc_dt::uint64)new_val); }    inline void operator = ( int new_val )        { (*this)->write((sc_dt::uint64)new_val); }    inline void operator = ( long new_val )        { (*this)->write((sc_dt::uint64)new_val); }    inline void operator = ( short new_val )        { (*this)->write((sc_dt::uint64)new_val); }    inline void operator = ( unsigned int new_val )        { (*this)->write((sc_dt::uint64)new_val); }    inline void operator = ( unsigned long new_val )        { (*this)->write((sc_dt::uint64)new_val); }    inline void operator = ( unsigned short new_val )        { (*this)->write((sc_dt::uint64)new_val); }    template<typename T>    inline void operator = ( const sc_dt::sc_generic_base<T>& new_val )        { (*this)->write(new_val->to_uint64()); }    inline void operator = ( const sc_dt::sc_signed& new_val )        { (*this)->write(new_val.to_uint64()); }    inline void operator = ( const sc_dt::sc_unsigned& new_val )        { (*this)->write(new_val.to_uint64()); }    inline void operator = ( const sc_dt::sc_bv_base& new_val )        { (*this)->write((sc_dt::sc_int<W>)new_val); }    inline void operator = ( const sc_dt::sc_lv_base& new_val )        { (*this)->write((sc_dt::sc_int<W>)new_val); }    inline void write( const sc_in<sc_dt::sc_int<W> >& new_val )        { (*this)->write( (sc_dt::int64)new_val ); }    inline void write( const sc_inout<sc_dt::sc_int<W> >& new_val )        { (*this)->write( (sc_dt::int64)new_val); }    inline void write( const sc_dt::sc_int<W>& new_val )        { (*this)->write( (sc_dt::int64)new_val); }  protected:    void remove_traces() const        {            if( m_traces != 0 ) {                for( unsigned int i = m_traces->size() - 1; i >= 0; -- i ) {                    delete (*m_traces)[i];                }                delete m_traces;                m_traces = 0;            }        }    sc_dt::int64*                      m_init_val_p;    mutable sc_trace_params_vec* m_traces;  private:    // disabled    sc_inout( const sc_inout<sc_dt::sc_int<W> >& );#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};SC_TEMPLATEinline std::ostream& operator << ( 	std::ostream& os, const sc_inout<sc_dt::sc_int<W> >& a ){    a.read().print( os );    return os;}//==============================================================================// CLASS sc_out<sc_dt::sc_int<W> >//// This class implements an output port whose target acts like an // sc_dt::sc_int<W> data value. This class is a derivation of sc_inout, since// output ports are really no different from input/output ports.//==============================================================================SC_TEMPLATEclass sc_out<sc_dt::sc_int<W> > : public sc_inout<sc_dt::sc_int<W> >{  public:    // typedefs    typedef sc_dt::sc_int<W>                          data_type;    typedef sc_out<data_type>                   this_type;    typedef sc_inout<data_type>                 base_type;    typedef typename base_type::inout_if_type   inout_if_type;    typedef typename base_type::inout_port_type inout_port_type;    // constructors    sc_out()        : base_type()        {}    explicit sc_out( const char* name_ )        : base_type( name_ )        {}    explicit sc_out( inout_if_type& interface_ )        : base_type( interface_ )        {}    sc_out( const char* name_, inout_if_type& interface_ )        : base_type( name_, interface_ )        {}    explicit sc_out( inout_port_type& parent_ )        : base_type( parent_ )        {}    sc_out( const char* name_, inout_port_type& parent_ )        : base_type( name_, parent_ )        {}    sc_out( this_type& parent_ )        : base_type( parent_ )        {}    sc_out( const char* name_, this_type& parent_ )        : base_type( name_, parent_ )        {}    // destructor (does nothing)    virtual inline ~sc_out()        {}    // assignment operators:  public:	inline void operator = ( const this_type& new_val )		{ (*this)->write( (sc_dt::int64)new_val ); }    inline void operator = ( const char* new_val )		{ (*this)->write( this_type(new_val) ); }    inline void operator = ( sc_dt::uint64 new_val )        { (*this)->write(new_val); }    inline void operator = ( sc_dt::int64 new_val )        { (*this)->write((sc_dt::uint64)new_val); }    inline void operator = ( int new_val )        { (*this)->write((sc_dt::uint64)new_val); }    inline void operator = ( long new_val )        { (*this)->write((sc_dt::uint64)new_val); }    inline void operator = ( short new_val )        { (*this)->write((sc_dt::uint64)new_val); }    inline void operator = ( unsigned int new_val )        { (*this)->write((sc_dt::uint64)new_val); }    inline void operator = ( unsigned long new_val )        { (*this)->write((sc_dt::uint64)new_val); }    inline void operator = ( unsigned short new_val )        { (*this)->write((sc_dt::uint64)new_val); }    template<typename T>    inline void operator = ( const sc_dt::sc_generic_base<T>& new_val )        { (*this)->write(new_val->to_uint64()); }    inline void operator = ( const sc_dt::sc_signed& new_val )        { (*this)->write(new_val); }    inline void operator = ( const sc_dt::sc_unsigned& new_val )        { (*this)->write(new_val); }    inline void operator = ( const sc_dt::sc_bv_base& new_val )        { (*this)->write((sc_dt::sc_int<W>)new_val); }    inline void operator = ( const sc_dt::sc_lv_base& new_val )        { (*this)->write((sc_dt::sc_int<W>)new_val); }  private:    // disabled    sc_out( const this_type& );};//------------------------------------------------------------------------------//"sc_int_sigref::initialize"//// This method initializes an object instance from the supplied arguments.//     if_p  -> access to target of this selection.//     left  =  left-most bit in selection.//     right =  right-most bit in selection.//------------------------------------------------------------------------------inline void sc_int_sigref::initialize(sc_int_part_if* if_p, int left, int right){    m_if_p = if_p;    m_left = left;    m_right = right;	m_obj_p = if_p->part_read_target();}//------------------------------------------------------------------------------//"sc_int_sigref::operator ="//// These operators assign a value to the bits associated with this object// instance within this object instance's target signal.//------------------------------------------------------------------------------inline void sc_int_sigref::operator = ( sc_dt::uint64 v ){	m_if_p->write_part( v, m_left, m_right );}inline void sc_int_sigref::operator = ( const char* v ){    // #### *this = (sc_dt::uint64)a;}inline void sc_int_sigref:: operator = ( sc_dt::int64 v ){     *this = (sc_dt::uint64)v; }inline void sc_int_sigref:: operator = ( int v ){     *this = (sc_dt::uint64)v; }inline void sc_int_sigref:: operator = ( long v ){     *this = (sc_dt::uint64)v; }inline void sc_int_sigref:: operator = ( unsigned int v ){     *this = (sc_dt::uint64)v; }inline void sc_int_sigref:: operator = ( unsigned long v ){     *this = (sc_dt::uint64)v; }void sc_int_sigref::operator = ( const sc_int_sigref& v ){    *this = (sc_dt::uint64)v;}template<typename T>inline void sc_int_sigref:: operator = ( const sc_dt::sc_generic_base<T>& v ){     *this = v->to_uint64(); }inline void sc_int_sigref:: operator = ( const sc_dt::sc_signed& v ){     *this = v.to_uint64(); }inline void sc_int_sigref:: operator = ( const sc_dt::sc_unsigned& v ){     *this = v.to_uint64(); }#undef SC_TEMPLATE#undef TTEST} // namespace sc_core#endif // !defined(SC_SIGNAL_INT_H)

⌨️ 快捷键说明

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