Exemple #1
0
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;
}
Exemple #2
0
/*
* 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;
}
Exemple #3
0
/*
* 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;
}
Exemple #4
0
/*
* 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;
}