Adds MUX
This commit is contained in:
parent
627d56f1eb
commit
2cfa691be3
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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 |
|
Loading…
Reference in New Issue