Worst FullAdder you've ever seen
This commit is contained in:
parent
67e8249e7e
commit
b6ebd26215
|
@ -13,5 +13,10 @@ CHIP FullAdder {
|
|||
carry; // Left bit of a + b + c
|
||||
|
||||
PARTS:
|
||||
// Put you code here:
|
||||
HalfAdder(a=b, b=c, sum=is, carry=ic);
|
||||
Not(in=is, out=nis);
|
||||
Mux(a=is, b=nis, sel=a, out=sum);
|
||||
|
||||
Or(a=is, b=ic, out=carryifaisone);
|
||||
Mux(a=ic, b=carryifaisone, sel=a, out=carry);
|
||||
}
|
|
@ -0,0 +1,9 @@
|
|||
| a | b | c | sum | carry |
|
||||
| 0 | 0 | 0 | 0 | 0 |
|
||||
| 0 | 0 | 1 | 1 | 0 |
|
||||
| 0 | 1 | 0 | 1 | 0 |
|
||||
| 0 | 1 | 1 | 0 | 1 |
|
||||
| 1 | 0 | 0 | 1 | 0 |
|
||||
| 1 | 0 | 1 | 0 | 1 |
|
||||
| 1 | 1 | 0 | 0 | 1 |
|
||||
| 1 | 1 | 1 | 1 | 1 |
|
Loading…
Reference in New Issue