Go to the documentation of this file.
62 #ifndef __SYSTEMC_EXT_DT_BIT_SC_BIT_HH__
63 #define __SYSTEMC_EXT_DT_BIT_SC_BIT_HH__
67 #include "../int/sc_nbdefs.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(); }
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);
295 inline const sc_bit operator ~ (const sc_bit &
a) {
return sc_bit(!
a.m_val); }
301 inline void b_not(sc_bit &
r,
const sc_bit &
a) {
r = (~
a); }
320 return sc_bit(
a.m_val !=
b.m_val);
330 inline const sc_bit
b_xor(
const sc_bit &
a,
const sc_bit &
b) {
return a ^
b; }
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)
357 #undef DEFN_BIN_FUN_T
359 #undef DEFN_TRN_FUN_T
365 inline ::std::ostream &
372 inline ::std::istream &
381 #endif // __SYSTEMC_EXT_DT_BIT_SC_BIT_HH__
bool not_equal(const sc_bit &a, const sc_bit &b)
sc_signed operator|(const sc_unsigned &u, const sc_int_base &v)
bool equal(const sc_bit &a, const sc_bit &b)
void sc_deprecated_sc_bit()
const friend sc_bit operator^(const sc_bit &a, const sc_bit &b)
sc_signed operator<<(const sc_signed &u, const sc_int_base &v)
const friend sc_bit operator|(const sc_bit &a, const sc_bit &b)
static void invalid_value(char)
sc_signed operator^(const sc_unsigned &u, const sc_int_base &v)
bool operator==(const sc_signed &u, const sc_int_base &v)
sc_bit & operator=(const sc_bit &b)
const sc_bit b_and(const sc_bit &a, const sc_bit &b)
#define DEFN_BIN_FUN(ret, fun)
const friend sc_bit operator~(const sc_bit &a)
#define DEFN_TO_VALUE_T(tp)
void scan(::std::istream &=::std::cin)
bool operator!=(const sc_signed &u, const sc_int_base &v)
friend bool operator==(const sc_bit &a, const sc_bit &b)
void print(::std::ostream &os=::std::cout) const
static bool to_value(char c)
#define DEFN_TRN_FUN(fun)
const sc_bit b_or(const sc_bit &a, const sc_bit &b)
sc_signed operator>>(const sc_signed &u, const sc_int_base &v)
const friend sc_bit operator&(const sc_bit &a, const sc_bit &b)
friend bool operator!=(const sc_bit &a, const sc_bit &b)
#define DEFN_ASN_OP_T(op, tp)
sc_bit & operator^=(const sc_bit &b)
const sc_bit b_xor(const sc_bit &a, const sc_bit &b)
sc_bit & operator|=(const sc_bit &b)
sc_signed operator&(const sc_unsigned &u, const sc_int_base &v)
const sc_bit b_not(const sc_bit &a)
Generated on Wed Sep 30 2020 14:02:15 for gem5 by doxygen 1.8.17