Académique Documents
Professionnel Documents
Culture Documents
Chapter 2:
Combinational Logic Design
Slides to accompany the textbook Digital Design, First Edition,
by Frank Vahid, John Wiley and Sons Publishers, 2007.
http://www.ddvahid.com
2.1
Introduction
Digital circuit
• Let’s learn to design digital circuits 1
a Combinational 1
• We’ll start with a simple form of circuit: b
0
digital circuit
F
– Combinational circuit
• A digital circuit whose outputs depend solely on 1
a Sequential ?
the present combination of the circuit inputs’ b
0 F
digital circuit
values
Digital Design
Copyright © 2006 2
Frank Vahid Note: Slides with animation are denoted with a small red "a" near the animated items
1
2.2
Switches
• Electronic switches are the basis of
binary digital circuits
– Electrical terminology A
.5
4
9V
– Analogous to water pressure
• Current: Flow of charged particles 2 ohms
– Analogous to water flow
9V
• Resistance: Tendency of wire to resist 0V
current flow
4.5 A
– Analogous to water pipe diameter
• V = I * R (Ohm’s Law)
Digital Design
Copyright © 2006 3
Frank Vahid
Switches
• A switch has three parts control
input
– Source input, and output
“off”
• Current wants to flow from source
input to output
source output
– Control input input a
quarter
Digital Design (to see the relative size)
Copyright © 2006 4
Frank Vahid
2
Moore’s Law
• IC capacity doubling about every 18 months
for several decades
– Known as “Moore’s Law” after Gordon Moore,
co-founder of Intel
• Predicted in 1965 predicted that components
per IC would double roughly every year or so
– Book cover depicts related phenomena
• For a particular number of transistors, the IC
shrinks by half every 18 months
– Notice how much shrinking occurs in just about
10 years
– Enables incredibly powerful computation in
incredibly tiny devices
– Today’s ICs hold billions of transistors
• The first Pentium processor (early 1990s)
needed only 3 million
2.3
nMOS
A positive ...attracts electrons here, 1 0
voltage here... turning the channel gate
between source and drain
into a conductor.
pMOS
1 0
gate
(a) IC
3
Boolean Logic Gates 2.4
• “Logic gates” are better digital circuit building blocks than switches (transistors)
– Why?...
Digital Design
Copyright © 2006 7
Frank Vahid
Digital Design
Copyright © 2006 8
Frank Vahid
4
Boolean Algebra and its Relation to Digital Circuits
• Developed mid-1800’s by George Boole to formalize human thought
– Ex: “I’ll go to lunch if Mary goes OR John goes, AND Sally does not go.”
• Let F represent my going to lunch (1 means I go, 0 I don’t go)
• Likewise, m for Mary going, j for John, and s for Sally a b AND
0 0 0
• Then F = (m OR j) AND NOT(s) 0 1 0
1 0 0
– Nice features 1 1 1
• Formally evaluate
a b OR
– m=1, j=0, s=1 --> F = (1 OR 0) AND NOT(1) = 1 AND 0 = 0 0 0 0
• Formally transform 0 1 1
1 0 1
– F = (m and NOT(s)) OR (j and NOT(s))
1 1 1
» Looks different, but same function
» We’ll show transformation techniques soon a NOT
0 1
1 0
Digital Design
Copyright © 2006 9
Frank Vahid
a NOT
0 1
1 0
Digital Design
Copyright © 2006 10
Frank Vahid
5
Converting to Boolean Equations
a
• Convert the following English
statements to a Boolean equation
– Q1. a is 1 and b is 1.
• Answer: F = a AND b
– Q2. either of a or b is 1.
• Answer: F = a OR b
– Q3. both a and b are not 0.
• Answer:
– (a) Option 1: F = NOT(a) AND NOT(b)
– (b) Option 2: F = a OR b
– Q4. a is 1 and b is 0.
• Answer: F = a AND NOT(b)
Digital Design
Copyright © 2006 11
Frank Vahid
6
Relating Boolean Algebra to Digital Design
NOT OR AND
Boolean Boole’s intent: formalize x x
algebra human thought Symbol x F F F
y y
(mid-1800s)
x F x y F x y F
Switches For telephone Truth table 0 1 0 0 0 0 0 0
1 0 0 1 1 0 1 0
(1930s) switching and other
electronic uses 1 0 1 1 0 0
1 1 1 1 1 1
Showed application 1 0 0
x y
Digital design x
0
1 1
• Implement Boolean operators using transistors
Note: These OR/AND
– Call those implementations logic gates. implementations are inefficient;
– Let’s us build circuits by doing math -- we’ll show why, and show better
ones later.
powerful concept
Digital Design
Copyright © 2006 13
Frank Vahid
1 1
1 x x
x 0 0
0 1 1
y y
1 0 0
F 1 1
0 F F
0 0
time
time time
Digital Design
Copyright © 2006 14
Frank Vahid
7
Building Circuits Using Gates
Digital Design
Copyright © 2006 15
Frank Vahid
a
F
(a)
a
a
b F
c
(b)
Digital Design
Copyright © 2006 16
Frank Vahid
8
Example: Seat Belt Warning Light System
• Design circuit for warning light
• Sensors
– s=1: seat belt fastened
– k=1: key inserted
– p=1: person in seat
• Capture Boolean equation
– person in seat, and seat belt not
fastened, and key inserted w = p AND NOT(s) AND k
• Convert equation to circuit
• Notice k BeltWarn
– Boolean algebra enables easy
capture as equation and conversion p w
to circuit
• How design with switches?
• Of course, logic gates are built from s
switches, but we think at level of logic
gates, not switches
Digital Design
Copyright © 2006 17
Frank Vahid
no yes
ok
not ok
Digital Design
Copyright © 2006 18
Frank Vahid
9
2.5
Boolean Algebra
• By defining logic gates based on Boolean algebra, we can use algebraic
methods to manipulate circuits
– So let’s learn some Boolean algebraic methods
• Start with notation: Writing a AND b, a OR b, and NOT(a) is cumbersome
– Use symbols: a * b, a + b, and a’ (in fact, a * b can be just ab).
• Original: w = (p AND NOT(s) AND k) OR t
• New: w = ps’k + t
– Spoken as “w equals p and s prime and k, or t”
– Or even just “w equals p s prime k, or t”
– s’ known as “complement of s”
• While symbols come from regular algebra, don’t say “times” or “plus”
Boolean algebra precedence, highest precedence first.
Symbol Name Description
() Parentheses Evaluate expressions nested in parentheses first
’ NOT Evaluate from left to right
* AND Evaluate from left to right
Digital Design
Copyright © 2006 + OR Evaluate from left to right 19
Frank Vahid
Digital Design
Copyright © 2006 20
Frank Vahid
10
Boolean Algebra Terminology
• Example equation: F(a,b,c) = a’bc + abc’ + ab + c
• Variable
– Represents a value (0 or 1)
– Three variables: a, b, and c
• Literal
– Appearance of a variable, in true or complemented form
– Nine literals: a’, b, c, a, b, c’, a, b, and c
• Product term
– Product of literals
– Four product terms: a’bc, abc’, ab, c
• Sum-of-products
– Equation written as OR of product terms only
– Above equation is in sum-of-products form. “F = (a+b)c + d” is not.
Digital Design
Copyright © 2006 21
Frank Vahid
11
Example that Applies Boolean Algebra Properties
• Want automatic door opener • Found inexpensive chip that
circuit (e.g., for grocery store) computes:
– Output: f=1 opens door • f = c’hp + c’hp’ + c’h’p
– Inputs: – Can we use it?
• p=1: person detected • Is it the same as f = c’(p+h)?
• h=1: switch forcing hold open • Use Boolean algebra:
• c=1: key forcing closed
– Want open door when
• h=1 and c=0, or f = c’hp + c’hp’ + c’h’p
• h=0 and p=1 and c=0 f = c’h(p + p’) + c’h’p (by the distributive property)
– Equation: f = hc’ + h’pc’ f = c’h(1) + c’h’p (by the complement property)
DoorOpener f = c’h + c’h’p (by the identity property)
h
f
c f = hc’ + h’pc’ (by the commutative property)
p
Same!
Digital Design
Copyright © 2006 23
Frank Vahid
12
2.6
The function F
Digital Design
Copyright © 2006 26
Frank Vahid
13
Converting among Representations
• Can convert from any representation Inputs Outputs Term
to any other a b F F = sum of
0 0 1 a’b’
• Common conversions 0 1 1 a’b
– Equation to circuit (we did this earlier) 1 0 0
1 1 0
– Truth table to equation (which we can
convert to circuit) F = a’b’ + a’b
• Easy -- just OR each input term that
should output 1
Q: Convert to equation
– Equation to truth table a b c F
• Easy -- just evaluate equation for each 0 0 0 0
input combination (row) 0 0 1 0
• Creating intermediate columns helps 0 1 0 0
0 1 1 0
Q: Convert to truth table: F = a’b’ + a’b 1 0 0 0
Inputs Output 1 0 1 1 ab’c
1 1 0 1 abc’
a b a' b' a' b F
a
1 1 1 1 abc a
0 0 1 0 1
0 1 0 1 1 F = ab’c + abc’ + abc
1 0 0 0 0
Digital Design
Copyright © 2006 1 1 0 0 0
27
Frank Vahid
0
1
1
0
1
0 a me0
1
1
0
1
0
Digital Design
Copyright © 2006
1 1 1 S 1 1 1
28
Frank Vahid
14
Canonical Form -- Sum of Minterms
• Truth tables too big for numerous inputs
• Use standard form of equation instead
– Known as canonical form
– Regular algebra: group terms of polynomial by power
• ax2 + bx + c (3x2 + 4x + 2x2 + 3 + 1 --> 5x2 + 4x + 4)
– Boolean algebra: create sum of minterms
• Minterm: product term with every function literal appearing exactly
once, in true or complemented form
• Just multiply-out equation until sum of product terms
• Then expand each term until all terms are minterms
Q: Determine if F(a,b)=ab+a’ is same function as F(a,b)=a’b’+a’b+ab, by
converting first equation to canonical form (second already in canonical
form)
F = ab+a’ (already sum of products)
a F = ab + a’(b+b’) (expanding term)
Digital Design
F = ab + a’b + a’b’ (SAME -- same three terms as other equation)
Copyright © 2006 29
Frank Vahid
Multiple-Output Circuits
• Many circuits have more than one output
• Can give each a separate circuit, or can share gates
• Ex: F = ab + c’, G = ab + bc
a
a
b
b
F
F
c
c
G
G
(b)
(a)
15
Multiple-Output Example:
BCD to 7-Segment Converter
a
f
b
g
e
c
d
Digital Design
Copyright © 2006 31
Frank Vahid
2.7
Digital Design
Copyright © 2006 32
Frank Vahid
16
Example: Three 1s Detector
• Problem: Detect three consecutive 1s
in 8-bit input: abcdefgh
• 00011101 Æ 1 10101011 Æ 0
11110000 Æ 1
– Step 1: Capture the function
• Truth table or equation?
– Truth table too big: 2^8=256 rows a
a
– Equation: create terms for each
a abc
possible case of three consecutive 1s b
c
• y = abc + bcd + cde + def + efg + fgh
bcd
– Step 2: Convert to equation -- already d
done cde
e y
– Step 3: Implement as a gate-based
def
circuit f
efg
g
fgh
Digital Design h
Copyright © 2006 33
Frank Vahid
17
2.8
More Gates
1 1
NAND NOR XOR XNOR NAND NOR
x x x
F F x y
y y
F y
x y F x y F x y F x y F x F
0 0 1 0 0 1 0 0 0 0 0 1
0 1 1 0 1 0 0 1 1 0 1 0 x y
y
1 0 1 1 0 0 1 0 1 1 0 0
1 1 0 1 1 0 1 1 0 1 1 1 0 0
• NAND: Opposite of AND (“NOT AND”) • NAND same as AND with power &
• NOR: Opposite of OR (“NOT OR”) ground switched
• XOR: Exactly 1 input is 1, for 2-input • Why? nMOS conducts 0s well, but not
XOR. (For more inputs -- odd number 1s (reasons beyond our scope) -- so
of 1s) NAND more efficient
• XNOR: Opposite of XOR (“NOT XOR”) • Likewise, NOR same as OR with
power/ground switched
• AND in CMOS: NAND with NOT
• OR in CMOS: NOR with NOT
Digital Design
Copyright © 2006
• So NAND/NOR more common
35
Frank Vahid
– S = (abc)’
• Detecting all 0s 0
0 1 a0
0
– Use NOR b0
– Use XOR
– Useful for generating “parity”
bit common for detecting
errors
Digital Design
Copyright © 2006 36
Frank Vahid
18
Completeness of NAND
• Any Boolean function can be implemented using just NAND
gates. Why?
– Need AND, OR, and NOT
– NOT: 1-input NAND (or 2-input NAND with inputs tied together)
– AND: NAND followed by NOT
– OR: NAND preceded by NOTs
• Likewise for NOR
Digital Design
Copyright © 2006 37
Frank Vahid
• N variables 24 = 16
– 2N rows possible functions
N
– 2(2 ) possible functions
a XOR b
a NOR b
a NAND b
a OR b
a
a XNOR b
1
b
0
b’
a’
' '
0 1
b
R
O
b
R
O
a
b
R
O
N
a
b
D
N
A
a
b
R
O
N
X
a
b
D
A
N
a
Digital Design
Copyright © 2006 38
Frank Vahid
19
2.9
Decoder Example
• New Year’s Eve 210 21 0 0
Happy
0 1 0 0 0 1 New Year
Countdown Display 1 0 0
i0 d0
0 1 0
i1 d1 1
– Microprocessor counts 0 0 0 i2 d2 1 0 0 2
0 0 0 i3 d3 0 0 0 3
r
o
s
e
from 59 down to 0 in
c
a
0 0 0 i4
r
ci
0 0 0 i5
M
d58 0 0 0
– Want illuminate one of 60 e d59 0 0 0
lights for each binary d60
d61 58
number 6x64 d62 59
– Use 6x64 decoder dcd d63
• 4 outputs unused
Digital Design
Copyright © 2006 40
Frank Vahid
20
Multiplexor (Mux)
• Mux: Another popular combinational building block
– Routes one of its N data inputs to its one output, based on binary
value of select inputs
• 4 input mux Æ needs 2 select inputs to indicate which input to route
through
• 8 input mux Æ 3 select inputs
• N inputs Æ log2(N) selects
– Like a railyard switch
Digital Design
Copyright © 2006 41
Frank Vahid
2x1 mux 0 s0
i0
4⋅ 1
i0 i1
i1 d
d
i2 i2
i3
s1 s0 i3
4x1 mux
s1 s0
Digital Design
Copyright © 2006 42
Frank Vahid
21
Mux Example
• City mayor can set four switches up or down, representing
his/her vote on each of four proposals, numbered 0, 1, 2, 3
• City manager can display any such vote on large green/red
LED (light) by setting two switches to represent binary 0, 1,
2, or 3 Mayor’s switches
i3 Green/
3
P
s1 s0 Red
LED
4
manager's
switches
Digital Design
Copyright © 2006 43
Frank Vahid
Digital Design
Copyright © 2006 44
Frank Vahid
22
N-bit Mux Example
Additional Considerations
2.10
d2 d2
d1 d1
d0 d0
• Schematic capture
– Computer tool for user to capture logic circuit graphically
• Simulator
– Computer tool to show what circuit outputs would be for given inputs
• Outputs commonly displayed as waveform
Digital Design
Copyright © 2006 46
Frank Vahid
23
Additional Considerations
Non-Ideal Gate Behavior -- Delay
Digital Design
Copyright © 2006 47
Frank Vahid
Chapter Summary
• Combinational circuits
– Circuit whose outputs are function of present inputs
• No “state”
• Switches: Basic component in digital circuits
• Boolean logic gates: AND, OR, NOT -- Better building block than
switches
– Enables use of Boolean algebra to design circuits
• Boolean algebra: uses true/false variables/operators
• Representations of Boolean functions: Can translate among
• Combinational design process: Translate from equation (or table) to
circuit through well-defined steps
• More gates: NAND, NOR, XOR, XNOR also useful
• Muxes and decoders: Additional useful combinational building blocks
Digital Design
Copyright © 2006 48
Frank Vahid
24