Professional Documents
Culture Documents
Lecture Material
- Sankara Subramanian
Digital Systems
° Analysis problem:
. Logic .
Inputs Outputs
Circuit
. .
Truth Table
A Y
A Y 0 1
1 0
Symbol
Input Output
° Basic logic functions have symbols.
° The same functionality can be represented with truth
tables.
• Truth table completely specifies outputs for all input combinations.
A
Y
B
be deasserted (low). 1 0 0
1 1 1
The OR Gate
A
Y
B
° This is an OR gate. A B Y
asserted, or both of 1 0 1
will be asserted.
Describing Circuit Functionality: Waveforms
AND Gate
A B Y
0 0 0
0 1 0
1 0 0
1 1 1
3 Input OR Gate
Ordering Boolean Functions
x y z F
0 0 0 0
0 0 1 0 x
0 1 0 0 y
0 1 1 0 F = x(y+z’)
z y+z’
1 0 0 1 z’
1 0 1 0
1 1 0 1
1 1 1 1 F = x(y+z’)
Boolean Functions
x y z xy yz G
0 0 0 0 0 0
0 0 1 0 0 0 x xy
0 1 0 0 0 0 y
0 1 1 0 1 1 G = xy +yz
1 0 0 0 0 0 z
yz
1 0 1 0 0 0
1 1 0 1 0 1 We will learn how to transition between equation,
1 1 1 1 1 1 symbols, and truth table.
Representation Conversion
Circuit Boolean
Expression
Truth
Table
Truth Table to Expression
x y z
G = xyz + xyz’ + x’yz
Reducing Boolean Expressions
x y z Minterm x y z Maxterm
0 0 0 x’y’z’ m0 0 0 0 x+y+z M0
0 0 1 x’y’z m1 0 0 1 x+y+z’ M1
… …
1 0 0 xy’z’ m4 1 0 0 x’+y+z M4
… …
1 1 1 xyz m7 1 1 1 x’+y’+z’ M7
Representing Functions with Minterms
° Minterm number same as row position in truth table
(starting from top from 0)
° Shorthand way to represent functions
x y z G
0 0 0 0 G = xyz + xyz’ + x’yz
0 0 1 0
0 1 0 0
0 1 1 1
G = m7 + m6 + m3 = Σ(3, 6, 7)
1 0 0 0
1 0 1 0
1 1 0 1
1 1 1 1
Complementing Functions
° Minterm number same as row position in truth table
(starting from top from 0)
° Shorthand way to represent functions
x y z G G’
0 0 0 0 1 G = xyz + xyz’ + x’yz
0 0 1 0 1
0 1 0 0 1
0 1 1 1 0 G’ = (xyz + xyz’ + x’yz)’ =
1 0 0 0 1
1 0 1 0 1
1 1 0 1 0 Can we find a simpler representation?
1 1 1 1 0
Complementing Functions
° DeMorgan’s
• F’ = (x’z)’ (yz)’
° DeMorgan’s
• F’ = (x’’+z’)(y’+z’)
x y z G
0 0 0 0 G = xyz + xyz’ + x’yz
0 0 1 0
0 1 0 0
0 1 1 1 G = m7 + m6 + m3 = Σ(3, 6, 7)
1 0 0 0
1 0 1 0
1 1 0 1 G = M0M1M2M4M5 = Π(0,1,2,4,5)
1 1 1 1
G = (x+y+z)(x+y+z’)(x+y’+z)(x’+y+z)(x’+y+z’)
Representation of Circuits
° All logic expressions can be represented in 2-
level format
° Circuits can be reduced to minimal 2-level
representation
° Sum of products representation most common in
industry.
Logic functions of N variables
A
Y
B
0 1 1
1 0 1
1 1 0
The NAND Gate
NOT Gate A
B Y
A AND Gate
Y
B
OR Gate
The NOR Gate
A
Y
B
interesting properties… 0 0 1
• NOR(a,a)=(a+a)’ = a’ = NOT(a) 0 1 0
• NOR’(a,b)=(a+b)’’ = a+b = OR(a,b)
• NOR(a’,b’)=(a’+b’)’ = ab = AND(a,b) 1 0 0
1 1 0
Functionally Complete Gates
NOT Gate A
B Y
A OR Gate
Y
B
AND Gate
The XOR Gate (Exclusive-OR)
A
Y
B
° This is a XOR gate.
A B Y
° XOR gates assert their output
0 0 0
when exactly one of the inputs
0 1 1
is asserted, hence the name.
1 0 1
° The switching algebra symbol
1 1 0
for this operation is ⊕, i.e.
1 ⊕ 1 = 0 and 1 ⊕ 0 = 1.
The XNOR Gate
A
Y
B
° This is a XNOR gate.
° This functions as an A B Y
exclusive-NOR gate, or 0 0 1
Example
Karnaugh Maps
AB A
C 00 01 11 10
0
A
0 0 1 1 C 1
G(A,B,C) = A
C 0 0 1 1 B
B
A
1 0 0 1
F(A,B,C) = Σm(0,4,5,7) = AC + B’C’
C 0 0 1 1
B
Karnaugh Maps for Four Input Functions
° F(A,B,C,D) = Σm(0,2,3,5,6,7,8,10,11,14,15)
F=
C + A’BD + B’D’
A 1111
0111
1 0 0 1
0 1 0 0
D
C
1 1 1 1 D
C A
1000
1 1 1 1 0000 B
B
Solution set can be considered as a coordinate
System!
Design examples
A A A
0 0 0 0 1 0 0 0 0 1 1 1
1 0 0 0 0 1 0 0 0 0 1 1
D D D
1 1 0 1 0 0 1 0 0 0 0 0
C C C
1 1 0 0 0 0 0 1 0 0 1 0
B B B
0 1 0 0
D
0 0 1 0
C
0 0 0 1
B
K-map for EQ
Karnaugh Maps
° Four variable maps.
CD
00 01 11 10
AB F=A′BC ′+A′CD ′+ABC
00 0 0 0 1
+AB ′C′D ′+ABC ′+AB ′C
01 1 1 0 1
11 1 1 1 1 F=BC ′+CD ′+ AC+ AD ′
10 1 0 1 1
A
AB
CD 00 01 11 10
00 0 0 X 0 - Treat X’s like either 1’s or 0’s
01 - Very useful
1 1 X 1
D - OK to leave some X’s uncovered
11 1 1 0 0
C
10 0 X 0 0
B
Karnaugh maps: Don’t cares
° f(A,B,C,D) = Σ m(1,3,5,7,9) + d(6,12,13)
• without don't cares
- f=
A B C D f
A’D + C’D 0 0 0 0 0
0 0 0 1 1
0 0 1 0 0
A 0 0 1 1 1
AB 0 1 0 0 0
CD 00 01 11 10 0 1 0 1 1
00 0 0 X 0 0 1 1 0 X
+
0 +
1 1 1 1
01 1 1 X 1 1 0 0 0 0
D 1 0 0 1 1
11 1 1 0 0 1 0 1 0 0
C 1 0 1 1 0
10 0 X 0 0 1 1 0 0 X
1 1 0 1 X
B 1 1 1 0 0
1 1 1 1 0
Don’t Care Conditions
CD
00 01 11 10
AB
00 0 1 0 0
01 x x x 1 F=A′C′D+B+AC
11 1 1 1 x
10 x 0 1 1
° Alternative covering.
CD
00 01 11 10
AB
00 0 1 0 0
01 x x x 1 F=A′B′C′D+ABC′+BC+AC
11 1 1 1 x
10 x 0 1 1
Karnaugh maps: don’t cares (cont’d)
A'D + C'D
A
by using don't care as a "1"
0 0 X 0
a 2-cube can be formed
1 1 X 1
rather than a 1-cube to cover
D this node
1 1 0 0
C don't cares can be treated as
0 X 0 0 1s or 0s
B depending on which is more
advantageous
Definition of terms for two-level simplification
° Implicant
• Single product term of the ON-set (terms that create a logic 1)
° Prime implicant
• Implicant that can't be combined with another to form an implicant with
fewer literals.
° Objective:
• Grow implicant into prime implicants (minimize literals per term)
• Cover the K-map with as few prime implicants as possible
(minimize number of product terms)
Examples to illustrate terms
A
0 X 1 0 6 prime implicants:
A'B'D, BC', AC, A'C'D, AB, B'CD
1 1 1 0
D
essential
1 0 1 1
C
0 0 1 1 minimum cover: AC + BC' + A'B'D
B
A
5 prime implicants: 0 0 1 0
BD, ABC', ACD, A'BC, A'C'D
1 1 1 0
D
essential 0 1 1 1
C
0 1 0 0
minimum cover: 4 essential implicants
B
Prime Implicants
A
B
C
Out
A
B
C’
Label Gate Outputs
A R
B
C
Out
S T
A
B
C’
Approach 1: Create Intermediate Equations
Step 1: Create an equation for each gate output based
on its input.
• R = ABC
• S=A+B
• T = C’S
• Out = R + T
A R
B
C
Out
S T
A
B
C’
Approach 1: Substitute in subexpressions
Step 2: Form a relationship based on input variables
(A, B, C)
• R = ABC
• S=A+B
• T = C’S = C’(A + B)
• Out = R+T = ABC + C’(A+B)
A R
B
C
Out
S T
A
B
C’
Approach 1: Substitute in subexpressions
Step 3: Expand equation to SOP final result
• Out = ABC + C’(A+B) = ABC + AC’ + BC’
A
B
C
Out
A
C’
B
C’
Approach 2: Truth Table
Step 1: Determine outputs for functions of input
variables.
A B C R S
0 0 0 0 0
0 0 1 0 0
0 1 0 0 1
0 1 1 0 1
1 0 0 0 1
1 0 1 0 1
1 1 0 0 1
A R
1 1 1 1 1
B
C
Out
S T
A
B
C’
Approach 2: Truth Table
Step 2: Determine outputs for functions of
intermediate variables.
A B C C’ R S T
0 0 0 1 0 0 0
T = S * C’ 0 0 1 0 0 0 0
0 1 0 1 0 1 1
0 1 1 0 0 1 0
1 0 0 1 0 1 1
1 0 1 0 0 1 0
1 1 0 1 0 1 1
A R 1 1 1 0 1 1 0
B
C
Out
S T
A
B
C’
Approach 2: Truth Table
Step 3: Determine outputs for function.
A B C R S T Out
0 0 0 0 0 0 0
0 0 1 0 0 0 0
R + T = Out 0 1 0 0 1 1 1
0 1 1 0 1 0 0
1 0 0 0 1 1 1
1 0 1 0 1 0 0
1 1 0 0 1 1 1
A R 1 1 1 1 1 0 1
B
C
Out
S T
A
B
C’
Design Procedure (Mano)
Design a circuit from a specification.
1. Determine number of required inputs and
outputs.
2. Derive truth table
3. Obtain simplified Boolean functions
4. Draw logic diagram and verify correctness
A B C RS
0 0 0 0 0
0 0 1 0 1
S=A+B+C 0 1 0 0 1
R = ABC 0 1 1 0 1
1 0 0 0 1
1 0 1 0 1
1 1 0 0 1
1 1 1 1 1
Half Adder
A0
A0 B0 S0 C 1 S0
B0
0 0 0 0
0 1 1 0
1 0 1 0 C1
1 1 0 1
Dec Binary
1 1
+1 +1
2 10
Multiple-bit Addition
A3 A2 A1 A0 B3 B2 B1 B0
A 0 1 0 1 B 0 1 1 1
Ci+1 Ci
1 1 1
A 0 1 0 1 Ai
B 0 1 1 1 +Bi
1 1 0 0 Si
Each bit position creates a sum and carry
Full Adder
Ci Ai Bi Si Ci+1 AiBi
Ci 00 01 11 10
0 0 0 0 0
0 0 1 1 0 0 1 1
0 1 0 1 0
0 1 1 0 1 1 1 1
1 0 0 1 0
1 0 1 0 1 Si
1 1 0 0 1
1 1 1 1 1
Full Adder
Si = Ci $ (Ai $ Bi)
Full Adder
Ci Ai Bi Si Ci+1 AiBi
Ci 00 01 11 10
0 0 0 0 0
0 0 1 1 0 0 1
0 1 0 1 0
0 1 1 0 1 1 1 1 1
1 0 0 1 0
1 0 1 0 1 Ci+1
1 1 0 0 1
1 1 1 1 1 Note: 3 inputs
Full Adder
° Now consider implementation of carry out
° Minimize circuit for carry out - Ci+1
AiBi
Ci Ai Bi Si Ci+1 Ci 00 01 11 10
0 0 0 0 0 0 1
0 0 1 1 0
0 1 0 1 0 1 1 1 1
0 1 1 0 1
1 0 0 1 0 Ci+1
1 0 1 0 1
1 1 0 0 1 Ci+1 = Ai & Bi
1 1 1 1 1 # Ci & Bi
# Ci & Ai
Full Adder
Ci+1 = Ai & Bi
# Ci !Ai & Bi
# Ci & Ai & !Bi
Ci+1 = Ai & Bi
# Ci & (!Ai & Bi # Ai & !Bi)
Recall:
Si = Ci $ (Ai $ Bi)
Si = Ci $ (Ai $ Bi)
Ci+1 = Ai & Bi # Ci & (Ai $ Bi)
Ci
Ai Si
Bi
C i+1
Half-adder Half-adder
Full Adder
° Hardware repetition simplifies hardware design
Ci Si
half-adder
Ai S C
half-adder C i+1
Bi
C
Si
Block Diagram
4-Bit Adder
° Chain single-bit adders together.
° What does this do to delay?
A3 B3 A2 B2 A1 B1 A0 B0
C4 S3 S2 S1 S0
C 1 1 1 0
A 0 1 0 1
B 0 1 1 1
S 1 1 0 0
Negative Numbers – 2’s Complement.
° Subtracting a number is the same as:
1. Perform 2’s complement
2. Perform addition
A3 B3 A2 B2 A1 B1 A0 B0
° Design Approaches
• the truth table
2n
- 2 entries - too cumbersome for large n
• use inherent regularity of the problem
- reduce design efforts
- reduce human errors
A<B
A[3..0] Magnitude
Compare A=B
B[3..0]
A>B
Magnitude Comparator
A0 C0
B0 D01
A1 C1
B1 A_EQ_B
A2 C2
B2
A3 C3 D23
B3
28 = 256
Magnitude Comparator
A0 C0
B0 D01
A1 C1
B1 A_EQ_B Find A > B
A2 C2
B2
A3 C3 D23
B3
Because A3 > B3
If A = 1001 and i.e. A3 . B3’ = 1
B = 0111 Therefore, one term in the
is A > B? logic equation for A > B is
Why? A3 . B3’
Magnitude Comparator
° Implementation
• xi = (AiBi'+Ai'Bi)’
Multiplexers
n Binary 2n outputs
inputs Decoder
2-to-4 Binary Decoder
Truth Table:
X Y F0 F1 F2 F3
0 0 1 0 0 0
0 1 0 1 0 0 F0 = X'Y'
1 0 0 0 1 0
1 1 0 0 0 1
F1 = X'Y
F0
X Y
X 2-to-4 F1
Y Decoder F2
F3
3-to-8 Binary Decoder
Truth Table:
F0 = x'y'z'
x y z F0 F1 F2 F3 F4 F5 F6 F7 F1 = x'y'z
0 0 0 1 0 0 0 0 0 0 0
0 0 1 0 1 0 0 0 0 0 0 F2 = x'yz'
0 1 0 0 0 1 0 0 0 0 0
0 1 1 0 0 0 1 0 0 0 0 F3 = x'yz
1 0 0 0 0 0 0 1 0 0 0
1 0 1 0 0 0 0 0 1 0 0 F4 = xy'z'
1 1 0 0 0 0 0 0 0 1 0
1 1 1 0 0 0 0 0 0 0 1 F5 = xy'z
F6 = xyz'
F0
F1 F7 = xyz
X
F2
Y
3-to-8
F3
Z
Decoder F4
F5
F6
x y z
F7
Implementing Functions Using Decoders
3-to-8 0
Decoder 1 S
2
x S2 3
y S1 4
5 C
z S0 6
7
Building a Binary Decoder with NAND Gates
Binary
2n encoder n
. .
inputs . . outputs
. .
8-to-3 Binary Encoder
At any one time, only Inputs Outputs
one input line has a value of 1.
I0 I1 I2 I3 I4 I5 I6 I7 y2 y1 y0
1 0 0 0 0 0 0 0 0 0 0
0 1 0 0 0 0 0 0 0 0 1
0 0 1 0 0 0 0 0 0 1 0
0 0 0 1 0 0 0 0 0 1 1
0 0 0 0 1 0 0 0 1 0 0
0 0 0 0 0 1 0 0 1 0 1
0 0 0 0 0 0 1 0 1 1 0
0 0 0 0 0 0 0 1 1 1 1
I0
I1 y 2 = I 4 + I5 + I6 + I7
I2
I3 y 1 = I 2 + I3 + I6 + I7
I4
I5
I6
I7 y 0 = I 1 + I3 + I5 + I7
8-to-3 Priority Encoder
• What if more than one input line has a value of 1?
• Ignore “lower priority” inputs.
• Idle indicates that no input is a 1.
• Note that polarity of Idle is opposite from Table 4-8 in Mano
Inputs Outputs
I0 I1 I2 I3 I4 I5 I6 I7 y2 y1 y0 Idle
0 0 0 0 0 0 0 0 x x x 1
1 0 0 0 0 0 0 0 0 0 0 0
X 1 0 0 0 0 0 0 0 0 1 0
X X 1 0 0 0 0 0 0 1 0 0
X X X 1 0 0 0 0 0 1 1 0
X X X X 1 0 0 0 1 0 0 0
X X X X X 1 0 0 1 0 1 0
X X X X X X 1 0 1 1 0 0
X X X X X X X 1 1 1 1 0
Sequential Circuits
Timing signal
(clock)
Clock
a periodic external event (input)
Clock
synchronizes
synchronizeswhen
whencurrent
currentstate
statechanges
changeshappen
happen
keeps
keepssystem
systemwell-behaved
well-behaved
makes
makesititeasier
easierto
todesign
designand
andbuild
buildlarge
largesystems
systems
Cross-coupled Inverters
0 1
1 0
State 1 State 2
S-R Latch with NORs
R (reset) Q S R Q Q’
1 1 0 0 Undefined
1 0 1 0 Set
Q 0 1 0 1 Reset
S (set) 0 0 0 1 Stable
1 0
° S-R latch made from cross-coupled NORs
° If Q = 1, set state
° If Q = 0, reset state
° Usually S=0 and R=0
° S=1 and R=1 generates unpredictable results
S-R Latch with NANDs
S S R Q Q’
Q
0 0 1 1 Disallowed
0 1 1 0 Set
1 0 0 1 Reset
Q’
R 1 1 0 1
1 0 Store
C’
Q’
Latch operation
S’
enabled by
C Outputs change
when C is low:
Input sampling RESET and SET
enabled by gates Otherwise: HOLD
D Latch
Q’
Y R
X Y C Q Q’
D C Q Q’
0 0 1 Q0 Q0 ’ Store
0 1 0 1
0 1 1 0 1 Reset
1 1 1 0
1 0 1 1 0 Set
X 0 Q0 Q0 ’
1 1 1 1 1 Disallowed
X X 0 Q0 Q0 ’ Store
D Latch
X
D S
Q
C
Q’
Y R
D C Q Q’
0 1 0 1
1 1 1 0
X 0 Q0 Q0 ’
E
x D
Q x
z
E C
z
E
x D
Q x
z
E C
z
D
S
S’
Q
C
Q’
R R’
S R C Q Q’
D C Q Q’
0 0 1 Q0 Q0 ’ Store
0 1 0 1
0 1 1 0 1 Reset
1 1 1 0
1 0 1 1 0 Set
X 0 Q0 Q0 ’
1 1 1 1 1 Disallowed
X X 0 Q0 Q0 ’ Store
D C Q Q’
D Q
0 0 1
C Q’ 1 1 0
X 0 Q0 Q0 ’
D C Q Q’
D Q
0 0 1
C Q’ 1 1 0
X 0 Q0 Q0 ’
Characteristic Table
Positive Edge-Triggered T Flip-Flop
Clk
y(t) = x(t)Q1(t)Q0(t)
Q0(t+1) = D0(t) = x(t)Q1(t)
Q1(t+1) = D1(t) = x(t) + Q0(t)
Output and State Equations
x D0
Q1 Q0
Q
D
Q’
y
Q
D Q1
Q0 D1 Q’
Clk
Output equation
y(t) = x(t)Q1(t)Q0(t)
Q0(t+1) = D0(t) = x(t)Q1(t)
State equations
Q1(t+1) = D1(t) = x(t) + Q0(t)
State Table
° Sequence of outputs, inputs, and flip flop states
enumerated in state table
° Present state indicates current value of flip flops
° Next state indicates state after next rising clock
edge
° Output is output value on current clock edge
1/1
0/0 0/0
0/0 1/0
s0 s1 s2 s3
1/0
1/0 0/0
Flip Flop Input Equations
x D0
Q1 Q0
Q
D
Q’
y
Q
D Q1
Q0 D1 Q’
Clk
DQ0 = xQ1
DQ1 = x + Q0 Format implies type of flop used
Analysis with D Flip-Flops
Q(t+1) Flip
Comb.
next Flops
Logic Q(t)
state present Y(t)
X(t) Comb.
state
present Logic
input
clk
Moore Machine
Q(t+1) Y(t)
Comb. Flip Comb.
Logic next Flops Q(t) Logic
state present
X(t)
state
present
input
clk
State Diagram with One Input & One Mealy Output
S4 S2
0/0
0/0
0/0
1/0 S3 1/0
State Diagram with One Input & a Moore Output
0
° State S0 : zero 1s detected
° State S1 : one 1 detected
° State S2 : two 1s detected
° State S3 : three 1s detected
° S0 = 00 ° S2 = 10
° S1 = 01 ° S3 = 11
Finding Expressions for Next State and Output Value
° Load Control = 1
• New data loaded
on next positive
clock edge
° Load Control = 0
• Old data reloaded
on next positive
clock edge
Shift Registers
° Parallel communications
• Provides a binary number through multiple data lines at the
same time.
Serial Transfer
° Data transfer one bit at a time
° Data loopback for register A
° Slower than
parallel
° Low cost
° Share fast
hardware on
slow data
° Good for
multiplexed
data
Serial Addition (D Flip-Flop)
° Shift control
used to stop
addition
° Generally not a
good idea to
gate the clock
° Shift register
can be
arbitrary length
° FA can be built
from combin.
logic
Universal Shift Register
° Clear
° Clock
° Shift
• Right
• Left
° Load
° Read
° Control
Counters
° Synchronous(parallel)
counters
• All of the FFs are triggered
simultaneously by the clock
input pulses.
• All FFs change at same time
° Remember
• If J=K=0, flop maintains value
• If J=K=1, flop toggles
° Synchronous counters
• Same counter as previous slide except Count enable replaced
by J=K=1
• Note that clock signal is a square wave
• Clock fans out to all clock inputs
Circuit operation
Function Table
° If Clear is asserted (0), the
counter is cleared
° If Load is asserted data
inputs are loaded
° If Count asserted counter
value is incremented
Binary Counter with Parallel Load and Preset
• Presettable parallel counter with
asynchronous preset.