1 ethics of computing mont 113g, spring 2012 session 5 binary addition

5
1 Ethics of Computing MONT 113G, Spring 2012 Session 5 Binary Addition

Upload: shawn-washington

Post on 14-Jan-2016

214 views

Category:

Documents


1 download

TRANSCRIPT

Page 1: 1 Ethics of Computing MONT 113G, Spring 2012 Session 5 Binary Addition

1

Ethics of Computing MONT 113G, Spring 2012

Session 5Binary Addition

Page 2: 1 Ethics of Computing MONT 113G, Spring 2012 Session 5 Binary 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.

Page 3: 1 Ethics of Computing MONT 113G, Spring 2012 Session 5 Binary Addition

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

Page 4: 1 Ethics of Computing MONT 113G, Spring 2012 Session 5 Binary Addition

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

Page 5: 1 Ethics of Computing MONT 113G, Spring 2012 Session 5 Binary Addition

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