Вы находитесь на странице: 1из 19

20/9/2016

2.1

Introduction
Lets learn to design digital circuits, starting with a
simple form of circuit:
Digital Design Combinational circuit
Outputs depend solely on the present combination of the circuit
inputs values
Chapter 2:
Vs. sequential circuit: Has memory that impacts outputs too
Combinational Logic Design
b=0 Digital F=0
System
Slides to accompany the textbook Digital Design, with RTL Design, VHDL, and Motion a
Verilog, 2nd Edition,
b=0 Digital F=0
sensor Digital
by Frank Vahid, John Wiley and Sons Publishers, 2010. System
System F b=1 Digital F=1
http://www.ddvahid.com
Lamp System
Light b
b=1 Digital F=1 sensor
System b=0 Digital F=1
if a=0 and b=0, then F=0 System
if b=0, then F=0 if a=0 and b=1, then F=0
Copyright 2010 Frank Vahid if b=1, then F=1 if a=1 and b=0, then F=1 Cannot determine value of
Instructors of courses requiring Vahid's Digital Design textbook (published by John Wiley and Sons) have permission to modify and use these slides for customary course-related activities, (a) a (b) if a=1 and b=1, then F=0 (c) F solely from present
a
subject to keeping this copyright notice in place and unmodified. These slides may be posted as unanimated pdf versions on publicly-accessible course websites.. PowerPoint source (or pdf a input value
Digital
with animations) mayDesign 2e
not be posted to publicly-accessible websites, but may be posted for students on internal protected sites or distributed directly to students by other electronic means. Digital Design 2e
Instructors mayCopyright 2010of the slides available to students for a reasonable photocopying charge, without incurring royalties. Any other use requires explicit permission. Instructors
make printouts Copyright 2010
Frank Vahid
may obtain PowerPoint source or obtain special use permissions from Wiley see http://www.ddvahid.com for information. Frank Vahid Note: Slides with animation are denoted with a small red "a" near the animated items

2.2

Switches Switches
Electronic switches are the basis of A switch has three parts
control
input
binary digital circuits Source input, and output off

Electrical terminology Current tries to flow from source


Voltage: Difference in electric potential input to output source output
4.5 A
4.5 A

a
input
between two points (volts, V)
9V
+ Control input control
Analogous to water pressure input
Voltage that controls whether that on
Resistance: Tendency of wire to resist current can flow
current flow (ohms, W) 2 ohms
The amazing shrinking switch source output
input
Analogous to water pipe diameter
9V 1930s: Relays (b)
Current: Flow of charged particles (amps, A) 0V
Analogous to water flow 1940s: Vacuum tubes
V = I * R (Ohms Law) 4.5 A 1950s: Discrete transistor
9 V = I * 2 ohms a
1960s: Integrated circuits (ICs)
I = 4.5 A If a 9V potential difference is applied Initially just a few transistors on IC discrete
across a 2 ohm resistor, then 4.5 A of Then tens, hundreds, thousands... transistor
IC
relay vacuum tube
current will flow.
quarter
Digital Design 2e Digital Design 2e (to see the relative size)
Copyright 2010 Copyright 2010
Frank Vahid Frank Vahid

1
20/9/2016

2.3

Moores Law The CMOS Transistor


IC capacity doubling about every 18 months CMOS transistor
for several decades Basic switch in modern ICs
Known as Moores Law after Gordon Moore, A positive
a
...attracts electrons here,
co-founder of Intel voltage here... turning the channel between
nMOS
Predicted in 1965 predicted that components the source and drain into
a conductor 1 0
per IC would double roughly every year or so gate

Book cover depicts related phenomena gate


oxide
For a particular number of transistors, the IC IC package
source drain conducts does not
area shrinks by half every 18 months conduct
Consider how much shrinking occurs in just 10
years (try drawing it)
Enables incredibly powerful computation in pMOS
incredibly tiny devices 1 0
IC gate
Todays ICs hold billions of transistors (a)

The first Pentium processor (early 1990s)


needed only 3 million Silicon -- not quite a conductor or insulator: does not conducts
conduct
Semiconductor
An Intel Pentium processor IC
Digital Design 2e
Copyright 2010
having millions of transistors Digital Design 2e
Copyright 2010
Frank Vahid Frank Vahid

Boolean Logic Gates 2.4

CMOS Transistor Analogy Building Blocks for Digital Circuits


(Because Switches are Hard to Work With)

gate gate
source source

drain drain

Logic gates are better digital circuit building blocks than switches (transistors)
Why?...

Digital Design 2e Digital Design 2e


Copyright 2010 Copyright 2010
Frank Vahid Frank Vahid

2
20/9/2016

Boolean Algebra and its Relation to Digital Circuits Boolean Algebra and its Relation to Digital Circuits
To understand the benefits of logic gates vs. switches, Developed mid-1800s by George Boole to formalize human thought
we should first understand Boolean algebra Ex: Ill 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 dont go)
Traditional algebra Likewise, m for Mary going, j for John, and s for Sally a b AND
0 0 0
Variables represent real numbers (x, y) Then F = (m OR j) AND NOT(s) 0 1 0
1 0 0
Operators operate on variables, return real numbers (2.5*x + y - 3) Nice features 1 1 1
Formally evaluate
Boolean Algebra m=1, j=0, s=1 --> F = (1 OR 0) AND NOT(1) = 1 AND 0 = 0
a b OR
0 0 0
Variables represent 0 or 1 only Formally transform 0 1 1
a b AND 1 0 1
F = (m and NOT(s)) OR (j and NOT(s))
Operators return 0 or 1 only 0 0 0 a 1 1 1
0 1 0 Looks different, but same function
Basic operators 1 0 0 Well show transformation techniques soon a NOT
1 1 1 a b OR 0 1
AND: a AND b returns 1 only when both a=1 and b=1 0 0 0 Formally prove 1 0
0 1 1 Prove that if Sally goes to lunch (s=1), then I dont go (F=0)
OR: a OR b returns 1 if either (or both) a=1 or b=1 1 0 1
1 1 1 F = (m OR j) AND NOT(1) = (m OR j) AND 0 = 0
NOT: NOT a returns the opposite of a (1 if a=0, 0 if a=1) a
0
NOT
1
1 0

Digital Design 2e Digital Design 2e


Copyright 2010 Copyright 2010
Frank Vahid Frank Vahid

Evaluating Boolean Equations Converting to Boolean Equations


a
Evaluate the Boolean equation F = (a AND b) OR (c a
Convert the following English
AND d) for the given values of variables a, b, c, and d: statements to a Boolean equation
Q1: a=1, b=1, c=1, d=0. a b AND
Q1. a is 1 and b is 1.
Answer: F = 0 0 0 Answer: F =
0 1 0
Q2: a=0, b=1, c=0, d=1. 1 0 0 Q2. either of a or b is 1.
1 1 1
Answer: F = Answer: F =
Q3: a=1, b=1, c=1, d=1. a
0
b
0
OR
0 Q3. a is 1 and b is 0.
Answer: F = 0
1
1
0
1
1
Answer: F =
1 1 1
Q4. a is not 0.
a NOT Answer:
0 1
1 0 (a) Option 1: F =
(b) Option 2: F =

Digital Design 2e Digital Design 2e


Copyright 2010 Copyright 2010
Frank Vahid Frank Vahid

3
20/9/2016

Converting to Boolean Equations Exercise


a
Q1. A fire sprinkler system should spray water if high heat Which Boolean operation, AND, OR or NOT, is appropriate for
is sensed and the system is set to enabled. each of the following:
Answer: h represent high heat is sensed, a) Detecting motion in any motion sensor surrounding a
e represent enabled, house (each motion sensor outputs 1 when motion is
F represent spraying water. detected).
Then an equation is: F =
b) Detecting that three buttons are being pressed
Q2. A car alarm should sound if the alarm is enabled, and simultaneously (each button outputs 1 when a button is
either the car is shaken or the door is opened. being pressed).
Answer: a represent alarm is enabled,
c) Detecting the absence of light from a light sensor (the light
s represent car is shaken,
sensor outputs 1when light is sensed).
d represent door is opened,
F represent alarm sounds.
Then an equation is: F =
Digital Design 2e Digital Design 2e
Copyright 2010 Copyright 2010
Frank Vahid Frank Vahid

Exercise Relating Boolean Algebra to Digital Design


Boolean NOT OR AND
Convert the following English problem statements to Boolean algebra
Booles intent: formalize x x
human thought Symbol x F
y
F
y
F
equations. Introduce Boolean variables as needed. (mid-1800s)
x F x y F x y F
a) A flood detector should turn on a pump if water is detected Switches For telephone Truth table 0 1 0 0 0 0 0 0
(1930s) switching and other 1 0 0 1 1 0 1 0
and the system is set to enabled electronic uses 1 0 1 1 0 0
1 1 1 1 1 1
b) A house energy monitor should sound an alarm it is night Showed application 1 0 0

Shannon (1938) of Boolean algebra y


and light is detected inside a room but motion is not to design of switch-
x y

detected. based circuits Transistor


circuit
x F
x
F y
F

c) An irrigation system should open the sprinklers water Digital design x y


x
0
valve if the system is enabled and neither rain nor freezing 1 1
Implement Boolean operators using
temperatures are detected. transistors 1.8 V
Next slides show how
1 these circuits work.
Call those implementations logic gates. 1.2 V Note: The above OR/AND
implementations are
Lets us build circuits by doing math - 0.6 V
inefficient; well show why,
0
- powerful concept 0V and show better ones,
later.
Digital Design 2e Digital Design 2e 1 and 0 each actually corresponds to
Copyright 2010 Copyright 2010
Frank Vahid Frank Vahid
a voltage range

4
20/9/2016

NOT gate OR gate

1 0 0
1 x y F
0 0 0 1 0
y y
x F 0 1 1
0 1 0 1 1 0 1 0 0
1 x 0
x F x F 1 1 1
x 1
1 0 0
F F
1 0 1 y 0 0 y
x x x
1 a a
0 a
0 a

x 0
(a) 1
0 (b) y
0 1 1
1 When the input is 0 When the input is 1
F
1 (a) (b)
F
0 0 When an input is 1 When both inputs are 0
time time
Digital Design 2e Digital Design 2e
Copyright 2010 Copyright 2010
Frank Vahid Frank Vahid

AND gate Building Circuits Using Gates

0 0
x y F
0 0 0
1 1 0 1
0 1 0 x y x y
1 0 0
F F
1 1 1
y 1 1 y 1 0
1
x
0 x
1 x
0
Recall Chapter 1 motion-in-dark example
a a

y
1 Turn on lamp (F=1) when motion sensed (a=1) and no light (b=0)
1
0 1
(b)
F = a AND NOT(b)
1 (a)
F Build using logic gates, AND and NOT, as shown
0
When both inputs are 1 When an input is 0 We just built our first digital circuit!
time
Digital Design 2e Digital Design 2e
Copyright 2010 Copyright 2010
Frank Vahid Frank Vahid

5
20/9/2016

Example: Converting a Boolean Equation to a


More examples
Circuit of Logic Gates
Start from the output, work back towards the inputs
F = (a AND NOT(b)) OR (b AND NOT(c))
Q: Convert the following equation to logic gates: F = a AND (s OR d)
2 1 3
1 2 a
F = a AND NOT( b OR NOT(c) )
a b
s F F
a
d
c
a
a (a) a
b F
(b)
c

Start from the output, work back towards the inputs


Digital Design 2e Digital Design 2e
Copyright 2010 Copyright 2010
Frank Vahid Frank Vahid

Example: Seat Belt Warning Light


Using gates with more than 2 inputs System
Design circuit for warning light
Sensors
s=1: seat belt fastened
F = a AND b AND c
k=1: key inserted
w = NOT(s) AND k
BeltWarn
Capture Boolean equation
k w
a seat belt not fastened, and key
a inserted
b b F Convert equation to circuit
a

s
F c
c Seatbelt
Timing diagram illustrates circuit Inputs
(a) (b) behavior k
1
We set inputs to any values 0
1
Output set according to circuit s a
0
Can think of as AND(a,b,c) Outputs
1
w
0
Digital Design 2e Digital Design 2e
Copyright 2010 Copyright 2010 time
Frank Vahid Frank Vahid

6
20/9/2016

Gates vs. switches More examples: Seat belt warning light extensions
Notice Only illuminate warning light if
k Belt W a rn

Boolean algebra enables easy


capture as equation and conversion person is in the seat (p=1), p w

to circuit and seat belt not fastened a

How design with switches? and key inserted


Of course, logic gates are built from s
switches, but we think at level of logic w = p AND NOT(s) AND k
gates, not switches
w = NOT(s) AND k
1 BeltWarn

0 BeltWarn
s
Given t=1 for 5 seconds after k BeltWarn
k w
key inserted. Turn on warning p
w w
0
light when t=1 (to check that s
a

s
warning lights are working)
k t
w = (p AND NOT(s) AND k) OR t
1 Seatbelt
a

Digital Design 2e Digital Design 2e


Copyright 2010 Copyright 2010
Frank Vahid Frank Vahid

2.5

Some Gate-Based Circuit Drawing Conventions Boolean Algebra


By defining logic gates based on Boolean algebra, we can
no yes
use algebraic methods to manipulate circuits
x
y
F
Notation: Writing a AND b, a OR b, NOT(a) is cumbersome
Use symbols: a * b (or just ab), a + b, and a
no yes Original: w = (p AND NOT(s) AND k) OR t
a
New: w = psk + t
Spoken as w equals p and s prime and k, or t
Or just w equals p s prime k, or t
s known as complement of s
While symbols come from regular algebra, dont say times or plus
"product" and "sum" are OK and commonly used
ok
a
Boolean algebra precedence, highest precedence first.
Symbol Name Description
not ok () Parentheses Evaluate expressions nested in parentheses first
NOT Evaluate from left to right
Digital Design 2e Digital Design 2e * AND Evaluate from left to right
Copyright 2010 Copyright 2010
Frank Vahid Frank Vahid + OR Evaluate from left to right

7
20/9/2016

Boolean Algebra Operator Precedence Boolean Algebra Terminology


Evaluate the following Boolean equations, assuming a=1, b=1, c=0, d=1. Example equation: F(a,b,c) = abc + abc + ab + c
Q1. F = a * b + c.
Answer: * has precedence over +, so we evaluate the equation as F = (1 *1) + 0 = (1) + 0 = 1 + Variable
0 = 1.
Represents a value (0 or 1)
Q2. F = ab + c.
Answer: the problem is identical to the previous problem, using the shorthand notation for *. Three variables: a, b, and c
Q3. F = ab. Literal
Answer: we first evaluate b because NOT has precedence over AND, resulting in F = 1 * (1) =
1 * (0) = 1 * 0 = 0. Appearance of a variable, in true or complemented form
a Q4. F = (ac). Nine literals: a, b, c, a, b, c, a, b, and c
Answer: we first evaluate what is inside the parentheses, then we NOT the result, yielding
(1*0) = (0) = 0 = 1. Product term
Q5. F = (a + b) * c + d. Product of literals
Answer: Inside left parentheses: (1 + (1)) = (1 + (0)) = (1 + 0) = 1. Next, * has precedence
over +, yielding (1 * 0) + 1 = (0) + 1. The NOT has precedence over the OR, giving (0) + (1) = Four product terms: abc, abc, ab, c
(0) + (0) = 0 + 0 = 0. Boolean algebra precedence, highest precedence first.
Sum-of-products
Symbol Name Description
Equation written as OR of product terms only
() Parentheses Evaluate expressions nested in parentheses first
Above equation is in sum-of-products form. F = (a+b)c + d is not.
NOT Evaluate from left to right
Digital Design 2e * AND Evaluate from left to right Digital Design 2e
Copyright 2010 Copyright 2010
Frank Vahid + OR Evaluate from left to right Frank Vahid

Boolean Algebra Properties Example that Applies Boolean Algebra Properties


Commutative Example uses of the properties Want automatic door opener
a+b=b+a Can the circuit be simplified?
a*b=b*a Show abc equivalent to cba. circuit (e.g., for grocery store)
Output: f=1 opens door f = hc' + h'pc
Distributive Use commutative property: a

a * (b + c) = a * b + a * c f = c'h + c'h'p (by the commutative property)


a*b*c = a*c*b = c*a*b = c*b*a Inputs:
Can write as: a(b+c) = ab + ac Show abc + abc = ab. f = c'(h + h'p) (by the first distrib. property)
p=1: person detected
a + (b * c) = (a + b) * (a + c) Use first distributive property f = c'((h+h')*(h+p)) (2nd distrib. prop.; tricky one)
(This second one is tricky!)
a h=1: switch forcing hold open
abc + abc = ab(c+c). f = c'((1)*(h + p)) (by the complement property)
Can write as: a+(bc) = (ab)(ac) c=1: key forcing closed
Associative Complement property f = c'(h+p) (by the identity property)
Replace c+c by 1: ab(c+c) = ab(1). Want open door when
(a + b) + c = a + (b + c)
Identity property h=1 and c=0, or
(a * b) * c = a * (b * c)
ab(1) = ab*1 = ab. h=0 and p=1 and c=0 a
Identity
0+a=a+0=a Show x + xz equivalent to x + z. Equation: f = hc + hpc
1*a=a*1=a Second distributive property DoorOpener
DoorOpener
Complement Replace x+xz by (x+x)*(x+z). h c
Simplified
a + a = 1 Complement property c f
h f circuit
a * a = 0 Replace (x+x) by 1, p p
To prove, just evaluate all possibilities Identity property
replace 1*(x+z) by x+z.
Digital Design 2e
Copyright 2010
Digital Design 2e
Copyright 2010
Simplification of circuits is covered
Frank Vahid Frank Vahid in Sec. 2.11 / Sec 6.2.

8
20/9/2016

Example that Applies Boolean Algebra Properties Boolean Algebra: Additional Properties
Found inexpensive chip that Null elements
computes: DoorOpener a+1=1
h
f = chp + chp + chp
Can we use it for the door opener? c
f a*0=0
Commutative
a+b=b+a
Is it the same as f = hc + hpc? p
Idempotent Law
a*b=b* a
Apply Boolean algebra: a+a=a
Distributive a*a=a
a * (b + c) = a * b + a * c f = chp + chp + chp
a + (b * c) = (a + b) * (a + c) f = ch(p + p) + chp (by the distributive property) Involution Law
Associative (a) = a
(a + b) + c = a + (b + c) f = ch(1) + chp (by the complement property)
(a * b) * c = a * (b * c) f = ch + chp (by the identity property) DeMorgans Law
Identity a
(a + b) = ab
0+a=a+0=a f = hc + hpc (by the commutative property)
1*a=a* 1=a (ab) = a + b
Same! Yes, we can use it.
Complement Very useful!
a + a = 1
a * a = 0 To prove, just evaluate all possibilities
Digital Design 2e Digital Design 2e
Copyright 2010 Copyright 2010
Frank Vahid Frank Vahid

(a + b) = ab
Example Applying DeMorgans Law (ab) = a + b Example Applying Properties
Commutative For door opener f = c'(h+p) , prove
Aircraft lavatory Behavior Alternative: Instead of a + b = b + a
Three lavatories, each with sensor (a, lighting Available,
sign example b, c), equals 1 if door locked
a * b = b * a door stays closed (f=0) when c=1
light Occupied Distributive
Light Available sign (S) if any lavatory
Opposite of
f = c'(h+p)
available a * (b + c) = a * b + a * c
Equation and circuit
Available function a + (b * c) = (a + b) * (a + c) Let c = 1 (door forced closed)
S = a + b + c Associative f = 1'(h+p)
S = a + b + c
So S = (a + b + c) (a + b) + c = a + (b + c)
Transform (a * b) * c = a * (b * c) f = 0(h+p)
(abc) = a+b+c (by DeMorgans Law) S = (a) * (b) * (c)
(by DeMorgans Identity f = 0h + 0p (by the distributive property)
S = (abc) Law) 0 + a = a + 0 = a
Null elements f=0+0 (by the null elements property)
New circuit S = a * b * c (by 1 * a = a * 1 = a
a + 1 = 1
Involution Law) Complement a * 0 = 0 f=0
Makes intuitive sense a + a = 1
Circuit Idempotent Law
Occupied if all doors a * a = 0
a a + a = a
Circuit are locked
S a a * a = a
b S
b Involution Law
c
c (a) = a
DeMorgans Law
(a + b) = ab
Digital Design 2e Digital Design 2e
Copyright 2010 Copyright 2010 (ab) = a + b
Frank Vahid Frank Vahid

9
20/9/2016

2.6

Complement of a Function Representations of Boolean Functions


English 1: F outputs 1 when a is 0 and b is 0, or when a is 0 and b is 1.
Commonly want to find complement (inverse) of function F English 2: F outputs 1 when a is 0, regardless of bs value
(a)
0 when F is 1; 1 when F is 0 a

Use DeMorgans Law repeatedly b


a b
0 0
F
1
Equation 1: F(a,b) = ab + ab
Note: DeMorgans Law defined for more than two variables, e.g.: F
0 1 1
Equation 2: F(a,b) = a
(a + b + c)' = (abc)' 1 0 0
(b) (c)
1 1 0
(abc)' = (a' + b' + c') Circuit 1 a

Truth table
Complement of f = w'xy + wx'y'z' a F (d)
f ' = (w'xy + wx'y'z')' Circuit 2

f ' = (w'xy)'(wx'y'z')' (by DeMorgans Law)


The function F
f ' = (w+x'+y')(w'+x+y+z) (by DeMorgans Law)
Can then expand into sum-of-products form A function can be represented in different ways
Above shows seven representations of the same functions F(a,b), using
four different methods: English, Equation, Circuit, and Truth Table
Digital Design 2e Digital Design 2e
Copyright 2010 Copyright 2010
Frank Vahid Frank Vahid

Truth Table Representation of Boolean Functions Converting among Representations


1
Define value of F for
a b F a b c F a b c d F
Can convert from any representation
0 0 0 0 0 0 0 0 0
to another Equations Circuits
each possible 0 1 0 0 1 0 0 0 1
2
1 0 0 1 0 0 0 1 0 Common conversions
combination of input 1 1 0 1 1 0 0 1 1
Equation to circuit (we did this earlier)
4 6
1 0 0 0 1 0 0 3 5
values (a)
1 0 1 0 1 0 1 Circuit to equation
1 1 0 0 1 1 0 Start at inputs, write expression of Truth tables
2-input function: 4 rows 1 1 1 0 1 1 1 each gate output
3-input function: 8 rows (b) 1 0 0 0
1 0 0 1
4-input function: 16 rows a b c F 1 0 1 0
0 1 0 1 1 c c'
Q: Use truth table to 0
0
0
0
0
1 0 1 1 0 0
1 1 0 1
define function F(a,b,c) a 0 1 0 0
1 1 1 0
0 1 1 0 h F = c'(h+p)
that is 1 when abc is 5 or 1 0 0 0 1 1 1 1

greater in binary 1 0 1 1 (c) p


1 1 0 1 h+p
1 1 1 1

Digital Design 2e Digital Design 2e


Copyright 2010 Copyright 2010
Frank Vahid Frank Vahid

10
20/9/2016

Converting among
1

Representations
Equations

4
2
Circuits

6
Example: Converting from Truth Table to Equation
3 5
More common conversions Truth tables Parity bit: Extra bit added to a b c P
Truth table to equation (which we can data, intended to enable
then convert to circuit) Inputs Outputs Term
0 0 0 0
Easyjust OR each input term that
detection of error (a bit 0 0 1 1
a b F F = sum of
should output 1 0 0 1 ab changed unintentionally) 0 1 0 1
Equation to truth table 0 1 1 ab
e.g., errors can occur on wires
Easyjust evaluate equation for each
1 0 0
due to electrical interference 0 1 1 0
1 1 0
input combination (row) 1 0 0 1
Creating intermediate columns helps F = ab + ab Even parity: Set parity bit so
total number of 1s (data + 1 0 1 0
Q: Convert to equation parity) is even 1 1 0 0
a b c F
0 0 0 0 e.g., if data is 001, parity bit is 1 1 1 1 1
0 0 1 0 0011 has even number of 1s
Q: Convert to truth table: F = ab + ab 0 1 0 0
Inputs Output 0 1 1 0 Want equation, but easiest to Convert to eqn.
a b a' b' a' b F 1
1
0
0
0
1
0
1 abc
start from truth table for this
a
0 0 1 0 1
0 1 0 1 1 1 1 0 1 abc example P = a'b'c + a'bc' + ab'c' + abc
1 0 0 0 0 1 1 1 1 abc a
Digital Design 2e 1 1 0 0 0 Digital Design 2e
Copyright 2010
Frank Vahid
F = abc + abc + abc Copyright 2010
Frank Vahid

Example: Converting from Circuit to Truth Table Standard Representation: Truth Table
First convert to circuit to equation, then equation to table How can we determine if two f = chp + chp + ch
functions are the same? f = ch(p + p) + chp
a ab (ab)' Recall automatic door example
f = ch(1) + chp
Same as f = hc + hpc?
b f = ch + chp
Used algebraic methods
c' F But if we failed, does that prove (what if we stopped here?)
c (ab)'c' not equal? No. f = hc + hpc
Solution: Convert to truth tables
Inputs Outputs Only ONE truth table
Q: Determine if F=ab+a is same
a b c ab (ab)' c' F representation of a given
function as F=ab+ab+ab, by converting
0 0 0 0 1 1 1 function
each to truth table first
0 0 1 0 1 0 0 Standard representationfor
0 1 0 0 1 1 1 given function, only one version F = ab + a' F = ab +
ab + ab
0 1 1 0 1 0 0 in standard form exists
a b F a b F
1 0 0 0 1 1 1
0 0 1 0 0 1 a

1 0 1 0 1 0 0 0 1 1 0 1 1
1 1 0 1 0 1 0 1 0 0 1 0 0
Digital Design 2e 1 1 1 1 0 0 0 Digital Design 2e 1 1 1 1 1 1
Copyright 2010 Copyright 2010
Frank Vahid Frank Vahid

11
20/9/2016

Truth Table Canonical Form Canonical Form Sum of Minterms


Q: Determine via truth tables whether ab+a' and (a+b)' are equivalent 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
F = ab + a' F = (a+b)'
ax2 + bx + c (3x2 + 4x + 2x2 + 3 + 1 --> 5x2 + 4x + 4)
a b F a b F Boolean algebra: create sum of minterms
0 0 1 0 0 1 Minterm: product term with every function literal appearing exactly
0 1 1 0 1 0 once, in true or complemented form
1 0 0 1 0 0 Just multiply-out equation until sum of product terms
Then expand each term until all terms are minterms
1 1 1 1 1 0
Q: Determine if F(a,b)=ab+a is equivalent to F(a,b)=ab+ab+ab, by
a converting first equation to canonical form (second already is)

F = ab+a (already sum of products)


a F = ab + a(b+b) (expanding term)
F = ab + ab + ab (Equivalent same three terms as other equation)
Digital Design 2e Digital Design 2e
Copyright 2010 Copyright 2010
Frank Vahid Frank Vahid

Canonical Form Sum of Minterms Compact Sum of Minterms Representation


Q: Determine whether the functions G(a,b,c,d,e) = abcd + a'bcde and List each minterm as a number
H(a,b,c,d,e) = abcde + abcde' + a'bcde + a'bcde(a' + c) are equivalent.
Number determined from the binary representation of its
G = abcd + a'bcde variables values
G = abcd(e+e') + a'bcde a'bcde corresponds to 01111, or 15
G = abcde + abcde' + a'bcde abcde' corresponds to 11110, or 30
G = a'bcde + abcde' + abcde (sum of minterms form) abcde corresponds to 11111, or 31
Thus, H = a'bcde + abcde' + abcde can be written as:
H = abcde + abcde' + a'bcde + a'bcde(a' + c) H = m(15,30,31)
H = abcde + abcde' + a'bcde + a'bcdea' + "H is the sum of minterms 15, 30, and 31"
a a'bcdec
H = abcde + abcde' + a'bcde + a'bcde + a'bcde
H = abcde + abcde' + a'bcde
Digital Design 2e
H = a'bcde + abcde' + abcde Digital Design 2e
Copyright 2010 Copyright 2010
Frank Vahid Frank Vahid

12
20/9/2016

Multiple-Output Example:
Multiple-Output Circuits
BCD to 7-Segment Converter
Many circuits have more than one output
w a
Can give each a separate circuit, or can share gates x
y
f
b
Ex: F = ab + c, G = ab + bc z Converter g
e
c
a d
a
b
b
F
F
a
c f
c
a
b
a g
e
G c
G
d

abcdefg = 1111110 0110000 1101101


(b)
(a) (a) (b)

Option 1: Separate circuits Option 2: Shared gates


Digital Design 2e Digital Design 2e
Copyright 2010 Copyright 2010
Frank Vahid Frank Vahid

Multiple-Output Example:
2.7

Combinational Logic Design Process


BCD to 7-Segment Converter
Step Description
Step 1: Create a truth table or equations, whichever is
a Capture the
f Capture most natural for the given problem, to describe
function
b behavior the desired behavior of each output of the
g
e combinational logic.
c
d
This substep is only necessary if you captured the
2A: Create function using a truth table instead of equations. Create
Step 2: equations an equation for each output by ORing all the minterms
a = wxyz + wxyz + wxyz + wxyz +
Convert for that output. Simplify the equations if desired.
wxyz + wxyz + wxyz + wxyz
to circuit 2B: Implement For each output, create a circuit corresponding
b = wxyz + wxyz + wxyz + wxyz + as a gate- to the outputs equation. (Sharing gates among
wxyz + wxyz + wxyz + wxyz based circuit multiple outputs is OK optionally.)
a
...
Digital Design 2e Digital Design 2e
Copyright 2010 Copyright 2010
Frank Vahid Frank Vahid

13
20/9/2016

Example: Three 1s Pattern Detector Example: Number of 1s Counter


Problem: Detect three consecutive 1s Problem: Output in binary on two
in 8-bit input: abcdefgh outputs yz the # of 1s on three inputs
00011101 1 010 01
101 10
10101011 0
000 00
11110000 1 a
Step 1: Capture the function
Step 1: Capture the function Truth table or equation?
a
a Truth table or equation? Truth table is straightforward
Truth table too big: 2^8=256 rows a abc Step 2a: Create equations
b
Equation: create terms for each c
y = abc + abc + abc + abc
possible case of three consecutive 1s bcd
z = abc + abc + abc + abc
y = abc + bcd + cde + def + efg + fgh d a
Optional: Let's simplify y: b
c
Step 2a: Create equation -- already cde
y = a'bc + ab'c + ab(c' + c) = a'bc + ab'c + ab a
e y a
done Step 2b: Implement as a gate-based b
def a c
Step 2b: Implement as a gate-based f circuit b
c
z
a
circuit efg
a
b
g y c
b
c
fgh a
b
Digital Design 2e h Digital Design 2e
a c
Copyright 2010 Copyright 2010
Frank Vahid Frank Vahid
b

Simplifying Notations Example: Keypad Converter


Used in previous circuit Keypad has 7 outputs
One per row
r1
One per column 1 2 3 w
a
b
a
b
a a Key press sets one row r2
x
y
b b 4 5 6
c c c c and one column output Converter
z
to 1 r3
a a 7 8 9
b
b'
c
Press "5" r2=1, c2=1
(a) (b) r4
a Goal: Convert keypad * 0 #
outputs into 4-bit binary
List inputs multiple times Draw inversion bubble number
Less wiring in drawing rather than inverter. Or list 0-9 0000 to 1001 c1 c2 c3

* 1010, # 1011
input as complemented.
nothing pressed: 1111

Digital Design 2e Digital Design 2e


Copyright 2010 Copyright 2010
Frank Vahid Frank Vahid

14
20/9/2016

Example: Keypad Converter Example: Sprinkler Controller


Step 1: Capture behavior Microprocessor outputs which zone to water (e.g., cba=110
Truth table too big (2^7 rows); equations not clear either means zone 6) and enables watering (e=1)
Informal table can help Decoder should set appropriate valve to 1

zone 0
Step 1: Capture
zone 1
a
d0 behavior
d1
b d2 2
Micro- d3 3
4
d0 = a'b'c'e a

processor c
d4
d5
d1 = a'b'ce
a decoder d6 5
e d7
6 d2 = a'bc'e
7
a
Step 2b: Implement d3 = a'bce
as circuit (note d4 = ab'c'e
w = r3c2 + r3c3 + r4c1 + r4c3 + r1'r2'r3'r4'c1'c2'c3' sharable gates) ...
x = r2c1 + r2c2 + r2c3 + r3c1 + r1'r2'r3'r4c1'c2'c3'
d5 = ab'ce
a

Digital Design 2e
y = r1c2 + r1c3 + r2c3 + r3c1 + r4c1 + r4c3 + r1'r2'r3'r4'c1'c2'c3' Digital Design 2e
Equations seem like d6 = abc'e
Copyright 2010
Frank Vahid
z = r1c1 + r1c3 + r2c2 + r3c1 + r3c3 + r4c3 + r1'r2'r3'r4'c1'c2'c3' Copyright 2010
Frank Vahid a natural fit d7 = abce

Example: Sprinkler Controller Section 1 : END


Step 2b: Implement as circuit a
b
c d0
zone 0 zone 1
d0
a
d1

Micro-
b d2
d3 3
2 d1
c 4
processor d4
d5
decoder d6 5
e 6
d7 7 d2

d3
d0 = a'b'c'e
d1 = a'b'ce d4
d2 = a'bc'e
d3 = a'bce d5

d4 = ab'c'e
d6
d5 = ab'ce
d6 = abc'e d7
e
Digital Design 2e
Copyright 2010
d7 = abce Digital Design 2e
Copyright 2010
Frank Vahid Frank Vahid

15
20/9/2016

2.8

More Gates More Gates: Example Uses


1 1
NAND NOR XOR XNOR NAND NOR
x
F
x
F x y
x
Aircraft lavatory sign Circuit
y y a
F y a
example b
c
S
x y F x y F x y F x y F
0 0 1 0 0 1 0 0 0 0 0 1
x F
S = (abc)
x y
0
1
1
0
1
1
0
1
1
0
0
0
0
1
1
0
1
1
0
1
1
0
0
0
y Detecting all 0s 0
0 1 a0
0
1 1 0 1 1 0 1 1 0 1 1 1 0 0 Use NOR b0

NAND: Opposite of AND (NOT AND) NAND same as AND with power & Detecting equality a1 A=B
b1
NOR: Opposite of OR (NOT OR) ground switched Use XNOR
XOR: Exactly 1 input is 1, for 2-input nMOS conducts 0s well, but not 1s a2
XOR. (For more inputs -- odd number (reasons beyond our scope) so Detecting odd # of 1s b2
of 1s) NAND is more efficient
Use XOR
XNOR: Opposite of XOR (NOT XOR) Likewise, NOR same as OR with
power/ground switched
Useful for generating parity
bit common for detecting
NAND/NOR more common
errors
AND in CMOS: NAND with NOT
Digital Design 2e
Copyright 2010
OR in CMOS: NOR with NOT Digital Design 2e
Copyright 2010
Frank Vahid Frank Vahid

Completeness of NAND Number of Possible Boolean Functions


Any Boolean function can be implemented using just NAND How many possible functions of 2 a b F
0 0 0 or 1 2 choices
variables?
gates. Why? 22 rows in truth table, 2 choices for each
0 1 0 or 1 2 choices
1 0 0 or 1 2 choices
Need AND, OR, and NOT 2
2(2 ) = 24 = 16 possible functions 1 1 0 or 1 2 choices

NOT: 1-input NAND (or 2-input NAND with inputs tied together) N variables 24 = 16
AND: NAND followed by NOT 2N rows possible functions
N
OR: NAND preceded by NOTs 2(2 ) possible functions

Thus, NAND is a universal gate a b f0 f1 f2 f3 f4 f5 f6 f7 f8 f9 f10 f11 f12 f13 f14 f15
Can implement any circuit using just NAND gates 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1
0 1 0 0 0 0 1 1 1 1 0 0 0 0 1 1 1 1
Likewise for NOR 1 0 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1
1 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1

a AND b

a OR b

a XNOR b
a XOR b
b

a NAND b
a NOR b

a
0

1
Digital Design 2e Digital Design 2e
Copyright 2010 Copyright 2010
Frank Vahid Frank Vahid

16
20/9/2016

2.9

Decoders and Muxes Decoder Example


Decoder: Popular combinational New Years Eve 21 0 Happy
210 0
logic building block, in addition to 0 1 0 0 0 1 New Year
logic gates d0 1 d0 0 d0 0 d0 0 Countdown Display 1 0 0
i0 d0
0 1 0

Processor
i1 d1 1
1 0
Converts input binary number to
0 i0 d1 0 1 i0 d1 i0 d1 0 1 i0 d1 0
Microprocessor counts 0 0 0 i2 d2 1 0 0 2
0 i1 d2 0 0 i1 d2 0 1 i1 d2 1 1 i1 d2 0 0 0 0 i3 d3 0 0 0 3
one high output from 59 down to 0 in a
d3 0 d3 0 d3 0 d3 1 0 0 0 i4
2-input decoder: four possible binary on 6-bit output 0 0 0 i5
input binary numbers d58 0 0 0
Want illuminate one of 60 e d59 0 0 0
So has four outputs, one for each d0 0 lights for each binary d60
i1i0 d0
possible input binary number 1 i0 d1 0 d61 58
number 59
Internal design i1i0 d1 1 i1 d2 0 6x64 d62

AND gate for each output to e d3 1 Use 6x64 decoder dcd d63

detect input combination i1i0 d2 4 outputs unused


1
Decoder with enable e i1i0 d3 d0 0
Outputs all 0 if e=0 1 i0 d1 0
Regular behavior if e=1 1 i1 d2 0

n-input decoder: 2n outputs i1 i0 a


e d3 0
a
0
Digital Design 2e Digital Design 2e
Copyright 2010 Copyright 2010
Frank Vahid Frank Vahid

Multiplexor (Mux) Mux Internal Design


i0 i0 (1*i0=i0)
Mux: Another popular combinational building block 21 21 21
1 d
i0 i0 i0 i0 (0+i0=i0)
Routes one of its N data inputs to its one output, based on binary d d d
i1
0
i1 i1 i1 0
value of select inputs
s0 s0 s0
4 input mux needs 2 select inputs to indicate which input to route 0 1
a

through 0 s0
2x1 mux
8 input mux 3 select inputs
N inputs log2(N) selects
i0
Like a rail yard switch 4 1
i0 i1
i1 d
d
i2 i2
i3
s1 s0 i3

4x1 mux
s1 s0
Digital Design 2e Digital Design 2e
Copyright 2010 Copyright 2010
Frank Vahid Frank Vahid

17
20/9/2016

Mux Example Muxes Commonly Together N-bit Mux


City mayor can set four switches up or down, representing a3 i0
2x1
Simplifying
d
b3 i1
his/her vote on each of four proposals, numbered 0, 1, 2, 3 s0 notation:
4
4-bit
City manager can display any such vote on large green/red a2 i0
2x1
d A
4
I0
2x1
4
C
b2 i1 D C is short
LED (light) by setting two switches to represent binary 0, 1, s0
B
4
I1 for
2, or 3 Mayors switches a1 i0
2x1
d
s0
b1 i1 c3
Use 4x1 mux
s0
a
1 s0 c2
4x1 on/off 2x1
a0 i0
d c1
i0 b0 i1
s0
2 i1 s0 c0
d
i2
Proposal
3
i3 Green/ Ex: Two 4-bit inputs, A (a3 a2 a1 a0), and B (b3 b2 b1 b0)
s1 s0 Red
LED 4-bit 2x1 mux (just four 2x1 muxes sharing a select line) can select
4
between A or B
manager's
switches
Digital Design 2e Digital Design 2e
Copyright 2010 Copyright 2010
Frank Vahid Frank Vahid

Additional Considerations
2.10

N-bit Mux Example


Non-Ideal Gate Behavior -- Delay
From the car's 8-bit a
T 8
central computer I0 4x1
8 To the 1 1 1
A I1 8 D x x x x
above- F
I 8 D y 0 0 0
I2 mirror
M 8 display 1 1 1
I3
y y y
s1 s0
x y 0 0 0
We'll design
this later (1.8 V) 1 1 1
F F F
(0 V) 0 0 0
button
time time time
(a) (b) a
(c)
Four possible display items ideal a
more with delay but
a

Temperature (T), Average miles-per-gallon (A), Instantaneous mpg (I), and realistic
Miles remaining (M) each is 8-bits wide Real gates have some delay otherwise ideal
Choose which to display on D using two inputs x and y
Pushing button sequences to the next item
Outputs dont change immediately after inputs change
Use 8-bit 4x1 mux
Digital Design 2e Digital Design 2e
Copyright 2010 Copyright 2010
Frank Vahid Frank Vahid

18
20/9/2016

Circuit Delay and Critical Path Active Low Inputs


BeltWarn
Data inputs: flow through component (e.g., mux data input)
k
Control input: influence component behavior
p 1 ns Normally active high 1 causes input to carry out its purpose
1 ns
1 ns 1 ns a Active low Instead, 0 causes input to carry out its purpose
w
s 1 ns 1+1+1+1+1 = 5 ns
1 ns Example: 2x4 decoder with active low enable
1 ns 1 ns 1+0.5+1+1+1+1+1 = 6.5 ns
0.5 ns 1 disables decoder, 0 enables
t 1 ns 1+1+1 = 3 ns Drawn using inversion bubble d0 0 d0 0
Critical path del ay = 6.5 ns
1 i0 d1 0 1 i0 d1 0
Hence, circuits delay is 6.5 ns
1 i1 d2 0 1 i1 d2 0
Wires also have delay
e d3 0 e d3 1
Assume gates and wires have delays as shown
Path delay time for input to affect output
1 0
Critical path path with longest path delay (a) (b)
Digital Design 2e
Copyright 2010 Circuit delay delay of critical path Digital Design 2e
Copyright 2010
Frank Vahid Frank Vahid

Schematic Capture and Simulation Chapter Summary


Inputs Inputs a Combinational circuits
i0 i0 Circuit whose outputs are function of present inputs
i1 i1
No state
Simulate Simulate
Outputs Outputs Switches: Basic component in digital circuits
d3 d3

d2 d2
Boolean logic gates: AND, OR, NOT Better building block than switches
Enables use of Boolean algebra to design circuits
d1 d1
Boolean algebra: Uses true/false variables/operators
d0 d0
Representations of Boolean functions: Can translate among
Combinational design process: Translate from equation (or table) to
Schematic capture circuit through well-defined steps
Computer tool for user to capture logic circuit graphically More gates: NAND, NOR, XOR, XNOR also useful
Simulator Muxes and decoders: Additional useful combinational building blocks
Computer tool to show what circuit outputs would be for given inputs
Outputs commonly displayed as waveform
Digital Design 2e Digital Design 2e
Copyright 2010 Copyright 2010
Frank Vahid Frank Vahid

19

Вам также может понравиться