// 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 = !(a == b). */ CHIP Xor { IN a, b; OUT out; PARTS: Not(in=a,out=na); Not(in=b,out=nb); And(a=na,b=b,out=c); And(a=a,b=nb,out=d); Or(a=c,b=d,out=out); }