94% found this document useful (16 votes)
34K views29 pages

Moore & Mealy Machine

The document discusses Moore and Mealy machines, which are finite automata machines that provide output. Moore machines have output that depends only on the present state, while Mealy machines have output that depends on both the present state and present input. The key differences between Moore and Mealy machines are illustrated through examples of their transition tables and diagrams. The document also provides information on converting between Moore and Mealy machines.

Uploaded by

api-3828940
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
94% found this document useful (16 votes)
34K views29 pages

Moore & Mealy Machine

The document discusses Moore and Mealy machines, which are finite automata machines that provide output. Moore machines have output that depends only on the present state, while Mealy machines have output that depends on both the present state and present input. The key differences between Moore and Mealy machines are illustrated through examples of their transition tables and diagrams. The document also provides information on converting between Moore and Mealy machines.

Uploaded by

api-3828940
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
You are on page 1/ 29

MOORE & MEALY

MACHINE
COMPILED BY
ASHWIN PRAKASH SRIVASTAVA
2ND IT
234/05
LIMITATION OF
FINITE AUTOMATA MACHINES
 One limitation of the FINITE AUTOMATA is
that output is limited to a binary signal
TRUE(1) or FALSE(0) depending on the basis
of reachability of the final state by the initial
state. The only explicit task a machine has
done so far is to recognize a language
whereas computers can perform calculations
and convey the result i.e. provide OUTPUT.
FINITE AUTOMATA
WITH OUTPUT
 Moore and Mealy machines remove this
limitation and provide output. They are
FINITE AUTOMATA MACHINE with OUTPUT.
 For example We simply want to print out a
copy of the input string.
DIFFERENCE BETWEEN
MEALY AND MOORE
MACHINES
 In Mealy machine output function Z(t) depends on
both the present state q(t) and the present input
x(t).
 The expression for Mealy machine is
 Z(t) = λ[q(t),x(t)]
 λ = output function.
 In Moore machine output function Z(t) depends only
on the present state and is independent of the
current input.
 The expression for Moore machine is
 Z(t) = λ[q(t)].
MOORE MACHINE
 Developed by E.F. Moore in 1956.
 It is a finite automata machine with output
 The output is associated with each state.
Every state of this machine has a fixed
output.
 There is no concept of final state in Moore
machine.
 It can be represented by Transition table as
well as Transition diagram.
 It is a six tuple machine.
MATHEMATICAL
REPRESENTATION
 M = (Q , Σ , λ , Δ , qo , δ)
 Q = A nonempty finite set of state in M.
 Σ = A nonempty finite set of input symbols.
 Δ = A nonempty finite set of outputs.
 δ = It is a transition function which takes two
arguments input state and input symbol.
 qo = Initial state of M belongs to Q.
 λ = It is a mapping function which maps Q to Δ
giving output associated with each state.
REPRESENTATION OF
MOORE MACHINE
 Let M be a Moore machine and a1 , a2 , a3 ,
…….an be input symbols where n>0 then
output of M is λ(q1) , λ(q2), λ(q3) , λ(q4) ………
… λ(qn) , such that
 δ(qi – 1 , ai ) = qi for 1<i<n.
EXAMPLE OF
MOORE MACHINE
TRANSITION TABLE

Present input output


state a=0 a=1
q0 q3 q1 0
q1 q1 q2 1

q2 q2 q3 0

q3 q3 q0 0
VALUES OF
Q, Σ, Δ
 Q = {q0 , q1 , q2 , q3 }
 Σ={0,1}
 Δ={0,1}
 λ(q0) = 0 , λ(q1) = 1 , λ(q2) = 0 , λ(q3) = 0
TRANSITION DIAGRAM

0 1

1
q0 q1 0
0
1
1 0

0
1

0
q2 q3
0 0
PROCESSING OF STRING
THROUGH
MOORE MACHINE
 Let the input string be w = 0111 and Output
string will be єw’ = 00010.

0 0 0 1 0
є 0 1 1 1
q0 q3 q0 q1 q2

|w| = 4
|w’| = 5

Since for the input of null string the output is 0


A Moore machine that counts the
occurrence of substring “aab” in
the input strung
 Let the input string be w = “aaabbbaabaa”
 M = (Q , Σ , λ , Δ , qo , δ)
 Q = { q1 , q2 , q3 , q4 }
 Σ={a,b}
 Δ={0,1}
 λ(q0 ) = 0 , λ(q1 ) = 0 , λ(q2 ) = 0 , λ(q3) = 1
TRANSITION DIAGRAM

0 1
a
q1 q3
a a
b
b
0 b 0
q0 q2
b
a
aaabbbaabaa

0 0 0 0 1
a a a b
q0 q1 q2 q2 q3
b
0 0 0 0 1
b a a b
q0 qo q1 q2 q3
a
0 0
q1 a q2
000010000100
RESULT
 The occurrence of 1’s in the output string is
2 so the number of times “aab” appears in
the input string is 2.
MEALY MACHINE
 Independently developed by G.H. Mealy in
1955
 Output is associated with each transition.
 Output is fixed for a particular input symbol.
 It can be represented by Transition table as
well as Transition diagram.
 It is a six tuple machine.
MATHEMATICAL
REPRESENTATION
 M = (Q , Σ , λ , Δ , qo , δ)
 Q = A nonempty finite set of state in M.
 Σ = A nonempty finite set of input symbols.
 Δ = A nonempty finite set of outputs.
 δ = It is a transition function which takes two
arguments input state and input symbol.
 qo = Initial state of M.
 λ = It is a mapping function which maps Q * Σ to Δ
giving output associated with each transition.
REPRESENTATION OF
MEALY MACHINE
 Let M be a Mealy machine and a1 , a2 , a3 ,
…….an be input symbols where n>0 then
output of M is λ(q0 , a1) , λ(q1 , a2) λ(q2 , a3)
λ(q3 , a4) λ(q4 , a5)………… λ(qn - 1 , an), such
that
 δ(qi – 1 , ai ) = qi for 1<i<n.
EXAMPLE OF
MEALY MACHINE
TRANSITION TABLE
Present Input a=0 Input a=1
state State
q1 qState
3 output
0 output
q2 0
q2 q1 1 q4 1
q3 q2 1 q1 0
q4 q4 1 q3 0
Values of
Q , Σ, Δ
 Q = { q1 , q2 , q3 , q4 }
 Σ={0,1}
 Δ={0,1}
 λ(q1 , 0) = 0 , λ(q2 , 0) = 1 , λ(q3 , 0) = 1 ,
λ(q4 , 0) = 1
 λ(q1 , 1) = 0 , λ(q2 , 1) = 0 , λ(q3 , 1) = 1 ,
λ(q4 , 1) = 0
TRANSITION DIAGRAM

0/1
q1 q2
1/0

0/0 1/0
1/1 0/1

q3 1/0
q4 0/1
PROCESSING OF STRING
THROUGH
MEALY MACHINE
 Let the input string be w = 0111 and Output
string will be w’ = 0100.

0/0 1/1 1/0 1/0


q1 q3 q1 q2 q4

|w| = 4
|w’| = 4
TRANSFORMING A MOORE MACHINE INTO
A MEALY MACHINE

P
b d
q 1

a/P
c
d
MOORE
MACHINE
b/P q1
MEALY
c/P MACHINE
EXAMPLE

1
q1
a a
0 1
q0 b q3 a/b

b b
q2 0

a
MOORE MACHINE
CONVERT INTO MEALY MACHINE

q1
a/1 a/1

q0 b/0 q3 a/1 , b/1

b/0 b/1
q2

a/0
MEALY MACHINE
TRANSFORMING A MEALY MACHINE INTO
A MOORE MACHINE
b/0

a/0 a/1
b/1 b/1
q1
MEALY MACHINE
b
0 1 a/1
a/1
q11 q12
a b/1 b b/1

MOORE MACHINE
EXAMPLE
b/1

q1
a/0 a/1

a/1
q0 q2 b/0
b/0
b/1
a/0
q3

MEALY MACHINE
MOORE MACHINE

b 1 a

q1
a a
0
a
0 q01 q21 b
a a
b b
1
q02 b
q3 0
b q22
a
1
THANK
YOU

You might also like