Files
nand-to-tetris/projects/01/Xor.hdl
T

22 lines
465 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=out1);
Nand(a=b, b=b, out=out2);
Nand(a=out1, b=b, out=out3);
Nand(a=out2, b=a, out=out4);
Nand(a=out3, b=out4, out=out);
}