Professional Documents
Culture Documents
Sequential Circuits
Chapter 5 - Part 1 1
Overview
Chapter 5 - Part 1 2
Introduction to Sequential Circuits
Inputs Outputs
Combina-
A Sequential tional
circuit contains: Storage
Logic
Elements
• Storage elements:
Latches or Flip-Flops Next
State State
• Combinational Logic:
Implements a multiple-output
switching function
Inputs are signals from the outside.
Outputs are signals to the outside.
Other inputs, State or Present State, are
signals from storage elements.
The remaining outputs, Next State are
inputs to storage elements.
Chapter 5 - Part 1 3
Introduction to Sequential Circuits
Chapter 5 - Part 1 4
Introduction to Sequential Circuits
Inputs Outputs
Combina-
tional
Storage
Logic
Elements
Combinatorial Logic Next
• Next state function State State
Next State = f(Inputs, State)
• Output function
Outputs = g(Inputs, State)
• Output function
Outputs = h(State)
Output function type depends on specification and affects
the design significantly
Chapter 5 - Part 1 5
Types of Sequential Circuits
Chapter 5 - Part 1 6
Types of Sequential Circuits
Chapter 5 - Part 1 7
Gate Delay and Information Storage
Chapter 5 - Part 1 8
Information Storage
Chapter 5 - Part 1 11
LATCHES
Chapter 5 - Part 1 12
Basic (NOR) S – R Latch
Cross-coupling two
NOR gates gives the
S – R Latch:
Which has the time
sequence
behavior:
S = 1, R = 1 is
forbidden as
input pattern
Chapter 5 - Part 1 13
Basic (NOR) S – R Latch
Chapter 5 - Part 1 14
Latches
SR Latch S R Q0 Q Q’
Q = Q0
0 0 0 0 1
0 0
R Q
S Q
0 1
Initial Value
0 1
R Q
S Q
0 0
0 0 1 1 0
Q=0
0 1 0 0 1
1 0
R Q
S Q
0 1
0 0 1 1 0
Q=0
0 1 0 0 1
1 1 Q=0
R Q
0 1 1 0 1
S Q
0 0
0 0 1 1 0
0 1 0 0 1 Q=0
0 0
R Q
0 1 1 0 1
Q=1
1 0 0 1 0
S Q
1 1
0 0 1 1 0
0 1 0 0 1 Q=0
0 1
R Q
0 1 1 0 1
Q=1
1 0 0 1 0
1 0 1 1 0 Q=1
S Q
1 0
0 0 1 1 0
0 1 0 0 1 Q=0
1 0
R Q
0 1 1 0 1
1 0 0 1 0 Q=1
1 0 1 1 0
Q = Q’
1 1 0 0 0
S Q
1 10
0 0 1 1 0
0 1 0 0 1 Q=0
1 10
R Q
0 1 1 0 1
1 0 0 1 0 Q=1
1 0 1 1 0
Q = Q’
1 1 0 0 0
Q = Q’
1 1 1 0 0
S Q
1 0
S Q 1 1 Q=Q’=0
S S R Q
Q Invalid
0 0 Q=Q’=1
Set
0 1 1 Reset
1 0 0 No change
R Q
1 1 Q0
Eastern Mediterranean University
23
Latches
SR Latch
S R Q
R Q Q0 No change
0 0
Reset
0 1 0 Set
1 0 1 Invalid
S Q 1 1 Q=Q’=0
Chapter 5 - Part 1 25
Basic (NAND) S – R Latch
S S’ R’ Q
Q Invalid
0 0 Q=Q’=1
Set
0 1 1 Reset
1 0 0 No change
R Q
1 1 Q0
Chapter 5 - Part 1 26
Clocked S - R Latch
Chapter 5 - Part 1 27
Basic (NAND) S – R Latch
“Cross-Coupling”
two NAND gates gives
the S -R Latch:
Which has the time
sequence behavior:
S = 0, R = 0 is
forbidden as
input pattern
Chapter 5 - Part 1 28
Clocked S - R Latch (continued)
Chapter 5 - Part 1 29
D Latch – Clocked or controlled D
Latch
To Eliminate undesirable undefined state.
Ensure that s and R and
Adding an inverter to the S-R Latch, gives the
D Latch:
Note that there are no
indeterminate/Undefined”
states!
C=0 both inputs are 1 and circuit cannot
change state.
Chapter 5 - Part 1 30
D Latch
Chapter 5 - Part 1 31
D Latch
D Latch (D = Data) Timing Diagram
C
D S
Q
D
C
R Q
Q
t
C D Q
Output may change
0 x Q0 No change
Reset
1 0 0 Set
1 1 1
C
D S
Q
D
C
R Q
Q
0 x Q0 No change
Reset
1 0 0 Set
1 1 1
Chapter 5 - Part 1 34
The Latch Timing Problem
Clock C Q
Suppose that initially Y = 0.
Clock
Y
As long as C = 1, the value of Y continues to change!
The changes are based on the delay present on the loop
through the connection from Y back to Y.
This behavior is clearly unacceptable.
Desired behavior: Y changes only once per clock pulse
Chapter 5 - Part 1 36
The Latch Timing Problem (continued)
Chapter 5 - Part 1 38
JK Master Slave Flip Flop
Chapter 5 - Part 1 39
Flip-Flop Problem
The change in the flip-flop output is delayed by
the pulse width which makes the circuit slower or
Master Slave Flip Flop also Called Pulse
Triggered Flip Flop ; can respond to input values
that can cause a change in state and occur
anytime during the pulse
Chapter 5 - Part 1 40
Flip Flop Problem
Chapter 5 - Part 1 41
Flip-Flop Solution
Chapter 5 - Part 1 42
Flip-Flops solutions
Controlled latches are level-triggered
Master Slave
CLK
CLK
QSlave
Eastern Mediterranean University
45
Positive-Edge Triggered D Flip-Flop
Formed by D D Q S Q
Q
adding inverter C
to clock input C C Q R Q Q
Chapter 5 - Part 1 46
Flip-FlopT
T Flip-Flop
T Q
T J Q
Q
K Q
D Q D Q(t+1)
0 0 Reset
Set
Q 1 1
J K Q(t+1)
J Q No change
0 0 Q(t) Reset
0 1 0 Set
1 0 1 Toggle
K Q
1 1 Q’(t)
T Q T Q(t+1)
0 Q(t) No change
Q Toggle
1 Q’(t)
Eastern Mediterranean University
48
Flip-Flop Characteristic Equations
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)
Q(t+1) = JQ’ + K’Q
0 1 0
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)
Eastern Mediterranean University
49
Flip-Flop Characteristic Equations
Analysis / Derivation
J K Q(t) Q(t+1)
No change
0 0 0 0
J Q Reset
0 0 1 1
0 1 0 Set
K Q 0 1 1
Toggle
1 0 0
1 0 1
1 1 0
1 1 1
R R C C
Master-Slave:
(a) Latches
Postponed output S S D D
indicators C C
R R C C
Dynamic D D
indicator
C C
Triggered D Triggered D
(c) Edge-Triggered Flip-Flops
Chapter 5 - Part 1 55
Lecture 12
Sequential Circuit Analysis &
Sequential Circuits Design
Chapter 5 - Part 1 56
Overview
Part 1 - Sequential Circuit Analysis
• Sequential circuit analysis
State tables
State diagrams
Equivalent states
Chapter 5 - Part 2 57
Sequential Circuit Analysis
General Model
Inputs Outputs
• Current State Combina-
at time (t) is tional
stored in an Storage Logic
array of Elements
Next
flip-flops. State State
• Next State at time (t+1)
is a Boolean function of CLK
State and Inputs.
• Outputs at time (t) are a Boolean function of
State (t) and (sometimes) Inputs (t).
Chapter 5 - Part 1 58
Analysis of Clocked Sequential
Circuits
The State
• State = Values of all Flip-Flops
x
Example D Q A
AB=00 Q
D Q B
CLK Q
59
Analysis of Clocked Sequential
Circuits
State Equations
x
D Q A
A(t+1) = DA
= A(t) x(t)+B(t) x(t)
=Ax +Bx Q
B(t+1) = DB
= A’(t) x(t)
= A’ x D Q B
y(t) = [A(t)+ B(t)] x’(t)
= (A + B) x’ CLK Q
60
Analysis of Clocked Sequential Circuits
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
61
Analysis of Clocked Sequential
Circuits
State Table (Transition Table)
x
Present Next State Output D Q A
t t+1 t A(t+1) = A x + B x
B(t+1) = A’ x
y(t) = (A + B) x’
62
Analysis of Clocked Sequential Circuits
State Diagram Present Next State Output
State x=0 x=1 x=0 x=1
A B A B A B y y
AB input/output
0 0 0 0 0 1 0 0
0 1 0 0 1 1 1 0
0/0 1/0
1 0 0 0 1 0 1 0
0/1 1 1 0 0 1 0 1 0
00 10
x
D Q A
0/1
Q
1/0 0/1 1/0
D Q B
CLK Q
01 11
y
64
Analysis of Clocked Sequential
Circuits
JK Flip-Flops J Q A
Example: x K Q
1 1 1 1 1 0
0 1 1 1 0 1 0 0 1
1 0 0 A(t+1) = JA Q’A + K’A QA
1 1 0 0 1 1 = A’B + AB’ + Ax
1 0 1 1 0 0 0 0 0 B(t+1) = JB Q’B + K’B QB
= B’x’ + ABx + A’Bx’
1 1 0 0 0 1 1 1 1
1 1 1 1 1 1 0 0 0
Eastern Mediterranean University
65
Analysis of Clocked Sequential
Circuits
JK Flip-Flops J Q A
x K Q
Example:
Present Next Flip-Flop J Q B
I/P
State State Inputs
A B x A B JA KA JB KB K Q
0 0 0 0 1 0 0 1 0 CLK
1 0 1
0 0 1 0 0 0 0 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 0 0
1 1 0 0 1 1
1 0 1 1 0 0 0 0 0
1 1 0 0 0 1 1 1 1 01 10
1
1 1 1 1 1 1 0 0 0 1
Eastern Mediterranean University
66
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
A(t+1) = TA Q’A + T’A QA
1 0 1 1 1 0 1 0 = AB’ + Ax’ + A’Bx
1 1 0 B(t+1) = TB Q’B + T’B QB
1 1 0 0 1 =x B
1 1 1 0 0 1 1 1
67
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 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/1 1/0
1 0 1 1 1 0 1 0
1 1 0 1 1 0 0 1 11 10
0/1 0/0
1 1 1 0 0 1 1 1 1/0
68
Sequential Circuit Design
Chapter 5 - Part 1 69
The Design Procedure
Specification
Formulation - Obtain a state diagram or state table
State Assignment - Assign binary codes to the states
Flip-Flop Input Equation Determination - Select flip-flop
types and derive flip-flop equations from next state entries in the
table
Output Equation Determination - Derive output equations
from output entries in the table
Optimization - Optimize the equations
Technology Mapping - Find circuit from equations and map to
flip-flops and gate technology
Verification - Verify correctness of final design
Chapter 5 - Part 2 70
Specification
Chapter 5 - Part 2 71
Formulation: Finding a State Diagram
Chapter 5 - Part 2 72
Formulation: Finding a State Diagram
Chapter 5 - Part 2 73
Sequence Recognizer Procedure
To develop a sequence recognizer state diagram:
• Begin in an initial state in which NONE of the initial portion of
the sequence has occurred (typically “reset” state).
• Add a state that recognizes that the first symbol has occurred.
• Add states that recognize each successive symbol occurring.
• The final state represents the input sequence (possibly less the
final input value) occurence.
• Add state transition arcs which specify what happens when a
symbol not in the proper sequence has occurred.
• Add other arcs on non-sequence inputs which transition to
states that represent the input subsequence that has occurred.
The last step is required because the circuit must recognize the
input sequence regardless of where it occurs within the overall
sequence applied since “reset.”.
Chapter 5 - Part 2 74
State Assignment
1/0 0/0
A 1/0 B C D
1/1
• Transition arcs are used to denote the output function (Mealy Model)
• Output 1 on the arc from D means the sequence has been recognized
• To what state should the arc from state D go? Remember: 1101101 ?
• Note that D is the last state but the output 1 occurs for the input
applied in D. This is the case when a Mealy model is assumed.
Chapter 5 - Part 2 78
Example: Recognize 1101 (continued)
A 1/0
B
1/0 0/0 1/1
C D
Clearly the final 1 in the recognized sequence
1101 is a sub-sequence of 1101. It follows a 0
which is not a sub-sequence of 1101. Thus it
should represent the same state reached from the
initial state after a first 1 is observed. We obtain:
1/0 0/0
A 1/0 B C D
1/1
Chapter 5 - Part 2 79
Example: Recognize 1101 (continued)
1/1
The state have the following abstract meanings:
• A: No proper sub-sequence of the sequence has
occurred.
• B: The sub-sequence 1 has occurred.
• C: The sub-sequence 11 has occurred.
• D: The sub-sequence 110 has occurred.
• The 1/1 on the arc from D to B means that the last 1
has occurred and thus, the sequence is recognized.
Chapter 5 - Part 2 80
Example: Recognize 1101 (continued)
Answer: 1/1
"0" arc from A
"0" arc from B
"1" arc from C
"0" arc from D.
Chapter 5 - Part 2 81
Example: Recognize 1101 (continued)
0/0 1/1
0/0
Note that the 1 arc from state C to state C
implies that State C means two or more 1's have
occurred.
Chapter 5 - Part 2 82
Formulation: Find State Table
From the State Diagram, we can fill in the State Table.
There are 4 states, one 0/0 1/0
input, and one output.
1/0 1/0 0/0
We will choose the form A B C D
with four rows, one for
each current state. 0/0 1/1
Chapter 5 - Part 2 83
Formulation: Find State Table
0/0 1/1
0/0
Present Next State Output
State x=0 x=1 x=0 x=1
A A B 0 0
B A C 0 0
C D C 0 0
D A B 0 1
What would the state diagram and state table
look like for the Moore model?
Chapter 5 - Part 2 84
State Assignment
Counting Order Assignment: A = 0 0, B = 0 1,
C = 1 0, D = 1 1
The resulting coded state table:
Present Next State Output
State x = 0 x = 1 x = 0 x = 1
00 00 01 0 0
01 00 10 0 0
10 11 10 0 0
11 00 01 0 1
Chapter 5 - Part 2 85
Flip Flop Input and Output Equations
• The State diagram specifies , 4 states , two input values , two out put values and
two D-FF are required to represent 4 states.
• FF Input equation are derived.
• Output Equation is derived.
Chapter 5 - Part 1 86
Simplified FF Equations
Chapter 5 - Part 1 87
Sequential Circuit
Y1
D
C
R
Z
Y2
X D
Clock C
R
Reset
Chapter 5 - Part 1 88