输入 0 1 值进行运算
using sc_16 = unsigned short;
//...code
// 0 = 0b-00000000-00000000
// 1 = 0b-00000000-00000001
#define TO_1 (sc_16)1
sc_16 sc_and(sc_16 vL, sc_16 vR)
{
return sc_16(vL & vR);
}
sc_16 sc_or(sc_16 vL, sc_16 vR)
{
return sc_16(vL | vR);
}
sc_16 sc_not(sc_16 v)
{
/*
*not(1) = 0b- 1111 1111 1111 1110
*and(1,not(1)) = 0b-0000 0000 0000 0000
*not(0) = 0b- 1111 1111 1111 1111
*and(1,not(0)) = 0b- 0000 0000 0000 0001
*/
return sc_16( (~v) & TO_1);
}