Files
2022-09-14 23:17:40 +09:00

23 lines
444 B
Plaintext

// This file is part of www.nand2tetris.org
// and the book "The Elements of Computing Systems"
// by Nisan and Schocken, MIT Press.
// File name: projects/01/Xor.hdl
/**
* Exclusive-or gate:
* out = not (a == b)
*/
CHIP Xor {
IN a, b;
OUT out;
PARTS:
// Put your code here:
Nand(a=a, b=a, out=w1);
Nand(a=b, b=b, out=w2);
Nand(a=a, b=w2, out=w3);
Nand(a=b, b=w1, out=w4);
Nand(a=w3, b=w4, out=out);
}