Академический Документы
Профессиональный Документы
Культура Документы
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
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
gate gate
source source
drain drain
Logic gates are better digital circuit building blocks than switches (transistors)
Why?...
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
3
20/9/2016
4
20/9/2016
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
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
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
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
2.5
7
20/9/2016
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
Truth table
Complement of f = w'xy + wx'y'z' a F (d)
f ' = (w'xy + wx'y'z')' Circuit 2
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
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
Multiple-Output Example:
2.7
13
20/9/2016
* 1010, # 1011
input as complemented.
nothing pressed: 1111
14
20/9/2016
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
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
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
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
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
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
Additional Considerations
2.10
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
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