Académique Documents
Professionnel Documents
Culture Documents
LOGIC DESIGN
Prepared by:
V.SESHAGIRI RAO, Professor
S.RAMBABU(Asst.Prof)
LINJU T T(Asst.Prof)
Unit 1
NUMBER SYSTEMS
Any number in one base system can be
converted into another base system
Types
1) decimal to any base
2) Any base to decimal
3) Any base to Any base
Base Conversions
Conversions of fractional numbers
Decimal to Binary
Octal to Binary Conversion
Complements
Complements arc used in digital
computers to simplify the subtraction
operation and for log- ical manipulation
They are two types of complements
1) Diminished radix complement
(rn - 1)-N {r is the base of num
system}
2) Radix Complement
(rn - 1)-N+1
(r-1)’s complement
If the base = 10
The 9's complement of 546700 is
999999 - 546700 = 453299.
If the base = 2
The 1's complemcnt of 1011000 is
0100111.
r’s complement
____1010100
1011 | 1001011100
1011
001001
1001
0010
001011
1011
0000 Remainder
Canonical and Standard Forms
We need to consider formal techniques for
the simplification of Boolean functions.
◦ Identical functions will have exactly the same
canonical form.
◦ Minterms and Maxterms
◦ Sum-of-Minterms and Product-of- Maxterms
◦ Product and Sum terms
◦ Sum-of-Products (SOP) and Product-of-Sums
(POS)
Definitions
Literal: A variable or its complement
Product term: literals connected by •
Sum term: literals connected by +
Minterm: a product term in which all the
variables appear exactly once, either
complemented or uncomplemented
Maxterm: a sum term in which all the
variables appear exactly once, either
complemented or uncomplemented
Truth Table notation for Minterms
and Maxterms
Canonical Forms (Unique)
Any Boolean function F( ) can be
expressed as a unique sum of minterms
and a unique product of maxterms
(under a fixed variable ordering).
In other words, every function F() has two
canonical forms:
◦ Canonical Sum-Of-Products (sum of minterms)
◦ Canonical Product-Of-Sums (product of
maxterms)
Canonical Forms (cont.)
Canonical Sum-Of-Products:
The minterms included are those mj such
that F( ) = 1 in row j of the truth table for
F( ).
Canonical Product-Of-Sums:
The maxterms included are those Mj such
that F( ) = 0 in row j of the truth table for
F( ).
Example
Conversion Between Canonical
Forms
Replace ∑ with ∏ (or vice versa) and
replace those j’s that appeared in the
original form with those that do not.
Example:
f1(a,b,c) = a‟b‟c + a‟bc‟ + ab‟c‟ + abc‟
= m1 + m2 + m 4 + m6
= ∑(1,2,4,6)
= ∏(0,3,5,7)
=
(a+b+c)•(a+b‟+c‟)•(a‟+b+c‟)•(a‟+b‟+c‟)
Conversion of SOP from standard
to canonical form
Expand non-canonical terms by inserting
equivalent of 1 in each missing variable x:
(x + x‟) = 1
Remove duplicate minterms
f1(a,b,c) = a‟b‟c + bc‟ + ac‟
= a‟b‟c + (a+a‟)bc‟ + a(b+b‟)c‟
= a‟b‟c + abc‟ + a‟bc‟ + abc‟ +
ab‟c‟
= a‟b‟c + abc‟ + a‟bc + ab‟c‟
Conversion of POS from standard
to canonical form
Expand noncanonical terms by adding 0 in
terms of missing variables (e.g., xx‟ = 0) and
using the distributive law
Remove duplicate maxterms
f1(a,b,c) = (a+b+c)•(b‟+c‟)•(a‟+c‟)
= (a+b+c)•(aa‟+b‟+c‟)•(a‟+bb‟+c‟)
= (a+b+c)•(a+b‟+c‟)•(a‟+b‟+c‟)•
(a‟+b+c‟)•(a‟+b‟+c‟)
=
(a+b+c)•(a+b‟+c‟)•(a‟+b‟+c‟)•(a‟+b+c‟)
Boolean Algebra and
Basic Gates
LOGIC GATES
Formal logic: In formal logic, a statement
(proposition) is a declarative sentence that is
either
true(1) or false (0).
It is easier to communicate with computers using
formal logic.
(9) x + y = y + x
(10) xy = yx
(11) x + ( y + z ) = ( x + y ) + z
(12) x (yz) = (xy) z
(13) x ( y + z ) = xy + xz
(14) x + yz = ( x + y )( x + z)
(15) ( x + y )’ = x’ y’
(16) ( xy )’ = x’ + y’
(17) (x’)’ = x
Function Minimization using
Boolean Algebra
Examples:
(a) a + ab = a(1+b)=a
F = ab + c‟d‟
F‟ = ??
F = ab + c‟d‟ + b‟d
F‟ = ??
More DeMorgan's example
Show that: (a(b + z(x + a')))' =a' + b' (z' + x')
NAND-AND
AND-NOR
NOR-OR
OR-NAND
NAND-AND
It can also be implemented using AND-NOR
circuit as it is equivalent to NAND- AND circuit
It can also be implemented using OR-NAND
circuit as it is equivalent to NOR-OR circuit
Universal Gates
62
Karnaugh Maps
Boolean algebra helps us simplify expressions and circuits
Karnaugh Map: A graphical technique for simplifying a Boolean
expression into either form:
◦ minimal sum of products (MSP)
◦ minimal product of sums (MPS)
Goal of the simplification.
◦ There are a minimal number of product/sum terms
◦ Each term has a minimal number of literals
Circuit-wise, this leads to a minimal two-level implementation
63
Re-arranging the Truth Table
A two-variable function has four possible minterms. We can
re-arrange
these minterms into a Karnaugh map
x y minterm Y
0 0 x’y’ 0 1
0 1 x’y 0 x’y’ x’y
1 0 xy’ X
1 xy’ xy
1 1 xy
65
More Two-Variable Examples
Another example expression is x‟y + xy
◦ Both minterms appear in the right side, where y is
uncomplemented Y
◦ Thus, we can reduce x‟y + xy to just y x’y’ x’y
X xy’ xy
66
A Three-Variable Karnaugh Map
For a three-variable expression with inputs x,
y, z, the arrangement of
minterms is more tricky: YZ
YZ 00 01 11 10
00 01 11 10 0 m0 m1 m3 m2
X
0 x’y’z’ x’y’z x’yz x’yz’ 1 m4 m5 m7 m6
X
1 xy’z’ xy’z xyz xyz’ Y
Y m0 m1 m3 m2
x’y’z’ x’y’z x’yz x’yz’ X m4 m5 m7 m6
X xy’z’ xy’z xyz xyz’ Z
Z
67
Why the funny ordering?
With this ordering, any group of 2, 4 or 8 adjacent
squares on the map
contains common literals that can be factored out
Y
x‟y‟z + x‟yz
= x‟z(y‟ + y)
x’y’z’ x’y’z x’yz x’yz’
= x‟z 1
X xy’z’ xy’z xyz xyz’
Z
= x‟z
68
K-maps From Truth Tables
We can fill in the K-map directly from a truth table
◦ The output in row i of the table goes into square mi of the K-map
◦ Remember that the rightmost columns of the K-map are “switched”
Y
x y z f(x,y,z)
0 0 0 0
m0 m1 m3 m2
0 0 1 1
X m4 m5 m7 m6
0 1 0 0
0 1 1 0 Z
Y
0 1 0 0
X 0 1 1 1
Z
1 0 0 0
1 0 1 1
1 1 0 1
1 1 1 1
69
Reading the MSP from the K-map
You can find the minimal SoP expression
◦ Each rectangle corresponds to one product term
◦ The product is determined by finding the common literals in that
rectangle Y Y
0 1 0 0 x’y’z’ x’y’z x’yz x’yz’
X 0 1 1 1 X xy’z’ xy’z xyz xyz’
Z Z
y‟z xy
F(x,y,z)= y‟z + xy
70
Grouping the Minterms Together
The most difficult step is grouping together
all the 1s in the K-map
◦ Make rectangles around groups of one,
two, four or eight 1s
◦ All of the 1s in the map should be
included in at least one rectangle
◦ Do not include any of the 0s
◦ Each group corresponds to one product
term Y
0 1 0 0
X 0 1 1 1
Z
71
For the Simplest Result
72
K-map Simplification of SoP
Expressions
Let‟s consider simplifying f(x,y,z) = xy + y‟z + xz
Here is the truth table and sum of minterms for our example:
x y z f(x,y,z)
0 0 0 0
f(x,y,z) = x‟y‟z + xy‟z +
0 0 1 1
0 1 0 0 xyz‟ + xyz
0 1 1 0 = m1 + m5 + m6 + m7
1 0 0 0
1 0 1 1
1 1 0 1
1 1 1 1
73
Unsimplifying Expressions
You can also convert the expression to a sum of
minterms with Boolean
algebra
◦ Apply the distributive law in reverse to add in missing
variables.
◦ Very few people actually do this, but it‟s occasionally useful.
xy + y‟z + xz = (xy 1) + (y‟z 1) + (xz 1)
= (xy (z‟ + z)) + (y‟z (x‟ + x)) + (xz (y‟ + y))
= (xyz‟ + xyz) + (x‟y‟z + xy‟z) + (xy‟z + xyz)
= xyz‟ + xyz + x‟y‟z + xy‟z
= m1 + m5 + m6 + m 7
In both cases, we‟re actually “unsimplifying” our
example expression
◦ The resulting expression is larger than the original one!
◦ But having all the individual minterms makes it easy to
combine them
together with the K-map
74
Making the Example K-map
In our example, we can write f(x,y,z) in
two equivalent ways f(x,y,z) = m1 + m5 + m6 + m7
f(x,y,z) = x‟y‟z + xy‟z + xyz‟
+ xyz Y
Y m0 m1 m3 m2
x’y’z’ x’y’z x’yz x’yz’ X m4 m5 m7 m6
X xy’z’ xy’z xyz xyz’ Z
Z
75
Practice K-map 1
X
Z
Y
m0 m1 m3 m2
X m4 m5 m7 m6
Z
76
Solutions for Practice K-map 1
Here is the filled in K-map, with all groups
shown
◦ The magenta and green groups overlap, which
makes each of them as
large as possible
◦ Minterm m6 is in a group all by its lonesome
Y
0 1 1 0
X 0 1 0 1
Z
77
K-maps can be tricky!
Y Y
0 1 0 1 0 1 0 1
X 0 1 1 1 X 0 1 1 1
Z Z
78
Four-variable K-maps – f(W,X,Y,Z)
We can do four-variable expressions too!
◦ The minterms in the third and fourth columns, and in the third and
fourth rows, are switched around.
◦ Again, this ensures that adjacent squares have common literals
79
Four-variable K-maps
Y Y
w’x’y’z’ w’x’y’z w’x’yz w’x’yz’ m0 m1 m3 m2
w’xy’z’ w’xy’z w’xyz w’xyz’ m4 m5 m7 m6
X X
wxy’z’ wxy’z wxyz wxyz’ m12 m13 m15 m14
W W
wx’y’z’ wx’y’z wx’yz wx’yz’ m8 m9 m11 m10
Z Z
80
The expression is already a sum of minterms, so here‟s the K-map:
Y Y
1 0 0 1 m0 m1 m3 m2
0 1 0 0 m4 m5 m7 m6
X X
0 1 0 0 m12 m13 m15 m14
W W
1 0 0 1 m8 m9 m11 m10
Z Z
We can make the following groups, resulting in the MSP x‟z‟ + xy‟z
Y Y
1 0 0 1 w’x’y’z’ w’x’y’z w’x’yz w’x’yz’
0 1 0 0 w’xy’z’ w’xy’z w’xyz w’xyz’
X X
0 1 0 0 wxy’z’ wxy’z wxyz wxyz’
W W
1 0 0 1 wx’y’z’ wx’y’z wx’yz wx’yz’
Z Z
Example: Simplify
m0+m2+m5+m8+m10+m13
81
Five-variable K-maps –
f(V,W,X,Y,Z)
V= 0 V= 1 Y
Y m16 m17 m19 m8
m0 m1 m3 m2 m20 m21 m23 m22
m4 m5 m7 m6 X
X m28 m29 m31 m30
m12 m13 m15 m14 W
W m24 m25 m27 m26
m8 m9 m11 m10
Z
Z
82
Simplify f(V,W,X,Y,Z)=Σm(0,1,4,5,6,11,12,14,16,20,22,28,30,31)
1 1 1
1 1 1 1 1
1 1 1 1 1
V= 0 V= 1
f = XZ‟
Σm(4,6,12,14,20,22,28,30)
+ V‟W‟Y‟ Σm(0,1,4,5)
+ W‟Y‟Z‟ Σm(0,4,16,20)
+ VWXY Σm(30,31)
+ V‟WX‟YZ m11
83
PoS Optimization
0
x x +y+z x+y+z’ x+y’+z’ x+y’+z
1 x’ +y+z x’+y+z’ x’+y’+z’ x’+y’+z
84
F(W,X,Y,Z)= ∏ M(0,1,2,4,5)
F(W,X,Y,Z)= Y . (X + Z)
0 0 0 yz
1 0
x 00 01 11
1 10 0 0 1 1
PoS Optimization
85
PoS Optimization from SoP
F(W,X,Y,Z)= Σm(0,1,2,5,8,9,10)
= ∏ M(3,4,6,7,11,12,13,14,15)
86
SoP Optimization from PoS
F(W,X,Y,Z)= ∏ M(0,2,3,4,5,6)
= Σm(1,7,8,9,10,11,12,13,14,15)
1 1 1 1
1 1 1 1
87
I don’t care!
You don‟t always need all 2n input combinations in an n-variable function
x y z f(x,y,z)
0 0 0 0
0 0 1 1
0 1 0 X
0 1 1 0
1 0 0 0
1 0 1 1
1 1 0 X
1 1 1 1
88
Practice K-map
Find a MSP for
89
Solutions for Practice K-map
Find a MSP for:
f(w,x,y,z) = m(0,2,4,5,8,14,15), d(w,x,y,z) = m(7,10,13)
Y
1 1
1 1 x
X
x 1 1
W
1 x
Z
90
K-map Summary
K-maps are an alternative to algebra for simplifying
expressions
◦ The result is a MSP/MPS, which leads to a minimal two-level
circuit
◦ It‟s easy to handle don‟t-care conditions
◦ K-maps are really only good for manual simplification of
small expressions...
Things to keep in mind:
◦ Remember the correct order of minterms/maxterms on the
K-map
◦ When grouping, you can wrap around all sides of the K-
map, and your groups can overlap
◦ Make as few rectangles as possible, but make each of them
as large as possible. This leads to fewer, but simpler,
product terms
◦ There may be more than one valid solution
91
Tabular method notation
Consider Support Set of f: S={x1, x2, …,
xn}
xici denotes:
xi if ci = ‘1’
xi if ci = ‘0’
1 if ci = ‘-’
If NO ci = -, then we have a minterm
◦ Can be Represented by Decimal Equivalent of ci
EXAMPLE (S={x1, x2, x3, x4})
x11x02x03x14 = m9, a minterm c1 c2 c3 c4 = 1001 =
9
x01x-2x-3x04 = a 4-cube 0--0
Cube merging
f on = {m0, m1, m2, m3, m5, m8, m10, m11, m13, m15} =
(0, 1, 2, 3, 5, 8, 10, 11, 13, 15)
0 1 2 3 5 8 10 11 13 15
A x x x x
B x x x x
C x x x x
D x x
E x x
F x x
G x x
STEP 2 – Finding the Minimum
Cover
Extract All Essential Prime Implicants, EPI
EPIs are the PI for which a Single x Appears in a Column
0 1 2 3 5 8 10 11 13 15
A x x x x
B x x x x
C x x x x
D x x
E x x
F x x
G x x
0 1 2 3 5 8 10 11 13 15
A x x x x
B x x x x
Essential row
C x x x x
D x x
E x x
F x x
G x x
107
Analysis procedure
To obtain the output Boolean functions
from a logic diagram, proceed as follows:
1. Label all gate outputs that are a function of input
variables with arbitrary symbols. Determine the
Boolean functions for each gate output.
2. Label the gates that are a function of input
variables and previously labeled gates with other
arbitrary symbols. Find the Boolean functions for
these gates.
108
Analysis procedure…
109
Example
F2 = AB + AC + BC; T1 = A + B + C; T2 = ABC; T3 =
F2’T1;
F1 = T3 + T2
F1 = T3 + T2 = F2’T1 + ABC = A’BC’ + A’B’C + AB’C’ + ABC
110
Derive truth table from logic
diagram
We can derive the truth table in below Table
by using the circuit of above Fig.
111
Design procedure
1. Table4-2 is a Code-Conversion example,
first, we can list the relation of the BCD and
Excess-3 codes in the truth table.
112
Karnaugh map
2. For each symbol of the Excess-3 code, we use
1’s to draw the map for simplifying Boolean
function.
113
Circuit implementation
z = D’; y = CD + C’D’ = CD + (C + D)’
x = B’C + B’D + BC’D’ = B’(C + D) + B(C + D)’
w = A + BC + BD = A + B(C + D)
114
Binary Adder-Subtractor
A combinational circuit that performs the addition of
two bits is called a half adder.
The truth table for the half adder is listed below:
S: Sum
C: Carry
S = x’y + xy’
C = xy
115
Implementation of Half-Adder
116
Full-Adder
One that performs the addition of three bits(two
significant bits and a previous carry) is a full
adder.
117
Simplified Expressions
118
Full adder implemented in SOP
119
Another implementation
Full-adder can also implemented with two
half adders and one OR gate (Carry Look-
Ahead adder).
S= z ⊕ (x ⊕ y)
= z’(xy’ + x’y) + z(xy’ + x’y)’
= xy’z’ + x’yz’ + xyz + x’y’z
C= z(xy’ + x’y) + xy = xy’z + x’yz + xy
120
Binary adder
This is also called
Ripple Carry
Adder ,because of
the construction
with full adders
are connected in
cascade.
121
Carry Propagation
Fig.4-9 causes a unstable factor on carry bit, and
produces a longest propagation delay.
The signal from Ci to the output carry Ci+1,
propagates through an AND and OR gates, so, for an
n-bit RCA, there are 2n gate levels for the carry to
propagate from input to output.
122
Carry Propagation
Because the propagation delay will affect the output
signals on different time, so the signals are given enough
time to get the precise and stable outputs.
The most widely used technique employs the principle of
carry look-ahead to improve the speed of the algorithm.
123
Boolean functions
Pi = Ai ⊕ Bi steady state value
Gi = AiBi steady state value
Output sum and carry
Si = Pi ⊕ Ci
Ci+1 = Gi + PiCi
Gi : carry generate Pi : carry propagate
C0 = input carry
C1 = G0 + P0C0
C2 = G1 + P1C1 = G1 + P1G0 + P1P0C0
C3 = G2 + P2C2 = G2 + P2G1 + P2P1G0 + P2P1P0C0
125
4-bit adder with carry lookahead
Delay time of n-bit CLAA = XOR + (AND + OR) + XOR
126
Binary subtractor
M = 1subtractor ; M = 0adder
127
Overflow
It is worth noting in above figure that binary
numbers in the signed-complement system are
added and subtracted by the same basic addition
and subtraction rules as unsigned numbers.
128
Overflow on signed and unsigned
When two unsigned numbers are added, an
overflow is detected from the end carry out of the
MSB position.
When two signed numbers are added, the sign bit
is treated as part of the number and the end
carry does not indicate an overflow.
An overflow can't occur after an addition if one
number is positive and the other is negative.
An overflow may occur if the two numbers added
are both positive or both negative.
129
4-5 Decimal adder
BCD adder can’t exceed 9 on each input digit. K is the carry.
130
Rules of BCD adder
When the binary sum is greater than 1001, we
obtain a non-valid BCD representation.
The addition of binary 6(0110) to the binary sum
converts it to the correct BCD representation and
also produces an output carry as required.
To distinguish them from binary 1000 and 1001,
which also have a 1 in position Z8, we specify further
that either Z4 or Z2 must have a 1.
C = K + Z8Z4 + Z8Z2
131
Implementation of BCD adder
A decimal parallel
adder that adds n
decimal digits
needs n BCD
adder stages.
The output carry
from one stage If =1
must be
connected to the 0110
input carry of the
next higher-order
stage.
132
4-6. Binary multiplier
Usually there are more bits in the partial products and it is necessary to
use full adders to produce the sum of the partial products.
133
4-bit by 3-bit binary multiplier
For J multiplier bits
and K multiplicand
bits we need (J X K)
AND gates and (J − 1)
K-bit adders to
produce a product of
J+K bits.
K=4 and J=3, we
need 12 AND gates
and two 4-bit adders.
134
7. Magnitude comparator
A = A3 A 2 A 1 A 0 ; B =
B3 B2 B 1 B0
xi=AiBi+Ai‟Bi‟ for i =
0, 1, 2, 3
(A = B) = x3x2x1x0
135
Magnitude comparator
137
Implementation and truth table
138
Decoder with enable input
Some decoders are constructed with NAND gates, it
becomes more economical to generate the decoder
minterms in their complemented form.
As indicated by the truth table , only one output can be
equal to 0 at any given time, all other outputs are
equal to 1.
139
Demultiplexer
A decoder with an enable input is referred to
as a decoder/demultiplexer.
The truth table of demultiplexer is the same
with decoder. A B
D0
D1
E
Demultiplexer D2
D3
140
3-to-8 decoder with enable
implement the 4-to-16 decoder
141
Implementation of a Full Adder
with a Decoder
From table 4-4, we obtain the functions for the combinational
circuit in sum of minterms:
S(x, y, z) = ∑(1, 2, 4, 7)
C(x, y, z) = ∑(3, 5, 6, 7)
142
Encoders
An encoder is the inverse operation of a decoder.
We can derive the Boolean functions by table 4-7
z = D1 + D3 + D5 + D7
y = D2 + D3 + D6 + D7
x = D4 + D5 + D6 + D7
143
Priority encoder
144
Priority encoder
Implementation
of table 4-8
x = D2 + D3
y = D3 + D1D’2
V = D0 + D1 + D2 + D3
146
Multiplexers
S = 0, Y = I0 Truth Table S Y Y = S’I0 + SI1
S = 1, Y = I1 0 I0
1 I1
147
4-to-1 Line Multiplexer
148
Quadruple 2-to-1 Line Multiplexer
Multiplexer circuits can be combined with common selection inputs
to provide multiple-bit selection logic. Compare with Fig4-24.
I0 Y
I1
149
Boolean function implementation
A more efficient method for implementing a Boolean
function of n variables with a multiplexer that has n-
1 selection inputs.
F(x, y, z) = (1,2,6,7)
150
4-input function with a multiplexer
151
Combinational Logic Design
Find W = A + BC + BD
Minimize K-Maps
X minimization
Find X = BC‟D‟+B‟C+B‟D
Minimize K-Maps
Y minimization
Find Y = CD + C‟D‟
Minimize K-Maps
Z minimization
Find Z = D‟
BCD-to-Seven-Segment Decoder
Specification
◦ Digital readouts on many digital products often
use LED seven-segment displays.
◦ Each digit is created by lighting the appropriate
segments. The segments are labeled
a,b,c,d,e,f,g
◦ The decoder takes a BCD input and outputs the
correct code for the seven-segment display.
Specification
Input: A 4-bit binary value that is a BCD
coded input.
Outputs: 7 bits, a through g for each of
the segments of the display.
Operation: Decode the input to activate
the correct segments.
Formulation
Construct a truth table
Optimization
169
Three state gates
Gates statement: gate name(output, input, control)
>> bufif1(OUT, A, control);
A = OUT when control = 1, OUT = z when control = 0;
>> notif0(Y, B, enable);
Y = B’ when enable = 0, Y = z when enable = 1;
170
Timing Hazards
Timing Hazards
In a real logic circuit there is a delay in an input
change to the corresponding output change.
Reset
Set Q
The Gated Latch
Gated latch is a basic latch that includes input
gating and a control signal
The latch retains its existing state when the
control input is equal to 0
Its state may be changed when the control signal
is equal to 1. In our discussion we referred to
the control input as the clock
We consider two types of gated latches:
◦ Gated SR latch uses the S and R inputs to set the latch
to 1 or reset it to 0, respectively.
◦ Gated D latch uses the D input to force the latch into a
state that has the same logic value as the D input.
Gated S/R Latch
Gated D Latch
Setup and Hold Times
Setup Time tsu
◦ The minimum time that the input signal must be stable
prior to the edge of the clock signal.
Hold Time th
◦ The minimum time that the input signal must be stable
after the edge of the clock signal.
t su
th
Clk
Q
Flip-Flops
A flip-flop is a storage element based on
the gated latch principle
It can have its output state changed only
on the edge of the controlling clock signal
Flip-Flops
We consider two types:
◦ Edge-triggered flip-flop is affected only by
the input values present when the active edge
of the clock occurs
◦ Master-slave flip-flop is built with two gated
latches
The master stage is active during half of the clock
cycle, and the slave stage is active during the
other half.
The output value of the flip-flop changes on the
edge of the clock that activates the transfer into
the slave stage.
Master-Slave D Flip-Flop
Master Slave
Qm Qs
D D Q D Q Q
Clock Clk Q Clk Q Q
(a) Circuit
Clock
D
Qm
Q = Qs
(b) Timing diagram
D Q
Q
D Q
Clock Q
Graphical symbol
Comparison of Level-Sensitive and
Edge-Triggered D Storage
Elements
SR flip-flop (Set,
Reset)
T flip-flop (Toggle)
D flip-flop (Delay)
JK flip-flop
Excitation Tables
Previous State -> Present S R
State
0 -> 0 0 X
0 -> 1 1 0
1 -> 0 0 1
1 -> 1 X 0
0->0 0 X S
0->1 1 0
1->0 0 1 R
1->1 X 0
Q
T CLK
0->0 0
T
0->1 1
1->0 1 Q
1->1 0
Timing Diagrams
D
CLK
0->0 0
D
0->1 1
1->0 0
Q
1->1 1
CLK
J K
J
0->0 0 X
0->1 1 X
K
1->0 X 1
1->1 X 0
Q
Conversions of flipflops
Procedure uses excitation tables
g
x Q CL x Q
y CL y
h
Type B Type A
D Q Q+ J K Q Q+ R S J K T D
0 0 0 0 X 0 0 X 0 0 X 0 0
0 1 0 1 1 X 1 1
0 1 0 X 1
1 0 1 0 X 1 1 0
1 0 1 1 X
1 1 0 X X 0 0 1
1 1 1 X 0
D D
State-Table Q 0 1 Q 0 1
e.g.
0 0 1 0 X X
when D=Q=0, then Q+= 0
the same transition Q-->Q+
is realize with J=0, K=X 1 X X 1 1 0
J= D K=D
Example: Implement JK-FF using a D-FF
J K Q Q+ D T
J
D Q
0 0 0 0 0 0 K DFF
0 0 1 1 1 0 C
0 1 0 0 0 0 Clk
0 1 1 0 0 1
1 0 0 1 1 1
1 0 1 1 1 0
J
1 1 0 1 1 1 T Q
1 1 1 0 0 1 K T-FF
J C
JK J JK Clk
Q 00 01 11 10 Q 00 01 11 10
0 0 0 1 1 0 0 0 1 1
1 1 0 0 1 1 0 1 1 0
K K
d= jQ + Kq t= jQ + kq
Asynchronous inputs
PRESET
PRESET and CLEAR: T Q
asynchronous, level-sensitive inputs
used to initialize a flipflop. Clk
CLEAR
PRESET = 0 --> Q = 1
SET
CLEAR = 0 --> Q = 0 1
0
1 DS Q Q
0 T
LogicWorks Simulation CRQ
Clk
1
0 CLR
200 400
Cl k
CLR
SET
T
Q
Counters
Counters are a specific type of
sequential circuit.
Like registers, the state, or the
flip-flop values themselves,
serves as the “output.”
The output value increases by
one on each clock cycle.
After the largest value, the output
“wraps around” back to 0.
Using two bits, we‟d get
something like this:
1
Present State Next State 00 01
A B A B
0 0 0 1
1 1
0 1 1 0
1 0 1 1
1
1 1 0 0 11 10
Benefits of counters
00 01
11 10
The complete state diagram and
table
• Here‟s the complete state diagram and state table for this circuit.
Clock
Synchronous Counters (continued)
Internal details =>
Internal Logic Incrementer
◦ XOR complements each bit
◦ AND chain causes complement
of a bit if all bits toward LSB
from it equal 1
Count Enable
◦ Forces all outputs of AND
chain to 0 to “hold” the state
Carry Out
◦ Added as part of incrementer
◦ Connect to Count Enable of
additional 4-bit counters to
form larger counters
Design Example: Synchronous
BCD
Use the sequential logic model to design a synchronous
BCD counter with D flip-flops
State Table => Current State Next State
Input combinations Q8 Q4 Q2 Q1 Q8 Q4 Q2 Q1
1010 through 1111 0 0 0 0 0 0 0 1
are don‟t cares 0 0 0 1 0 0 1 0
0 0 1 0 0 0 1 1
0 0 1 1 0 1 0 0
0 1 0 0 0 1 0 1
0 1 0 1 0 1 1 0
0 1 1 0 0 1 1 1
0 1 1 1 1 0 0 0
1 0 0 0 1 0 0 1
1 0 0 1 0 0 0 0
Synchronous BCD (continued)
Use K-Maps to two-level optimize the next state equations and manipulate
into forms containing XOR gates:
D1 = Q1‟
D2 = Q2 + Q1Q8‟
D4 = Q4 + Q1Q2
D8 = Q8 + (Q1Q8 + Q1Q2Q4)
Y = Q1Q8
The logic diagram can be drawn from these equations
◦ An asynchronous or synchronous reset should be added
What happens if the counter is perturbed by a power disturbance or other
interference and it enters a state other than 0000 through 1001?
Synchronous BCD (continued)
Find the actual values of the six next states for the don‟t care combinations
from the equations
Find the overall state diagram to assess behavior for the don‟t care states
(states in decimal)
We can also make a circuit that counts up to only 1100, instead of 1111.
Here, when the counter value reaches 1100, the NAND gate forces the
counter to load, so the next state becomes 0000.
Summary of Counters
Notes on State diagrams
Continue to build up the diagram
Add a state C
◦ State C – Have detected the input sequence 11
which is the start of the sequence.
Continue…..
Add a state D
◦ State D – have detected the 3rd input in the
start of a sequence, a 0, now having 110.
From State D, if the next input is a 1 the
sequence has been detected and a 1 is output.
Add remaining transitions
258
State Minimization:
Completely Specified Machines
Two states, si and sj of machine M are
distinguishable if and only if there exists a finite
input sequence which when applied to M causes
different output sequences depending on whether
M started in si or sj.
259
State Minimization:
Completely Specified Machines
PS NS, z
x=0 x=1
A E, 0 D, 1
B F, 0 D, 0
C E, 0 B, 1
D F, 0 B, 0
E C, 0 F, 1
F B, 0 C, 0
Example:
states A and B are 1-distinguishable, since a 1 input applied to A
yields an output 1, versus an output 0 from B.
260
Completely Specified Machines
States si and sj (si ~ sj ) are said to be
equivalent iff no distinguishing sequence
exists for (si, sj ).
263
Completely Specified Machines
Theorem: The equivalence partition is unique.
Theorem: If two states, si and sj, of machine M
are distinguishable, then they are (n-1 )-
distinguishable, where n is the number of
states in M.
Definition: Two machines, M1 and M2, are
equivalent (M1 ~ M2 ) iff, for every state in M1
there is a corresponding equivalent state in M2
and vice versa.
Theorem. For every machine M there is a
minimum machine Mred ~ M.
Mred is unique up to isomorphism.
264
Completely Specified Machines
266
State Minimization of CSMs:
Complexity
3. (* Denote
[q ] the equivalence class of state q ,
and {Qi } the set of all
equivalence classes.
*)
Q’ := {Q1, Q2, ..., Qt }.
q ‟0 := [q0].
F’ := { [q] Q’ | q F }.
’ ( [q], a) := [(q,a)] for all q Q, a .
267
State Minimization of CSMs:
Complexity
Standard implementation: O (kn 2), where n
=|Q| and k = ||
Modification of the body of the while loop:
1. Choose such an i, a , and choose j1,j2 t with j1 j 2,
(Qi,a) Qj1 , and (Qi,a) Qj2 .
268
State Minimization of CSMs:
Complexity
269
State Minimization of CSMs:
BDD Implementation
270
State Minimization:
Incompletely Specified Machines
271
State Minimization:
Incompletely Specified Machines
Machine M:
PS NS, z
x=0 x=1
s1 s3, 0 s2, 0
s2 s2, - s3, 0
s3 s3, 1 s2, 0
Attempt to reduce this case to usual state minimization of completely
specified machines.
• Brute Force Method: Force the don‟t cares to all their possible values
and choose the smallest of the completely specified machines so
obtained.
In this example, it means to state minimize two completely specified
machines obtained from M, by setting the don‟t care to either 0 and 1.
272
State Minimization:
Incompletely Specified Machines
Suppose that the - is set to be a 0.
Machine M’:
PS NS, z
x=0 x=1
s1 s3, 0 s2, 0
s2 s2, 0 s3, 0
s3 s3, 1 s2, 0
273
Incompletely Specified Machines
Suppose that the - is set to be a 1.
Machine M’’:
PS NS, z
x=0 x=1
s1 s3, 0 s2, 0
s2 s2, 1 s3, 0
s3 s3, 1 s2, 0
PS NS, z
x=0 x=1
s1 s3, 0 s2, 0
s2 s2, - s1, 0
s3 s1, 1 s2, 0
275
State Minimization:
Incompletely Specified Machines
Machine M2: PS NS, z
x=0 x=1
s1 s3, 0 s2, 0
s2 s2, 0 s1, 0
s3 s1, 1 s2, 0
Machine M3: PS NS, z
x=0 x=1
s1 s3, 0 s2, 0
s2 s2, 1 s1, 0
s3 s1, 1 s2, 0
278
Incompletely Specified Machines
PS NS, z
I1 I2 I3 I4
s1 s3,0 s1,- - -
s2 s6,- s2,0 s1,- -
s3 -,1 -,- s4,0 -
s4 s1,0 -,- - s5,1
s5 -,- s5,- s2,1 s1,1
s6 -,- s2,1 s6,- s4,1
279
Incompletely Specified Machines
PS NS, z
I1 I2 I3 I4
s1 s3,0 s1,- - -
s2 s6,- s2,0 s1,- -
s3 -,1 -,- s4,0 -
s4 s1,0 -,- - s5,1
s5 -,- s5,- s2,1 s1,1
s6 -,- s2,1 s6,- s4,1
Another set of compatibles that covers all states is (s1s2s5), (s3s6), (s4s5).
But
(s1s2s5) requires (s3s6) (s3s6) requires (s4s6) (s4s6) requires
(s4s5) (s4s5) requires (s1s5).
So must select also (s4s6) and (s1s5).
280
Incompletely Specified Machines
More formally:
When a next state is unspecified, the future behavior of
the machine is unpredictable. This suggests the
definition of admissible input sequence.
Definition. An input sequence is admissible, for a starting
state of a machine if no unspecified next state is
encountered, except possibly at the final step.
Definition. State si of machine M1 is said to cover, or
contain, state sj of M2 provided
1. every input sequence admissible to sj is also admissible to si ,
and
2. its application to both M1 and M2 (initially is si and sj,
respectively) results in identical output sequences whenever
the outputs of M2 are specified.
281
State Minimization:
Incompletely Specified Machines
Definition. Machine M1 is said to cover machine
M2 iff
for every state sj in M2, there is a
corresponding state si in M1 such that si covers
sj.
282
Short summary of rest of section
283
Algorithmic State Machines
ASM chart
Salient features of the ASM
Examples of system design
Binary multiplier
Weighing Machine
Introduction
The binary information stored in the digital system can be
classified as either data or control information
The data information is manipulated by performing
arithmetic, logic, shift and other data processing tasks
The control information provides the command signals that
controls the various operations on the data in order to
accomplish the desired data processing task
Design a digital system we have to design two subsystems
data path subsystem and control subsystem
ASM CHART
A special flow chart that has been developed specifically to
define digital hardware algorithms is called ASM chart.
A hardware algorithm is a step by step procedure to
implement the desire task
What is the Difference b/n conventional flow chart
and ASM chart
conventional flow chart describes the sequence of
procedural steps and decision paths for an algorithm with
out concern for their time relationship
An ASM chart describes the sequence of events as well as
the timing relationship b/n the states of sequential
controller and the events that occur while going from one
state to the next
ASM consists of
1. State box
2. Decision box
3. Conditional box
State box
Decision box
BINARY MULTIPLIER
Data path subsystem for binary
multiplier
Thank you