mirror of
https://github.com/StepanovPlaton/Nand2Tetris.git
synced 2026-04-03 20:30:47 +04:00
18 lines
399 B
Plaintext
18 lines
399 B
Plaintext
// 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=nsel);
|
|
And(a=nsel, b=a, out=aa);
|
|
And(a=sel, b=b, out=bb);
|
|
Or(a=aa, b=bb, out=out);
|
|
} |