// 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/Mux.hdl /** * Multiplexor: * out = a if sel == 0 * b otherwise */ CHIP Mux { IN a, b, sel; OUT out; PARTS: // Put your code here: Nand(a=sel, b=b, out=out1); Nand(a=out1, b=out1, out=out2); Nand(a=sel, b=sel, out=out3); Nand(a=a, b=out3, out=out4); Nand(a=out4, b=out4, out=out5); //Nand(a=out2, b=out5, out=out); //Nand(a=out6, b=out6, out=out); //OR Nand(a=out2, b=out2, out=out6); Nand(a=out5, b=out5, out=out7); Nand(a=out6, b=out7, out=out); }