106 static void invalid_value(
char );
107 static void invalid_value(
int );
111 if( v < Log_0 || v >
Log_X ) {
123 unsigned int index = (int)c;
132 if( v < Log_0 || v >
Log_X ) {
141 if( i < 0 || i > 3 ) {
148 void invalid_01()
const;
173 : m_val( to_value( v ) )
177 : m_val( to_value( a ) )
181 : m_val( to_value( a ) )
185 : m_val( to_value( a ) )
189 : m_val( to_value( a.
to_bool() ) )
201 #define DEFN_ASN_OP_T(op,tp) \
202 sc_logic& operator op ( tp v ) \
203 { *this op sc_logic( v ); return *this; }
205 #define DEFN_ASN_OP(op) \
206 DEFN_ASN_OP_T(op, sc_logic_value_t) \
207 DEFN_ASN_OP_T(op, bool) \
208 DEFN_ASN_OP_T(op, char) \
209 DEFN_ASN_OP_T(op, int ) \
210 DEFN_ASN_OP_T(op, const sc_bit& )
213 { m_val = a.m_val;
return *
this; }
216 { m_val =
and_table[m_val][b.m_val];
return *
this; }
219 { m_val =
or_table[m_val][b.m_val];
return *
this; }
222 { m_val =
xor_table[m_val][b.m_val];
return *
this; }
251 { m_val =
not_table[m_val];
return *
this; }
261 {
return ( (
int) m_val ==
Log_0 || (
int) m_val ==
Log_1 ); }
264 {
if( !
is_01() ) { invalid_01(); }
return ( (
int) m_val !=
Log_0 ); }
272 void print( ::std::ostream& os = ::std::cout )
const
275 void scan( ::std::istream& is = ::std::cin );
280 static void*
operator new( std::size_t,
void* p )
283 static void*
operator new( std::size_t sz )
286 static void operator delete(
void* p, std::size_t sz )
289 static void*
operator new [] ( std::size_t sz )
292 static void operator delete [] (
void* p, std::size_t sz )
319 #define DEFN_BIN_OP_T(ret,op,tp) \
320 inline ret operator op ( const sc_logic& a, tp b ) \
321 { return ( a op sc_logic( b ) ); } \
322 inline ret operator op ( tp a, const sc_logic& b ) \
323 { return ( sc_logic( a ) op b ); }
325 #define DEFN_BIN_OP(ret,op) \
326 DEFN_BIN_OP_T(ret,op,sc_logic_value_t) \
327 DEFN_BIN_OP_T(ret,op,bool) \
328 DEFN_BIN_OP_T(ret,op,char) \
329 DEFN_BIN_OP_T(ret,op,int)
337 inline
bool operator == ( const sc_logic& a, const sc_logic& b )
338 {
return ( (
int) a.m_val == b.m_val ); }
341 {
return ( (
int) a.m_val != b.m_val ); }
const sc_logic SC_LOGIC_Z
const sc_bit operator|(const sc_bit &a, const sc_bit &b)
sc_logic & operator^=(const sc_logic &b)
const sc_logic SC_LOGIC_X
const sc_bit operator^(const sc_bit &a, const sc_bit &b)
sc_logic(const sc_bit &a)
sc_logic_value_t value() const
const sc_logic sc_logic_X
friend const sc_logic operator|(const sc_logic &, const sc_logic &)
void print(::std::ostream &os=::std::cout) const
static const char logic_to_char[4]
uint64 const sc_uint_base int b
const sc_logic operator~() const
bool operator!=(const sc_bit &a, const sc_bit &b)
friend bool operator==(const sc_logic &, const sc_logic &)
#define DEFN_BIN_OP(ret, op)
const sc_logic sc_logic_1
static const sc_logic_value_t xor_table[4][4]
inline::std::istream & operator>>(::std::istream &is, sc_bit &a)
static const sc_logic_value_t or_table[4][4]
sc_logic & operator=(const sc_logic &a)
friend bool operator!=(const sc_logic &, const sc_logic &)
static void * allocate(std::size_t sz)
sc_logic(const sc_logic &a)
sc_logic & operator|=(const sc_logic &b)
void scan(::std::istream &is=::std::cin)
static const sc_logic_value_t char_to_logic[128]
const sc_logic SC_LOGIC_0
static const sc_logic_value_t and_table[4][4]
const sc_logic sc_logic_Z
const sc_logic sc_logic_0
sc_logic(sc_logic_value_t v)
inline::std::ostream & operator<<(::std::ostream &os, const sc_bit &a)
friend const sc_logic operator^(const sc_logic &, const sc_logic &)
friend const sc_logic operator&(const sc_logic &, const sc_logic &)
const sc_logic SC_LOGIC_1
static void release(void *p, std::size_t sz)
sc_logic & operator&=(const sc_logic &b)
static const sc_logic_value_t not_table[4]
const sc_bit operator&(const sc_bit &a, const sc_bit &b)