Download as pdf or txt
Download as pdf or txt
You are on page 1of 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 state q0 q1 q2 q3

input output a=0 a=1 q3 q1 0 q1 q2 q3 q2 q3 q0 1 0 0

VALUES OF Q, ,

Q = {q0 , q1 , q2 , q3 } ={0,1} ={0,1} (q0) = 0 , (q1) = 1 , (q2) = 0 , (q3) = 0

TRANSITION DIAGRAM

1 1 0 1 1

q0

q1
1 0 0

q2
0

q3
0

PROCESSING OF STRING THROUGH MOORE MACHINE

Let the input string be w = 0111 and Output string will be w = 00010. 0 0 q3 1 0 q0 1 1 q1 1 0 q2

0 q0

|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 q1 a b 0 b q0 b a

1 q3

0 q2 a

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

000010000100

RESULT

The occurrence of 1s 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 state q1 q2 q3 q4 Input State q3 q1 q2 q4 a=0 Input State output output 0 q2 1 1 1 q4 q1 q3 a=1 0 1 0 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
1/1 0/0

q2
1/0 0/1 1/0 1/0

q3

q4

0/1

PROCESSING OF STRING THROUGH MEALY MACHINE

Let the input string be w = 0111 and Output string will be w = 0100. q1
0/0

q3

1/1

q1

1/0

q2

1/0

q4

|w| = 4 |w| = 4

TRANSFORMING A MOORE MACHINE INTO A MEALY MACHINE a P b d


1

q
c

a/P
MOORE MACHINE

b/P c/P

q1

MEALY MACHINE

EXAMPLE
1 q1 0 q0 b q2 a MOORE MACHINE 0 a b b a 1 q3 a/b

CONVERT INTO MEALY MACHINE

a/1 q0 b/0

q1

a/1 q3 b/1 a/1 , b/1

b/0

q2 a/0 MEALY MACHINE

TRANSFORMING A MEALY MACHINE INTO A MOORE MACHINE b/0 a/0 b/1 b 0 q11 a a/1 b/1 b 1 q12 q1 a/1 b/1 MEALY MACHINE a/1 b/1

MOORE MACHINE

EXAMPLE
b/1 q1 a/0 q0 b/0 b/1 q3 MEALY MACHINE a/0 a/1 a/1 q2 b/0

MOORE MACHINE b a 0 q01 b 1 q02 a b b q3 0 q22 1 1 q1 a a a a

0 q21 a b b

THANK YOU

You might also like