Professional Documents
Culture Documents
Analysis and Design of Sequential Logic Circuits
Analysis and Design of Sequential Logic Circuits
Poras T. Balsara & Dinesh K. Bhatia Center for Integrated Circuits and Systems Department of Electrical Engineering University of Texas at Dallas
Introduction
Inputs
Next State
Outputs
Memory
Present State
Introduction
Next State
Outputs
Memory
Present State
Introduction
3.
Logic Equations: Determine the flip-flop excitation and sequential circuit output logic equations. State Table: State table is a tabular representation of the behavior of a sequential logic circuit. For a given input and present state of a circuit, it gives the output and the next state of the circuit. It is created using the characteristic table for the appropriate flip-flop. State Diagram: State diagram is a graphical depiction of a sequential logic circuit. Circles in this diagram depict the states and directed arcs depict the transitions. Ij /Oj Ik /Ok
Mealy Model
Sj
Sk
Ij
Sj /Oj
Ik
Sk /Ok
Moore Model
Introduction 5
a
0/0
b
1/0
0/1
Present State a b c
Input (x ) 0 0 0 1 1 1
Present State a b c a b c
Next State a a c b c b
Output (z) 0 0 1 0 0 0
Introduction
State Encoding
Assigning binary labels to states. Example:
1/0 0/0 1/0
a
0/0
b
1/0
0/1
b =10
00 0/1
c = 00
Example:
1.
Determine the flip-flop excitation and sequential circuit output logic equations.
D0 = Q0 D1 = Q1 Q0 + Q1 Q0
(there are no explicit outputs in the above circuit)
ptb/dkb (March 20, 2006) Introduction 8
2.
CLK
Q* 0 1
0 1
Input (none )
Present State
Flip-flop Inputs
Next State
Q1 0 0 1 1
Q0 0 1 0 1
D1 0 1 1 0
D0 1 0 1 0
Q1* Q0* 0 1 1 0 1 0 1 0
Output (none)
D0 = Q0 D1 = Q1 Q0 + Q1 Q0
3. State Diagram:
00 01
11
ptb/dkb (March 20, 2006)
10
Introduction
Example:
1.
D0 = Q 2 Q 0 ; X = Q 2 Q1 Q 0
D1 = Q1 Q0 + Q1 Q0 ;
D2 = Q1Q0 ;
Introduction
10
2.
State table:
D0 = Q2 Q0 ; X = Q2 Q1 Q0
Present State Input (none ) Q2 Q1 Q0 Flip-flop Inputs Next State Output
D1 = Q1 Q0 + Q1 Q0 ;
D2 = Q1 Q0 ;
D2 0 0 0 1 0 0 0 1
D1 0 1 1 0 0 1 1 0
D0 1 0 1 0 0 0 0 0
Q2* 0 0 0 1 0 0 0 1
Q1* 0 1 1 0 0 1 1 0
Q0* 1 0 1 0 0 0 0 0
X 1 0 0 0 0 0 0 0
0 0 0 0 1 1 1 1
0 0 1 1 0 0 1 1
0 1 0 1 0 1 0 1
Introduction
11
3.
State diagram:
000 0/1
Present state Flip-flop input Next state (none) Q2 Q1 Q0 D2 D1 D0 Q2* Q1* Q0*
in
out X
0 0 0 0 1 1 1 1
0 0 0 1 1 0 1 1 0 0 0 1 1 0 1 1
0 0 0 1 0 1 1 0 0 0 0 1 0 1 1 0
1 0 1 0 0 0 0 0
0 0 0 1 0 0 0 1
0 1 1 0 0 1 1 0
1 0 1 0 0 0 0 0
1 0 0 0 0 0 0 0
101 5/0 010 2/0 001 1/0 100 4/0 111
7/0
3/0 011
6/0 110
Introduction
12
Example:
1.
J 0 = Q1 X ; J1 = X ;
K 0 = Q1 X ; K 1 = X Q0 = XQ0 + X Q0
Introduction 13
2.
State table:
3.
State Diagram:
J 0 = Q1 X ; J1 = X ;
Input X 0 0 0 0 1 1 1 1 Present State Q1 0 0 1 1 0 0 1 1 Q0 0 1 0 1 0 1 0 1
K 0 = Q1 X ; K 1 = X Q0 = XQ0 + X Q0
Flip-flop Inputs Next State Q0* 0 1 1 1 0 1 0 0 0/11 1/1/10 1/0 0 0 1 1 1 1 0 Out
(none)
0/00 1/01
0/-
J1 K1 J0 K0 Q1* 0 0 0 0 1 1 1 1 1 0 1 0 0 1 0 1 0 0 1 1 0 0 0 0 0 0 0 0 0 0 1 1
0/-
Introduction
14
Present State
Next State
Q1* Q0*
x=1 10 11 10 00 x=0 00 01 01 11
Q1 Q0
00 01 10 11
Introduction
15
4. 5.
Construct a state diagram Choose a set of state variables and assign state-variable combinations to the named states in the state diagram. Construct the excitation table: For a given transition from a present state to its next state, this table indicates the inputs that must be applied to the flip-flops. Derive the boolean equations for flip-flop excitation and the explicit outputs. Draw a logic diagram to implement the above equations using logic gates and flip-flops.
Introduction
16
Q 0 0 1 1
Excitation table for JK flip-flop:
Q* 0 1 0 1
D 0 1 0 1
T 0 1 1 0 J 0 1 X X K X X 1 0
17
Q 0 0 1 1
ptb/dkb (March 20, 2006)
Q* 0 1 0 1
Introduction
J 0 1 0 or 1 0 or 1
K 0 or 1 0 or 1 1 0
Example:
Design a 2-bit binary counter using D flip-flops.
State diagram:
00
01
11
10
Introduction
18
Excitation table:
Input (none )
Present State
Next State
Flip-flop Inputs
Q1 0 0 1 1
Q0 0 1 0 1
Q1* 0 1 1 0
Q0* 1 0 1 0
D1 0 1 1 0
D0 1 0 1 0
Output (none)
Introduction
19
Circuit implementation:
Introduction
20
Present State
Next State
Q1 Q0
00 01 10
Q1* Q0*
x=1 01 01 01 x=0 00 10 00 0 0 1
Introduction
21
Example:
A sequential circuit has one input and one output. When input sequence 110 occurs the output becomes 1 and remains 1 until the sequence 110 occurs again in which case the output returns to 0. The output remains 0 until 110 occurs a third time, etc.
State Diagram: State Encoding:
b
0/0 0/0 1/0
000 001
6 states 1/0
010
3-bit encoding
c
0/1
1/0
b c
0/0 1/1
d 011
0/1
101
011
d
0/1
e f
1/1
100
1/1
e
ptb/dkb (March 20, 2006)
3-bit encoding
Introduction
Present State Q2 0 0 0 0 0 0 0 0 1 1 1 1 Q1 0 0 0 0 1 1 1 1 0 0 0 0 Q0 0 0 1 1 0 0 1 1 0 0 1 1 0 0 0 0 0 0 0 1 0 1 0 1
Flip-flop Inputs D2 0 0 0 0 0 0 0 1 0 1 0 1 D1 0 0 0 1 1 1 1 0 1 0 0 0 D0 0 1 0 0 1 0 1 0 1 1 0 1
Output (S) 0 0 0 0 1 0 1 1 1 1 0 1
b
001 1/0 1/0 010 c 1/0 0/1 011 d 1/1 0/1 0/1
0 1 0 1 0 1 0 1 0 1
000
0/0 1/1
Introduction
23
Circuit Implementation
Introduction
25
1.
Design a Gray code counter using JK flip-flops. Design a 3 bit up/down counter using T flip-flops. The count direction is determined by input D (D=0 means count down).
2.
Introduction
26
Example:
Design a sequential comparator circuit that is to determine which of the two multi-bit numbers, A and B, of equal length is larger. Inputs are supplied in MSB first fashion.
10/10
10
X X /10
00,11/00
00
01/01
01
X X /01
Introduction
27
Example:
Design a sequential circuit that produces 1 on its output if it detects the sequence 101 on its input. The detector should keep checking for the appropriate sequence and should not reset to the initial state after it has recognized the sequence.
Mealy Implementation (using D flip-flops)
P.S. Q1Q0 s0 (00) s1 (01) s2 (10) P.S. Q1Q0 s0 (00) s1 (01) s2 (10) s3 (11)
ptb/dkb (March 20, 2006)
N.S. (Q1*Q0*) x=0 s0 (00) s2 (10) s0 (00) x=1 s1 (01) s1 (01) s1 (01)
D1 = x Q0 D0 = x z = x Q1
D1 = x Q0 + x Q1 Q0 D0 = x z = Q1 Q0
Introduction
s0
s1
s2
s1
s1
s2
s1
s1
s2
s0
Moore
s0
s1
s2
s3
s1
s2
s3
s1
s2
s0
Mealy outputs may change when an input changes (i.e., not necessarily on a clock edge). output may have glitches. This problem can be solved by making Mealy inputs synchronous. Moore outputs only change on clock edges since they depend only on the present state. Moore outputs may be delayed w.r.t. the corresponding outputs in a Mealy implementation.
Introduction
29
0 1
Using D flip-flops
Using T flip-flops
D0 = x Q0 z = Q0
T0 = x z = Q0
Introduction
30
Introduction
31
A
0000
XXX0 1XXX X1XX XX1X 0001
B
1000
1XXX
0XXX
E
0001
01XX
X0XX 1XXX
001X
0001
C
0100
01XX
D
0010
001X
Introduction
32
Modulus
Calculate remainder
Binary Modulus
Take one bit at a time (MSB first) Calculate remainder m
Three possible values 0,1,2
m = m' mod 3
ptb/dkb (March 20, 2006) Introduction 34
0
1
1
0
Present Modulus 00 01 10
ptb/dkb (March 20, 2006)
Next x=0 00 10 01
Introduction
x=1 01 00 10
35
Q1 0 0 1 0 0 1
Q0 0 1 0 0 1 0
Q1* 0 1 0 0 0 1
Q0* 0 0 1 1 0 0
T1 0 1 1 0 0 0
T0 0 1 1 1 1 0
T1 = x(Q1 + Qo ) T0 = ( x Q1 ) + Qo
ptb/dkb (March 20, 2006) Introduction 36
Minimal Cost: This approach assumes that the machine will never enter an unused state. Therefore, next state entries of unused states can be marked as dont-cares. In most cases, this simplifies the excitation logic. Minimal Risk: This approach assumes that it is possible for the machine somehow to get into one of the unused (illegal) states. Therefore, all unused states should have explicit next state entries for any input combination so that they always reach some other safe state.
Introduction 37
2.
Introduction
38
Timing Parameters
Global setup time (Tsu) Global hold time (Th) Maximum clock frequency Clock skew.
These parameters are derived using the circuit (known) delays described below.
tio delay from input of IFL to output of OFL tif delay from circuit inputs of flip-flop inputs tfo delay from flip-flop outputs to circuit outputs tff delay from flip-flop outputs to flip-flop inputs tc-q clock to Q propagation delay of flip-flops tsu setup time of flip-flops th hold time of flip-flops tc clock delay; time required for clock to reach all flip-flops
ptb/dkb (March 20, 2006) Introduction 39
D (at FF input)
Clock Frequency
The limiting factor on the clocking rate is the propagation delay through the IFL block:
Changes on the Qs must propagate through the IFL before they can affect the next state
ptb/dkb (March 20, 2006) Introduction 41
Clock Frequency
The limiting factor on the clocking rate is the propagation delay through the combinational logic block (input forming logic):
Dj Qj
Comb. logic
CKj
Di
CKi CLK tff
Qi
Changes on the Qs must propagate through the combinational logic before they can affect the next state
Introduction
42
tC-Q
Dj
tff
tsu
Tck (=Tclk)
Edge Triggering
f clk
ptb/dkb (March 20, 2006) Introduction
1 Tclk
43
CKi Qi
Comb. logic
CKj
Di
CKi
Qi
tC-Q
Dj
tff
tsu
CLK
tff
Tck (=Tclk)
Edge Triggering
f clk
ptb/dkb (March 20, 2006) Introduction
1 Tclk
44
Timing Violations
Tclk tC Qmax + t ffmax + tsumax
The clock period (Tclk) has a lower bound of tff.max . If the clock period is equal to (tff.max + tC-Q.max) then the flip-flop state changes can violate setup times. Remedy :
Use faster flip-flops (decrease tC-Q ) Use faster gates (decrease tff ) Use a slower clock (increase clock period, Tclk)
ptb/dkb (March 20, 2006) Introduction 45
Clock Skew
The previous discussion assumes that clock signals arrive at all flip-flops simultaneously - this is not a good assumption since it is not true in practice. Because of different wire lengths over which the clock signals travel and the load at the destination, there is a slight difference in clock arrival times at different flip-flop inputs. Clock skew, tskew, is the difference in time between triggering edges seen at different flip-flops. Clock skew affects minimum Tclk.
ptb/dkb (March 20, 2006) Introduction 46
Di
Tck (=Tclk)
CKi CKj
Comb. logic
CKj
Di
CKi
Qi
tskew
Qj
CLK
tff
Di
Tck (=Tclk)
CKi CKj
tskew tC-Q th
Comb. logic
CKj
Di
CKi
Qi
tskew
Qi
tff
Dj
state of Dj before clock becomes active
CLK
tff
tC Q + t ff tskew + th
state of Dj after clock becomes active
For a D flip-flop use: tsu = 2ns, th = 15ns and tC-Q = 20ns For a NAND gate use: tp,max = 10ns and tp,min = 3ns
ptb/dkb (March 20, 2006) Introduction 50
tif ,max = 3t p ,max,nand = 30ns tif ,min = 2t p ,min,nand = 6ns t ff ,max = 2t p ,max,nand = 20ns t ff ,min = 2t p ,min,nand = 6ns tc ,max = 2t p ,max,nand = 20ns tc ,min = 2t p ,min,nand = 6ns
For a D flip-flop use: tsu = 2ns, th = 15ns, tC-Q = 20ns For a NAND gate use: tp,max = 10ns, tp,min = 3ns
Tsu = tsu ,max + tif ,max tc ,min = 2 + 30 6 = 26ns Th = th ,max tif ,min + tc ,max = 20 + 15 6 = 29ns Tclk tC Q ,max + t ff ,max + tsu ,max = 20 + 20 + 2 = 42ns f clk ,max = 1/ 42ns = 23.8MHz tskew,max = tC Q ,min + t ff ,min th ,max = 20 + 6 15 = 11ns
Why is clock skew irrelevant in this example?
ptb/dkb (March 20, 2006) Introduction 51
Latch must be open for less than the shortest combinational logic delay but more than the worst setup time.
and
( (t
t w > t sumax or
+ tlmin tw th max
Introduction
52
Comb. logic
CKj
Di
CKi
CLK
tff
Use narrow-width clock whose pulse width is less than the fastest possible path through the combinational logic. To guarantee correct next state, make sure that the clock period is longer than the worst-case propagation delay through the combinational logic.
ptb/dkb (March 20, 2006) Introduction 53
tsu tw tskew
Comb. logic
CKj
tD-Q
Di
CKi
Qi
tskew
Qi
tff th
CLK
tff
Dj
Comb. logic
CKj
Di
CKi
Qi
CLK
tff
Qj
Di
tcycle t1 tsumin + td q max + tl 1max + tsumax + t 21 For block CL2 : tcycle t 2 t sumin + td q max + tl 2max + tsumax + t12 tskewmin For latching: t1 > tsumax and t 2 > t sumax
ptb/dkb (March 20, 2006) Introduction 56
( (
Comb. logic
tff
D2
Q2
Comb. logic 1
tff1
D2
Q2
Comb. logic 2
CLK2 tff2
CLK1
t12
CLK1
t21
CLK1
CLK2
CLK2
non-overlap periods
Introduction 57
t21
t12
D1
Q1
Comb. logic
tff
D2
Q2
CLK2
D1
tD-Q1
CLK1
CLK2
Q1
tff tsu2
D2
Tclk1 > ( tw1 tsu1min ) +tDQ1max + t ffmax +tsu2max + t21 Tclk 2 > ( tw2 tsu 2min ) + tDQ2max + tsu1max + t12
tD-Q2
tsu1
Q2
Tclk1 Tclk2
ptb/dkb (March 20, 2006) Introduction 58
Counters
Counters are sequential circuits that go through a prescribed sequence of states upon the application of input pulses, i.e. they are sequence generators. Sequence of counter states may follow a binary count or any other sequence of states. Binary Counter: It follows the binary counting sequence, An n-bit binary counter has n flip-flops and can count in binary from 0 to (2n 1).
00 01 00 01
11
10
11
10
Up Counter
ptb/dkb (March 20, 2006) Introduction
Down Counter
59
Divide-by-n Counter
It is a binary counter with n states. It resets to state 0 after going through n states.
00
01
10 Divide-by-3 Counter
Introduction
60
Ripple Counters
Each bit toggles if and only if the immediately preceding bit changes from 1 to 0. Q0 Q1 Q3 Q2
Q Q CLK T
Q Q CLK
Q Q CLK
Q Q CLK
CLK
CLK
Q0 Q1 Q2 Q3
ptb/dkb (March 20, 2006) Introduction
A bit change from 1 to 0 generates a carry to the next most significant bit => ripple Slower than other counters when MSB has to change, the output is not valid until time n.tclkQ for an n-bit counter. Requires fewer components.
61
D0 = Q0 D1 = Q1 Q 0 D 2 = Q 2 Q1Q 0 D 3 = Q 3 Q 2Q1Q 0
high fan-in gates Serial (cascaded) implementation low fan-in gates, but longer clock period
Introduction 62
Introduction
63
Introduction
64
Introduction
65
CLK D3 D2 D1 D0 LD EN CLR Q0 0 1 0
CLK
Q0 Q1 Q2 Q3
Q3
Q2
Q1
RCO
Introduction
66
D3 D2 D1 D0 LD EN CLR
Q0
0 1
CLK
CLK LD
Q1
Q0 Q1 Q2
1 1 0
Q3
Q2
Q3
This counter is self-starting. Resetting clears the counter to 0000. Although it starts off in an invalid state, it reaches the desired sequence within 6 clock cycles.
ptb/dkb (March 20, 2006) Introduction 67
D3 D2 D1 D0 LD EN CLR
CLK
1 0
Q0
CLK CLR
Q1
Q0 Q1 Q2 Q3
Q3
Q2
Introduction
68
Q6
3 4
Q5
5 6
Q4
7 8 9
10 11 12 13 14 15 16 17 18
CLK Q0 Q1 Q2 Q3 RCO Q4 Q7
Introduction
69
Ring Counter
It is a circulating bit counter. It counts by shifting 1 through a counter. This family of counters is also referred to as Shifting Counters.
It requires n bits of memory to encode n states. However the states are directly usable, e.g., in state i, the ith bit is 1, others are 0. Binary counters are more efficient since n states can be represented by log2n bit binary representation of i. Where can you use ring counters?
ptb/dkb (March 20, 2006) Introduction 70
A start pulse sets a 1 in flip-flop n and 0 in all others. On subsequent clock pulses the 1 in bit 1 shifts right.
Introduction
71
In this basic design if the counter gets caught in an invalid state, it will never be able to come to a valid state on its own.
ptb/dkb (March 20, 2006) Introduction 72
The feedback mechanism for an n-bit counter ensures return to the valid states within a maximum of (n-1) clock cycles.
ptb/dkb (March 20, 2006) Introduction 73
Note: Preset and clear on flip-flops are no longer required if time is available for the counter to self-correct. Hence, it is also a Self-starting counter. State diagram of a self-starting, self-correcting 4-bit ring counter:
Introduction
74
Johnson Counter
This is another shifting counter. It is a compromise between binary and ring counter since it encodes 2n states in n bits. The counter is first initialized to all 0s. Then each next state is formed by shifting in 1s until all bits are 1, after which 0s are shifted until all bits are 0.
Shifting counters can get into unused state and will persist in moving from one invalid state to another and never find its way to a valid state. Proper design can prevent this from happening.
Introduction 75
Excitation table
Next State Q2* Q1* 0 1 1 1 0 0 Q0* 0 0 1 1 1 0 J2 1 X X X 0 0 Flip-flop Inputs K2 X 0 0 1 X X J1 0 1 X X X 0 K1 X X 0 0 1 X J0 0 0 1 X X X K0 X X X 0 0 1
76
Introduction
Logic equations:
J 2 = Q0 K 2 = Q0
J1 = Q2 K1 = Q2
J 0 = Q1 K 0 = Q1
Circuit implementation:
It needs self-correcting logic to correct itself whenever it gets into an invalid state.
ptb/dkb (March 20, 2006) Introduction 77
Modify the circuit so that 0s are forced in until the counter gets to the all 0s state and then force 1 to ensure contiguous 1s and 0s.
Introduction
78
101
010
001 011
111
Introduction
79
Sequence Detectors
Sequence detectors are sequential networks used to detect if a given sequence of events have occurred on its input(s). These circuits form a necessary component in a number of applications, e.g., vending machines, telecommunication equipment, slot machines, etc. Two modes of operation:
Verify Mode: Start in a reset state and look for the given sequence. As soon as an input not in the sequence occurs assert a failure signal and wait for a signal to reset and begin again. Hunt Mode: Detector continuously looks for the specified sequence, when the sequence is found, success is indicated.
Introduction
80
In the above state diagram note that reset input is not shown on all transitions (it is a dont care), and outputs indicated by - imply found=failed=0
ptb/dkb (March 20, 2006) Introduction 81
Note: In hunt mode, to detect a sequence of length n we need states to remember last n-1 inputs.
ptb/dkb (March 20, 2006) Introduction 82
1234
Texas
LC LB LA
ptb/dkb (March 20, 2006)
RA RB RC
Introduction 83
XX1 100
101
R2
000 110
XX0
XXX 000
Introduction
XXX
L3 111 000
ptb/dkb (March 20, 2006)
R3 000 111
Introduction
85
86
Exam 2
Has been graded and recorded.
scores to be released today. PLEASE pick your paper after 1PM from either,
my office, or, if I am not around, my secretary Ms. Hines.
Introduction
87
State Minimization
To reduce the cost of sequential machines, it is necessary to eliminate redundant (equivalent) states. State minimization is the removal of redundant states. Two states are said to be equivalent if for each member of the set of inputs, they:
1. 2.
give exactly the same output, and send the circuit either to the same state or to an equivalent state.
Introduction
88
Example
Consider the following state diagram for state minimization
Introduction
89
1. Check for equivalent states. 2. States 4 and 6 are equivalent 3. Go to step 1. and check again.
Note: states 2 and 4 are not equivalent since the outputs are different.
ptb/dkb (March 20, 2006) Introduction 90
Implication Table
If there are 2m states in a sequential machine we need m flip-flops Reduction in the number of states may or may not result in a reduction in the of flip-flops. Determination of equivalent states can be done using a tool called Implication Table. It is a more general technique compared to State Reduction by Inspection discussed earlier.
Introduction
92
Using a table of present states, next states and outputs, construct an implication table as follows:
Each state is associated with a column and a row, i.e., list all states except the first in rows and all except the last in columns. Each cell in this table corresponding to the intersection of a row and column represents two states being tested for equivalence.
2.
3.
4.
Based on condition 1 for equivalent states place a cross in the cells corresponding to those state pairs whose outputs are not equal for every input. In each remaining cell, place the pairs of next states whose equivalence is implied by the two states corresponding to the cell, i.e., states in each state pair must be equivalent in order for the states labeling the row and column to be equivalent. Make successive passes through the entire table to determine if any more cells should be crossed off. Repeat this procedure until no additional cells can be crossed off.
Introduction 93
Example:
Reduce the following state machine using an implication table.
Introduction
94
Implication Table
AH DG
D-F
Introduction
95
Reduce the state diagram removing equivalent states (AH and DG).
Example
Reduce the following state machine using an implication table.
Present State A B C D E F G H Next State x=1 C H D E A B H G x=0 D F E A C F B C Out 0 0 1 0 1 1 0 1
Introduction
97
Implication Table:
Present State A B C D E F G H
Out 0 0 1 0 1 1 0 1
AD CE
Introduction
98
Present State A B C D E F G H
Out 0 0 1 0 1 1 0 1
Present State A B C F G H
Out 0 0 1 1 0 1
Introduction
99
State Assignment
State Assignment is a binary encoding used to represent states of a sequential machine in its digital circuit implementation. In our designs so far we have assumed some state assignment without considering any alternatives. Two different assignments may result in vast differences in hardware. Appropriate choice of state assignment may result in lower cost and improved performance.
ptb/dkb (March 20, 2006) Introduction 100
Present State A B C D E F G
x=0
B/0 C/0 D/0 A/1 G/0 A/0 F/0
x=1
E/0 G/0 F/0 A/0 C/0 A/1 D/0
Introduction
101
J 1 = q2 x + q 3 x J 2 = q3 J 3 = q2 z = q1 q2 q3 x + q1 q3 x
K 1 = q3 + x K 2 = q3 K 3 = q2
J 1 = q 3 x + q2 x J 2 = q1 q3 + q1 q3 J 3 = q2 + q1 x z = q1 q3 x + q2 q3 x
K 1 = q3 + x K 2 = q3 + q1 x + q1 x K 3 =1
2 n 1 < s 2 n
Number of ways to select s combinations out of 2n combinations is,
C 2 n ,s
2n 2n ! = s = s! ( 2 n s )!
For each of these combinations, there are s! permutations for assigning s elements (binary encodings) to s states, making the Total number of possible assignments =
ptb/dkb (March 20, 2006) Introduction
2 n ! s! s! ( 2 s )!
n
2n ! ( 2 n s )!
103
s
2 3 6 8 12 16
n
1 2 3 3 4 4
# Assignments
2 24 20,160 40,320 871,782,912,0000 209,227,898,880,00
Introduction
104
Introduction
105
Minimum-Bit-Change Heuristic:
Minimize the number of bit changes for all state transitions.
Write down all sets of states which should be given adjacent assignments.
i/j
i/k
i/j
i/j
Lowest Priority
Highest Priority
Medium Priority
2.
3.
4.
Compare the adjacencies of states for different assignments by plotting the states on state assignment K-maps with each cell representing the state variable combination assigned to one state of the circuit. If all adjacencies suggested by the top two priorities are not satisfied due to some conflicting requirements, then resolve them in favor of conditions from highest priority and the adjacency conditions which are required two or more times. When guidelines require that 3 or 4 states be adjacent, these states should be placed within a group of 4 adjacent cells on the assignment K-map.
Introduction
107
Example:
Consider the following state machine having 4 states
Present State A B C D Next State / Out x=1 D/0 A/0 D/0 B/1 x=0 C/0 C/0 B/0 A/1
Adjacencies from medium priority guideline: for state A: {C, D} for state B: {A, C} for state C: {B, D} for state D: {A, B}
Adjacencies from highest priority guideline: for x=0: {A, B} for x=1: {A, C}
Adjacencies from lowest priority guideline: for 0/0: {A, B, C} for 1/0: {A, B, C}
ptb/dkb (March 20, 2006) Introduction 108
Compare the adjacencies of states for the different assignments by plotting the states on state (assignment) maps. In general it is a good
idea to assign the reset state (state A in this example) to state map cell 0).
Adjacencies: {A,B}; {A,C} {C,D}; {A,C}; {B,D}; {A,B} {A,B,C}; {A,B,C}
It can be seen that assignment 3 fulfills most of the adjacencies and hence should produce the best results for this example. The state encoding (q1 q2) is A:00 C:10 B:01 D:11
ptb/dkb (March 20, 2006) Introduction 109
Example:
Encode the states using the state assignment guidelines for the sequential circuit described by the following state machine
A Adjacencies from highest priority guideline: for x=0: {D, E}; {F, G} for x=1: {F, G} C 0/0 0/0 E 1/0 0/1 G 1/0 Adjacencies from medium priority guideline: for state A: {B, C} for states B and C: {D, E} 2x for state E: {F, G} (note: 2x next to an adjacency => it exists twice on the list)
1/0 1/0
Adjacencies from lowest priority guideline: for 0/0: {A, B, C, D, E, F} for 1/0: {A, B, C, D, E, F, G}
Introduction
110
q2q3 q1 00 0 1 A
01 B C
11 D E
10 F G
q2q3 q1 00 0 1 A F
01 B C
11 D E
10
Both assignments satisfy all of the high- and medium-priority guidelines, as well as most of the lowest-priority ones.
Introduction
111
Example:
Find a state assignment for the sequential machine described below:
Adjacencies from highest priority guideline: for x=0: {A, C, E, G}; {D, F} for x=1: {A, B, D, F}; {E, G} Adjacencies from medium priority guideline: for state A: {B, C} for state B: {C, D} for state C: {B, E} for states D and F: {C, F} 2x for states E and G: {B, G} 2x (note: 2x next to an adjacency => it exists twice on the list) Adjacencies from lowest priority guideline: for 0/0: {A, B, C, D, E, G} for 1/0: {A, B, C, D, E, F}
Introduction 112
Present State A B C D E F G
Next State / Output x=1 C/0 C/0 E/0 C/0 G/0 C/0 G/1 x=0 B/0 D/0 B/0 F/0 B/0 F/1 B/0
Assignment I
Assignment II
These assignments were done by first satisfying the guideline for 3 or 4 adjacent states and then conditions which are required two or more times. Based on the assignment I we get the following state encodings,
A:000, B:110, C:001, D:111 E:011, F:101, G:010
Introduction
113
x=0
B/0 D/0 E/0 F/0 F/0 A/0 A/1
x=1
C/0 E/0 D/0 F/0 G/0 A/0 A/0
D5 = q1 x D6 = q7 x D7 = q5 x + q2 x z = q6 x
115