10 SequentialCircuitDesign
10 SequentialCircuitDesign
Overview
Sequential Circuit Design
Specification Formulation State Assignment Flip-Flop Input and Output Equation Verification
Optimization - Optimize the equations Technology Mapping - Use available flip-flops and gate technology
Examples:
State A represents the fact that a 1 input has occurred among the past inputs. State B represents the fact that a 0 followed by a 1 have occurred as the most recent past two inputs.
Sequential Circuit Design 4
We will develop a procedure specific to sequence recognizers to convert a problem statement into a state diagram
Next, the state diagram, will be converted to a state table from which the circuit will be designed
Sequential Circuit Design 5
Thus, the sequential machine must remember that the first two one's have occurred as it receives another symbol Also, the sequence 1101101 contains 1101 as both an initial subsequence and a final subsequence with some overlap, i. e., 1101101 or 1101101 The 1 in the middle, 1101101, is in both subsequences The sequence 1101 must be recognized each time it occurs in the input sequence
Sequential Circuit Design 7
1/0
State B is the state which represents the fact that the first 1 in the input subsequence has occurred. The output symbol 0 means that the full recognized sequence has not yet occurred
Sequential Circuit Design 8
A 1/0
1/0
1/0 A
1/0
0/0
1/1
Transition arcs are used to denote the output function Output 1 on the arc from D means the sequence is recognized To what state should the arc from state D go? recall 1101101
1/0
0/0
1/1
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: A 1/0 B 1/0
C
1/1
0/0
10
1/0
0/0
1/1
The states have the following meanings:
A: Start state, no sub-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 in 1101 has occurred and thus, the output is 1
Sequential Circuit Design 11
Answer:
0 arc from state A 0 arc from state B 1 arc from state C 0 arc from state D
1/1
12
0/0
The 1 arc from state C to itself implies that State C means two or more 1's have occurred.
Sequential Circuit Design 13
1/0
1/0
C
1/1
0/0
Present State A B C D
14
1/0
0/0
Present State A B C D
State Assignment
Each state must be assigned a unique code Minimum number of bits required for m states in the state diagram is n such that n log2 m , where x is the smallest integer x
There are useful state assignments that use more than the minimum number of bits
If n bits are used, there are 2n m unused states
16
19
D1
0 1
Y1Y2
D2
0 1
Z
Y1Y2 X
0 1
00 01 11 10
00 01 11 10
0 0 0 1 0 0 1 1
00 01 11 10
0 1 0 0 0 1 1 0
0 0 0 0 0 1 0 0
20
D2
0 0 0 1 Y2 0 0 Y1 1 1
0 1 0 0 0 0 Y2 0 1 0 Y1 Y1 1 0 0
0 0 Y2 1 0
D2
0 0 0 1 Y2 1 1 Y1 0 0
0 0 1 0 0 1 Y2 0 0 1 Y1 Y1 0 0 1
0 0 Y2 0 1
23
D2
0 0 0 1 Y2 1 1 Y1 0 0
0 0 1 0 0 1 Y2 0 0 1 Y1 Y1 0 0 1
0 0 Y2 0 1
D1 = Y1Y2 + XY2 Gate Input Cost = 9 D2 = X Select this state assignment to Z = XY1Y2 complete the design
Sequential Circuit Design 24
Map to Technology
Library: D-type Flip-Flops with Reset input
Reset input is used to reset to start state: Y1 Y2 = 00
D1 D C R Z D2 Y2 Y2 Y1
X Clock Reset
D C R
25
D1
Y1 D
C R Z D2 Y2
D Y2
Clock Reset
C R
26
SR Flip-Flop
Characteristic Table
S R Q(t +1) Operation 0 0 0 1 1 0 1 1 Q(t) 0 1 ? No change Reset Set Undefined
Excitation Table
Q(t) Q(t+ 1) S R Operation 0 0 1 1 0 1 0 1 0 X No change 1 0 Set 0 1 Reset X 0 No change
S C R
28
JK Flip-Flop
Characteristic Table
J K Q(t+1) Operation
0 0 1 1
0 1 0 1
Q(t) 0 1 Q(t)
Symbol
Excitation Table
Q(t) 0 0 1 1 Q(t +1) J K Operation 0 1 0 1 0 1 X X X X 1 0 No change Set Reset No Change
J C K
29
T Flip-Flop
Characteristic Table
T Q(t+1) 0 1 Q(t) Q(t) Operation No change Complement
T C
Q(t +1)
0 1 0 1
T
0 1 1 0
Operation
No change Complement Complement No Change
30
0 0 1
1 0 1
X1 X0 X1 X0 0X 1X
0 0 0
0 0 1
Sequential Circuit Design 31
J
Y1Y2 x
0 1
K
Y1Y2 x
0 1 00 01
00 01
11
10
0 0 0 1 0 0 1 1
00 01
11
10
0 1 X X X X 0 1
11
10
X X 1 0 1 0 X X
Circuit Implementation
Reset input is used to reset Y1Y2 to 00 (start state)
Y1 Y C R
1
Z Y2
X X Clock Reset
J K C R
Y2
33
One-Hot Assignment
Use one flip-flop per state: m states m flip-flops
Y3Y2Y1Y0 = 0001 (state A), 0010 (B), 0100 (C), 1000 (D)
Flip-flop cost is higher but combinational logic might be simpler Provides simplified analysis and design
In equations, need to include only the variable that is 1 for the state, e. g., state with code 0001, is represented in equations by Y0 instead of Y3 Y2 Y1 Y0 because if Y0 is 1 then the remaining state variables will be 0
34
35
Current State
Memory Elements
Next State
Current State
Next State
Output Z
Sequential Circuit Design 38
The Moore model for a sequence recognizer usually has more states than the Mealy model
39
C/0
1
D/0
Arcs now show state transitions and input only Add a new state E to produce the output 1
Note that the new state E produces the same behavior as state B, but gives a different output: 1 rather than 0
Sequential Circuit Design 40
1 0
C/0 1 D/0
41
Next State
x=0 00001 00001 01000 00001 00001 x=1 00010 00100 00100 10000 00100
Output
Z 0 0 0 0 1
42
Circuit Implementation
D0 D S Clock Q Q Y0 Y0 R D1 D Q Q Y1
X X D2 Y2 Y2 D3 Y3 Y3 D4
D R
Q Q
D R
Q
Q
D R
Q Q
Y4
Reset
44
Verification
Sequential circuits should be verified by showing that the circuit produces the original state diagram Verification can be done manually, or with the help of a simulation program All possible input combinations are applied at each state and the state variables and outputs are observed A reset input is used to reset the circuit to its initial state Apply a sequence of inputs to test all the state-input combinations, i.e., all transitions in the state diagram Observe the output and the next state that appears after each clock edge in the timing diagram
Sequential Circuit Design 45
0
2,4,12 5,13
1 C 0 0
7,10,14
reset
A 0
1
0
3
B 0
D 0
16
1
8,15
E 1
11
0 0
Sequential Circuit Design 46
Y0
Y1 Y2 Y3 Y4 Output Z
B
C C D E 1 C D
B
C D E 1
47
1/0
0/0
1/0
0/0
1
0 reset A 0
1
0
B 0
1
0
C 0
1 0
D 1
49
Output
0 0 0 0 0 1
x=0
00 00 00
x=0
00 00 00 00
x=1
01 11 10 10
Z
0 0 0 1
D1 = X Y0 D0 = X Z = X Y1
D1 = X (Y0 + Y1) D0 = X Y1 Z = Y1 Y0
Sequential Circuit Design 50
Timing Diagrams
Clock Reset X A = 00 Y1 1 B = 01 1 C = 11 0 A = 00 1 B = 01 1 C = 11 1 C = 11 1 C = 11
Mealy
Y0 Z False Output
A = 00
Y1
B = 01
C = 11
A = 00
B = 01
C = 11
D = 10
D = 10
Moore
Y0 Z
Sequential Circuit Design 51