Worst FullAdder you've ever seen

This commit is contained in:
Nemo 2020-05-20 16:38:32 +05:30
parent 67e8249e7e
commit b6ebd26215
2 changed files with 16 additions and 2 deletions

View File

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

View File

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