00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045 sc_unsigned_bitref_r::operator uint64 () const
00046 {
00047 return m_obj_p->test( m_index );
00048 }
00049
00050 bool
00051 sc_unsigned_bitref_r::operator ! () const
00052 {
00053 return ( ! m_obj_p->test( m_index ) );
00054 }
00055
00056 bool
00057 sc_unsigned_bitref_r::operator ~ () const
00058 {
00059 return ( ! m_obj_p->test( m_index ) );
00060 }
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071 const sc_unsigned_bitref&
00072 sc_unsigned_bitref::operator = ( const sc_unsigned_bitref_r& b )
00073 {
00074 m_obj_p->set( m_index, (bool) b );
00075 return *this;
00076 }
00077
00078 const sc_unsigned_bitref&
00079 sc_unsigned_bitref::operator = ( const sc_unsigned_bitref& b )
00080 {
00081 m_obj_p->set( m_index, (bool) b );
00082 return *this;
00083 }
00084
00085 const sc_unsigned_bitref&
00086 sc_unsigned_bitref::operator = ( bool b )
00087 {
00088 m_obj_p->set( m_index, b );
00089 return *this;
00090 }
00091
00092
00093 const sc_unsigned_bitref&
00094 sc_unsigned_bitref::operator &= ( bool b )
00095 {
00096 if( ! b ) {
00097 m_obj_p->clear( m_index );
00098 }
00099 return *this;
00100 }
00101
00102 const sc_unsigned_bitref&
00103 sc_unsigned_bitref::operator |= ( bool b )
00104 {
00105 if( b ) {
00106 m_obj_p->set( m_index );
00107 }
00108 return *this;
00109 }
00110
00111 const sc_unsigned_bitref&
00112 sc_unsigned_bitref::operator ^= ( bool b )
00113 {
00114 if( b ) {
00115 m_obj_p->invert( m_index );
00116 }
00117 return *this;
00118 }
00119
00120
00121 void sc_unsigned_bitref::concat_set(int64 src, int low_i)
00122 {
00123 bool value = 1 & ((low_i < 64) ? (src >> low_i) : (src >> 63));
00124 m_obj_p->set(low_i, value);
00125 }
00126
00127 void sc_unsigned_bitref::concat_set(const sc_signed& src, int low_i)
00128 {
00129 if ( low_i < src.length() )
00130 m_obj_p->set(low_i, src.test(low_i));
00131 else
00132 m_obj_p->set(low_i, src<0);
00133 }
00134
00135 void sc_unsigned_bitref::concat_set(const sc_unsigned& src, int low_i)
00136 {
00137 if ( low_i < src.nbits )
00138 m_obj_p->set(low_i, src.test(low_i));
00139 else
00140 m_obj_p->set(low_i, 0);
00141 }
00142
00143 void sc_unsigned_bitref::concat_set(uint64 src, int low_i)
00144 {
00145 bool value = ((low_i < 64) ? (src >> low_i)&1 : 0);
00146 m_obj_p->set(low_i, value);
00147 }
00148
00149
00150
00151 void
00152 sc_unsigned_bitref::scan( ::std::istream& is )
00153 {
00154 bool b;
00155 is >> b;
00156 *this = b;
00157 }
00158
00159
00160