Moore to Mealy Conversion Solved Examples

Each Moore Machine is easily converted into its corresponding Mealy Machine. The equivalence of the Moore and Mealy machines means that both machines produce the same output for the same input.

As we know, in the Moore machine, the output is attached to every state symbol, and in the Mealy machine, the output is attached to the input symbol. 

Method To Convert Moore to Mealy Machine

Find the output symbol of each transition from each state. Simply place the output symbol along with the input over the arrow.

The above procedure starts from an initial state and repeats till the end. Simple Moore to Mealy Machine examples are given below.

Example 01- Moore to Mealy Conversion

Consider the following Moore Machine

Conversion From Moore to Mealy Machine Example 1

Let’s convert the above Moore Machine into the corresponding Mealy Machine.

At q0 for input “0”, the transition also goes to the state q0, which gives output “a”. So for Mealy Machine, Just label output (a) with input (1) over the arrow as given below.

Conversion From Moore to Mealy Machine Example 01 (At q0 For Input “0”)

At q0 for input “1”, the transition also goes to the state q0, which gives output “a”. So for Mealy Machine, Just label output (a) with input (1) over the arrow as given below.

Conversion From Moore to Mealy Machine (At q0 For Input “1”) Example 01

Hence, the above diagram converts the Moore Machine into the corresponding Mealy Machine.

Example 02- Moore to Mealy Conversion

Consider the following Moore Machine

Moore Machine to Mealy Conversion Example 2

Solution

At q0 for input “0”, the transition also goes to the state q0, which gives output “a”. So for Mealy Machine, Just label output with input over arrow as given below.

Moore Machine to Mealy Conversion Example 2 step 1

At q0 for input “1”, the transition also goes to the state q1, which gives output “b.” So for Mealy Machine, Just label output (b) with input (1) over the arrow as given below.

Moore Machine to Mealy Conversion Example 2 step 2

Now Move to q1 to discuss both inputs “0” and “1”.

The new state, At q1 for input “0”, the transition also goes to the state q1, which gives output “b.” So for Mealy Machine, Just label output (b) with input (1) over the arrow as given below.

Moore Machine to Mealy Conversion Example 2 step 3

At q1 for input “1”, the transition goes to the state q0, which gives output “a.” So for Mealy Machine, Just label output (b) with input (0) over the arrow as given below.

Moore Machine to Mealy Conversion Example 2 step 4

Hence in above diagram, the given Moore Machine is converted into corresponding Mealy Machine.

Example 03- Moore to Mealy Conversion

Convert the following Moore machine into its equivalent Mealy machine.

Solution

After applying the conversion rules, which we see in the above examples, the result in the Mealy Machine is given below.

Moore Machine to Mealy Conversion Example 3

Example 04 – Moore to Mealy Conversion

Construct a Moore Machine and convert that Moore machine to an equivalent Mealy Machine that generates the 1’s complement of a given binary number.



Solution

Here is a Moore machine to Mealy conversion Transition diagram for a given example 04 to generate the 1’s complement of a given binary number.

  Moore to Mealy Conversions Examples - First Complement Transition Diagram in Automata

Here is a Moore machine to Mealy conversion Transition Table for a given example 04 to generate the 1’s complement of a given binary number.

Moore to Mealy Conversions Examples - First Complement Transition Table                    

Example 05 – Moore to Mealy Conversion

Construct a Moore Machine and convert that Moore machine to an equivalent Mealy Machine that generates the 2nd complement of a given binary number.

Solution

Here is a Moore machine to Mealy conversion Transition diagram for a given example to generate the 2nd complement of a given binary number.

Moore to Mealy Conversions Examples - Transition diagram of 2's Complement

Here is a Moore machine to Mealy conversion Transition Table for a given example to generate the 2nd complement of a given binary number.

Moore to Mealy Conversions Examples - Transition Table of 2's Complement

Example 06 – Moore to Mealy Conversion

Construct a Moore Machine and convert that Moore machine to an equivalent Mealy Machine that prints “a” whenever the sequence “01” is encountered in any input binary string.

Solution

Here is a Moore machine to Mealy conversion Transition diagram for a given example that prints “a” whenever the sequence “01” is encountered in any input binary string.

Moore to Mealy Conversions Examples - Transition Diagram to prints “a” whenever the sequence “01” occur

Here is a Moore machine to Mealy conversion Transition Table for a given example that prints “a” whenever the sequence “01” is encountered in any input binary string.

Moore to Mealy Conversions Examples - Transition Table to prints “a” whenever the sequence “01” occur

Example 07 – Moore to Mealy Conversion

Construct a Moore Machine and convert that Moore machine to an equivalent Mealy Machine that takes all the strings of a’s and b’s as input and counts the number of a’s in the input string in terms of 1. Where

input Σ = {a,b},  and output △ = {0,1}

Solution

Here is a Moore machine to Mealy conversion Transition diagram for a given example that takes all the strings of a’s and b’s as input and counts the number of a’s in the input string in terms of 1 over input Σ = {a,b},  and output △ = {0,1}.

Moore to Mealy Conversions Examples - Transition Diagram to Counts the number of a's

Here is a Moore machine to Mealy conversion Transition table for a given example that takes all the strings of a’s and b’s as input and counts the number of a’s in the input string in terms of 1 over input Σ = {a,b},  and output △ = {0,1}.

Moore to Mealy Conversions Examples -Transition Table to Counts the number of a's

Example 08 – Moore to Mealy Conversion

Construct a Moore Machine and converts that Moore machine to an equivalent Mealy Machine that counts the occurrences of the sequence “abb” In any input string over 



input Σ = {a,b}, output △ = {0,1}

Solution

Here is a Moore machine to Mealy conversion Transition diagram for a given example that counts the occurrences of the sequence “abb” In any input string over 

Moore to Mealy Conversions Examples -Transition Diagram to Counts the occurrence of “abb”

Here is a Moore machine to Mealy conversion Transition Table for a given example that counts the occurrences of the sequence “abb” In any input string over 

Moore to Mealy Conversions Examples - Transition Diagram to Counts the occurrence of “abb”

Here is a Moore machine to Mealy conversion Transition Table for a given example 04 to generate the 1’s complement of a given binary number.

Moore to Mealy Conversions Examples - Transition Diagram to Counts the occurrence of “abb”

Example 09 – Moore to Mealy Conversion

Construct a Moore Machine and converts that Moore machine to an equivalent Mealy Machine that counts the occurrences of the sequence “0101” In any input string over {0,1}

Input Σ = {0,1}, Output △ = {0,1}

Solution

Here is a Moore machine to Mealy conversion Transition diagram for a given example that counts the occurrences of the sequence “0101”

Moore to Mealy Conversions Examples - Transition Diagram to detecting Binary Sequence ‘0101’

Here is a Moore machine to Mealy conversion Transition Table for a given example that counts the occurrences of the sequence “0101”

Moore to Mealy Conversions Examples - Transition Table to detecting Binary Sequence ‘0101’

Example 10 – Moore to Mealy Conversion

Construct a Moore Machine and converts that Moore machine to an equivalent Mealy Machine that takes a set of all strings over {0,1} and gives

  • “A” as output if input ends with “10”
  • “B” as output if input ends with “11”
  • Otherwise gives C as output.

Input Σ = {0,1},  Output △ = {A,B,C}

Solution

Here is a Moore machine to Mealy conversion Transition diagram for a given example that takes a set of all strings over {0,1} and gives

  • “A” as output if input ends with “10”
  • “B” as output if input ends with “11”
  • Otherwise gives C as output.

Input Σ = {0,1},  Output △ = {A,B,C}

Moore to Mealy Conversions Examples - “A” as output if input ends with “10” , “B” as output if input ends with “11”, otherwise gives C as output.

Here is a Moore machine to Mealy conversion Transition Table for a given example is given below

Moore to Mealy Conversions Examples - Table - “A” as output if input ends with “10” , “B” as output if input ends with “11”, otherwise gives C as output.

Example 11 – Moore to Mealy Conversion

Construct a Moore Machine and converts that Moore machine to an equivalent Mealy Machine that takes a binary input sequence such that if it has a

  • Substring 101, the machine output A,
  • If the input has a substring 110, its output is B;
  • Otherwise, it outputs C.

Input Σ = {0,1},  Output △ = {A,B,C}

Solution

Here is a Moore machine to Mealy conversion Transition diagram for a given example that takes a binary input sequence such that if it has a

  • Substring 101, the machine output A,
  • If the input has a substring 110, its output is B;
  • Otherwise, it outputs C.

Input Σ = {0,1},  Output △ = {A,B,C}

Moore to Mealy Conversions Examples - “A” as output if input has substring “101”, “B” as output if Input has substring “110”, otherwise gives C as output.

Here is a Moore machine to Mealy conversion Transition Table for a given example 

Moore to Mealy Conversions Examples - Transition Table for “A” as output if input has substring “101”,

Example 12 – Moore to Mealy Conversion

Construct a Moore Machine and converts that Moore machine to an equivalent Mealy Machine that generates the remainder after dividing a number by 3 (modulus of 3) in binary

over Σ = {0,1}, △ = {0,1,2}

Solution

Here is a Moore machine to Mealy conversion Transition diagram for a given example that generates the remainder after dividing a number by 3 (modulus of 3) in binary over Σ = {0,1}, △ = {0,1,2}



 

Moore to Mealy Conversions Examples - To generate remainder after dividing a number by 3 (modulus of 3) in binary

Here is a Moore machine to Mealy conversion Transition Table for a given example that generates the remainder after dividing a number by 3 (modulus of 3) in binary over Σ = {0,1}, △ = {0,1,2}

Moore to Mealy Conversions Examples - Transition Table to Generate Remainder after dividing a number by 3

Example 13 – Moore to Mealy Conversion

Construct a Moore Machine and converts that Moore machine to an equivalent Mealy Machine that generates the remainder after dividing a number by 4 (modulus of 4) in binary

over Σ = {0,1}, △ = {0,1,2,3}

Solution

Here is a Moore machine to Mealy conversion Transition diagram for a given example that generates the remainder after dividing a number by 4 (modulus of 4) in binary over Σ = {0,1}, △ = {0,1,2,3}

 

Moore to Mealy Conversions Examples - Transition Diagram to generate remainder after dividing a number by 4 (modulus of 4) in binary

Here is a Moore machine to Mealy conversion Transition Table for a given example that generates the remainder after dividing a number by 4 (modulus of 4) in binary over Σ = {0,1}, △ = {0,1,2,3}

Moore to Mealy Conversions Examples - Transition Table to generate Remainder after dividing a number by 4

Example 14 – Moore to Mealy Conversion

Construct a Moore Machine and converts that Moore machine to an equivalent Mealy Machine that generates the remainder after dividing a number by 5 (modulus of 5) in binary

over Σ = {0,1}, △ = {0,1,2,3,4}

Solution

Here is a Moore machine to Mealy conversion Transition diagram for a given example that generates the remainder after dividing a number by 5 (modulus of 5) in binary over Σ = {0,1}, △ = {0,1,2,3,4}

Moore to Mealy Conversions Examples - To generate remainder after dividing a number by 5 (modulus of 5) in binary

Here is a Moore machine to Mealy conversion Transition Table for a given example that generates the remainder after dividing a number by 5 (modulus of 5) in binary over Σ = {0,1}, △ = {0,1,2,3,4}

Moore to Mealy Conversions Examples - Transition Table to generate Remainder after dividing a number by 5

Key Changes When Converting Moore to Mealy

Key Change
Output placement Moves from states to transitions
Output timing Happens during transition, not after
State count Can reduce (fewer states needed for different outputs)
Output function Depends on the state and input, not just the state

Important

Number of states

After conversion from Moore to the Mealy Machine, The states of the Mealy Machine are always less than or equal to the Moore Machine.

Transition Table

As discussed earlier in the Moore and Mealy Machine lectures, transition tables can also be obtained from corresponding Moore or Mealy diagrams.

"Your Support, Our Priority"

"We Make It Easy"