Re: Full-Adder (3 Gates)
Posted by WBahn on May 20, 2019; 9:37pm
URL: http://nand2tetris-questions-and-answers-forum.52.s1.nabble.com/Full-Adder-3-Gates-tp4029696p4033187.html
Don't worry, we'll get you there.
Think about how you add two normal decimal numbers together.
Unfortunately, I don't know how to force a fixed-width font so it's hard to make sure that things will line up properly, but let's say you wanted to add
45
+37
-------
How would you do it (or, more to the point, how would a second grader do it)?
You add the one's digits -- the 5 and the 7 -- to get 12. You bring down the 2 as the one's digit of the final answer and you carry the 1 from the ten's digit and add it to the other ten's digit values -- the 4 and the 3v-- to get the final value for the ten's digit in the answer (plus possible a carry to the hundred's digit).
You do the same thing in binary, except instead of the digits being the one's, the ten's, the hundred's, etc, they are the one's, the two's, the four's, the eight's, etc.
If you need a refresher, go do a search on positional numbering systems.
Let's take the extreme example of three 1-bit numbers.
1+1+1
I add the first two together to get 10 using a half adder. This is my subtotal (or partial sum). I add the one's digit of the partial sum (which is 0) to the third number (which is 1) using a half adder and I get a result of 01. The one's digit from this IS the one's digit in my final sum. I know have two digits that have a weight of 2, the 1 from the first operation and the 0 from the second. I add those together to get 01. The 1 is the final two's digit and the 0 is the final four's digit. Since the sum of three one bit numbers is always less than four, I can ignore this output because it will always be zero.