107 static void invalid_value(
char );
108 static void invalid_value(
int );
112 if( v < Log_0 || v >
Log_X ) {
125 unsigned int index = (int)c;
132 return char_to_logic[index];
137 if( i < Log_0 || i >
Log_X ) {
146 void invalid_01()
const;
153 static const char logic_to_char[4];
171 : m_val( to_value( v ) )
175 : m_val( to_value( a ) )
179 : m_val( to_value( a ) )
183 : m_val( to_value( a ) )
187 : m_val( to_value( a.to_bool() ) )
199#define DEFN_ASN_OP_T(op,tp) \
200 sc_logic& operator op ( tp v ) \
201 { *this op sc_logic( v ); return *this; }
203#define DEFN_ASN_OP(op) \
204 DEFN_ASN_OP_T(op, sc_logic_value_t) \
205 DEFN_ASN_OP_T(op, bool) \
206 DEFN_ASN_OP_T(op, char) \
207 DEFN_ASN_OP_T(op, int ) \
208 DEFN_ASN_OP_T(op, sc_bit )
211 { m_val = a.m_val;
return *
this; }
214 { m_val = and_table[m_val][
b.
m_val];
return *
this; }
217 { m_val = or_table[m_val][
b.
m_val];
return *
this; }
220 { m_val = xor_table[m_val][
b.
m_val];
return *
this; }
246 {
return sc_logic( not_table[m_val] ); }
249 { m_val = not_table[m_val];
return *
this; }
259 {
return ( (
int) m_val ==
Log_0 || (
int) m_val ==
Log_1 ); }
262 {
if( ! is_01() ) { invalid_01(); }
return ( (
int) m_val !=
Log_0 ); }
265 {
return logic_to_char[m_val]; }
270 void print( ::std::ostream& os = ::std::cout )
const
273 void scan( ::std::istream& is = ::std::cin );
278 static void*
operator new( std::size_t,
void* p )
281 static void*
operator new( std::size_t sz )
284 static void operator delete(
void* p, std::size_t sz )
287 static void*
operator new [] ( std::size_t sz )
290 static void operator delete [] (
void* p, std::size_t sz )
301 sc_logic& operator = (
const char* );
317#define DEFN_BIN_OP_T(ret,op,tp) \
318 inline ret operator op ( const sc_logic& a, tp b ) \
319 { return ( a op sc_logic( b ) ); } \
320 inline ret operator op ( tp a, const sc_logic& b ) \
321 { return ( sc_logic( a ) op b ); }
323#define DEFN_BIN_OP(ret,op) \
324 DEFN_BIN_OP_T(ret,op,sc_logic_value_t) \
325 DEFN_BIN_OP_T(ret,op,bool) \
326 DEFN_BIN_OP_T(ret,op,char) \
327 DEFN_BIN_OP_T(ret,op,int)
336 {
return ( (
int) a.m_val ==
b.
m_val ); }
339 {
return ( (
int) a.m_val !=
b.
m_val ); }
#define DEFN_BIN_OP(ret, op)
X & operator|=(sc_proxy< X > &px, const sc_proxy< Y > &py)
SC_API const sc_logic SC_LOGIC_0
SC_API const sc_logic SC_LOGIC_X
SC_API const sc_logic sc_logic_1
sc_bit operator&(const sc_bit &a, const sc_bit &b)
sc_bit operator^(const sc_bit &a, const sc_bit &b)
X & operator^=(sc_proxy< X > &px, const sc_proxy< Y > &py)
bool operator==(const sc_bit &a, const sc_bit &b)
SC_API const sc_logic sc_logic_0
SC_API const sc_logic sc_logic_X
SC_API const sc_logic SC_LOGIC_Z
X & operator&=(sc_proxy< X > &px, const sc_proxy< Y > &py)
SC_API const sc_logic SC_LOGIC_1
bool operator!=(const sc_bit &a, const sc_bit &b)
inline::std::istream & operator>>(::std::istream &is, sc_bit &a)
SC_API const sc_logic sc_logic_Z
inline::std::ostream & operator<<(::std::ostream &os, const sc_bit &a)
uint64 const sc_uint_base int b
sc_bit operator~(const sc_bit &a)
sc_bit operator|(const sc_bit &a, const sc_bit &b)
static const sc_logic_value_t or_table[4][4]
sc_logic(const sc_bit &a)
static const sc_logic_value_t xor_table[4][4]
static const sc_logic_value_t and_table[4][4]
sc_logic(const sc_logic &a)
void scan(::std::istream &is=::std::cin)
sc_logic(sc_logic_value_t v)
void print(::std::ostream &os=::std::cout) const
sc_logic_value_t value() const
static void release(void *p, std::size_t sz)
static void * allocate(std::size_t sz)