21
INF2270 — Spring 2011 Lecture 1: Digital Representation

INF2270 — Spring 2011€¦ · Lecture 1: Digital Representation 4. A Short History of Computers æ The Analytical Engine by Charles Babbage in 1837 (mechanical) æ G. Stibitz’

  • Upload
    others

  • View
    2

  • Download
    0

Embed Size (px)

Citation preview

Page 1: INF2270 — Spring 2011€¦ · Lecture 1: Digital Representation 4. A Short History of Computers æ The Analytical Engine by Charles Babbage in 1837 (mechanical) æ G. Stibitz’

INF2270 — Spring 2011

Lecture 1: Digital Representation

Page 2: INF2270 — Spring 2011€¦ · Lecture 1: Digital Representation 4. A Short History of Computers æ The Analytical Engine by Charles Babbage in 1837 (mechanical) æ G. Stibitz’

content

Background

Binary Numbers

Boolean Algebra

Lecture 1: Digital Representation 2

Page 3: INF2270 — Spring 2011€¦ · Lecture 1: Digital Representation 4. A Short History of Computers æ The Analytical Engine by Charles Babbage in 1837 (mechanical) æ G. Stibitz’

content

Background

Binary Numbers

Boolean Algebra

Lecture 1: Digital Representation 3

Page 4: INF2270 — Spring 2011€¦ · Lecture 1: Digital Representation 4. A Short History of Computers æ The Analytical Engine by Charles Babbage in 1837 (mechanical) æ G. Stibitz’

Digital Electronics

æ Digital electronics is everywhere: PCs, cell phones,DVD and MP3 players, cameras, cars, fridges ...

æ ’Digital’ comes from latin ’digitus’ meaning ’finger’which we often use for discrete counting

æ Digital representation: discontinuous/discreterepresentation (discrete numbers/integers/Z) asopposed to analog/continuous

Lecture 1: Digital Representation 4

Page 5: INF2270 — Spring 2011€¦ · Lecture 1: Digital Representation 4. A Short History of Computers æ The Analytical Engine by Charles Babbage in 1837 (mechanical) æ G. Stibitz’

A Short History of Computers

æ The Analytical Engine by Charles Babbage in 1837(mechanical)

æ G. Stibitz’ Model-K (1937) and K. Zuse’s Z3 (1941)(electro mechanical, relays)

æ ENIAC, 1946 (vacuum tubes)

æ Computer revolution with transistors, first used tobuild a computer in 1953 (ca. 600 transistors)

Lecture 1: Digital Representation 5

Page 6: INF2270 — Spring 2011€¦ · Lecture 1: Digital Representation 4. A Short History of Computers æ The Analytical Engine by Charles Babbage in 1837 (mechanical) æ G. Stibitz’

Transistors

æ Transistors: electronicswitches (connecting‘drain’ and ‘source’)controlled by anelectronic signal(‘gate’-voltage)

æ Down to 28nm (0.000000028m) long, and hundreds ofmillions on a single integrated circuit. The IntelCoretm i7 Quad Extreme (Bloomfield) has 731millioner transistorer in a 45nm-technology (2008)

æ Transistors need in the order of hundreds ofpico-second to switch

Lecture 1: Digital Representation 6

Page 7: INF2270 — Spring 2011€¦ · Lecture 1: Digital Representation 4. A Short History of Computers æ The Analytical Engine by Charles Babbage in 1837 (mechanical) æ G. Stibitz’

Binary Representation

æ Switches obviously have two states: ’on’ and ’off’

æ Thus they are suited to represent digital numbers inthe binary system (rather than the decimal that we areused to)

æ The two states can also be used to represent the twostates in predicate logic/Boolean algebra: ’true’ and’false’, respectively ’1’ and ’0’

Lecture 1: Digital Representation 7

Page 8: INF2270 — Spring 2011€¦ · Lecture 1: Digital Representation 4. A Short History of Computers æ The Analytical Engine by Charles Babbage in 1837 (mechanical) æ G. Stibitz’

content

Background

Binary Numbers

Boolean Algebra

Lecture 1: Digital Representation 8

Page 9: INF2270 — Spring 2011€¦ · Lecture 1: Digital Representation 4. A Short History of Computers æ The Analytical Engine by Charles Babbage in 1837 (mechanical) æ G. Stibitz’

Binary Numbers

’10010’ as a binary number means:1� 24 � 0� 23 � 0� 22 � 1� 21 � 0� 20 � 16� 2 � 18

just as ’18’ as a decimal number means:1� 101 � 8� 100

Lecture 1: Digital Representation 9

Page 10: INF2270 — Spring 2011€¦ · Lecture 1: Digital Representation 4. A Short History of Computers æ The Analytical Engine by Charles Babbage in 1837 (mechanical) æ G. Stibitz’

content

Background

Binary Numbers

Boolean Algebra

Lecture 1: Digital Representation 10

Page 11: INF2270 — Spring 2011€¦ · Lecture 1: Digital Representation 4. A Short History of Computers æ The Analytical Engine by Charles Babbage in 1837 (mechanical) æ G. Stibitz’

Boolean Algebra

æ Boolean algebra/logic is a set of operations defined onvariables that have only two values: ’0’ and ’1’

æ There are three basic opeartoions: NOT, AND, OR

æ NOT a can be written as :a, a or a’

æ a AND b can be written as a^a or a�b (not to be mixedup with normal multiplication)

æ a OR b can be written as a_a or a�b (not to be mixedup with normal addition)

Lecture 1: Digital Representation 11

Page 12: INF2270 — Spring 2011€¦ · Lecture 1: Digital Representation 4. A Short History of Computers æ The Analytical Engine by Charles Babbage in 1837 (mechanical) æ G. Stibitz’

Truth Tables

a a

0 1

1 0

a b a^b

0 0 0

0 1 0

1 0 0

1 1 1

a b a_b

0 0 0

0 1 1

1 0 1

1 1 1

Lecture 1: Digital Representation 12

Page 13: INF2270 — Spring 2011€¦ · Lecture 1: Digital Representation 4. A Short History of Computers æ The Analytical Engine by Charles Babbage in 1837 (mechanical) æ G. Stibitz’

Derived Boolean Functions

a XOR b = �a^ b�_ �a^ b�

a XNOR b = �a^ b�_ �a^ b�

a NAND b = a^ b

a NOR b = a_ b

Lecture 1: Digital Representation 13

Page 14: INF2270 — Spring 2011€¦ · Lecture 1: Digital Representation 4. A Short History of Computers æ The Analytical Engine by Charles Babbage in 1837 (mechanical) æ G. Stibitz’

Rules that Apply

a^b_c = (a^b)_c a_b^c = a_(b^c) (priority)

a^b = b^a a_b = b_a (commutativity)

(a^b)^c=a^(b^c) (a_b)_c=a_(b_c) (associativity)¯a=a (involution)

a^a=0 a_a=1 (completness)

a^a=a a_a=a (idempotency)

a^1=a a_0=a (boundedness)

a^0=0 a_1=1 (boundedness)

a^(a_b)=a a_(a^b)=a (absorbtion)

a^�b_c)=(a^b)_(a^c) a_(b^c)=(a_b)^(a_c) (distributivity)

a_ b � a^ b a^ b � a_ b (deMorgan)Lecture 1: Digital Representation 14

Page 15: INF2270 — Spring 2011€¦ · Lecture 1: Digital Representation 4. A Short History of Computers æ The Analytical Engine by Charles Babbage in 1837 (mechanical) æ G. Stibitz’

Checking deMorgan’s Theorem

for NOR:

a b a_ b

0 0 1

0 1 0

1 0 0

1 1 0

a b a^ b

0 0 1

0 1 0

1 0 0

1 1 0

Lecture 1: Digital Representation 15

Page 16: INF2270 — Spring 2011€¦ · Lecture 1: Digital Representation 4. A Short History of Computers æ The Analytical Engine by Charles Babbage in 1837 (mechanical) æ G. Stibitz’

Examples: simplify

a^b _ a^b = ?a^b^c _ a^b^c _ a^b^c^ �a_ c� = ?

Lecture 1: Digital Representation 16

Page 17: INF2270 — Spring 2011€¦ · Lecture 1: Digital Representation 4. A Short History of Computers æ The Analytical Engine by Charles Babbage in 1837 (mechanical) æ G. Stibitz’

Solution 1

a^b _ a^b

= a^(b_b�= a^1

= a

Solution 2

a^b^c _ a^b^c _ a^b^c^ �a_ c�= �a_ a)^b^c _ a^b^c^ a _ a^ b^ c^ c

= 1^ b^ c _ 0_ 0

= b^ c

Lecture 1: Digital Representation 17

Page 18: INF2270 — Spring 2011€¦ · Lecture 1: Digital Representation 4. A Short History of Computers æ The Analytical Engine by Charles Babbage in 1837 (mechanical) æ G. Stibitz’

Completnes of NAND and NOR

Either the NAND or the NOR function are actuallysufficient to implement any Boolean function

a � a^ a � a_ a (1)

a^ b � a^ b � a_ b (2)

a_ b � a^ b � a_ b (3)

Lecture 1: Digital Representation 18

Page 19: INF2270 — Spring 2011€¦ · Lecture 1: Digital Representation 4. A Short History of Computers æ The Analytical Engine by Charles Babbage in 1837 (mechanical) æ G. Stibitz’

Examples: representation with truth tables (1/2)

F=(a^b) _ (a^ b�

a b F

0 0 1

0 1 0

1 0 0

1 1 1

Lecture 1: Digital Representation 19

Page 20: INF2270 — Spring 2011€¦ · Lecture 1: Digital Representation 4. A Short History of Computers æ The Analytical Engine by Charles Babbage in 1837 (mechanical) æ G. Stibitz’

Examples: representation with truth tables (2/2)

G= a^ b^ c| {z }x1

_ a^ c| {z }x2

_a^ b| {z }x3

a b c x1 x2 x3 G

0 0 0 0 0 0 0

0 0 1 0 1 0 1

0 1 0 0 0 0 0

0 1 1 0 1 0 1

1 0 0 0 0 1 1

1 0 1 0 0 1 1

1 1 0 0 0 0 0

1 1 1 1 0 0 1

Lecture 1: Digital Representation 20

Page 21: INF2270 — Spring 2011€¦ · Lecture 1: Digital Representation 4. A Short History of Computers æ The Analytical Engine by Charles Babbage in 1837 (mechanical) æ G. Stibitz’

Representing Boolean Functions

1. expression with variables and operators

2. truth table

3. graphically with logic gates

Lecture 1: Digital Representation 21