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

📄 sc_unsigned.h

📁 system C源码 一种替代verilog的语言
💻 H
📖 第 1 页 / 共 5 页
字号:
    virtual ~sc_unsigned_bitref_r()	{}    // copy constructor    sc_unsigned_bitref_r( const sc_unsigned_bitref_r& a )	: m_index( a.m_index ), m_obj_p( a.m_obj_p )	{}    // capacity    int length() const	{ return 1; }    // implicit conversion to bool    operator uint64 () const;    bool operator ! () const;    bool operator ~ () const;    // explicit conversions    uint64 value() const	{ return operator uint64(); }    bool to_bool() const	{ return operator uint64(); }    // concatenation support    virtual int concat_length(bool* xz_present_p) const        { if ( xz_present_p ) *xz_present_p = false; return 1; }    virtual uint64 concat_get_uint64() const        { return (uint64)operator uint64(); }    virtual bool concat_get_ctrl( sc_digit* dst_p, int low_i ) const        {            int  bit_mask = 1 << (low_i % BITS_PER_DIGIT);            int  word_i = low_i / BITS_PER_DIGIT;	    dst_p[word_i] &= ~bit_mask;	    return false;        }    virtual bool concat_get_data( sc_digit* dst_p, int low_i ) const        {            int  bit_mask = 1 << (low_i % BITS_PER_DIGIT);	    bool result;	// True if non-zero.            int  word_i = low_i / BITS_PER_DIGIT;            if ( operator uint64() )	    {                dst_p[word_i] |= bit_mask;		result = true;	    }            else	    {                dst_p[word_i] &= ~bit_mask;		result = false;	    }	    return result;        }    // other methods    void print( ::std::ostream& os = ::std::cout ) const	{ os << to_bool(); }protected:    int          m_index;    sc_unsigned* m_obj_p;private:    // disabled    const sc_unsigned_bitref_r& operator = ( const sc_unsigned_bitref_r& );};inline::std::ostream&operator << ( ::std::ostream&, const sc_unsigned_bitref_r& );// ----------------------------------------------------------------------------//  CLASS : sc_unsigned_bitref////  Proxy class for sc_unsigned bit selection (r-value and l-value).// ----------------------------------------------------------------------------class sc_unsigned_bitref    : public sc_unsigned_bitref_r{    friend class sc_unsigned;    friend class sc_core::sc_vpool<sc_unsigned_bitref>;protected: // construction    sc_unsigned_bitref()        {}public:    // copy constructor    sc_unsigned_bitref( const sc_unsigned_bitref& a )	: sc_unsigned_bitref_r( a )	{}    // assignment operators    const sc_unsigned_bitref& operator = ( const sc_unsigned_bitref_r& );    const sc_unsigned_bitref& operator = ( const sc_unsigned_bitref& );    const sc_unsigned_bitref& operator = ( bool );    const sc_unsigned_bitref& operator &= ( bool );    const sc_unsigned_bitref& operator |= ( bool );    const sc_unsigned_bitref& operator ^= ( bool );    // concatenation methods    virtual void concat_set(int64 src, int low_i);    virtual void concat_set(const sc_signed& src, int low_i);    virtual void concat_set(const sc_unsigned& src, int low_i);    virtual void concat_set(uint64 src, int low_i);    // other methods    void scan( ::std::istream& is = ::std::cin );protected:    static sc_core::sc_vpool<sc_unsigned_bitref> m_pool;};inline::std::istream&operator >> ( ::std::istream&, sc_unsigned_bitref& );// ----------------------------------------------------------------------------//  CLASS : sc_unsigned_subref_r////  Proxy class for sc_unsigned part selection (r-value only).// ----------------------------------------------------------------------------class sc_unsigned_subref_r : public sc_value_base{    friend class sc_signed;    friend class sc_unsigned;    friend class sc_unsigned_signal;protected:    // constructor    sc_unsigned_subref_r()	{}    void initialize( const sc_unsigned* obj_p, int left_, int right_ )	{	    m_obj_p = CCAST<sc_unsigned*>( obj_p );	    m_left = left_;	    m_right = right_;	}public:    // destructor    virtual ~sc_unsigned_subref_r()	{}    // copy constructor    sc_unsigned_subref_r( const sc_unsigned_subref_r& a )	: m_left( a.m_left ), m_obj_p( a.m_obj_p ), m_right( a.m_right )	{}    // capacity    int length() const	{ return m_left >= m_right ? (m_left-m_right+1) : (m_right-m_left+1 ); }    // implicit conversion to sc_unsigned    operator sc_unsigned () const;    // explicit conversions    int           to_int() const;    unsigned int  to_uint() const;    long          to_long() const;    unsigned long to_ulong() const;    int64         to_int64() const;    uint64        to_uint64() const;    double        to_double() const;    // explicit conversion to character string    const std::string to_string( sc_numrep numrep = SC_DEC ) const;    const std::string to_string( sc_numrep numrep, bool w_prefix ) const;    // concatenation support    virtual int concat_length(bool* xz_present_p) const	{	    if ( xz_present_p ) *xz_present_p = false;	    return m_left - m_right + 1;	}    virtual uint64 concat_get_uint64() const;    virtual bool concat_get_ctrl( sc_digit* dst_p, int low_i ) const;    virtual bool concat_get_data( sc_digit* dst_p, int low_i ) const;    // reduce methods    bool and_reduce() const;    bool nand_reduce() const;    bool or_reduce() const;    bool nor_reduce() const;    bool xor_reduce() const ;    bool xnor_reduce() const;    // other methods    void print( ::std::ostream& os = ::std::cout ) const	{ os << to_string(sc_io_base(os,SC_DEC),sc_io_show_base(os)); }protected:    int          m_left;   // Left-most bit in this part selection.    sc_unsigned* m_obj_p;  // Target of this part selection.    int          m_right;  // Right-most bit in this part selection.private:    // disabled    const sc_unsigned_subref_r& operator = ( const sc_unsigned_subref_r& );};inline::std::ostream&operator << ( ::std::ostream&, const sc_unsigned_subref_r& );// ----------------------------------------------------------------------------//  CLASS : sc_unsigned_subref////  Proxy class for sc_unsigned part selection (r-value and l-value).// ----------------------------------------------------------------------------class sc_unsigned_subref    : public sc_unsigned_subref_r{    friend class sc_unsigned;    friend class sc_core::sc_vpool<sc_unsigned_subref>;    // constructorprotected:    sc_unsigned_subref()	{}public:    // copy constructor    sc_unsigned_subref( const sc_unsigned_subref& a )	: sc_unsigned_subref_r( a )	{}    // assignment operators    const sc_unsigned_subref& operator = ( const sc_unsigned_subref_r& a );    const sc_unsigned_subref& operator = ( const sc_unsigned_subref& a );    const sc_unsigned_subref& operator = ( const sc_unsigned& a );    template<class T>    const sc_unsigned_subref& operator = ( const sc_generic_base<T>& a );    const sc_unsigned_subref& operator = ( const sc_signed_subref_r& a );    const sc_unsigned_subref& operator = ( const sc_signed& a );    const sc_unsigned_subref& operator = ( const char* a );    const sc_unsigned_subref& operator = ( unsigned long a );    const sc_unsigned_subref& operator = ( long a );    const sc_unsigned_subref& operator = ( unsigned int a )	{ return operator = ( (unsigned long) a ); }    const sc_unsigned_subref& operator = ( int a )	{ return operator = ( (long) a ); }    const sc_unsigned_subref& operator = ( uint64 a );    const sc_unsigned_subref& operator = ( int64 a );    const sc_unsigned_subref& operator = ( double a );    const sc_unsigned_subref& operator = ( const sc_int_base& a );    const sc_unsigned_subref& operator = ( const sc_uint_base& a );    // concatenation methods    virtual void concat_set(int64 src, int low_i);

⌨️ 快捷键说明

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