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

📄 sc_fxnum.h

📁 system C源码 一种替代verilog的语言
💻 H
📖 第 1 页 / 共 5 页
字号:
// implicit conversioninlinesc_fxnum_fast_bitref::operator bool() const{    SC_FXNUM_FAST_OBSERVER_READ_( m_num )    return get();}inline::std::ostream&operator << ( ::std::ostream& os, const sc_fxnum_fast_bitref& a ){    a.print( os );    return os;}inline::std::istream&operator >> ( ::std::istream& is, sc_fxnum_fast_bitref& a ){    a.scan( is );    return is;}// ----------------------------------------------------------------------------//  CLASS : sc_fxnum_subref////  Proxy class for part-selection in class sc_fxnum,//  behaves like sc_bv_base.// ----------------------------------------------------------------------------// constructorinlinesc_fxnum_subref::sc_fxnum_subref( sc_fxnum& num_, int from_, int to_ )    : m_num( num_ ), m_from( from_ ), m_to( to_ ),      m_bv( *new sc_bv_base( sc_max( m_from, m_to ) -			     sc_min( m_from, m_to ) + 1 ) ){}// copy constructorinlinesc_fxnum_subref::sc_fxnum_subref( const sc_fxnum_subref& a )    : m_num( a.m_num ), m_from( a.m_from ), m_to( a.m_to ),      m_bv( *new sc_bv_base( a.m_bv ) ){}// destructorinlinesc_fxnum_subref::~sc_fxnum_subref(){    delete &m_bv;}// assignment operatorsinlinesc_fxnum_subref&sc_fxnum_subref::operator = ( const sc_fxnum_subref& a ){    if( &a != this )    {	m_bv = static_cast<sc_bv_base>( a );	set();	SC_FXNUM_OBSERVER_WRITE_( m_num )    }    return *this;}inlinesc_fxnum_subref&sc_fxnum_subref::operator = ( const sc_fxnum_fast_subref& a ){    m_bv = static_cast<sc_bv_base>( a );    set();    SC_FXNUM_OBSERVER_WRITE_( m_num )    return *this;}#define DEFN_ASN_OP_T(tp)                                                     \inline                                                                        \sc_fxnum_subref&                                                              \sc_fxnum_subref::operator = ( tp a )                                          \{                                                                             \    m_bv = a;                                                                 \    set();                                                                    \    SC_FXNUM_OBSERVER_WRITE_( m_num )                                         \    return *this;                                                             \}DEFN_ASN_OP_T(const sc_bv_base&)DEFN_ASN_OP_T(const sc_lv_base&)DEFN_ASN_OP_T(const char*)DEFN_ASN_OP_T(const bool*)DEFN_ASN_OP_T(const sc_signed&)DEFN_ASN_OP_T(const sc_unsigned&)DEFN_ASN_OP_T(const sc_int_base&)DEFN_ASN_OP_T(const sc_uint_base&)DEFN_ASN_OP_T(int64)DEFN_ASN_OP_T(uint64)DEFN_ASN_OP_T(int)DEFN_ASN_OP_T(unsigned int)DEFN_ASN_OP_T(long)DEFN_ASN_OP_T(unsigned long)DEFN_ASN_OP_T(char)#undef DEFN_ASN_OP_T#define DEFN_ASN_OP_T(op,tp)                                                  \inline                                                                        \sc_fxnum_subref&                                                              \sc_fxnum_subref::operator op ## = ( tp a )                                    \{                                                                             \    SC_FXNUM_OBSERVER_READ_( m_num )                                          \    get();                                                                    \    m_bv = m_bv op a;                                                         \    set();                                                                    \    SC_FXNUM_OBSERVER_WRITE_( m_num )                                         \    return *this;                                                             \}#define DEFN_ASN_OP(op)                                                       \inline                                                                        \sc_fxnum_subref&                                                              \sc_fxnum_subref::operator op ## = ( const sc_fxnum_subref& a )                \{                                                                             \    SC_FXNUM_OBSERVER_READ_( m_num )                                          \    get();                                                                    \    m_bv = m_bv op static_cast<sc_bv_base>( a );                              \    set();                                                                    \    SC_FXNUM_OBSERVER_WRITE_( m_num )                                         \    return *this;                                                             \}                                                                             \                                                                              \inline                                                                        \sc_fxnum_subref&                                                              \sc_fxnum_subref::operator op ## = ( const sc_fxnum_fast_subref& a )           \{                                                                             \    SC_FXNUM_OBSERVER_READ_( m_num )                                          \    get();                                                                    \    m_bv = m_bv op static_cast<sc_bv_base>( a );                              \    set();                                                                    \    SC_FXNUM_OBSERVER_WRITE_( m_num )                                         \    return *this;                                                             \}                                                                             \                                                                              \DEFN_ASN_OP_T(op,const sc_bv_base&)                                           \DEFN_ASN_OP_T(op,const sc_lv_base&)DEFN_ASN_OP(&)DEFN_ASN_OP(|)DEFN_ASN_OP(^)#undef DEFN_ASN_OP_T#undef DEFN_ASN_OP// relational operators#define DEFN_REL_OP_T(op,tp)                                                  \inline                                                                        \bool                                                                          \operator op ( const sc_fxnum_subref& a, tp b )                                \{                                                                             \    return ( static_cast<sc_bv_base>( a ) op b );                             \}                                                                             \                                                                              \inline                                                                        \bool                                                                          \operator op ( tp a, const sc_fxnum_subref& b )                                \{                                                                             \    return ( static_cast<sc_bv_base>( b ) op a );                             \}#define DEFN_REL_OP(op)                                                       \inline                                                                        \bool                                                                          \operator op ( const sc_fxnum_subref& a, const sc_fxnum_subref& b )            \{                                                                             \    return ( static_cast<sc_bv_base>( a ) op static_cast<sc_bv_base>( b ) );  \}                                                                             \                                                                              \inline                                                                        \bool                                                                          \operator op ( const sc_fxnum_subref& a, const sc_fxnum_fast_subref& b )       \{                                                                             \    return ( static_cast<sc_bv_base>( a ) op static_cast<sc_bv_base>( b ) );  \}                                                                             \                                                                              \DEFN_REL_OP_T(op,const sc_bv_base&)                                           \DEFN_REL_OP_T(op,const sc_lv_base&)                                           \DEFN_REL_OP_T(op,const char*)                                                 \DEFN_REL_OP_T(op,const bool*)                                                 \DEFN_REL_OP_T(op,const sc_signed&)                                            \DEFN_REL_OP_T(op,const sc_unsigned&)                                          \DEFN_REL_OP_T(op,int)                                                         \DEFN_REL_OP_T(op,unsigned int)                                                \DEFN_REL_OP_T(op,long)                                                        \DEFN_REL_OP_T(op,unsigned long)DEFN_REL_OP(==)DEFN_REL_OP(!=)#undef DEFN_REL_OP_T#undef DEFN_REL_OP// reduce functions#define DEFN_RED_FNC(fnc)                                                     \inline                                                                        \bool                                                                          \sc_fxnum_subref::fnc() const                                                  \{                                                                             \    SC_FXNUM_OBSERVER_READ_( m_num )                                          \    get();                                                                    \    return static_cast<bool>( m_bv.fnc() );                                   \}DEFN_RED_FNC(and_reduce)DEFN_RED_FNC(nand_reduce)DEFN_RED_FNC(or_reduce)DEFN_RED_FNC(nor_reduce)DEFN_RED_FNC(xor_reduce)DEFN_RED_FNC(xnor_reduce)#undef DEFN_RED_FNC// query parameterinlineintsc_fxnum_subref::length() const{    return m_bv.length();}// explicit conversionsinlineintsc_fxnum_subref::to_int() const{    SC_FXNUM_OBSERVER_READ_( m_num )    get();    return m_bv.to_int();}inlineint64sc_fxnum_subref::to_int64() const{    SC_FXNUM_OBSERVER_READ_( m_num )    get();    return m_bv.to_int64();}inlineunsigned intsc_fxnum_subref::to_uint() const{    SC_FXNUM_OBSERVER_READ_( m_num )    get();    return m_bv.to_uint();}inlineuint64sc_fxnum_subref::to_uint64() const{    SC_FXNUM_OBSERVER_READ_( m_num )    get();    return m_bv.to_uint64();}inlinelongsc_fxnum_subref::to_long() const{    SC_FXNUM_OBSERVER_READ_( m_num )    get();    return m_bv.to_long();}inlineunsigned longsc_fxnum_subref::to_ulong() const{    SC_FXNUM_OBSERVER_READ_( m_num )    get();    return m_bv.to_ulong();}#ifdef SC_DT_DEPRECATEDinlineintsc_fxnum_subref::to_signed() const{    return to_int();}inlineunsigned intsc_fxnum_subref::to_unsigned() const{    return to_uint();}#endifinlineconst std::stringsc_fxnum_subref::to_string() const{    get();    return m_bv.to_string();}inlineconst std::stringsc_fxnum_subref::to_string( sc_numrep numrep ) const{    get();    return m_bv.to_string( numrep );}inlineconst std::stringsc_fxnum_subref::to_string( sc_numrep numrep, bool w_prefix ) const{    get();    return m_bv.to_string( numrep, w_prefix );}// implicit conversioninlinesc_fxnum_subref::operator sc_bv_base () const{    SC_FXNUM_OBSERVER_READ_( m_num )    get();    return m_bv;}inline::std::ostream&operator << ( ::std::ostream& os, const sc_fxnum_subref& a ){    a.print( os );    return os;}inline::std::istream&operator >> ( ::std::istream& is, sc_fxnum_subref& a ){    a.scan( is );    return is;}// ----------------------------------------------------------------------------//  CLASS : sc_fxnum_fast_subref////  Proxy class for part-selection in class sc_fxnum_fast,//  behaves like sc_bv_base.// ----------------------------------------------------------------------------// constructorinlinesc_fxnum_fast_subref::sc_fxnum_fast_subref( sc_fxnum_fast& num_,					    int from_, int to_ )    : m_num( num_ ), m_from( from_ ), m_to( to_ ),      m_bv( *new sc_bv_base( sc_max( m_from, m_to ) -			     sc_min( m_from, m_to ) + 1 ) ){}// copy constructorinlinesc_fxnum_fast_subref::sc_fxnum_fast_subref( const sc_fxnum_fast_subref& a )    : m_num( a.m_num ), m_from( a.m_from ), m_to( a.m_to ),      m_bv( *new sc_bv_base( a.m_bv ) ){}// destructorinlinesc_fxnum_fast_subref::~sc_fxnum_fast_subref(){    delete &m_bv;}// assignment operatorsinlinesc_fxnum_fast_subref&sc_fxnum_fast_subref::operator = ( const sc_fxnum_subref& a ){    m_bv = static_cast<sc_bv_base>( a );    set();    SC_FXNUM_FAST_OBSERVER_WRITE_( m_num )    return *this;}inlinesc_fxnum_fast_subref&sc_fxnum_fast_subref::operator = ( const sc_fxnum_fast_subref& a ){    if( &a != this )    {	m_bv = static_cast<sc_bv_base>( a );	set();	SC_FXNUM_FAST_OBSERVER_WRITE_( m_num )    }    return *this;}#define DEFN_ASN_OP_T(tp)                                                     \inline                                                                        \sc_fxnum_fast_subref&                                                         \sc_fxnum_fast_subref::operator = ( tp a )                                     \{                                                                             \    m_bv = a;                                                                 \    set();                                                                    \    SC_FXNUM_FAST_OBSERVER_WRITE_( m_num )                                    \    return *this;                                      

⌨️ 快捷键说明

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