Moore and Mealy machines
-
Upload
irfan-anjum -
Category
Education
-
view
574 -
download
7
description
Transcript of Moore and Mealy machines
1
Finite-State Machine
Muhammad Irfan Anjum
2
OUTLINE
• Introduction
• Types of Finite State Machines
• Mealy State Machine
• Moore State Machine
• Example
3
• 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.
• Simple forms of pattern matching.
• Models for sequential logic circuits, of the kind on which
every present-day computer and many device controllers is
based.
Finite State Machine
4
FFs
External I/Ps External O/Ps
m1 m2
nn
Comb.Logic
CLK
FFsn
CLK
n
OutputLogic
m2
Next StateComb.Logic
m1
ExternalI/Ps
External Outputs
Mealy Machine Model Moore Machine Model
even odd
Mealy and Moore Machines
5
Difference Between Mealy and Moore Machine
Mealy Moore (1) O/Ps depend on the present O/Ps depend only on the state and present I/Ps present state(2) The O/P change asyn Since the O/Ps change -chronously with the when the state changes, enabling clock edge and the state change is synchronous with the enabling clock edge, O/Ps change synchronously with this clock edge(3) A counter is not a Mealy A counter is a Moore machine machine(4) A Mealy machine will have the same # or fewer states than a Moore machine
6
Finite State Machine (FSM) Design
Example:There is a one 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.
FSMx O/p y
CLK
CLK
x
# of1s
even(0)
odd(1)
even(2)
odd(3)
odd(3)
7
Solution 1: (Mealy)0/0
Even
Odd
1/11/0
0/1
Reset0
Even
11
0
Reset[0]
Odd [1]
Output
InputOutput
Input
Transition Arc
Output is dependent only on current state
O/P is dependenton current state andinput in Mealy
Solution 2: (Moore)
Mealy Machine: Output is associatedwith the state transition, and appearsbefore the state transition is completed(by the next clock pulse).
Moore Machine: Output is associatedwith the state and hence appearsafter the state transition take place.
8
State Transition Table
(Even-Parity Checker)
Even State: 0 ; Odd State: 1; State Variable A
A x A+ y1 y2 DA
0 0 0 0 0 0
0 1 1 0 1 1
1 0 1 1 1 1
1 1 0 1 0 0
PresentState
InputNextState
MooreO/P
MealyO/P
D-FFExcit.
Input variablesto comb. logic
QFF
N.S. & O/PLogic
CLK
x y2
A DA
Or
FFs
y1
N.S.Logic
O/PLogic
DAAQ
x
DA= Ax ; y1 = A for Moorey2 = Ax for Mealy
Output functions
9
Moore M/C Implementation
D Q
QRCLK
y1x=1
A0
a) D-FF
Moore O/P is synchronized with clock.
Mealy M/C Implementation
D Q
QRCLK
y2
x=1A
0 1
a) D-FF
Mealy O/P is not synchronized with clock.
Reset
Reset