This commit is contained in:
Nemo 2020-05-19 18:45:05 +05:30
parent 627d56f1eb
commit 2cfa691be3
2 changed files with 15 additions and 3 deletions

View File

@ -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:
}
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);
}

9
projects/01/Mux.out Normal file
View File

@ -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 |