111 static void invalid_value(
char );
112 static void invalid_value(
int );
116 if( v < Log_0 || v >
Log_X ) {
129 unsigned int index = (int)c;
136 return char_to_logic[index];
141 if( i < Log_0 || i >
Log_X ) {
150 void invalid_01()
const;
157 static const char logic_to_char[4];
175 : m_val( to_value( v ) )
179 : m_val( to_value( a ) )
183 : m_val( to_value( a ) )
187 : m_val( to_value( a ) )
191 : m_val( to_value( a.to_bool() ) )
203 #define DEFN_ASN_OP_T(op,tp) \ 204 sc_logic& operator op ( tp v ) \ 205 { *this op sc_logic( v ); return *this; } 207 #define DEFN_ASN_OP(op) \ 208 DEFN_ASN_OP_T(op, sc_logic_value_t) \ 209 DEFN_ASN_OP_T(op, bool) \ 210 DEFN_ASN_OP_T(op, char) \ 211 DEFN_ASN_OP_T(op, int ) \ 212 DEFN_ASN_OP_T(op, const sc_bit& ) 215 { m_val = a.m_val;
return *
this; }
218 { m_val = and_table[m_val][b.m_val];
return *
this; }
221 { m_val = or_table[m_val][b.m_val];
return *
this; }
224 { m_val = xor_table[m_val][b.m_val];
return *
this; }
250 {
return sc_logic( not_table[m_val] ); }
253 { m_val = not_table[m_val];
return *
this; }
263 {
return ( (
int) m_val ==
Log_0 || (
int) m_val ==
Log_1 ); }
266 {
if( ! is_01() ) { invalid_01(); }
return ( (
int) m_val !=
Log_0 ); }
269 {
return logic_to_char[m_val]; }
274 void print( ::std::ostream& os = ::std::cout )
const 277 void scan( ::std::istream& is = ::std::cin );
282 static void*
operator new( std::size_t,
void* p )
285 static void*
operator new( std::size_t sz )
288 static void operator delete(
void* p, std::size_t sz )
291 static void*
operator new [] ( std::size_t sz )
294 static void operator delete [] (
void* p, std::size_t sz )
305 sc_logic& operator = (
const char* );
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 ); }
static const sc_logic_value_t and_table[4][4]
SC_API const sc_logic SC_LOGIC_X
static void release(void *p, std::size_t sz)
void scan(::std::istream &is=::std::cin)
bool operator==(const sc_bit &a, const sc_bit &b)
X & operator&=(sc_proxy< X > &px, const sc_proxy< Y > &py)
sc_logic(const sc_bit &a)
SC_API const sc_logic SC_LOGIC_0
X & operator|=(sc_proxy< X > &px, const sc_proxy< Y > &py)
SC_API const sc_logic sc_logic_Z
SC_API const sc_logic sc_logic_X
sc_logic(sc_logic_value_t v)
void print(::std::ostream &os=::std::cout) const
sc_logic_value_t
Enumeration of values for sc_logic.
uint64 const sc_uint_base int b
bool operator!=(const sc_bit &a, const sc_bit &b)
const sc_bit operator|(const sc_bit &a, const sc_bit &b)
SC_API const sc_logic sc_logic_1
Miscellaneous definitions that are needed by the headers.
static const sc_logic_value_t xor_table[4][4]
sc_logic_value_t value() const
SC_API const sc_logic SC_LOGIC_1
SC_API const sc_logic SC_LOGIC_Z
const sc_bit operator^(const sc_bit &a, const sc_bit &b)
X & operator^=(sc_proxy< X > &px, const sc_proxy< Y > &py)
#define DEFN_BIN_OP(ret, op)
const sc_bit operator&(const sc_bit &a, const sc_bit &b)
sc_logic(const sc_logic &a)
static void * allocate(std::size_t sz)
static const sc_logic_value_t or_table[4][4]
inline ::std::ostream & operator<<(::std::ostream &os, const sc_bit &a)
SC_API const sc_logic sc_logic_0
const sc_bit operator~(const sc_bit &a)
inline ::std::istream & operator>>(::std::istream &is, sc_bit &a)