19 lines
422 B
Plaintext
Executable File
19 lines
422 B
Plaintext
Executable File
// 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/1/Mux.hdl
|
|
/**
|
|
* Multiplexor:
|
|
* if (sel = 0) out = a, else out = b
|
|
*/
|
|
CHIP Mux {
|
|
IN a, b, sel;
|
|
OUT out;
|
|
|
|
PARTS:
|
|
|
|
Not(in=sel,out=notSel);
|
|
And(a= a, b= notSel, out= andA);
|
|
And(a= b, b= sel, out= andB);
|
|
Xor(a= andA , b= andB, out=out );
|
|
} |