Initial Commit with everything done
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
// 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:
|
||||
Not(in=a,out=negA);
|
||||
Not(in=b,out=negB);
|
||||
Not(in=sel,out=negSel);
|
||||
And(a=a,b=b,out=out1);
|
||||
And(a=a,b=negSel,out=out2);
|
||||
And(a=b,b=sel,out=out3);
|
||||
Or(a=out1,b=out2,out=xOut);
|
||||
Or(a=xOut,b=out3,out=out);
|
||||
}
|
||||
Reference in New Issue
Block a user