diff --git a/projects/01/Mux.hdl b/projects/01/Mux.hdl index 6220f3f..78d2b09 100644 --- a/projects/01/Mux.hdl +++ b/projects/01/Mux.hdl @@ -3,7 +3,7 @@ // by Nisan and Schocken, MIT Press. // File name: projects/01/Mux.hdl -/** +/** * Multiplexor: * out = a if sel == 0 * b otherwise @@ -14,5 +14,8 @@ CHIP Mux { OUT out; PARTS: - // Put your code here: -} \ No newline at end of file + Not(in=sel, out=n); + And(a=a, b=n, out=x); + And(a=b, b=sel, out=y); + Or(a=x, b=y, out=out); +} diff --git a/projects/01/Mux.out b/projects/01/Mux.out new file mode 100644 index 0000000..e4b51c6 --- /dev/null +++ b/projects/01/Mux.out @@ -0,0 +1,9 @@ +| a | b | sel | out | +| 0 | 0 | 0 | 0 | +| 0 | 0 | 1 | 0 | +| 0 | 1 | 0 | 0 | +| 0 | 1 | 1 | 1 | +| 1 | 0 | 0 | 1 | +| 1 | 0 | 1 | 0 | +| 1 | 1 | 0 | 1 | +| 1 | 1 | 1 | 1 |