Transcript Lecture 21
Lecture #21 Intro to Digital Electronics
This week: Circuits for digital
devices
10/19/2004
EE 42 fall 2004 lecture 21
1
Topics
Today:
• Digital electronics
• Boolean logic
• And, Or, and Not gates
10/19/2004
EE 42 fall 2004 lecture 21
2
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.
10/19/2004
EE 42 fall 2004 lecture 21
3
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.
10/19/2004
EE 42 fall 2004 lecture 21
4
• 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!
10/19/2004
e
EE 42 fall 2004 lecture 21
2
5
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!
10/19/2004
EE 42 fall 2004 lecture 21
6
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.
10/19/2004
EE 42 fall 2004 lecture 21
7
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)
10/19/2004
EE 42 fall 2004 lecture 21
8
George Boole
1815-1864
A schoolteacher and son
of 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.
10/19/2004
EE 42 fall 2004 lecture 21
9
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.
10/19/2004
EE 42 fall 2004 lecture 21
10
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)
10/19/2004
EE 42 fall 2004 lecture 21
11
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
10/19/2004
EE 42 fall 2004 lecture 21
12
Digital Signal Representations
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). It takes 6 binary digits (or “bits”) to represent any number 0 to 63.
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?)
Answer: with 5 binary digits we can represent only 32 values
10/19/2004
EE 42 fall 2004 lecture 21
13
So Why Digital?
(For example, why CDROM audio vs vinyl recordings?)
•
Digital signals can be transmitted, received, amplified, and retransmitted 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.
10/19/2004
EE 42 fall 2004 lecture 21
14
Logic Functions
Logic Expression : To create logic values we will define “True” , as
Boolean 1 and “False” , as Boolean 0.
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).
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.
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?
Boolean Expression:
H = (A · B · C) + T
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.
10/19/2004
EE 42 fall 2004 lecture 21
15
Logical Expressions
Standard logic notation :
AND:
“dot”
OR : “+ sign”
NOT:
Examples: X = A · B ; Y = A · B · C
Examples: W = A+B ; Z = A+B+C
“bar over symbol for complement” Example: Z = A
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. A B means (A B) .
10/19/2004
EE 42 fall 2004 lecture 21
16
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
10/19/2004
EE 42 fall 2004 lecture 21
17
Logic Function Example 2
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)}
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}
10/19/2004
EE 42 fall 2004 lecture 21
18
Evaluation of Logical Expressions with “Truth Tables”
Truth Table for Logic Expression
A
0
0
0
0
1
1
1
1
0
0
0
0
1
1
1
1
10/19/2004
B
0
0
1
1
0
0
1
1
0
0
1
1
0
0
1
1
C
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
EE 42 fall 2004 lecture 21
H = (A · B · C) + T
T
0
0
0
0
0
0
0
0
1
1
1
1
1
1
1
1
H
0
0
0
0
0
0
0
1
1
1
11
1
1
1
19
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
10/19/2004
EE 42 fall 2004 lecture 21
20
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”
10/19/2004
EE 42 fall 2004 lecture 21
21
And & Or
• Since boolean variables can only take on one of two
values, there are 16 possible two input operators (truth
tables)
Inputs
AB
N
O
R
X N A
O A N
R N D
D
O
R
00
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
01
0
0
1
1
0
0
1
1
0
0
1
1
0
0
1
1
10
0
0
0
0
1
1
1
1
0
0
0
0
1
1
1
1
11
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)
10/19/2004
EE 42 fall 2004 lecture 21
22
Some Important Logical Functions
• “AND”
A B
• “OR”
AB
• “INVERT” or “NOT”
not A (or A )
• “not AND” = NAND
AB
• “not OR” = NOR
A B
• exclusive OR = XOR
A B (only1 when A, B differ)
i.e., A B except A B
AB (only0 whenAB1)
10/19/2004
(or A B C)
(or A B C D)
(only 0 when A and B 1)
EE 42 fall 2004 lecture 21
(only 1 when A B 0)
23
Logic Gates
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.
A
A
AND
C=A·B
B
B
A
B
A
C=A+B B
OR
A
A
NOT
10/19/2004
A
B
NAND
C = A B
NOR
C = A B
C AB
EXCLUSIVE OR
EE 42 fall 2004 lecture 21
24
Logic Circuits
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.
A
X
C
B
It is helpful to list the intermediate
logic values (at the input to the OR
gate). Let’s call them X and Y.
Y
Now we complete the truth tables for X and Y, and from that for C. (Note
that X A B and Y B A
and finally C = X + Y)
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
10/19/2004
EE 42 fall 2004 lecture 21
Interestingly, this is the
same truth table as the
EXCLUSIVE OR
25