Professional Documents
Culture Documents
1 PDF
1 PDF
Digital Logic
1.1 Introduction
Digital circuits are electronic circuits designed to operate with a xed number
of discrete voltage values. Usuallyand throughout this bookwhere are just
two such values. Depending on how we use them, we may designate them with
dierent symbols, such as:
(a) CDs and DVDs represent 1 by the presence and 0 by the absence of a pit
(or depression) in a layer of aluminum depositied on a rigid plastic disk
and detected by reection of a laser beam. The same principlepresence
or absence of a hole detected by a light sensorwas used in computer
punch cards and paper tapes in early computers (and even before that).
(b) Magnetic Disks (and Data Storage Tapes) represent logic data with mag-
netized areas on an iron oxide recording surface. A south pole sticking
out of the surface would represent a 1 and a north pole would be a 0 (or
vice versa).
(c) Spring loaded mechanical switches have two states, closed and open. Ei-
ther of these states could be chosen to represent truth; for example, the
designer might interpret an open switch as a logic 1.
1 The same voltage levels are used for signal values and power levels. For the latter, we use
the names the names power and ground with symbols Vcc and Vdd, respectively.
1
2 CHAPTER 1. DIGITAL LOGIC
G=H G=L
X Y X Y
S S
Copyright
c 2003 Steven D. Johnson Draft Material August 27, 2004
1.2. DIGITAL DEVICES 3
A B
X Y
X Y
B
(a) Connected in series (a) Connected in parallel
Figure 1.1: Two ways to combine two switches to connect points X and Y
A high voltage at the point G closes this switch, making a connection between
points X and Y . A low voltage at G opens the switch, disconnecting X and Y .
Switches integrated circuits are realized with transistors, depicted in schemat-
ics by this symbol:
G
A B
Chapter ?? describes how transistors work.
The logical function of a circuit derives from the elementary ways we can
combine switches. Fig. 1.1 shows the two ways to combine switches S1 and
S2 between two connecting points, X and Y . In Fig. 1.1(a), on the left, they
are connected in series; and in Fig. 1.1(b), on the right, they are connected in
parallel. If S1 and S2 are connected in series, then there must be high voltage
at both point A and point B to have a connection between points X and Y .
Thus, in this sense the series connection represents the function and. Similarly,
If S1 and S2 are connected in parallel, then X and Y are connected when there
is high voltage at either point A or point B, or both, so the parallel connection
represents the logical function or.
In theory, we could use this idea to implement any logical expression of
and s and or s. However, our idealized concept of a perfect switch cannot be
realized by physical devices, and we must do a bit more to sustain the illusion
of digital logic. Both the impulse needed to open or close the switch and
the imperfect (dis)connection it makes consume electrical energy. The most
signicant consequence of this energy drain is to compromise the discrete voltage
levels on which the logic is based in the rst place. If a high voltage closes the
Copyright
c 2003 Steven D. Johnson Draft Material August 27, 2004
4 CHAPTER 1. DIGITAL LOGIC
switch and a low voltage opens it, an intermediate voltage leaves the state
of the switch uncertain. It takes only a few real switches to create such an
ambiguous situation.
Real digital components are active devices that employ amplication to re-
store signals to their proper digital levels. Below, two transistors are connected
in series with a resistor (an electronic element that restricts current ow), be-
tween Vdd (ground) and Vcc (power), both constant voltage sources.
VCC
VCC
R
A
Z Z
B
A
Now suppose that high voltage is present at both points A and B, so that
both switches are closed, as before. The point Z is thereby more directly (i.e.
with less resistence2 ) connected to ground through the switches; it therefore
acquires a low voltage. On the other hand, if either of the switches is open, Z
is disconnected from ground and the connection to Vcc dominates.
In either case, the voltage at point Z is restored to a proper digital level
and, in addition, this voltage has the full strength of the power supply behind
it. Hence, the signal Z is clear and strong.
This device is an example of a digital logic gate, and there are several points
worth remembering about it.
Copyright
c 2003 Steven D. Johnson Draft Material August 27, 2004
1.2. DIGITAL DEVICES 5
VCC
R
A
Z Z
B
A B
Copyright
c 2003 Steven D. Johnson Draft Material August 27, 2004
6 CHAPTER 1. DIGITAL LOGIC
This is traditionally called a nor gate. We shall see in the next chapter that
the names nand and nor are misleading.
(S A) ((S) B)
Copyright
c 2003 Steven D. Johnson Draft Material August 27, 2004
1.3. LOGIC AND BOOLEAN ALGEBRA 7
X(A, B, C) = [F, T, T, F, T, F, F, F]
A A
T F T F
B B B B
T F T F T F T
C C C C C T
C F
T F T F T F T F T
F F
F T T F T F F F
T F
Figure 1.2: Some truth table representations: an array (top), a decision tree
(left), and a decision diagram (right).
If you study the truth tables for X, Y and Z long enough, you may probably
think of better ways to describe them, either informally with English predicates
or perhaps formally as logic expressions.
You may also have noticed a dierence in the order that the rows of these
two tables are presented. Although the order does not matter, so long as there
is just one row for each of the eight possible input combinations, it is generally
better to have a standard, or canonical, ordering. For reasons that are explained
in Section 1.3.5, the ordering on the left, above, is canonical.
If we are going to use the standard ordering, then the only thing we really
need to describe a particular truth table are the functions name, its variables
in some order, and the column of specied function values. The rest is boiler-
plate, giving the table a familiar shape and format. Figure 1.2 shows a number
of possible representations this essential information might have, including data
structures that often used for computer representations. Of particular note is
the binary decision diagram (BDD), Fig. 1.2, lower left, a computer represen-
tation found in many design tools.
Figure 1.3 gives truth tables dening some of the primitive logic functions.
3 The term boolean derives from the name of the mathematician George Boole (18151864)
who was the rst to apply the concept of algebra to logic. Some textbooks acknowledge
Booles profound contributions to computer science by using a lower-case b.
Copyright
c 2003 Steven D. Johnson Draft Material August 27, 2004
8 CHAPTER 1. DIGITAL LOGIC
not, and , or ,
A A A B AB A B AB
F T F F F F F F
T F F T F F T T
T F F T F T
T T T T T T
0 + 0 1 0 1
0 1 0 0 1 0 0 0
1 0 1 1 1 1 0 1
Copyright
c 2003 Steven D. Johnson Draft Material August 27, 2004
1.3. LOGIC AND BOOLEAN ALGEBRA 9
(j) x (x + y) = x x + xy = x absorbtion
(k) x (x + y) = x y x + xy = x + y absorbtion
(l) xy + xy = y (x + y) (x + y) = y independence
(A + B + C + D + E) = A B C D E
and
A (B1 + B2 + + Bn ) = (A B1 ) + (A B2 ) + (A Bn )+
Although the boolean operators share many properties with their arithmetic
counterparts, there are also some signicant dierences. You will see in Fig. 1.4
that all of the identities involving + or come in pairs. This feature reects the
Copyright
c 2003 Steven D. Johnson Draft Material August 27, 2004
10 CHAPTER 1. DIGITAL LOGIC
AB = A B
Be careful!
The general form of DeMorgans Law is proved valid by an induction over
the grammar of logical expressions. We have not laid the groundwork for such
a proof in this textbook. Let us look at an example, at least.
A + B C + AC D + B D = A + B CA C D + B D
= AB CA C D + B D
= A(B + C)A C D + B D
= A(B + C)A C DB D
= A(B + C)(A + C + D)B D
= A(B + C)(A + C + D)(B + D)
Copyright
c 2003 Steven D. Johnson Draft Material August 27, 2004
1.3. LOGIC AND BOOLEAN ALGEBRA 11
A B C X A B C X
F F F F (0) 0 0 0 0
F F T T (1) 0 0 1 1
F T F T (2) 0 1 0 1
F T T F (3) 0 1 1 0
T F F T (4) 1 0 0 1
T F T F (5) 1 0 1 0
T T F F (6) 1 1 0 0
T T T F (7) 1 1 1 0
This truth table is in standard form because its rows are listed in numerical
order, depending a xed choice of rst A, then B, and nally C as the ordering
of its input variables. In this case, we have (redundantly) numbered the rows
for reference.
Copyright
c 2003 Steven D. Johnson Draft Material August 27, 2004
12 CHAPTER 1. DIGITAL LOGIC
We shall have a great deal more to say about the binary numeric represen-
tations and the implementation of arithmetic in later chapters.
1.4 Summary
This chapter has set the scene for the topics that follow. Like most chapters
in this textbook, this one has looked at both physical and conceptual aspects
of digital systems. As in common in most textbooks about design, we are
concerned with resolving two levels of abstraction. Of course, we are just at
the outset of this process, so the distinction is rather course. We have taken a
brief, qualitative glimpse at what digital systemsa vast domain ranging from
wristwatches to global communication systemsare made of: switches. And we
have taken the rst step toward imposing a useful conceptual function on those
elementary devices: logic gates.
We want to get started on a good footing. In the next chapter, we will
explore a vital, fundamental principle of design in detail, before returning to
the task of expanding our design methodology.
Exercises 1.4
1. Figure 1.3 denes ve binary (two-input) logic functions. How many two-
input logic functions are there?
3. Verify that the truth table for Y on page 7 species the function
Y = S A S B
(a) B A C + D + E
(b) A + B C + D
(c) A + B (C + D)
Copyright
c 2003 Steven D. Johnson Draft Material August 27, 2004
1.4. SUMMARY 13
6. Give 5-bit binary representations for the decimal numbers 5, 21, 48 and
13.
7. What numerical values are represented by the binary numbers 1011, 11011,
011 and 1111111111?
8. Describe algorithms for adding and subtracting binary number representa-
tions. Implement and test these algorithms in software using the language
of your choice.
Copyright
c 2003 Steven D. Johnson Draft Material August 27, 2004