first commit
This commit is contained in:
19
project-1-boolean-logic/01/Mux.hdl
Executable file
19
project-1-boolean-logic/01/Mux.hdl
Executable file
@@ -0,0 +1,19 @@
|
||||
// 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 );
|
||||
}
|
||||
Reference in New Issue
Block a user