How do we add two numbers using logic gates?

1 Answer
Apr 9, 2017

Answer:

See explanation...

Explanation:

Suppose you have #3# bits, represented by Boolean values #a#, #b# and #c#. That is true represents #1# and false represents #0#.

The result of adding #a#, #b# and #c# modulo #2# is:

#(a ^^ b ^^ c) vv (a ^^ not b ^^ not c) vv (not a ^^ b ^^ not c) vv (not a ^^ not b ^^ c)#

In fact, if you denote exclusive or by #o+# then an alternative expression for this is simply:

#a o+ b o+ c#

In logic gates this looks like:
enter image source here

The overflow/carry bit resulting from adding #a#, #b# and #c# is:

#(a ^^ b) vv (a ^^ c) vv (b ^^ c)#

In logic gates this expression could be implemented like this:

enter image source here

The combination of these two arrangements of logic gates implement a #1# bit binary adder with carry in and out.

When you add two binary numbers using long addition, for each column (starting from the rightmost column) take #a# from the first number, #b# from the second number and #c# from the carry from the previous column.

Then the two complex operations we found will give you the result digit and the carry digit for the next column.

To add more than one binary column at a time, you can chain as many one bit adders as you require together.