4 Sequential Circuits
4 Sequential Circuits
4 Sequential Circuits
Chapter 4
Sequential Circuits
0
Sequential Circuits
• Most digital systems like digital watches, digital phones,
personal computers, digital traffic light controllers and so on
require memory elements.
• Memory elements are Combinational
digital circuits that can outputs Memory outputs
store and retrieve data
in the form of 1's and
0's.
Combinational Memory
• The output of the logic elements
systems with memory
depends not only on
present inputs but also
on what has happened
in the past External inputs
Inputs Outputs
Combinational
Circuit
Flip-flops
Clock
Inputs Outputs
Combinational
Circuit
Memory
Elements
2
Memory Elements
Memory element: a device which can remember value
indefinitely, or change value on command from its
inputs.
Memory Q
Command element Stored value
3
Latch vs Flip-Flops
A latch is a type temporary data storage device(memory
element) that have two possible states( i.e. it is bistable
device).
A flip-flop is synchronous bistable device(memory element)
that changes state at specified point.
Similarity: Both are bistable devices.
Differences: Latches are level sensitive devices and flip-
flops are edge sensitive devices.
In other words, Latches are Asynchronous and Flip-flops
are synchronous devices.
Latches are the building block of Flip-flops.
4
Set-Reset (S-R) Latch
S Q
R Q’
5
S-R Latch
S
Q
R Q'
6
S-R Latch
7
S-R Latch
SR Latch implementation
S R Q0 Q Q’
0 0 0 0 1 Q = Q0
R
0 0
Q
S Q
0 1
Initial Value
8
S-R Latch
SR Latch implementation
S R Q0 Q Q’
0 0 0 0 1 Q = Q0
0 0 1 1 0 Q = Q0
R
0 1
Q
S Q
0 0
9
S-R Latch
SR Latch implementation
S R Q0 Q Q’
0 0 0 0 1
Q = Q0
0 0 1 1 0
0 1 0 0 1 Q=0
R
1 0
Q
S Q
0 1
10
S-R Latch
SR Latch implementation
S R Q0 Q Q’
0 0 0 0 1
Q = Q0
0 0 1 1 0
0 1 0 0 1 Q=0
R
1 1 0 1 1 0 1 Q=0
Q
S Q
0 0
11
S-R Latch
SR Latch implementation
S R Q0 Q Q’
0 0 0 0 1
Q = Q0
0 0 1 1 0
0 1 0 0 1
R
0 0 0 1 1 0 1
Q=0
Q 1 0 0 1 0 Q=1
S Q
1 1
12
S-R Latch
SR Latch implementation
S R Q0 Q Q’
0 0 0 0 1
Q = Q0
0 0 1 1 0
0 1 0 0 1
R
0 1 0 1 1 0 1
Q=0
Q 1 0 0 1 0 Q=1
1 0 1 1 0 Q=1
S Q
1 0
13
S-R Latch
SR Latch implementation
S R Q0 Q Q’
0 0 0 0 1
Q = Q0
0 0 1 1 0
0 1 0 0 1
R 1 0 Q=0
0 1 1 0 1
Q 1 0 0 1 0
Q=1
1 0 1 1 0
1 1 0 0 0 Q = Q’
S Q
1 0
14
S-R Latch
SR Latch implementation
S R Q0 Q Q’
0 0 0 0 1
Q = Q0
0 0 1 1 0
0 1 0 0 1
R
1 1 0 1 1 0 1
Q=0
Q 1 0 0 1 0
Q=1
1 0 1 1 0
1 1 0 0 0 Q = Q’
1 1 1 0 0 Q = Q’
S Q
1 0
15
S-R Latch
SR Latch implementation
S R Q0 Q Q’
0 0 0 0 1
Q = Q0
0 0 1 1 0
0 1 0 0 1
R
1 0 0 1 1 0 1
Q=0
Q 1 0 0 1 0
Q=1
1 0 1 1 0
1 1 0 0 0 Q = Q’
1 1 1 0 0
S Q
1 0
16
Exercise
Construct the characteristics table for the following
S R Q0 Q Q’
0 0 0
0 10
S Q
R Q
0 0
17
S-R Latch (Active-high and Active-low)
S R Q
R Q Q0 No change
0 0
0 1 0 Reset
1 0 1 Set
S Q 1 1 Q=Q’=0 Invalid
S S R Q
Q Invalid
0 0 Q=Q’=1
0 1 1 Set
Q 1 0 0 Reset
R Q0 No change
1 1
18
SR Latch with Control Input (Gated SR Latch)
The operation of the basic SR latch can be modified by
providing an additional control input that determines when the
state of the latch can be changed.
It consists of the basic SR latch and two additional AND/NAND
gates.
R R S S
Q Q
C C
S Q R Q
S R
C S R Q
0 x x Q0 No change
1 0 0 Q0 No change
1 0 1 0 Reset
1 1 0 1 Set
1 1 1 Q=Q’ Invalid 19
Controlled Latches
D Latch (D = Data)
Timing Diagram
D latch is designed to eliminate the
indeterminate state in SR latch by making sure
C
that inputs S and R are never equal to 1 at the
same time D
D S
Q Q
C
R Q
t
Output may
C D Q change
0 x Q0 No change
1 0 0 Reset
1 1 1 Set 20
Controlled Latches
S
C
D
Q
C D
R Q
Q
C D Q Output may
0 x Q0 No change change
1 0 0 Reset
1 1 1 Set
21
Graphic Symbols for latches
22
Latch Circuits: Not Suitable
23
Memory Elements
Memory element with clock: Flip-flops are memory
elements that change state on clock signals.
Memory Q
command element stored value
clock
Positive pulses
CLK
CLK
CLK'
CLK'
CLK*
CLK*
Positive-going transition Negative-going transition
(rising edge) (falling edge)
26
Edge-Triggered Flip-flops
S Q D Q J Q
C C C
R Q' Q' K Q'
S Q D Q J Q
C C C
R Q' Q' K Q'
27
S-R Flip-flop
28
S-R Flip-flop
It comprises 3 parts:
a basic NAND/NOR latch
a pulse-steering circuit
29
S-R Flip-flop
CLK' CLK'
CLK CLK* CLK CLK*
CLK CLK
CLK' CLK'
CLK* CLK*
30
Edge-Triggered D Flip-Flop
• The first latch is called the master and the second the slave.
• The circuit samples the D input and changes its output Q only at
the negative-edge of the controlling clock.
D 110011…
Y 110011…
Q ? 1 1 0 0 1 ….
CLK
31
Edge-Triggered D Flip-Flop
When the clock is 0, the output of the inverter is 1.
● The slave latch is enabled, and its output Q is equal to the master output Y.
● The master latch is disabled because Clk=0.
Master-Slave D Flip-Flop
D D Q D Q Q
D Latch D Latch
(Master) (Slave)
C C
Master Slave
CLK
CLK
D
Looks like it is negative
edge-triggered QMaster
QSlave
33
Edge-Triggered D Flip-Flop
D Q D Q
Q Q
Negative Edge
Positive Edge
34
D Flip-flop
D Q Q3 =
Transfer CLK Z*
Q'
* After occurrence of negative-going transition
35
JK Flip-Flop
J
D Q Q
K
CLK Q Q
36
JK Flip-Flop
• The J input sets the flip-flop to 1, the K input resets it to 0, and when
both inputs are enabled, the output is complemented.
• This can be verified by investigating the circuit applied to the D input:
D = J Q` + K` Q
Q J K Q(t+1)
0 0 0 0
0 0 1 0
0 1 0 1
0 1 1 1
1 0 0 1
J K CLK Q(t+1) Comments 1 0 1 0
1 1 0 1
0 0 Q(t) No change
1 1 1 0
0 1 0 Reset
1 0 1 Set
1 1 Q(t)' Toggle
37
T-Flip-Flop
• The T(toggle) flip-flop is a complementing flip-flop and can be
obtained from a JK flip-flop when inputs J and K are tied together.
T J Q D Q
T
K Q Q
D = JQ’ + K’Q T Q
D = TQ’ + T’Q = T Q
Q
38
Flip-Flop Characteristic Tables
D Q D Q(t+1)
0 0 Reset
Q 1 1 Set
J K Q(t+1)
J Q 0 0 Q(t) No change
0 1 0 Reset
K Q 1 0 1 Set
1 1 Q’(t) Toggle
T Q T Q(t+1)
0 Q(t) No change
Q
1 Q’(t) Toggle
39
Flip-Flop Characteristic Equations
Analysis / Derivation
J K Q(t) Q(t+1)
0 0 0 0
J Q 0 0 1 1 J KQ
0 1 0 0 0 1 0 0
0 1 1 0 1 1 0 1
K Q
1 0 0 1
1 0 1 1
1 1 0 1
1 1 1 0
D Q D Q(t+1)
0 0 Q(t+1) = D
Q 1 1
J K Q(t+1)
J Q 0 0 Q(t)
0 1 0 Q(t+1) = JQ’ + K’Q
K Q 1 0 1
1 1 Q’(t)
T Q T Q(t+1)
0 Q(t) Q(t+1) = T Q
Q
1 Q’(t)
41
Exercise
A PN flip-flop has four operations: clear to 0, no change,
complement, and set to 1, when inputs P and N are 00, 01, 10, and
11, respectively.
(a) Tabulate the characteristic table.
(b) Derive the characteristic equation.
(c) Show how the PN flip-flop can be converted to a D flip-flop.
42
Analysis of Clocked Sequential Circuits
43
State Equation
• A state equation is an algebraic expression that specifies the
condition for a flip-flop state transition.
• The left side of the equation with (t+1) denotes the next state of the
flip-flop one clock edge later.
• The right side of the equation is Boolean expression that specifies
the present state and input conditions that make the next state equal
to 1.
44
Analysis of Clocked Sequential Circuits
State Equations
x
A
A(t+1) = DA D Q
=Ax+Bx
D Q B
B(t+1) = DB
CLK Q
= A’(t) x(t)
y
= A’ x
y(t) = [A(t)+ B(t)] x’(t)
= (A + B) x’
45
Analysis of Clocked Sequential Circuits
0 0 0 0 0 0
D Q B
0 0 1 0 1 0
CLK
0 1 0 0 0 1 Q
0 1 1 1 1 0 y
1 0 0 0 0 1
1 0 1 1 0 0
A(t+1) = A x + B x
1 1 0 0 0 1
1 1 1 1 0 0 B(t+1) = A’ x
y(t) = (A + B) x’
t t+1 t 46
Analysis of Clocked Sequential Circuits
1 1 0 0 1 0 1 0 y
t t+1 t A(t+1) = A x + B x
B(t+1) = A’ x
y(t) = (A + B) x’
47
Analysis of Clocked Sequential Circuits
State Diagram
The information available in a state table can be represented
graphically in the form of a state diagram.
In this type of diagram, a state is represented by a circle, and
the (clock-triggered) transitions between states are indicated by
directed lines connecting the circles
AB input/output
The binary number inside each circle identifies the state of
the flip-flops.
The directed lines are labeled with two binary numbers
separated by a slash which represents input and output during
the present state.
48
Analysis of Clocked Sequential Circuits
CLK Q
01 11
y
1/0 49
Analysis of Clocked Sequential Circuits
D Flip-Flops
Example: x D Q A
Present Next
y
Input
State State CLK Q
A x y A
0 0 0 0
0 0 1 1 A(t+1) = DA = A x y
0 1 0 1
0 1 1 0
1 0 0 1 01, 10
1 0 1 0
00, 11 0 1 00, 11
1 1 0 0
1 1 1 1 01, 10
50
Analysis of Clocked Sequential Circuits
JK Flip-Flops J Q A
Example: x K Q
JK Flip-Flops J Q A
x K Q
Example:
Present Next Flip-Flop J Q B
I/P
State State Inputs
K Q
A B x A B JA KA JB KB
0 0 0 0 1 0 0 1 0 CLK
0 0 1 0 0 0 0 0 1 1 0 1
0 1 0 1 1 1 1 1 0 00 11
0 1 1 1 0 1 0 0 1
0
1 0 0 1 1 0 0 1 1 0 0
1 0 1 1 0 0 0 0 0
1 1 0 0 0 1 1 1 1 01 10
1 0 0 0
1
1 1 1 1 1 1
52
Analysis of Clocked Sequential Circuits
x A
T Flip-Flops T Q y
R Q
Example:
Present Next F.F
I/P O/P
State State Inputs T Q
B
A B x A B TA TB y
R Q
0 0 0 0 0 0 0 0
0 0 1 0 1 0 1 0 CLK Reset
0 1 0 0 1 0 0 0
TA = B x TB = x
0 1 1 1 0 1 1 0
y =AB
1 0 0 1 0 0 0 0
1 0 1 1 1 0 1 0
A(t+1) = TA Q’A + T’A QA
= AB’ + Ax’ + A’Bx
1 1 0 1 1 0 0 1
1 1
B(t+1) = TB Q’B + T’B QB
1 1 1 0 0 1
=xB 53
Analysis of Clocked Sequential Circuits
x A
T Flip-Flops (Counter) T Q y
R Q
Example:
Present Next F.F
I/P O/P
State State Inputs T Q
B
A B x A B TA TB y
R Q
0 0 0 0 0 0 0 0
0 0 1 0 1 0 1 0 CLK Reset
0 1 0 0 1 0 0 0 0/0 0/0
0 1 1 1 0 1 1 0 00 1/0 01
1 0 0 1 0 0 0 0
1 0 1 1 1 0 1 0 1/1 1/0
1 1 0 1 1 0 0 1 11 10
1 1
0/1 0/0
1 1 1 0 0 1 1/0
54
Flip Flop Operating Characteristics
55
Flip Flop Operating Characteristics
56
Flip Flop Operating Characteristics
57
Flip Flop Operating Characteristics
The Hold Time: is the minimum interval required for
the logic levels to remain on the inputs after the
triggering edge of the clock pulse in order for the
levels to be reliably clocked into the flip-flop.
58
Flip Flop Operating Characteristics
Set-up Time: is the minimum interval required for the
logic levels to be maintained constantly on the inputs (J
and K, or D) prior to the triggering edge of the clock
pulse in order for the levels to be reliably clocked into
the flip-flop.
59
Flip Flop Operating Characteristics
60
Application of Flip-Flops
Frequency Division
● When a pulse waveform is applied to the clock input of a J-
K flip-flop that is connected to toggle, the Q output is a
square wave with half the frequency of the clock input.
61
Application of Flip-Flops
62
Application of Flip-Flops
63
Exercise
A sequential circuit with two D flip-flops A and B, two inputs, x
and y; and one output z is specified by the following next-state
and output equations