DSD Chapter 2
DSD Chapter 2
DSD Chapter 2
(EEE-344)
Week 2 - Chapter 2:
Combinational Logic Design
Instructor:
Umair Shafiq Khan
[email protected]
Electrical and Computer Engineering Department,
CUI Lahore campus
Office:
Block-B, Room No. B12A
Digital Design
Copyright © 2006
Frank Vahid 1
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 the a
1
?
Sequential
present combination of the circuit inputs’ values b
0 F
digital circuit
Digital Design
Copyright © 2006 2
Frank Vahid Note: Slides with animation are denoted with a small red "a" near the animated items
2.2
Switches
• Electronic switches are the basis of
binary digital circuits
– Electrical terminology
• Voltage: Difference in electric potential 4.5 A
– +
between two points 9V
4.5 A
• Current: Flow of charged particles
• Resistance: Tendency of wire to resist 2 ohms
current flow
9V
• V = I * R (Ohm’s Law) 0V
4.5 A
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
control
• Voltage that controls whether that input
“on”
current can flow
source output
input
(b)
discrete
transistor
IC
relay vacuum tube
quarter
Digital Design (to see the relative size)
Copyright © 2006 4
Frank Vahid
The CMOS(Complementary metal–oxide– 2.3
semiconductor)Transistor
• CMOS transistor
– Basic switch in modern ICs
a
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
• “Logic gates” are better digital circuit building blocks than switches (transistors)
– Why?...
Digital Design
Copyright © 2006 6
Frank Vahid
Boolean Algebra and its Relation to Digital Circuits
• Boolean Algebra
– Variables represent 0 or 1 only
– Operators return 0 or 1 only
– Basic operators
• AND: a AND b returns 1 only when both a=1 and b=1
• OR: a OR b returns 1 if either (or both) a=1 or b=1
• NOT: NOT a returns the opposite of a (1 if a=0, 0 if a=1)
a b AND
0 0 0
0 1 0
1 0 0
1 1 1 a b OR
0 0 0
0 1 1
1 0 1
a NOT 1 1 1
0 1
1 0
Digital Design
Copyright © 2006 7
Frank Vahid
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
Digital Design
Copyright © 2006 8
Frank Vahid
Relating Boolean Algebra to Digital Design
NOT OR AND
x x
Symbol x F F F
y y
x F x y F x y F
Truth table 0 1 0 0 0 0 0 0
1 0 0 1 1 0 1 0
1 0 1 1 0 0
1 1 1 1 1 1
1 0 0
y
x y
Transistor x F
x F
circuit F y
x y
0 x
1 1
Digital Design
Copyright © 2006 9
Frank Vahid
NOT/OR/AND Logic Gate Timing Diagrams
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 10
Frank Vahid
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
k BeltWarn
p w
Digital Design
Copyright © 2006 11
Frank Vahid
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 12
Frank Vahid
Boolean Algebra Properties
• Commutative Example uses of the properties
– a+b=b+a
– a*b=b*a • Show abc + abc’ = ab.
– Use first distributive property
• Distributive
• abc + abc’ = ab(c+c’).
– a * (b + c) = a * b + a * c
– Complement property
– a + (b * c) = (a + b) * (a + c) • Replace c+c’ by 1: ab(c+c’) = ab(1).
• (this one is tricky!)
– Identity property
• Associative • ab(1) = ab*1 = ab.
– (a + b) + c = a + (b + c)
– (a * b) * c = a * (b * c)
• Identity
– 0+a=a+0=a
– 1*a=a*1=a
• Complement
– a + a’ = 1
– a * a’ = 0
• To prove, just evaluate all possibilities
Digital Design
Copyright © 2006 13
Frank Vahid
Boolean Algebra: Additional Properties
• Null elements
– a+1=1
Circuit
– a*0=0 a Circuit
• Idempotent Law S
a S
b b
– a+a=a c
– a*a=a c
• Involution Law
– (a’)’ = a
• DeMorgan’s Law
– (a + b)’ = a’b’
– (ab)’ = a’ + b’
– Very useful!
• To prove, just evaluate all possibilities
Digital Design
Copyright © 2006 14
Frank Vahid
2.6
T he function F
Digital Design
Copyright © 2006 16
Frank Vahid
Standard Representation: Truth Table
• How can we determine if two
functions are the same?
• Used algebraic methods
• But if we failed, does that prove
not equal? No.
• Solution: Convert to truth tables
– Only ONE truth table
representation of a given
function
• Standard representation -- for Q: Determine if F=ab+a’ is same
given function, only one version function as F=a’b’+a’b+ab, by converting
in standard form exists each to truth table first
F = ab + a' F = a’b’ +
a’b + ab
a b F a b F
e
0 0 1 0 0 1 a
0 1 1
m
0 1 1
Digital Design
Copyright © 2006
1
1
0
1
0
1 Sa1
1
0
1
0
1
17
Frank Vahid
Canonical Form -- Sum of Minterms
• Truth tables too big for numerous inputs
• Use standard form of equation instead
– Known as canonical form
– 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
Digital Design
Copyright © 2006 18
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)
a
f
b
g
e
c
d
Digital Design
Copyright © 2006 20
Frank Vahid
2.7
Digital Design
Copyright © 2006 21
Frank Vahid
Example: Number of 1s Count
• Problem: Output in binary on
two outputs yz the number of 1s
on three inputs
• 010 01 101 10 000 00
– Step 1: Capture the function
• Truth table or equation?
– Truth table is straightforward
– Step 2: Convert to equation
• y = a’bc + ab’c + abc’ + abc a
b
c
• z = a’b’c + a’bc’ + ab’c’ + abc a
b
c a
– Step 3: Implement as a gate- b
a y c z
based circuit b
c a
b
a c
b a
b
Digital Design c
Copyright © 2006 22
Frank Vahid
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 & ground
• NOR: Opposite of OR (“NOT OR”) switched
• XOR: Exactly 1 input is 1, for 2-input • Why? nMOS conducts 0s well, but not 1s
XOR. (For more inputs -- odd number (reasons beyond our scope) -- so NAND
more efficient
of 1s)
• Likewise, NOR same as OR with
• XNOR: Opposite of XOR (“NOT XOR”)
power/ground switched
• AND in CMOS: NAND with NOT
• OR in CMOS: NOR with NOT
• So NAND/NOR more common
Digital Design
Copyright © 2006 23
Frank Vahid
More Gates: Example Uses
• Aircraft lavatory sign Circuit
a
example b
c
S
– 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 24
Frank Vahid
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 25
Frank Vahid
2.9
Digital Design 0
Copyright © 2006 26
Frank Vahid
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 27
Frank Vahid
Mux Internal Design
i0 i0 (1*i0=i0)
2×1 2×1 2×1 d
1 i0
i0 i0 i0 i1
d d d (0+i0=i0)
i1 i1 i1 0
0
s0 s0 s0
a
0 1
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 28
Frank Vahid
Muxes Commonly Together -- N-bit Mux
2 1
a3 i0 Simplifying
d
b3 i1 notation:
s0
4-bit 4
2 1 4 2x1
C
a2 i0 A I0
d 4
b2 i1 D C is short
s0 4
B I1 for
2 1
a1 i0 s0
d
b1 i1 c3
s0
s0 c2
2 1
a0 i0
d c1
b0 i1
s0
s0 c0
Digital Design
Copyright © 2006 29
Frank Vahid
N-bit Mux Example
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 31
Frank Vahid
Additional Considerations
Non-Ideal Gate Behavior -- Delay
Digital Design
Copyright © 2006 32
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 33
Frank Vahid