62#ifndef __SYSTEMC_EXT_DT_BIT_SC_BIT_HH__
63#define __SYSTEMC_EXT_DT_BIT_SC_BIT_HH__
97 if (
c !=
'0' &&
c !=
'1') {
100 return (
c ==
'0' ?
false :
true);
106 if (i != 0 && i != 1) {
109 return (i == 0 ?
false :
true);
113#define DEFN_TO_VALUE_T(tp) \
114 static bool to_value(tp i) { return to_value((int)i); }
122#undef DEFN_TO_VALUE_T
129#define DEFN_CTOR_T(tp) \
130 explicit sc_bit(tp a) : m_val(to_value(a)) { sc_deprecated_sc_bit(); }
143 explicit sc_bit(
const sc_logic &
a);
162#define DEFN_ASN_OP_T(op, tp) \
163 sc_bit &operator op(tp b) { return (*this op sc_bit(b)); }
164#define DEFN_ASN_OP(op) \
165 DEFN_ASN_OP_T(op,int) \
166 DEFN_ASN_OP_T(op,bool) \
167 DEFN_ASN_OP_T(op,char)
175 sc_bit &operator = (const sc_logic &
b);
210 operator bool ()
const {
return m_val; }
246 void scan(::std::istream & =::std::cin);
255#define DEFN_BIN_FUN_T(ret,fun,tp) \
256 inline ret fun(const sc_bit& a, tp b) { return fun(a, sc_bit(b)); } \
257 inline ret fun(tp b, const sc_bit &a) { return fun(sc_bit(a), b); }
259#define DEFN_BIN_FUN(ret,fun) \
260 DEFN_BIN_FUN_T(ret,fun,bool) \
261 DEFN_BIN_FUN_T(ret,fun,char) \
262 DEFN_BIN_FUN_T(ret,fun,int)
268 return (
a.m_val ==
b.m_val);
274 return (
a.m_val !=
b.m_val);
338#define DEFN_TRN_FUN_T(fun,tp) \
340 fun(sc_bit &r, const sc_bit &a, tp b) \
341 { r = fun(a, sc_bit(b)); } \
343 fun(sc_bit &r, tp a, const sc_bit &b) \
344 { r = fun(sc_bit(a), b); }
346#define DEFN_TRN_FUN(fun) \
348 fun(sc_bit &r, const sc_bit &a, const sc_bit &b) { r = fun(a , b); } \
349 DEFN_TRN_FUN_T(fun, int) \
350 DEFN_TRN_FUN_T(fun, bool) \
351 DEFN_TRN_FUN_T(fun, char)
365inline ::std::ostream &
372inline ::std::istream &
friend bool operator==(const sc_bit &a, const sc_bit &b)
static bool to_value(char c)
sc_bit & operator=(const sc_bit &b)
friend const sc_bit operator|(const sc_bit &a, const sc_bit &b)
static bool to_value(bool b)
sc_bit & operator|=(const sc_bit &b)
friend const sc_bit operator^(const sc_bit &a, const sc_bit &b)
void print(::std::ostream &os=::std::cout) const
friend const sc_bit operator~(const sc_bit &a)
sc_bit & operator^=(const sc_bit &b)
friend const sc_bit operator&(const sc_bit &a, const sc_bit &b)
static bool to_value(int i)
void scan(::std::istream &=::std::cin)
static void invalid_value(char)
friend bool operator!=(const sc_bit &a, const sc_bit &b)
const sc_bit b_xor(const sc_bit &a, const sc_bit &b)
const sc_bit b_and(const sc_bit &a, const sc_bit &b)
const sc_bit b_not(const sc_bit &a)
sc_signed operator|(const sc_unsigned &u, const sc_int_base &v)
sc_signed operator&(const sc_unsigned &u, const sc_int_base &v)
sc_signed operator^(const sc_unsigned &u, const sc_int_base &v)
bool operator==(const sc_signed &u, const sc_int_base &v)
bool equal(const sc_bit &a, const sc_bit &b)
void sc_deprecated_sc_bit()
bool not_equal(const sc_bit &a, const sc_bit &b)
bool operator!=(const sc_signed &u, const sc_int_base &v)
sc_signed operator<<(const sc_signed &u, const sc_int_base &v)
sc_signed operator>>(const sc_signed &u, const sc_int_base &v)
const sc_bit b_or(const sc_bit &a, const sc_bit &b)
#define DEFN_BIN_FUN(ret, fun)
#define DEFN_TRN_FUN(fun)
#define DEFN_ASN_OP_T(op, tp)
#define DEFN_TO_VALUE_T(tp)