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

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.

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.

Hence, the above diagram converts the Moore Machine into the corresponding Mealy Machine.
Example 02- Moore to Mealy Conversion
Consider the following Moore Machine

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.

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.

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.

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.

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.

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.
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.
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.
Here is a Moore machine to Mealy conversion Transition Table for a given example to generate the 2nd complement of a given binary number.
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.
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.
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}.
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}.
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
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
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.
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”
Here is a Moore machine to Mealy conversion Transition Table for a given example that counts the occurrences of the 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}
Here is a Moore machine to Mealy conversion Transition Table for a given example is given below
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}
Here is a Moore machine to Mealy conversion Transition Table for a given example
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}
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}
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}
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}
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}
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}
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.