Full Adder
It’s take 1 year and 18 days for me to write the second part of this post about how to create a Full Adder. I originally wrote a post that demonstrated how to create a half adder logic circuit from simple logic statements in Python. The next stage is to create a full adder to be able to add more than 1 bit binary numbers. This is the logic diagram: I used the half adder I created over a year ago to create a full adder.
1 2 3 4 5 6 7 8 |
def halfadder(a,b): def fulladder (a, b, c): d = halfadder(a, b) e = halfadder (d[0], c) f = d[1] or e[1] return f, e[0] |
The Truth table looks like this:
A | B | Carry-In | Sum | Carry-Out |
0 | 0 | 0 | 0 | 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 |
This was not too hard, I don’t why took me so long. Probably something to do with my attention.