1
Ethics of Computing MONT 113G, Spring 2012
Session 5Binary Addition
2
Half adders and Full adders
A half adder adds 2 binary digits and outputs a sum and a carry bit.
A full adder adds 3 binary digits and outputs a sum and a carry bit.
These can be used together to add 2 binary integers.
3
Adding Binary Integers with Circuits
a7 a6 a5 a4 a3 a2 a1 a0+ b7 b6 b5 b4 b3 b2 b1 b0
a0b0
½adder
s0
a1b1
c0full adder
c1full adderb2
a2
s1
s2
c2
etc.
c0c1c2c3c4c5c6c7
s0s1s2s3s4s5s6s7
4
Universal Building Blocks
One can build any logical circuit with the following gates:2 input AND gate2 input OR gateInverter
In fact, one can build any logical circuit with just 1 type of gate:2 input NAND
5
Everything from NANDNOT
atrue
z = a
AND
ab z = a b
true
ORa
b
z = a V btrue
true
a true output0 1 11 1 0