static inline A0 asin(const A0& a0) { A0 sign, x; // bf::tie(sign, x) = sign_and_abs(a0); x = abs(a0); sign = bitofsign(a0); A0 x_smaller_1e_4 = lt(x, single_constant<A0, 0x38d1b717>()); //1.0e-4f; A0 x_larger_05 = gt(x, Half<A0>()); A0 x_else = b_or(x_smaller_1e_4, x_larger_05); A0 a = b_and(x, x_smaller_1e_4); A0 b = b_and(Half<A0>()*oneminus(x), x_larger_05); A0 z = b_or(b_or(b_notand(x_else, sqr(x)), a), b); x = b_notand(x_else, x); a = b_and(sqrt(z), x_larger_05); x = b_or(a, x); A0 z1 = madd(z, single_constant<A0, 0x3d2cb352>(), single_constant<A0, 0x3cc617e3>()); z1 = madd(z1, z, single_constant<A0, 0x3d3a3ec7>()); z1 = madd(z1, z, single_constant<A0, 0x3d9980f6>()); z1 = madd(z1, z, single_constant<A0, 0x3e2aaae4>()); z1 = madd(z1, z*x, x); z = select(x_smaller_1e_4, z, z1); z1 = z+z; z1 = Pio_2<A0>()-z1; z = select(x_larger_05, z1, z); return b_xor(z, sign); }
static inline void kernel_log(const A0& a0, A0& fe, A0& x, A0& x2, A0& y) { typedef typename meta::as_integer<A0, signed>::type int_type; typedef typename meta::strip<A0>::type stA0; int_type e; boost::fusion::vector_tie(x, e) = fast_frexp(a0); int_type x_lt_sqrthf = -(single_constant<stA0, 0x3f3504f3>() > x); e += x_lt_sqrthf; // if (x_lt_sqrthf) x+= x; // x += single_constant<A0, 0xbf800000>(); x += b_and(x, x_lt_sqrthf)+single_constant<stA0,0xbf800000>(); x2 = sqr(x); A0 y1 = madd(single_constant<stA0, 0x3d9021bb>() ,x2,single_constant<stA0, 0x3def251a>() ); A0 y2 = madd(single_constant<stA0, 0xbdebd1b8>() ,x2,single_constant<stA0, 0xbdfe5d4f>() ); y1 = madd(y1,x2,single_constant<stA0, 0x3e11e9bf>() ); y2 = madd(y2,x2,single_constant<stA0, 0xbe2aae50>() ); y1 = madd(y1,x2,single_constant<stA0, 0x3e4cceac>() ); y2 = madd(y2,x2,single_constant<stA0, 0xbe7ffffc>() ); y1 = madd(y1,x2,single_constant<stA0, 0x3eaaaaaa>() ); y = madd(x,y2,y1)*x*x2; fe = tofloat(e); }
static inline void kernel_log(const A0& a0, A0& fe, A0& x, A0& x2, A0& y) { typedef typename meta::as_integer<A0, signed>::type int_type; int_type e; boost::fusion::tie(x, e) = fast_frexp(a0); // std::cout << "x " << x << " e " << e << std::endl; // bf::tie(x, e) = frexp(a0); // std::cout << "x " << x << " e " << e << std::endl; int_type x_lt_sqrthf = nt2::simd::native_cast<int_type>(gt(single_constant<A0, 0x3f3504f3>(),x)); e = e+x_lt_sqrthf; x = x+b_and(x, x_lt_sqrthf)+single_constant<A0, 0xbf800000>(); x2 = sqr(x); A0 y1 = madd(single_constant<A0, 0x3d9021bb>() ,x2,single_constant<A0, 0x3def251a>() ); A0 y2 = madd(single_constant<A0, 0xbdebd1b8>() ,x2,single_constant<A0, 0xbdfe5d4f>() ); y1 = madd(y1,x2,single_constant<A0, 0x3e11e9bf>() ); y2 = madd(y2,x2,single_constant<A0, 0xbe2aae50>() ); y1 = madd(y1,x2,single_constant<A0, 0x3e4cceac>() ); y2 = madd(y2,x2,single_constant<A0, 0xbe7ffffc>() ); y1 = madd(y1,x2,single_constant<A0, 0x3eaaaaaa>() ); y = madd(x,y2,y1)*x*x2; fe = tofloat(e); }
inline void kernel_log(const float& a0, float& fe, float& x, float& x2, float& y) { typedef float A0; typedef meta::as_integer<A0, signed>::type int_type; int_type e; boost::fusion::tie(x, e) = fast_frexp(a0); int_type x_lt_sqrthf = -(Const<float, 0x3f3504f3>() > x); e += x_lt_sqrthf; // if (x_lt_sqrthf) x+= x; // x += Const<float, 0xbf800000>(); x += b_and(x, genmask<float>(x_lt_sqrthf))+Const<float,0xbf800000>(); x2 = sqr(x); A0 y1 = fma(Const<float, 0x3d9021bb>() ,x2,Const<float, 0x3def251a>() ); A0 y2 = fma(Const<float, 0xbdebd1b8>() ,x2,Const<float, 0xbdfe5d4f>() ); y1 = fma(y1,x2,Const<float, 0x3e11e9bf>() ); y2 = fma(y2,x2,Const<float, 0xbe2aae50>() ); y1 = fma(y1,x2,Const<float, 0x3e4cceac>() ); y2 = fma(y2,x2,Const<float, 0xbe7ffffc>() ); y1 = fma(y1,x2,Const<float, 0x3eaaaaaa>() ); y = fma(x,y2,y1)*x*x2; fe = tofloat(e); }
static inline void kernel_log(const A0& a0, A0& dk, A0& hfsq, A0& s, A0& R, A0& f) { A0 x; int_type k(fast_frexp(a0, x)); const int_type x_lt_sqrthf = -isgt(Sqrt_2o_2<A0>(), x); k += x_lt_sqrthf; f = minusone(x+b_and(x, genmask<A0>(x_lt_sqrthf))); dk = tofloat(k); s = f/add(Two<A0>(),f); A0 z = sqr(s); A0 w = sqr(z); A0 t1= w*horner<NT2_HORNER_COEFF_T(A0, 3, (0x3fc39a09d078c69fll, 0x3fcc71c51d8e78afll, 0x3fd999999997fa04ll) )> (w); A0 t2= z*horner<NT2_HORNER_COEFF_T(A0, 4, (0x3fc2f112df3e5244ll, 0x3fc7466496cb03dell, 0x3fd2492494229359ll, 0x3fe5555555555593ll) )> (w); R = t2+t1; hfsq = mul(Half<A0>(), sqr(f)); }
static inline void kernel_log(const A0& a0, A0& dk, A0& hfsq, A0& s, A0& R, A0& f) { typedef typename meta::as_integer<A0, signed>::type int_type; typedef typename meta::scalar_of<A0>::type sA0; A0 x; int_type k; boost::fusion::tie(x, k) = fast_frexp(a0); const int_type x_lt_sqrthf = simd::native_cast<int_type>(gt(Sqrt_2o_2<A0>(), x)); k = k+x_lt_sqrthf; f = minusone(x+b_and(x, x_lt_sqrthf)); dk = tofloat(k); s = f/add(Two<A0>(),f); A0 z = sqr(s); A0 w = sqr(z); A0 t1= w*horner<NT2_HORNER_COEFF_T(sA0, 3, (0x3fc39a09d078c69fll, 0x3fcc71c51d8e78afll, 0x3fd999999997fa04ll) )> (w); A0 t2= z*horner<NT2_HORNER_COEFF_T(sA0, 4, (0x3fc2f112df3e5244ll, 0x3fc7466496cb03dell, 0x3fd2492494229359ll, 0x3fe5555555555593ll) )> (w); R = t2+t1; hfsq = mul(Half<A0>(), sqr(f)); }
static inline A0_n kernel_atan(const A0_n a0_n) { typedef typename meta::scalar_of<A0>::type sA0; const A0 tan3pio8 = double_constant<A0, 0x4003504f333f9de6ll>(); // static const A0 Twothird = double_constant<A0, 0x3fe51eb851eb851fll>(); const A0 tanpio8 = double_constant<A0, 0x3fda827999fcef31ll>(); A0 x = { a0_n }; const A0 flag1 = lt(x, tan3pio8); //tan3pio8 const A0 flag2 = b_and(ge(x, tanpio8), flag1); //tanpio8 A0 yy = b_notand(flag1, Pio_2<A0>()); yy = select(flag2, Pio_4<A0>(), yy); A0 xx = select(flag1, x, -rec(x)); xx = select(flag2, minusone(x)/oneplus(x),xx); A0 z = sqr(xx); z = z*horner< NT2_HORNER_COEFF_T(sA0, 5, (0xbfec007fa1f72594ll, 0xc03028545b6b807all, 0xc052c08c36880273ll, 0xc05eb8bf2d05ba25ll, 0xc0503669fd28ec8ell) )>(z)/ horner< NT2_HORNER_COEFF_T(sA0, 6, (0x3ff0000000000000ll, 0x4038dbc45b14603cll, 0x4064a0dd43b8fa25ll, 0x407b0e18d2e2be3bll, 0x407e563f13b049eall, 0x4068519efbbd62ecll) )>(z); z = fma(xx, z, xx); const A0 morebits = double_constant<A0, 0x3c91a62633145c07ll>(); z = seladd(flag2, z, mul(Half<A0>(), morebits)); z = z+b_notand(flag1, morebits); return yy + z; }
void SeniorVMHandle::b_xor(long _register1,long _register2) { b_not_and(_register1,_register2); pop(T_INVALID); b_and(_register1,_register2); pop(T_INVALID); db(HANDLE.b_nand.handle); }
static inline A0 finalize(const A0& a0, const A0& , const A0& c , const A0& k, const A0& , const A0& ) { A0 y = fast_ldexp(c, toint(k)); //adjust for 10^n n flint return sel(b_and(is_gtz(a0), is_flint(a0)), round2even(y), y); }
static inline A0 finalize(const A0& a0, const A0& x, const A0& c, const A0 & k, const A0& ,const A0& ) { A0 y = oneminus(((-(x*c)/(Two<A0>()-c))-x)); y = fast_ldexp(y, toint(k)); // adjust for 2^n n flint return sel(b_and(is_gtz(a0), is_flint(a0)), round2even(y), y); }
void SeniorVMHandle::b_add_b(long _register1,long _register2) { d_push_imm(0); pop(T_TMP_REGISTER3); b_and(_register1,_register2); pop(T_INVALID); b_xor(_register1,_register2); pop(T_INVALID); pop(T_TMP_R8_1H); b_push_imm(1<<7); pop(T_TMP_R8_1L); pop(T_TMP_R8_2H); b_and(T_TMP_R8_2H,T_TMP_R8_1L); pop(T_INVALID); pop(T_TMP_R8_3L); d_shr(T_TMP_REGISTER3,7); pop(T_INVALID); pop(T_TMP_REGISTER3); d_or(T_TMP_REGISTER3,T_TMP_EFLAG); pop(T_INVALID); pop(T_TMP_EFLAG); d_push_imm(0); pop(T_TMP_REGISTER3); b_push_imm(1<<3); pop(T_TMP_R8_3H); b_and(T_TMP_R8_3H,T_TMP_R8_2H); pop(T_INVALID); pop(T_TMP_R8_2L); b_shl(T_TMP_R8_2L,1); pop(T_INVALID); pop(T_TMP_R8_3L); d_or(T_TMP_REGISTER3,T_TMP_EFLAG); pop(T_INVALID); pop(T_TMP_EFLAG); b_shl(T_TMP_R8_2H,1); pop(T_INVALID); pop(T_TMP_R8_2H); }
void emit(int tt, unsigned int tval) { if(tt == UNKNOWN) error("Unknown token"); else if(tt == DONE) error("Unexpected end of expression"); else if(tt == NONE) error("No token in expression"); else if(tt == EOS) error("End of string in expression"); else if(tt == NUM) push(tt, tval); else if(tt == STRING) { if(tval <= 0) error("Unrecognized expression"); else push(tt, tval); } else { /* apply operator */ switch(tt) { case 1: l_orr(); break; case 2: l_and(); break; case 3: b_orr(); break; case 4: b_xor(); break; case 5: b_and(); break; case 6: l_equ(); break; case 7: l_neq(); break; case 8: l_leq(); break; case 9: l_geq(); break; case 10: l_ltt(); break; case 11: l_gtt(); break; case 12: lshift(); break; case 13: l_rshift(); break; case 14: rshift(); break; case 15: plus(); break; case 16: minus(); break; case 17: multiply(); break; case 18: divide(); break; case 19: modulo(); break; case 20: l_not(); break; case 21: b_not(); break; case 22: unaryminus(); break; case 23: unaryplus(); break; default: error("Unknown operator"); } } }
static inline void kernel_log(const A0& a0,A0& fe, A0& x,A0& x2, A0& y, const A0&) { int_type e; bf::tie(x, e) = fast_frexp(a0); int_type x_lt_sqrthf = -(Const<float,0x3f3504f3>() > x); e += x_lt_sqrthf; x += b_and(x, genmask<float>(x_lt_sqrthf))+Const<float,0xbf800000>(); x2 = sqr(x); A0 y1 = fma(Const<float, 0x3d9021bb>() ,x2,Const<float, 0x3def251a>() ); A0 y2 = fma(Const<float, 0xbdebd1b8>() ,x2,Const<float, 0xbdfe5d4f>() ); y1 = fma(y1,x2,Const<float, 0x3e11e9bf>() ); y2 = fma(y2,x2,Const<float, 0xbe2aae50>() ); y1 = fma(y1,x2,Const<float, 0x3e4cceac>() ); y2 = fma(y2,x2,Const<float, 0xbe7ffffc>() ); y1 = fma(y1,x2,Const<float, 0x3eaaaaaa>() ); y = fma(x,y2,y1)*x*x2; fe = tofloat(e); }
static inline A0 atan(const A0& a0) { A0 x, sign; x = nt2::abs(a0); sign = bitofsign(a0); // bf::tie(sign, x) = sign_and_abs(a0); const A0 flag1 = lt(x, single_constant<A0, 0x401a827a>()); //tan3pio8); const A0 flag2 = b_and(ge(x, single_constant<A0, 0x3ed413cd>()), flag1); A0 yy = b_notand(flag1, Pio_2<A0>()); yy = select(flag2, Pio_4<A0>(), yy); A0 xx = select(flag1, x, -rec(x)); xx = select(flag2, (minusone(x)/oneplus(x)),xx); const A0 z = sqr(xx); A0 z1 = madd(z, single_constant<A0, 0x3da4f0d1>(),single_constant<A0, 0xbe0e1b85>()); A0 z2 = madd(z, single_constant<A0, 0x3e4c925f>(),single_constant<A0, 0xbeaaaa2a>()); z1 = madd(z1, sqr(z), z2); yy = add(yy, madd(xx, mul( z1, z), xx)); return b_xor(yy, sign); }
static inline void kernel_log(const A0& a0, A0& fe, A0& x, A0& x2, A0& y) { typedef typename meta::as_integer<A0, signed>::type int_type; int_type e; x = fast_frexp(a0, e); int_type x_lt_sqrthf = if_else_zero(gt(single_constant<A0, 0x3f3504f3>(),x), Mone<int_type>()); e = e+x_lt_sqrthf; x = x+b_and(x, x_lt_sqrthf)+single_constant<A0, 0xbf800000>(); x2 = sqr(x); A0 y1 = madd(single_constant<A0, 0x3d9021bb>() ,x2,single_constant<A0, 0x3def251a>() ); A0 y2 = madd(single_constant<A0, 0xbdebd1b8>() ,x2,single_constant<A0, 0xbdfe5d4f>() ); y1 = madd(y1,x2,single_constant<A0, 0x3e11e9bf>() ); y2 = madd(y2,x2,single_constant<A0, 0xbe2aae50>() ); y1 = madd(y1,x2,single_constant<A0, 0x3e4cceac>() ); y2 = madd(y2,x2,single_constant<A0, 0xbe7ffffc>() ); y1 = madd(y1,x2,single_constant<A0, 0x3eaaaaaa>() ); y = madd(x,y2,y1)*x*x2; fe = tofloat(e); }
); namespace nt2 { namespace ext { template<class X, class Dummy> struct call<tag::negation_(tag::simd_<tag::arithmetic_, X> , tag::simd_<tag::arithmetic_, X> ), tag::cpu_, Dummy> : callable { template<class Sig> struct result; template<class This,class A0> struct result<This(A0,A0)> : meta::strip<A0>{};// NT2_FUNCTOR_CALL(2) { return sel(is_ltz(a1),-a0,b_and(is_nez(a1), a0)); } }; } } ///////////////////////////////////////////////////////////////////////////// // Implementation when type A0 is unsigned ///////////////////////////////////////////////////////////////////////////// NT2_REGISTER_DISPATCH(tag::negation_, tag::cpu_, (A0)(X), ((simd_<unsigned_<A0>,X>)) ((simd_<unsigned_<A0>,X>)) ); namespace nt2 { namespace ext {
namespace nt2 { namespace ext { template<class Dummy> struct call<tag::sqrt_(tag::simd_<tag::uint8_, tag::xop_)), tag::cpu_, Dummy> : callable { template<class Sig> struct result; template<class This,class A0> struct result<This(A0)> : meta::strip<A0>{};// NT2_FUNCTOR_CALL(1) { A0 const na = isnez(a0); A0 n = add(shri(a0, 4), Four<A0>()); A0 n1 = shri(n+a0/n, 1); A0 msk = b_and(isle(n1,n), na); n = select(msk,n1,n); n1 = sqr(n); msk = b_or(isgt(n1,a0), b_and(iseqz(n1), na)); n = seladd( msk, n, Mone<A0>()); return seladd(na, Zero<A0>(), n); } }; } } ///////////////////////////////////////////////////////////////////////////// // Implementation when type A0 is arithmetic_ ///////////////////////////////////////////////////////////////////////////// NT2_REGISTER_DISPATCH(tag::sqrt_, tag::cpu_,
void cover_sc_bit() { sc_bit bdef; sc_bit bf(false); sc_bit bt(true); sc_bit b0(0); sc_bit b1(1); try { sc_bit foo(2); } catch (sc_report) { cout << "Caught exception for sc_bit(2)\n"; } sc_bit bc0('0'); sc_bit bc1('1'); try { sc_bit foo('2'); } catch (sc_report) { cout << "Caught exception for sc_bit('2')\n"; } sc_bit blc0(sc_logic('0')); sc_bit blc1(sc_logic('1')); sc_bit blcx(sc_logic('X')); sc_bit bcop(bt); cout << bdef << bf << bt << b0 << b1 << bc0 << bc1 << blc0 << blc1 << blcx << bcop << endl; sc_bit b; b = bt; sc_assert(b); b = 0; sc_assert(!b); b = true; sc_assert(b.to_bool()); b = '0'; sc_assert(!b.to_bool()); b = sc_logic('1'); sc_assert(b.to_char() == '1'); b = bf; sc_assert(~b); b |= bt; sc_assert(b); b &= bf; sc_assert(!b); b |= 1; sc_assert(b); b &= 0; sc_assert(!b); b |= '1'; sc_assert(b); b &= '0'; sc_assert(!b); b |= true; sc_assert(b); b &= false; sc_assert(!b); b ^= bt; sc_assert(b); b ^= 1; sc_assert(!b); b ^= '1'; sc_assert(b); b ^= true; sc_assert(!b); sc_assert(b == bf); sc_assert(b == 0); sc_assert(b == '0'); sc_assert(b == false); b = 1; sc_assert(b == bt); sc_assert(b == 1); sc_assert(b == '1'); sc_assert(b == true); sc_assert(1 == b); sc_assert('1' == b); sc_assert(true == b); sc_assert(equal(b, bt)); sc_assert(equal(b, 1)); sc_assert(equal(b, '1')); sc_assert(equal(b, true)); sc_assert(equal(1, b)); sc_assert(equal('1', b)); sc_assert(equal(true, b)); b = 0; sc_assert(b != bt); sc_assert(b != 1); sc_assert(b != '1'); sc_assert(b != true); sc_assert(1 != b); sc_assert('1' != b); sc_assert(true != b); sc_assert(not_equal(b, bt)); sc_assert(not_equal(b, 1)); sc_assert(not_equal(b, '1')); sc_assert(not_equal(b, true)); sc_assert(not_equal(1, b)); sc_assert(not_equal('1', b)); sc_assert(not_equal(true, b)); // the following assertion is incorrect, because the b_not() method // is destructive, i.e., it implements something like b ~= void. /// sc_assert(b == b_not(b.b_not())); b.b_not(); sc_assert(b); sc_bit bx; b_not(bx, b0); sc_assert(bx); b_not(bx, b1); sc_assert(!bx); cout << (b0|b0) << (b0|b1) << (b1|b0) << (b1|b1) << endl; cout << (b0&b0) << (b0&b1) << (b1&b0) << (b1&b1) << endl; cout << (b0^b0) << (b0^b1) << (b1^b0) << (b1^b1) << endl; cout << (b0|0) << (b0|1) << (b1|0) << (b1|1) << endl; cout << (b0&0) << (b0&1) << (b1&0) << (b1&1) << endl; cout << (b0^0) << (b0^1) << (b1^0) << (b1^1) << endl; cout << (b0|'0') << (b0|'1') << (b1|'0') << (b1|'1') << endl; cout << (b0&'0') << (b0&'1') << (b1&'0') << (b1&'1') << endl; cout << (b0^'0') << (b0^'1') << (b1^'0') << (b1^'1') << endl; cout << (b0|true) << (b0|false) << (b1|true) << (b1|false) << endl; cout << (b0&true) << (b0&false) << (b1&true) << (b1&false) << endl; cout << (b0^true) << (b0^false) << (b1^true) << (b1^false) << endl; cout << (0|b0) << (0|b1) << (1|b0) << (1|b1) << endl; cout << (0&b0) << (0&b1) << (1&b0) << (1&b1) << endl; cout << (0^b0) << (0^b1) << (1^b0) << (1^b1) << endl; cout << ('0'|b0) << ('0'|b1) << ('1'|b0) << ('1'|b1) << endl; cout << ('0'&b0) << ('0'&b1) << ('1'&b0) << ('1'&b1) << endl; cout << ('0'^b0) << ('0'^b1) << ('1'^b0) << ('1'^b1) << endl; cout << (false|b0) << (false|b1) << (true|b0) << (true|b1) << endl; cout << (false&b0) << (false&b1) << (true&b0) << (true&b1) << endl; cout << (false^b0) << (false^b1) << (true^b0) << (true^b1) << endl; cout << b_or(b0,b0) << b_or(b0,b1) << b_or(b1,b0) << b_or(b1,b1) << endl; cout << b_and(b0,b0) << b_and(b0,b1) << b_and(b1,b0) << b_and(b1,b1) << endl; cout << b_xor(b0,b0) << b_xor(b0,b1) << b_xor(b1,b0) << b_xor(b1,b1) << endl; cout << b_or(b0,0) << b_or(b0,1) << b_or(b1,0) << b_or(b1,1) << endl; cout << b_and(b0,0) << b_and(b0,1) << b_and(b1,0) << b_and(b1,1) << endl; cout << b_xor(b0,0) << b_xor(b0,1) << b_xor(b1,0) << b_xor(b1,1) << endl; cout << b_or(b0,'0') << b_or(b0,'1') << b_or(b1,'0') << b_or(b1,'1') << endl; cout << b_and(b0,'0') << b_and(b0,'1') << b_and(b1,'0') << b_and(b1,'1') << endl; cout << b_xor(b0,'0') << b_xor(b0,'1') << b_xor(b1,'0') << b_xor(b1,'1') << endl; cout << b_or(b0,false) << b_or(b0,true) << b_or(b1,false) << b_or(b1,true) << endl; cout << b_and(b0,false) << b_and(b0,true) << b_and(b1,false) << b_and(b1,true) << endl; cout << b_xor(b0,false) << b_xor(b0,true) << b_xor(b1,false) << b_xor(b1,true) << endl; cout << b_or(0,b0) << b_or(0,b1) << b_or(1,b0) << b_or(1,b1) << endl; cout << b_and(0,b0) << b_and(0,b1) << b_and(1,b0) << b_and(1,b1) << endl; cout << b_xor(0,b0) << b_xor(0,b1) << b_xor(1,b0) << b_xor(1,b1) << endl; cout << b_or('0',b0) << b_or('0',b1) << b_or('1',b0) << b_or('1',b1) << endl; cout << b_and('0',b0) << b_and('0',b1) << b_and('1',b0) << b_and('1',b1) << endl; cout << b_xor('0',b0) << b_xor('0',b1) << b_xor('1',b0) << b_xor('1',b1) << endl; cout << b_or(false,b0) << b_or(false,b1) << b_or(true,b0) << b_or(true,b1) << endl; cout << b_and(false,b0) << b_and(false,b1) << b_and(true,b0) << b_and(true,b1) << endl; cout << b_xor(false,b0) << b_xor(false,b1) << b_xor(true,b0) << b_xor(true,b1) << endl; b_or(b, b0, b1); sc_assert(b); b_and(b, b0, b1); sc_assert(!b); b_xor(b, b0, b1); sc_assert(b); }