bit nand(bit a, bit b) { bit r; a = maskBit(a); // make sure no spurious bits get by! b = maskBit(b); r = ~(a & b) & 0x01; return r; }
/* * bit nor(bit, bit); * Takes two bits and returns the logical NOT OR of the bits */ bit nor(bit a, bit b) { bit r; a = maskBit(a); // make sure no spurious bits get by! b = maskBit(b); r = maskBit(not(or(a , b))); return r; }
/* * bit not(bit); * Returns the logical NOT of the bit provided. */ bit not(bit a) { bit r; a = maskBit(a); // make sure no spurious bits get by! r = maskBit(~a); return r; }
/* * bit or(bit, bit); * Takes two bits and returns the logical OR of the bits. */ bit or(bit a, bit b) { bit r; a = maskBit(a); // make sure no spurious bits get by! b = maskBit(b); r = maskBit(a | b); return r; }
Bit not(Bit a) { Bit r; a = maskBit(a); // make sure no spurious bits get by! r = (~a) & 0x01; return r; }