Professional Documents
Culture Documents
(Synchronous)
Sequential Circuits
J.J. Shann
Contents
6-1 Sequential Circuit Definitions
6-2 Latches
6-3 Flip-Flops
6-6 Other Flip-Flop Types
6-4 Sequential Circuit Analysis
6-5 Sequential Circuit Design
6-7 HDL Representation for Sequential Circuits—
VHDL (×)
6-8 HDL Representation for Sequential Circuits—
Verilog (×)
6-9 Chapter Summary
J.J. Shann 6-2
6-1 Sequential Circuit Definitions
Combinational circuit: no memory elements
(inputs) ⇒ (outputs)
Sequential circuit:
(Optional) Flip-flops
Clock pulses
Async
Seq Ckt
S R Q+
— Useful states: 0 0 N o ch a n g e (Q + = Q )
¾ Set state: Q = 1, Q = 0 0 1 R eset (Q + = 0 )
¾ Reset state: Q = 0, Q = 1 1 0 S et (Q + = 1 )
1 1 In d eterm in a te
— Undefined states: Q = Q
Q + : n ex t sta te o f Q
0 S R Q+
0 0 No change (Q+ = Q)
1→ 1
0 0 1 Reset (Q+ = 0)
1 0 Set (Q+ = 1)
1 1 Indeterminate
Q+: next state of Q
J.J. Shann 6-11
S R Q Q Q+ Q+
(Case 2)
0 0 0 1 0 1
1 0 1 0
0 1 0 1 0 1 9
1 0→ 0
1 0 0 1
1 0 0 1 1 0
1 0 1 0 9
1
1 1 0 1 0 0
1 0 0 0
0 S R Q+
0 0 No change (Q+ = Q)
1→ 1
0 0 1 Reset (Q+ = 0)
1 0 Set (Q+ = 1)
1 1 Indeterminate
Q+: next state of Q
J.J. Shann 6-12
S R Q Q Q+ Q+
(Case 3)
0 0 0 1 0 1
1 0 1 0
0 1 0 1 0 1
1 0 0 1 9
1 1→ 0→ 0→ 0
1 0 0 1 1 0 9
1 0 1 0
0→ 0 → 1
1 1 0 1 0 0
1 0 0 0
1→ 0→ 0 S R Q+
0 0 No change (Q+ = Q)
0 0→ 0→ 1→ 1 0 1 Reset (Q+ = 0)
1 0 Set (Q+ = 1)
1 1 Indeterminate
Q+: next state of Q
J.J. Shann 6-13
S R Q Q Q+ Q+
(Case 4)
0 0 0 1 0 1
1 0 1 0
0 1 0 1 0 1
1 0 0 1
1 0→ 0→ 0
1 0 0 1 1 0
1 0 1 0
1→ 0
1 1 0 1 0 0
1 0 0 0
0→ 0 S R Q+
0 0 N o ch a n g e (Q + = Q )
1 1→ 0→ 0 0 1 R eset (Q + = 0 )
1 0 S et (Q + = 1 )
1 1 In d eterm in a te
Q + : n ex t sta te o f Q
0→ 1 S R Q+
0 0 No change (Q+ = Q)
0 0 → 1 → 0 →… 0 1 Reset (Q+ = 0)
1 0 Set (Q+ = 1)
1 1 Indeterminate
Q+: next state of Q
J.J. Shann 6-15
S R Q Q Q+ Q+
0 0 0 1 0 1
1 0 1 0
Summary:
0 1 0 1 0 1
1 0 0 1
1 0 0 1 1 0
1 0 1 0
1 1 0 1 0 0
1 0 0 0
S R Q+
0 0 No change (Q+ = Q)
0 1 Reset (Q+ = 0)
Set (Q+ = 1)
Q = ( R + Q )′
+ 1 0
1 1 Indeterminate
S R Q+
1 1 N o ch a n g e (Q + = Q )
1 0 R eset (Q + = 0 )
0 1 S et (Q + = 1 )
0 0 In d eter m in a te J.J. Shann 6-18
S R Q Q Q+ Q+
1 1 0 1 0 1
1 0 1 0
0 1 0 1 0 1
1 0 0 1
1 0 0 1 1 0
1 0 1 0
0 0 0 1 1 1
1 0 1 1
S R Q+
1 1 N o ch a n g e (Q + = Q )
Q + = ( S ⋅ Q )′ 1 0 R eset (Q + = 0 )
0 1 S et (Q + = 1 )
Q = ( R ⋅ Q)′
+
0 0 In d eter m in a te
1
D D′
D
×
D
0
D D′
D+ ×
Negative
edge-triggered
D flip-flop
Positive
edge-triggered
D flip-flop
Negative
edge-triggered
D flip-flop
Positive
edge-triggered
D flip-flop
1
0 No change
1
1
0
No change
1
D
D′
D′
D
D D′
D
D′
D′
D
D D′
D′
1
Setup time: G1 + G4
— the minimum time for which the D input must be
maintained at a constant value prior to the occurrence of
the clock transition
Hold time: max(G2, G3)
— the minimum time for which the D input must not change
after the application of the positive transition of the clock
Propagation delay time:
— the time interval b/t the trigger edge and the stabilization
of the output to a new state
D′
D′
J.J. Shann 6-39
Hold time: max(G2, G3)
— the minimum time for which the D input must not change
after the application of the positive transition of the clock
D D′
D
D′
D D′
D
D D′
D′
Clock pulse
width, tw
Setup time, ts
Hold time, th
Propagation
delay times,
tPHL, tPLH, tpd
* Assumption:
All flip-flops are of the positive-
edge-triggered type, unless
otherwise indicated.
J.J. Shann 6-43
E. Direct Inputs
Direct inputs: asynchronous inputs
— are used to force the flip-flop to a particular state
independent of the clock.
¾ When power is turned on in a digital system, the state of the flip-
flops is unknown.
¾ The direct inputs are useful for bringing all flip-flops in the
system to a known starting state prior to the clocked operation.
— Types of direct inputs:
¾ Preset: direct set, sets the f-f to 1
¾ Clear: direct reset, sets the f-f to 0
1 0
E.g.: (補充資料) *
D flip-flop w/
* 1
asynchronous
reset 1
*
* Active LOW
direct reset
(active LOW)
Q+ = JQ′ + K′Q
J.J. Shann 6-49
J K D Q+
0 0 Q Q
JK flip-flop (Cont’d) Verification
0 1 0 0
Q+ = JQ′ + K′Q 1 0 1 1
D = Q+ =JQ′ + K′Q 1 1 Q′ Q′
J K Q+
0 0 Q
J=K T Q+
⇒
0 1 0 From D flip-flop:
0 Q Q+ = D = TQ′ + T′Q
1 0 1
1 Q′
1 1 Q′
Q+ = TQ′ + T′Q
Q+ = JQ′ + K′Q J.J. Shann 6-51
Flip-Flop Logic, Characteristic Tables &
Equations, and Excitation Tables
(optional)
(2)
Analysis procedure:
Flip-Flop Characteristic Equation
1 2 3 4
1
Two-dimensional
state table
1
⇒
2. Next-state equation:
A+ = DA = A⊕X⊕Y
J.J. Shann 6-60
3. State table:
A+ = A ⊕ X ⊕ Y
Z=A
4. State diagram:
A/Z
state/output
J.J. Shann 6-61
補充資料:Analysis w/ JK Flip-Flops
Flip-Flop Characteristic Equation
1 2 3 4
Xi Zk
Inputs Combinational Outputs
Logic for
Outputs and
Next State
State
State Register Clock Feedback
— E.g. 1:
State
State Register Clock Feedback
— E.g. 1:
Xi Comb.
Combinational
Inputs Logic for
Logic for
Outputs
Next State
(Flip-flop Zk
Inputs) Outputs
Clock
state
feedback
— E.g. 2:
Xi Comb.
Combinational
Inputs Logic for
Logic for
Outputs
Next State
(Flip-flop Zk
Inputs) Outputs
Clock
state
feedback
— E.g. 2:
Hold time: th
— does not appear in the clock period
equation.
— relates to another timing constraint
equation dealing w/ one or both of 2
specific situations:
¾ output changes arrive at the inputs of one or more f-fs too soon
¾ the clock signals reaching one or more f-f are somehow delayed
(clock skew) J.J. Shann 6-84
D. Simulation
Sequential ckt simulation:
— The input patterns must be applied in a sequence.
— There must be some means to place the ckt in a known state.
— Observe the state to verify correctness.
— Deal with the timing of application of inputs and observation of
outputs relative to the active clock edge.
Function simulation
— Objective: determination or verification of the function of the ckt
⇒ Assumption: Ckt components has no delay or a very small delay.
Timing simulation
— Objective: verification of the proper op of the ckt in terms of timing
⇒ Ckt components has realistic delays.
Minimal
Functional State State
state
description table assignment
table
D.
Flip-Flop E. F.
input
Binary-coded Circuit Verify
equations (Used/Unused
state
& states)
table
Output
equations
J.J. Shann 6-89
A. Finding State Diagrams and State Tables
“1101”
X Z
Seq Recognizer
0/0 1/0
1/0
1/0 1/0 0/0 1/1
A B C D E
Init “1” “11” “110” “1101”
0/0
0/0 0/0
X/Z
State B = State E
J.J. Shann 6-93
— State diagram: (cont’d)
0
1
2
3
4
5
6
7
8
9
J.J. Shann 6-97
B1 B2 B3 B4
— State diagram:
B1=0 B1=1
0/0 1/1 0/0 0/0 0/1 0/0 1/1 0/1 0/0 0/1
Init
J.J. Shann 6-99
— State diagram: (cont’d)
S3 S4 S5 S6
0/0 1/0 0/1 1/0 0/0 1/0 0/1 1/0
S0
J.J. Shann 6-105
State table: Next State Output
Input Sequence Present State X=0 X =1 X =0 X=1
Reset S0 S1 S2 0 0
0 S1 S3 S4 0 0
1 S2 S5 S6 0 0
00 S3 S0 S0 0 0
01 S4 S0 S0 1 0
10 S5 S0 S0 0 0
11 S6 S0 S0 1 0
S0
0,1/0
S1 = S2
0/0 1/0
S3 = S5 S4 = S6
0/0 1/0 0/1 1/0
S0
J.J. Shann 6-107
E.g.: 3-state odd parity checker
Next State
Present State X=0 X=1 Output
S0 S0 S1 0
S1 S1 S2 1
S2 S2 S1 0
No
Noway
wayto
tocombine
combinestates
statesS0
S0and
andS2S2
based
basedon
onNext
NextState
StateCriterion!
Criterion!
S3 S3
S4 S4
S5 S5
S6 S6
S0 S1 S2 S3 S4 S5 S6 S0 S1 S2 S3 S4 S5
S1-S3
S1
S2-S4
S0
J.J. Shann 6-110
E.g.: 3-bit sequence detector
Single input X, Single output Z.
Output a 1 whenever the serial sequence 010 or 110 has
been observed at the inputs.
<Ans.>
State table: Next State Output
Input Sequence Present State X=0 X =1 X =0 X=1
Reset S0 S1 S2 0 0
0 S1 S3 S4 0 0
1 S2 S5 S6 0 0
00 S3 S0 S0 0 0
01 S4 S0 S0 1 0
10 S5 S0 S0 0 0
11 S6 S0 S0 1 0
J.J. Shann 6-111
Next State Output
Input Sequence Present State X=0 X =1 X =0 X=1
Reset S0 S1 S2 0 0
0 S1 S3 S4 0 0
1 S2 S5 S6 0 0
00 S3 S0 S0 0 0
01 S4 S0 S0 1 0
10 S5 S0 S0 0 0
Starting implication chart: 11 S6 S0 S0 1 0
S1
S1-S3 S2 and S4
S2-S4 have different
S1-S5 S3-S5 I/O behavior
S2 S2-S6 S4-S6
S1-S0 S3-S0 S5-S0 ⇓
S3 S2-S0 S4-S0 S6-S0 S1 and S0 cannot
be combined
S4
S1-S0 S3-S0 S5-S0 S0-S0
S5 S2-S0 S4-S0 S6-S0 S0-S0
S0-S0
S6 S0-S0
S0 S1 S2 S3 S4 S5
S1-S3
S1 S2-S4 S1
S1-S5 S3-S5 S3-S5
S2 S2-S6 S4-S6 S2
S4-S6
⇒
S1-S0 S3-S0 S5-S0
S3 S2-S0 S4-S0 S6-S0 S3
S4 S4
S1-S0 S3-S0 S5-S0 S0-S0 S0-S0
S5 S5
S2-S0 S4-S0 S6-S0 S0-S0 S0-S0
S0-S0 S0-S0
S6 S0-S0
S6
S0-S0
S0 S1 S2 S3 S4 S5 S0 S1 S2 S3 S4 S5
No
Noway
wayto
tocombine
combinestates
statesS0
S0and
andS2
S2
based
basedon
onRow
Rowmatching
matchingmethod!
method!
Implication S1
ImplicationChart
Chart
S2 S0 -S2
S1 -S1
S0 is equivalent to S2 S0 S1
since nothing contradicts this assertion!
J.J. Shann 6-115
Multiple Input State Diagram Example
E.g.: Multiple Input State Diagram Example
00 10
S0 00 S1
[1] [0]
11 Present Next State Output
01
11 State 00 01 10 11
10
01 S0 S0 S1 S2 S3 1
S1 S0 S3 S1 S5 0
00 00 S2 S1 S3 S2 S4 1
01 S3 S1 S0 S4 S5 0
S2 01 S3
[1] [0] S4 S0 S1 S2 S5 1
10 10 S5 S1 S4 S0 S5 0
11 11
10 01 10
00 Symbolic State Table
S4 11 S5
00
[1] [0]
01 11
State Diagram
J.J. Shann 6-116
Present Next State Output
State 00 01 10 11
S0 S0 S1 S2 S3 1
S1 S0 S3 S1 S5 0
S2 S1 S3 S2 S4 1
S3 S1 S0 S4 S5 0
S1 S4 S0 S1 S2 S5 1
S5 S1 S4 S0 S5 0
S0-S1
S1-S3 Symbolic State Diagram
S2 S2-S2
S3-S4
S0-S1
S3-S0
S3 S1-S4 Present Next State Output
S5-S5 State 00 01 10 11
S0-S0 S1-S0
S1-S1 S3-S1
S'0 S0' S1 S2 S3' 1
S4 S2-S2 S2-S2 S1 S0' S3' S1 S3' 0
S3-S5 S4-S5 S2 S1 S3' S2 S0' 1
S0-S1 S1-S1 S'3 S1 S'0 S'0 S'3 0
S3-S4 S0-S4
S5 S1-S0 S4-S0 Minimized State Table
S5-S5 S5-S5
S0 S1 S2 S3 S4
Implication Chart
J.J. Shann 6-117
Detailed Algorithm of Imp. Chart Method
1. Construct implication chart, one square for each
combination of states taken two at a time.
2. Square labeled (Si, Sj). If outputs differ then square gets
"×". Otherwise write down implied state pairs for all
input combinations
3. Advance through chart top-to-bottom and left-to-right.
If square (Si, Sj) contains next state pair Sm, Sn and that
pair labels a square already labeled " × ", then (Si, Sj) is
labeled " × ".
4. Continue executing Step 3 until no new squares are
marked with " × ".
5. For each remaining unmarked square (Si, Sj), then Si and
Sj are equivalent. J.J. Shann 6-118
C. State Assignment (補充資料)
Q1 Q 0
Q1 Q 0
S3 Q2 00 01 11 10
Q 00 01
2
11 10
0 S0 S4 S3 0 S0 S1 S3 S2
1 S1 S2 1 S4
S4
State Map
State Map
i. α β
states that share a common next state
i/j i/k
(group 1's in next state map)
Highest Priority
ii.
states that share a common ancestor state
(group 1's in next state map)
α β
Medium Priority
iii. α β
i/j i/j
states that have common output behavior
(group 1's in output map)
Highest Priority
0/0
1/0
A B
0/0
1/0
0/0
1/1 ⇒ (A, B, D) (A, D) (B, C)
D 0/0
C
1/0
J.J. Shann 6-123
Guideline 2: states that share a common ancestor state
(group 1's in next state map)
E.g.:
α β
Medium Priority
0/0
1/0
A B
0/0
1/0
0/0
1/1 ⇒ (A, B) (A, C) (C, D) (A, B)
D 0/0
C ⇒ (A, B)×2; (A, C); (C, D)
1/0
J.J. Shann 6-124
Guideline 3: states that have common output behavior
(group 1's in output map)
α β
i/j i/j E.g.:
Lowest Priority
0/0
1/0
A B
0/0
1/0
0/0
1/1 ⇒ (A, B, C, D) (A, B, C)
D 0/0
C
1/0
J.J. Shann 6-125
E.g.: State table State diagram
0/0
1/0
A B
0/0
1/0
0/0
1/1
Guideline 1: (A, B, D) (A, D) (B, C) D 0/0
C
1/0
Guideline 2: (A, B)×2, (A, C), (C, D)
Guideline 3: (A, B, C, D) (A, B, C)
State Assignment:
State Map: Q0
Q1 0 1 A=
0 B=
C=
1
D=
J.J. Shann 6-126
State Assignment 1: heuristics State Assignment 2: guidelines
A = 00 A = 00
B = 01 A B
B = 01 A B
C = 10 C = 11
D = 11 C D D = 10 D C
00 00 01 00 00 01
01 00 10 01 00 11
10 11 10 11 10 11
11 00 01 10 00 01
J.J. Shann 6-127
Transition Table 1: heuristics Transition Table 2: guidelines
Q1+ Q0+ Q1+ Q0+
Q1Q0 Q1Q0
00 00 01 00 00 01
01 00 10 01 00 11
10 11 10 11 10 11
11 00 01 10 00 01
Q1+ 0 0 0 1 Q1+ 0 0 1 0
0 1 0 1 0 1 1 0
Q0+ 0 0 0 1 Q0+ 0 0 0 0
1 0 1 0 1 1 1 1
0 0 0 0 0 0 0 0
Z Z
0 0 1 0 0 0 0 1
J.J. Shann 6-128
Example: 3-Bit Sequence Detector
α β
Reset i/j i/k
(S3', S4') × 2
S0 Highest Priority
0,1/0
S3′ S4′ α β
' ' i/j i/j
0/0: (S0, S1', S3')
1/0: (S0, S1', S3', S4')
Lowest Priority
0 S0 S’1
Reset
S0 Highest Priority:
0/0 1/0 (S3', S4'), (S7', S10') × 2
S1 S2
1/0
0/0 1/0 0/0 Medium Priority:
(S1, S2), (S3', S4') × 2, (S7', S10')
S3' S4'
1 1
Q1 Q0 Q1 Q0
Q2 00 01 11 10 Q2 00 01 11 10
0 S0 S3' 0 S0 00 = Reset = S0
1 S4' 1 S7' S10'
Adjacent states:
Q1 Q0 Q1 Q0
Q2 00 01 11 10 Q2 00 01 11 10 (S7', S10')
0 S0 S3' S7' 0 S0 S3' (S3', S4'),
1 S4' S10' 1 S7' S4' S10' (S1, S2),
Q1 Q0 Q1 Q0
Q2 00 01 11 10 Q2 00 01 11 10
0 S0 S1 S3' S7' 0 S0 S1 S3'
(b)
(a) J.J. Shann 6-132
Effect of Adjacencies on Next State Map
Q2 Q1 Q2 Q 1 Q2 Q1
Current Next State 00 01 11 10 00 01 11 10 00 01 11 10
State X =0 X=1 Q0 X Q0 X Q0 X
(S0 ) 000 001 101 00 0 0 0 X 00 0 0 0 X 00 1 0 0 X
(S1 ) 001 011 111
(S2 ) 101 111 011 01 1 0 0 X 01 0 0 0 X 01 1 0 0 X
( S'3 ) 011 010 010 11 1 1 11 1 1 11
(S4' ) 111 0 0 1 1 1 0 0 1
010 110
( S7' ) 010 000 000 10 0 0 0 1 10 1 1 1 1 10 1 0 0 1
(S'10) 110 000 000
P2 P1 P0
(p.6-120(a))
Current Q2 Q1 Q2 Q1 Q2 Q1
Next State 00 01 11 10 00 01 11 10 00 01 11 10
State X =0 X=1 Q0 X Q0 X Q0 X
( S0) 000 001 010 00 0 1 0 1 00 0 0 0 0 00 1 0 0 1
( S1) 001 011 100
( S2) 010 100 011 01 0 0 0 1 01 1 1 0 1 01 0 1 0 0
( S3' ) 011 101 101
( S'4 ) 100 101 110 11 1 1 X 0 11 0 0 X 0 11 0 1 X 0
( S7' ) 101 000 000 10 0 10 10
0 1 X 1 0 X 0 1 1 X 0
(S'10) 110 000 000
P2 P1 P0
(Another assignment)
First encoding exhibits a better clustering of 1's in the next state map
J.J. Shann 6-133
Construct the Binary-coded State Table
State assignment
Minimal state table Transition table
(Binary-coded state table)
— Unused states: don’t-care conditions
Eg.:
Transition table
(Binary-coded
state table)
J.J. Shann 6-134
D. Derive Flip-Flop Input Eqs & Output Eqs
E. Circuit
State table:
DA = AB + BX
DB = X
Z = AB X
3 unused states
000
110
111
DA = AX + BX + B C
DB = A C X + A B X
DC = X
− Circuit:
Synthesis
(A ~ F)
¾
Verify
Analysis
(G)
<Ans,>
Understand the problem:
N
Coin Vending Gum
Sensor D Open
Machine Release
Reset FSM Mechanism
Clk
S1 S2
N D
D N
S3 S4 S5 S6
[open] [open] [open]
N D
S7 S8
[open] [open]
N
5
D
N
10
D
N, D
15
[open]
6-16
— 新增一小題,使用JK flip-
flops重做(c)小題。