10/19/2004ee 42 fall 2004 lecture 211 lecture #21 intro to digital electronics this week: circuits...

25
10/19/2004 EE 42 fall 2004 lecture 2 1 1 Lecture #21 Intro to Digital Electronics This week: Circuits for digital devices

Post on 21-Dec-2015

217 views

Category:

Documents


1 download

TRANSCRIPT

Page 1: 10/19/2004EE 42 fall 2004 lecture 211 Lecture #21 Intro to Digital Electronics This week: Circuits for digital devices

10/19/2004 EE 42 fall 2004 lecture 21 1

Lecture #21 Intro to Digital Electronics

This week: Circuits for digital devices

Page 2: 10/19/2004EE 42 fall 2004 lecture 211 Lecture #21 Intro to Digital Electronics This week: Circuits for digital devices

10/19/2004 EE 42 fall 2004 lecture 21 2

Topics

Today:

• Digital electronics

• Boolean logic

• And, Or, and Not gates

Page 3: 10/19/2004EE 42 fall 2004 lecture 211 Lecture #21 Intro to Digital Electronics This week: Circuits for digital devices

10/19/2004 EE 42 fall 2004 lecture 21 3

Analysis

• Analysis is the systematic study of real and complex-valued continuous functions. Important subfields of analysis include calculus, differential equations, and functional analysis. Derivatives, integrals, and infinite series are examples of the tools of analysis.

Page 4: 10/19/2004EE 42 fall 2004 lecture 211 Lecture #21 Intro to Digital Electronics This week: Circuits for digital devices

10/19/2004 EE 42 fall 2004 lecture 21 4

Arithmetic

• Arithmetic is a branch of mathematics which studies the properties of the natural numbers (the integers) 1, 2, 3, … and operations on those numbers such as addition, subtraction, multiplication and division.

• From Geometry problems, it was realized by the ancients that there was a relationship between the natural numbers and continuous measures like distances.

• Of course, there are always quantities which don’t come out to an even multiple, so they invented the concept of a fraction.

Page 5: 10/19/2004EE 42 fall 2004 lecture 211 Lecture #21 Intro to Digital Electronics This week: Circuits for digital devices

10/19/2004 EE 42 fall 2004 lecture 21 5

• It came as quite a surprise when it turned out that some measurements could not be expressed exactly as a fraction (ratio of two integers)

• So much so that they are still called “irrational” numbers!

2 e

Page 6: 10/19/2004EE 42 fall 2004 lecture 211 Lecture #21 Intro to Digital Electronics This week: Circuits for digital devices

10/19/2004 EE 42 fall 2004 lecture 21 6

Discrete vs continuous

• For thousands of years, mathematics has been split between:– Arithmetic, the study of the discrete– Analysis, the study of the continuous.

• Until the 1930’s analysis was considered the pinnacle of mathematics.

• Computer Science and digital circuits are a triumph of discrete mathematics

• Most of Electrical engineering is analysis!

Page 7: 10/19/2004EE 42 fall 2004 lecture 211 Lecture #21 Intro to Digital Electronics This week: Circuits for digital devices

10/19/2004 EE 42 fall 2004 lecture 21 7

How close is good enough?

• A Fraction can be constructed to be arbitrarily close to any real number, but can not perfectly represent all numbers.

• Decimals are just an extension of the fraction concept, as are floating point numbers.

• A continuous quantity can not be expressed exactly with these, but it can be represented with any desired degree of accuracy.

Page 8: 10/19/2004EE 42 fall 2004 lecture 211 Lecture #21 Intro to Digital Electronics This week: Circuits for digital devices

10/19/2004 EE 42 fall 2004 lecture 21 8

The advantage of discrete techniques

• The great advantage of discrete techniques such as the integers, fractions, etc, are that quantities can be transmitted and stored without degradation.

• If you convey “This far” to your neighbor, it is not possible for him to transmit the information exactly to his neighbor, but “4/5” can be recorded and accurately transmitted for three thousand years!

• (4/5ths was what was left after the Pharaoh took his share)

Page 9: 10/19/2004EE 42 fall 2004 lecture 211 Lecture #21 Intro to Digital Electronics This week: Circuits for digital devices

10/19/2004 EE 42 fall 2004 lecture 21 9

George Boole 1815-1864

A schoolteacher and sonof a cobbler, George Boole was a largely self-taught mathematician. He came up with a way to treat logic (which was

regarded as a part of philosophy) with the tools of mathematic expressions.

His 1848 paper is on the web site, in case you are interested.

His work was not at all well known for the next 90 years, when Claude Shannon applied it to electronic circuits.

Page 10: 10/19/2004EE 42 fall 2004 lecture 211 Lecture #21 Intro to Digital Electronics This week: Circuits for digital devices

10/19/2004 EE 42 fall 2004 lecture 21 10

Claude Shannon

Claude Shannon was a student working on a mechanical calculating machine at MIT. He considered ways of improving it, perhaps by using electrical circuits instead of mechanical parts.

It occurred to Shannon that the discrete mathematics of Boolean algebra he had learned as an undergraduate could be implemented in hardware, in electronic circuits.

Shannon's 1937 thesis was a key piece in the development of digital electronics and modern computers.

Page 11: 10/19/2004EE 42 fall 2004 lecture 211 Lecture #21 Intro to Digital Electronics This week: Circuits for digital devices

10/19/2004 EE 42 fall 2004 lecture 21 11

Digital representations

• We have been looking mostly at circuits which do what we want by making them as linear as possible, and transferring information as a voltage, or as a current.

• In a digital system, we do pretty much the opposite, using highly nonlinear responses (like the comparator) to force a signal to be one of a few discrete values

(often just 2: high or low, true or false, 0 or 1)

Page 12: 10/19/2004EE 42 fall 2004 lecture 211 Lecture #21 Intro to Digital Electronics This week: Circuits for digital devices

10/19/2004 EE 42 fall 2004 lecture 21 12

Integers

• All operations on integers can be reduced to operations on multiple variables each of which takes on only one of two values, 0 and 1, and the operations and, or and not.

• For example, a specific integer can be represented by its binary equivalent

• 5=1012

• Implemented as electronic circuits, this would correspond to three wires, and each having a high or low voltage

• These three wires could represent integers 0 to 7

Page 13: 10/19/2004EE 42 fall 2004 lecture 211 Lecture #21 Intro to Digital Electronics This week: Circuits for digital devices

10/19/2004 EE 42 fall 2004 lecture 21 13

Digital Signal Representations

Example: Possible digital representation for a pure sine wave of known frequency. We must choose maximum value and “resolution” or “error,” then we can encode the numbers. Suppose we want 1V accuracy of amplitude with maximum amplitude of 50V, We could use a simple pure binary code with 6 bits of information. ( Why 6 bits…. What if we only use 5?)

By using binary numbers we can represent any quantity. For example a binary two (10) could represent a 2 Volt signal. But we generally have to agree on some sort of “code” and the dynamic range of the signal in order to know the form and the minimum number of bits.

Example: We want to encode to an accuracy of one part in 64 (i.e. 1.5% precision).

Answer: with 5 binary digits we can represent only 32 values

It takes 6 binary digits (or “bits”) to represent any number 0 to 63.

Page 14: 10/19/2004EE 42 fall 2004 lecture 211 Lecture #21 Intro to Digital Electronics This week: Circuits for digital devices

10/19/2004 EE 42 fall 2004 lecture 21 14

So Why Digital?

(For example, why CDROM audio vs vinyl recordings?)

• Digital signals can be transmitted, received, amplified, and re-transmitted with no degradation.

• Binary numbers are a natural method of expressing logical variables.

• Complex logical functions are easily expressed as binary functions (e.g., in control applications … see next page).

• Digital signals are easy to manipulate (as we shall see).

• With digital representation, we can achieve arbitrary levels of “dynamic range,” that is, the ratio of the largest possible signal to the smallest than can be distinguished above the background noise

• Digital information is easily and inexpensively stored (in RAM, ROM, EPROM, etc.), again with arbitrary accuracy.

Page 15: 10/19/2004EE 42 fall 2004 lecture 211 Lecture #21 Intro to Digital Electronics This week: Circuits for digital devices

10/19/2004 EE 42 fall 2004 lecture 21 15

Logic Functions

Logic Statement: H = 1 if A and B and C are 1 or T is 1.

We use “dot” to designate logical “and” and “+” to designate logical or in switching algebra. So how can we express this as a Boolean Expression?

Logic Expression : To create logic values we will define “True” , as Boolean 1 and “False” , as Boolean 0.

Boolean Expression: H = (A · B · C) + T

Example: The logic variable H is true (H=1) if (A and B and C are 1) or T is true (logic 1), where all of A,B,C and T are also logical variables.

Moreover we can associate a logic variable with a circuit node. Typically we associate logic 1 with a high voltage (e.g. 2V) and and logic 0 with a low voltage (e.g. 0V).

Note that there is an order of operation, just as in math, and AND is performed before OR. Thus the parenthesis are not actually required here.

Page 16: 10/19/2004EE 42 fall 2004 lecture 211 Lecture #21 Intro to Digital Electronics This week: Circuits for digital devices

10/19/2004 EE 42 fall 2004 lecture 21 16

Logical Expressions

Example: Z = A

Examples: X = A · B ; Y = A · B · C

Examples: W = A+B ; Z = A+B+C

Standard logic notation :

AND: “dot”

OR : “+ sign”

NOT: “bar over symbol for complement”

With these basic operations we can construct any logical expression.

Order of operation: NOT, AND, OR (note that negation of an expression is performed after the expression is evaluated, so there is an implied parenthesis, e.g. means .BA B)(A

Page 17: 10/19/2004EE 42 fall 2004 lecture 211 Lecture #21 Intro to Digital Electronics This week: Circuits for digital devices

10/19/2004 EE 42 fall 2004 lecture 21 17

Logic Function Example

• Boolean Expression: H = (A · B · C) + T

This can be read H=1 if (A and B and C are 1) or T is 1, or

H is true if all of A,B,and C are true, or T is true, or

The voltage at node H will be high if the input voltages at nodes A, B and C are high or the input voltage at node T is high

Page 18: 10/19/2004EE 42 fall 2004 lecture 211 Lecture #21 Intro to Digital Electronics This week: Circuits for digital devices

10/19/2004 EE 42 fall 2004 lecture 21 18

Logic Function Example 2

Boolean Expression: B = A + S(D + T )

This can be read B=1 if A = 1 or S=1 AND (D OR T =1), i.e.

B=1 if {A = 1} or {S=1 AND (D OR T =1)}

or

B is true IF {A is true} OR {S is true AND D OR T is true}

or

The voltage at node H will be high if {the input voltage at node A is high} OR {the input voltage at S is high and the voltages at D and T are high}

You wish to express under which conditions your burglar alarm goes off (B=1):

If the “Alarm Test” button is pressed (A=1)

OR if the Alarm is Set (S=1) AND { the door is opened (D=1) OR the trunk is opened (T=1)}

Page 19: 10/19/2004EE 42 fall 2004 lecture 211 Lecture #21 Intro to Digital Electronics This week: Circuits for digital devices

10/19/2004 EE 42 fall 2004 lecture 21 19

Evaluation of Logical Expressions with “Truth Tables”

Truth Table for Logic Expression

A B C T H0 0 0 00 1 0 01 0 0 01 10 00 1

0000111 1 01 1 10 0 00 0 10 1 00 1 11 0 0 1 11 0 1 1 11 1 0 1 11 1 1 1 1

0000011

11

0

0 0 0 1 1 1 1 1

H = (A · B · C) + T

Page 20: 10/19/2004EE 42 fall 2004 lecture 211 Lecture #21 Intro to Digital Electronics This week: Circuits for digital devices

10/19/2004 EE 42 fall 2004 lecture 21 20

Evaluation of Logical Expressions with “Truth Tables”

The Truth Table completely describes a logic expression

In fact, we will use the Truth Table as the fundamental meaning of a logic expression.

Two logic expressions are equal if their truth tables are the same

Page 21: 10/19/2004EE 42 fall 2004 lecture 211 Lecture #21 Intro to Digital Electronics This week: Circuits for digital devices

10/19/2004 EE 42 fall 2004 lecture 21 21

The Important Logical Functions

The most frequent (i.e. important) logical functions are implemented as electronic “building blocks” or “gates”.

We already know about AND , OR and NOT What are some others:

Combination of above: inverted AND = NAND,inverted OR = NOR

And one other basic function is often used: the “EXCLUSIVE OR” … which logically is “or except not and”

Page 22: 10/19/2004EE 42 fall 2004 lecture 211 Lecture #21 Intro to Digital Electronics This week: Circuits for digital devices

10/19/2004 EE 42 fall 2004 lecture 21 22

And & Or• Since boolean variables can only take on one of two

values, there are 16 possible two input operators (truth tables)

Inputs

A B

NOR

XOR

NAND

AND

OR

0 0 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1

0 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1

1 0 0 0 0 0 1 1 1 1 0 0 0 0 1 1 1 1

1 1 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1

Boole showed that all possible truth tables can be created with just the operators AND, OR, and NOT (NOR is also sufficient by itself)

Page 23: 10/19/2004EE 42 fall 2004 lecture 211 Lecture #21 Intro to Digital Electronics This week: Circuits for digital devices

10/19/2004 EE 42 fall 2004 lecture 21 23

Some Important Logical Functions

• “AND”

• “OR”

• “INVERT” or “NOT”

• “not AND” = NAND

• “not OR” = NOR

• exclusive OR = XOR

1)BA when0(only BA )DCBA(or BA

BA BA i.e., differ) BA, when1(only BA

except

C)BA(or BA

)0BA when1ly n(o BA

)1 and when 0ly (o AB BAn

(or ) Anot A

Page 24: 10/19/2004EE 42 fall 2004 lecture 211 Lecture #21 Intro to Digital Electronics This week: Circuits for digital devices

10/19/2004 EE 42 fall 2004 lecture 21 24

These are circuits that accomplish a given logic function such as “OR”. We will shortly see how such circuits are constructed. Each of the basic logic gates has a unique symbol, and there are several additional logic gates that are regarded as important enough to have their own symbol. The set is: AND, OR, NOT, NAND, NOR, and EXCLUSIVE OR.

Logic Gates

A

BC=A·BAND C =

A

BNAND BA

C = NORA

BBA

NOTA A

ORA

BC=A+B

EXCLUSIVE OR

A

BBAC

Page 25: 10/19/2004EE 42 fall 2004 lecture 211 Lecture #21 Intro to Digital Electronics This week: Circuits for digital devices

10/19/2004 EE 42 fall 2004 lecture 21 25

With a combination of logic gates we can construct any logic function. In these two examples we will find the truth table for the circuit.

Logic Circuits

B

A

C

It is helpful to list the intermediate logic values (at the input to the OR gate). Let’s call them X and Y.

X

Y

Now we complete the truth tables for X and Y, and from that for C. (Note that X and Y and finally C = X + Y)BA AB

A B X Y C

0 0 0 0 0

0 1 0 1 1

1 0 1 0 1

1 1 0 0 0

Interestingly, this is the same truth table as the EXCLUSIVE OR