mirror of
https://github.com/soconnor0919/eceg431.git
synced 2025-12-11 22:54:43 -05:00
Implement basic logic gates: Not, And, Or, Xor, Mux, DMux
This commit is contained in:
@@ -11,5 +11,10 @@ CHIP Xor {
|
||||
OUT out;
|
||||
|
||||
PARTS:
|
||||
//// Replace this comment with your code.
|
||||
}
|
||||
// Xor(a,b) = Or(And(a, Not(b)), And(Not(a), b))
|
||||
Not(in=a, out=notA);
|
||||
Not(in=b, out=notB);
|
||||
And(a=a, b=notB, out=aAndNotB);
|
||||
And(a=notA, b=b, out=notAAndB);
|
||||
Or(a=aAndNotB, b=notAAndB, out=out);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user