Conversion from Moore Machine to Mealy Machine

Conversion from Moore Machine to Mealy Machine

Moore Machine

The output of Moore machine depends only on the present state. In this, if machine has N number of states, then it will require N-flip-flops, where M is the smallest number such that N<=2M. In this, if the input string is of length n, then the output string will be of length n+1.

Mealy Machine

In Mealy machine value of output function depends on the current state q (t) and current input i (t). In this, if machine has N number of states then it will require N-flip-flops, where M is the smallest number such that N<=2M. In mealy machine, if the input string of length n, then the output string will be of length n.

Method for conversion of Moore machine to Mealy machine

Theorem:

If M = (Q, q0, ?, O, ?, ?) is a Moore machine, then there exists a mealy machine M’ = (Q, q0, ?, O, ?, ?') equivalent to M.

Proof:

If M’ = (Q, q0, ?, O, ?, ?) is a Mealy machine, we can define ?’ to be ? (? (q, a)) for all state q and input symbols a. The M’ will be equivalent to M since they enter the same sequence of states on the same input, and with each transition M’ has the same output that M associate with the state entered.

There are two methods for converting a Moore Machine to Mealy Machine

  • Converting a Moore Machine to Mealy Machine using transition diagram
  • Converting a Moore Machine to Mealy Machine using transition table

Converting a Moore Machine to Mealy Machine using transition diagram

In this method, we convert the Moore machineto Mealy Machine by using transition diagram of Moore machine.

Following steps are used to convert Moore machine to Mealy Machine:

Step1: Consider any state in Moore machine q0.

Step2: Check the output corresponding to this state, which is a.

Step3:  Check how many edges are entering into this state. As in q0 two edges, labelled 0 and 1 are entering.

Step4: Remove the output of q0 from inside the state and put it on the entering edges like 0/a and 1/a. This means that we have output a on the incoming edges before they enter state q0.

Step5: Follow the above steps for every state q0, q1…………………qn of Moore machine, which turns Moore machine M into an equivalent mealy machine M’. It will give same output string corresponding to all input strings.

Example

Convert the following Moore machine to mealy machine using transition diagram.

Solution:

In this method, we convert the Moore machine to mealy machine by using the transition diagram to Moore machine.

The transition table of given Moore machine is as follows:

Current State (Q)Input 0Input 1Output(?)
q0q2q1a
q1q3q2b
q2q2q2b
q3q2q0b

The equivalent mealy machine can be obtained by finding the output of following states:

Firstly, we find the output of state q0 for input 0 and 1

?' (q0, 0) = ? (?(q0, 0))  

                = ? (q2)  

                = b

?' (q0, 1) = ? (?(q0, 1))  

                = ? (q1)  

                = b

The output for state q1 for input 0 and 1 is as follows:

?' (q1, 0) = ? (?(q1, 0))  

                = ? (q3)  

                = b

?' (q1, 1) = ? (?(q1, 1))  

                = ? (q2)  

                = b

The output for state q2 for input 0 and 1 is as follows:

?' (q2, 0) = ? (?(q2, 0))  

                = ? (q2)  

                = b

?' (q2, 1) = ? (?(q2, 1))  

                = ? (q2)  

                = b

The output for state q3 for input 0 and 1 is as follows:

?' (q3, 0) = ? (?(q3, 0))  

                = ? (q2)  

                = b

?' (q3, 1) = ? (?(q3, 1))  

                = ? (q0)  

                = a

 The equivalent transition table for the Mealy machine is shown below:

The equivalent mealy machine for given Moore machine is shown below:

Converting a Moore Machine to Mealy Machine using transition table

In this method, we convert the Moore machine to Mealy machine using transition table.

Example:

Convert the Moore machine represented by the below transition table to Mealy Machine.

Current state (Q)Input 0Input 1Output(?)
    q0q0q10
q1q0q20
q2q0q21

The equivalent mealy machine can be obtained by finding the output of following states:

Firstly, we find the output of state q0 for input 0 and 1:

?' (q0, 0) = ? (?(q0, 0))  

                = ? (q0)  

                = 0

?' (q0, 1) = ? (?(q0, 1))  

                = ? (q1)  

                = 0

The output for state q1 for input 0 and 1:

?' (q1, 0) = ? (?(q1, 0))  

                = ? (q0)  

                = 0

?' (q1, 1) = ? (?(q1, 1))  

                = ? (q2)  

                = 1

Now we find the output for state q2 for input 0 and 1

?' (q2, 0) = ? (?(q2, 0))  

                = ? (q0)  

                = 0

?' (q2, 1) = ? (?(q2, 1))  

                = ? (q2)  

                = 1

The equivalent transition table for Mealy Machine is given below:

In above Mealy machine table, there are two identical transitions. The row for q1 and q2, both are same, which means, on state q1, q2 on input 0, the machine moves to same state q0. On input 1, from q1 and q2 the machine moves to same state q2. So, we will delete one row from these two rows. In above table q1 and q2 rows are identical so we will delete q2 from the transition table and replace q2 by q1 in other rows.

The final mealy machine is given below:


Related Topics

Conversion from Moore Machine to Mealy Machine

Conversion from Moore Machine to Mealy Machine Moore Machine The output of Moore machine depends only on the present state. In this, if machine has N number of states, then it will...

6 minutes read.

Minimization of Finite Automata with Output

Minimization of Finite Automata with Output The method to minimize the Moore and Mealy machine is very much similar to the method that we have used to minimize the DFA. Methods to...

3 minutes read.

Automata Regular Expressions

Regular Expressions Regular expressions are also referred as rational expressions, which are used to describe the algebraic description of regular languages. It is generally a sequence of characters that is used...

3 minutes read.

Finite Automata with Output

Finite Automata with Output The Finite State machine is similar to Finite Automata, except that it has the additional capacity of producing output. Finite State machine = Finite Automata + Output Capabilities Types...

3 minutes read.

Automata Greibach Normal Form

Greibach Normal Form In Greibach Normal Form, there is restriction on the position, in which, terminals and variables can appear on right-hand side of production rules. In Greibach Normal Form, every...

4 minutes read.

Automata Tutorial

What is Automata? Automata is a mathematical model and abstract model, which is used to detect string in various languages. In Automata, Regular language is recognized by Finite state AutomataContext Free language...

4 minutes read.

Closure Properties of Regular Languages -Automata

Closure Properties of Regular Languages We use the term “Closure” when we talk about sets of things. If we have two regular languages L1 and L2, and L is obtained by...

3 minutes read.

Conversion of DFA to Regular expression

Conversion of DFA to Regular expression To convert the DFA to Regular Expression (RE), we are going to use a method called converting DFA to regular expression by eliminating states. This...

3 minutes read.

Undecidable Problem of Turing Machine

Automata Undecidable Problem of Turing Machine Undecidable problems areproblems which cannot be solved by any Turing machine. Example: Post Correspondence Problem is the type of undecidable Problem. Post Correspondence Problem Post Correspondence problem is...

7 minutes read.

Finite Automata

Finite Automata Finite state Automata or Finite State Machine is the simplest model used in Automata. Finite state automata accepts regular language. In this, the term finite means it has a...

4 minutes read.

Derivation Tree of Context Free Grammar - Automata

Derivation Tree of Context Free Grammar Derivation tree gives a way to show how a string can be derived from context free grammar. It is also called as parse tree, production...

3 minutes read.

Equivalence of Regular Grammar and Finite Automata

Equivalence of Regular Grammar and Finite Automata Regular Grammar / type -3 grammar A regular grammar or type-3 defines the language called regular language that is accepted by finite Automata.A Regular Grammar...

3 minutes read.

Pumping Lemma for Regular Languages - Automata

Pumping Lemma for Regular Languages The language accepted by the finite automata is called Regular Language. If we are given a language L and asked whether it is regular or not?...

4 minutes read.

Minimization of Finite Automata

Minimization of Finite Automata The term minimization refers to the construction of finite automata with a minimum number of states, which is equivalent to the given finite automata. The number of...

4 minutes read.

Conversion from NFA to DFA

Conversion from NFA to DFA A Non-deterministic Finite Automata (NFA) is a finite state machine, in which, the move from one state to another is not fully deterministic, i.e., for a...

4 minutes read.

Automata Chomsky Hierarchy

Chomsky Hierarchy Formal languages: A language with precise syntax and semantics are called formal languages. Noam Chomsky has defined the Chomsky hierarchy in 1956. He is an American scientist and philosopher, and...

3 minutes read.

Recursive Language and Recursive Enumerable Language

Recursive Language and Recursive Enumerable Language Before discussing Recursive language and Recursive Enumerable language, let us see what Turing machine responds for some input string. If we have the Turing machine T...

4 minutes read.

Context Free Grammar - Automata

Context Free Grammar Grammar defines a set of rules, and with the help of these rules valid sentences in a language are constructed. A grammar consists of collection of substitution rules,...

3 minutes read.

Chomsky's Normal Form - Automata

Chomsky's Normal Form (CNF) In context free grammar, the left-hand side of production rules contains only one variable, and right side may contain any number of variables or terminals in production...

4 minutes read.

What is Automata Theory?

What is Automata Theory? Automata theory is used to study the abstract machine and automata (the self-acting machine).  Abstract machine is a theoretical model of a computer used in Automata theory. Automata...

4 minutes read.