예제 #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;
}
예제 #2
0
파일: logic_gate.c 프로젝트: tuckerd/ALU_C
/*
* 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;
}
예제 #3
0
파일: logic_gate.c 프로젝트: tuckerd/ALU_C
/*
* 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;
}
예제 #4
0
파일: logic_gate.c 프로젝트: tuckerd/ALU_C
/*
* 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;
}
예제 #5
0
Bit not(Bit a) {
    Bit r;

    a = maskBit(a);    // make sure no spurious bits get by!
    r = (~a) & 0x01;

    return r;
}