


















Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!



















1
Department of Electrical and Computer Engineering
University of Illinois, Chicago
Phone: (312) 355-1314: e-mail: [email protected]
URL: http://www.eecs.uic.edu/~dutt
2
- FSMs are different from counters in the sense that they have external I/Ps,
and state transitions are dependent on these I/Ps and the current state.
- Example : Problem Statement
There is a bit-serial I/P line. Design an FSM that outputs a ‘0’
if an even # of 1’s have been received on the I/P line and the
outputs a ‘1’ otherwise.
combinational ckt?
past inputs in order to solve the problem
Note : If a +ve edge triggerred synchronous sequential circuit is being designed,
the counting of the # of 1s (i.e., the sampling of the
input(s), for a general FSM) occurs T log
ff
su
time
before every +ve edge.
CLK
CLK
Tlog
+Tff
+T su
T log
= comb. logic delay
T ff
= FF delay
Tsu = FF setup time
4
Determining a Reset State:
reset state. E.g., in the parity detector problem, the even state qualifies to be the reset
state, as in the reset state no i/ps recvd zero 1’s recvd even # of 1’s recvd it can
be the even state
this state to the other states (depending on the problem solved by the FSM).
Solution 1: (Mealy)
Even
Odd
0/
Reset
Even
Reset
[0]
Odd
[1]
Output
Input
Output
Input
Transition
Arc
Output is
dependent only
on current state
O/P is dependent
on current state and
input in Mealy
Solution 2: (Moore)
Mealy Machine: Output is associated
with the state transition, and appears
before the state transition is completed
(by the next clock pulse).
Moore Machine: Output is associated
with the state and hence appears
after the state transition take place.
5
FFs
External I/Ps External O/Ps
m 1
m 2
n n
Comb.
Logic
CLK
FFs
n
CLK
n
Output
Logic
m 2
Next State
Comb.
Logic
m 1
External
I/Ps
External Outputs
even
odd
Time t : Even I/P = propagation delay of logic of Mealy M/C
t
t+ t+T CLK
t+T CLK
+ 2
Even
x=
O/P=
O/P=
(Mealy)
Odd O/P=
(Moore)
2
= propagation delay of O/P
logic unit of Moore M/C
7
State=
Even
State=
Odd
Reset 0
State=
Even
Reset
[0]
State=
Odd
[1]
x
FF
N.S.
Logic
CLK
Q
Q D
D-
Assume single bit state information stored in a D-FF
CLK
x
(state)
y 2
(Mealy O/P)
y 1
Moore O/P)
State Transition
is occurring
State Transition
is occurring
S.T. is complete.
S.T. is complete.
odd^ odd
even even even odd
0/
8
D Q
R Q CLK
y 1
x=
A
0
a) D-FF
T Q
R Q
A y 2
x
CLK
b) T-FF
Moore O/P is synchronized with clock.
D Q
R Q CLK
y 2
x=
A
0 1 T Q
R Q
x
CLK
y 1
a) D-FF
b) T-FF
Mealy O/P is not synchronized with clock.
Reset
Reset
Reset
Reset
A
= Ax ; T A
= x
y 1
= A for Moore; y 2
= Ax for Mealy
10
Here is how the control is supposed to work. The vending machine delivers
a package of gum after it has received 15 cents in coins. The machine has a single
coin slot that accepts nickels and dimes, one coin at a time. A mechanical sensor
indicates to the control whether a dime or a nickel has been inserted into the coin slot.
The controller’s output causes a single package of gum to be released down a chute
to the customer.
One further specification: We will design our machine so it does not give
change. A customer who pays with two dimes is out 5 cents!
Vending
Machine
FSM
CLK
Reset
Coin
Sensor
Gum
Release
Mechanism
Open
Vending Machine block diagram
States:
11
— The figure below show the Moore and Mealy machine state transition diagrams.
0 cent
[0]
5 cent
[0]
10 cent
[0]
=15 cent
[1]
Moore machine
=15 cent
10 cent
5 cent
0 cent
Mealy machine
Moore and Mealy machine state diagrams for the vending machine FSM
Reset / 0 ( N
( ND
Reset
Reset
Reset / 0
N / 0
D / 0
N / 0
N+D/
N+D
N
D
N
D
D/
N (^) D
N (^) D / 0
N (^) D
N (^) D / 0
Reset)/^
D Reset)/
Reset Reset / 1
13
00 01 11 10
00
01
11
10
Q 1
Q 0
DN
00 01 11 10
00
01
11
10
Q 1
Q 0
DN
00 01 11 10
00
01
11
10
Q 1
Q 0
DN
0 0 1 1
0 1 1 1
x x x x
1 1 1 1
0 1 1 0
1 0 1 1
x x x x
0 1 1 1
0 0 1 0
0 0 1 0
x x x x
0 0 1 0
K-map for D 1
K-map for D 0
K-map for Open (Moore)
D 1
= Q 1
·N
D N Q Q N Q N Q D 0 0 0 1 1
OPEN = Q 1
·Q 0
OPEN = Q1·Q 0
D·Q 0
D·Q 1
N·Q 1
Moore
Mealy
00 01 11 10
00
01
11
10
Q 1
Q 0
DN
0 0 1 0
0 0 1 1
x x x x
0 1 1 1
K-map for Open (Mealy)
14
D Q
R Q
D Q
R Q
Q 0
N
N
Q 0
Q 1
N
Q 1
D
D 0
D 1
Q 1
OPEN
D
0
Q
CLK
CLK
Vending machine FSM implementation based on D flip-flops(Moore).
0
Q
1
Q
Q 1
Q 0
Reset
Reset
16
00 01 11 10
00
01
11
10
Q 1
Q 0
DN
00 01 11 10
00
01
11
10
Q 1
Q 0
DN
00 01 11 10
00
01
11
10
Q 1
Q 0
DN
00 01 11 10
00
01
11
10
Q 1
Q 0
DN
0 0 x x
0 1 x x
x x x x
1 1 x x
x x 0 0
x x 0 0
x x x x
x x 0 0
0 x x 0
1 x x 1
x x x x
0 x x 1
x 0 0 x
x 1 0 x
x x x x
x 0 0 x
K-map for J (^1) K-map for K 1
K-map for J 0
K-map for K 0
K-maps for J-K flip-flop implementation of vending machine.
1
0
1
0 0 1
K Q N 0 1
17
J Q
R Q
Q 1
CLK
K
J Q
R Q
Q 0
CLK
K
OPEN N
Q 0
D
N
D
Q 1
N
0
Q
1
Q
0
Q
1
Q
J-K flip-flop implementation for the vending machine example (Moore).
Similarly, a Mealy implementation; only the OPEN function changes.
Reset
19
20
1 received 1 received 1 received
i=
i=
i=2 i=
[0]
i=
[0]
i=
[1]
Reset
Reset
0/
0/
0/
1/
1/
00
10
01 1
1
1
0
0
0
Mealy Machine Moore Machine
Input
Output
1/