96 static void invalid_value(
char );
97 static void invalid_value(
int );
99 static bool to_value(
char c )
101 if( c !=
'0' && c !=
'1' ) {
104 return ( c ==
'0' ?
false :
true );
107 static bool to_value(
int i )
109 if( i != 0 && i != 1 ) {
112 return ( i == 0 ?
false :
true );
114 static bool to_value(
bool b )
117 #define DEFN_TO_VALUE_T(tp) \ 118 static bool to_value( tp i ) \ 119 { return to_value( (int) i); } 127 #undef DEFN_TO_VALUE_T 140 #define DEFN_CTOR_T(tp) \ 141 explicit sc_bit( tp a ) \ 142 : m_val( to_value(a) ) \ 143 { sc_deprecated_sc_bit(); } 156 explicit sc_bit(
const sc_logic& a );
178 { m_val = b.m_val;
return *
this; }
180 #define DEFN_ASN_OP_T(op,tp) \ 181 sc_bit& operator op( tp b ) \ 182 { return ( *this op sc_bit( b ) ); } 183 #define DEFN_ASN_OP(op) \ 184 DEFN_ASN_OP_T(op,int) \ 185 DEFN_ASN_OP_T(op,bool) \ 186 DEFN_ASN_OP_T(op,char) 191 DEFN_ASN_OP_T(=,
long)
192 DEFN_ASN_OP_T(=,
unsigned long)
194 sc_bit& operator = ( const
sc_logic& b );
200 { m_val = ( m_val && b.m_val );
return *
this; }
203 { m_val = ( m_val || b.m_val );
return *
this; }
206 { m_val = ( m_val != b.m_val );
return *
this; }
220 operator bool ()
const 223 bool operator ! () const
233 {
return ( m_val ?
'1' :
'0' ); }
254 { m_val = ( ! m_val );
return *
this; }
264 void print( ::std::ostream& os = ::std::cout )
const 267 void scan( ::std::istream& = ::std::cin );
276 #define DEFN_BIN_FUN_T(ret,fun,tp) \ 277 inline ret fun( const sc_bit& a, tp b ) \ 278 { return fun(a, sc_bit(b) ); } \ 279 inline ret fun( tp b, const sc_bit& a ) \ 280 { return fun( sc_bit(a), b ); } 282 #define DEFN_BIN_FUN(ret,fun) \ 283 DEFN_BIN_FUN_T(ret,fun,bool) \ 284 DEFN_BIN_FUN_T(ret,fun,char) \ 285 DEFN_BIN_FUN_T(ret,fun,int) 290 {
return ( a.m_val == b.m_val ); }
293 {
return ( a.m_val != b.m_val ); }
301 {
return ( a == b ); }
304 {
return ( a != b ); }
317 {
return sc_bit( ! a.m_val ); }
336 {
return sc_bit( a.m_val && b.m_val ); }
339 {
return sc_bit( a.m_val || b.m_val ); }
342 {
return sc_bit( a.m_val != b.m_val ); }
365 #define DEFN_TRN_FUN_T(fun,tp) \ 366 inline void fun( sc_bit& r, const sc_bit& a, tp b ) \ 367 { r = fun( a, sc_bit(b) ); } \ 368 inline void fun( sc_bit& r, tp a, const sc_bit& b ) \ 369 { r = fun( sc_bit(a), b ); } 371 #define DEFN_TRN_FUN(fun) \ 372 inline void fun( sc_bit& r, const sc_bit& a, const sc_bit& b ) \ 373 { r = fun( a , b ); } \ 374 DEFN_TRN_FUN_T(fun,int) \ 375 DEFN_TRN_FUN_T(fun,bool) \ 376 DEFN_TRN_FUN_T(fun,char) 382 #undef DEFN_BIN_FUN_T 384 #undef DEFN_TRN_FUN_T
bool not_equal(const sc_bit &a, const sc_bit &b)
#define DEFN_ASN_OP_T(op, tp)
bool operator==(const sc_bit &a, const sc_bit &b)
bool equal(const sc_bit &a, const sc_bit &b)
void sc_deprecated_sc_bit()
X & operator|=(sc_proxy< X > &px, const sc_proxy< Y > &py)
#define DEFN_TO_VALUE_T(tp)
uint64 const sc_uint_base int b
const sc_bit b_or(const sc_bit &a, const sc_bit &b)
bool operator!=(const sc_bit &a, const sc_bit &b)
const sc_bit b_not(const sc_bit &a)
const sc_bit operator|(const sc_bit &a, const sc_bit &b)
void print(::std::ostream &os=::std::cout) const
#define DEFN_BIN_FUN(ret, fun)
const sc_bit operator^(const sc_bit &a, const sc_bit &b)
X & operator^=(sc_proxy< X > &px, const sc_proxy< Y > &py)
const sc_bit b_xor(const sc_bit &a, const sc_bit &b)
#define DEFN_TRN_FUN(fun)
const sc_bit b_and(const sc_bit &a, const sc_bit &b)
const sc_bit operator&(const sc_bit &a, const sc_bit &b)
Top level header file for arbitrary precision signed/unsigned.
void scan(::std::istream &=::std::cin)
inline ::std::ostream & operator<<(::std::ostream &os, const sc_bit &a)
const sc_bit operator~(const sc_bit &a)
inline ::std::istream & operator>>(::std::istream &is, sc_bit &a)