Conversion from Mealy Machine to Moore machine
Conversion from Mealy to Moore Machine
Let us take the transition table of mealy machine shown in Figure 2.
Input=0 | Input=1 | |||
Present State | Next State | Output | Next State | Output |
q0 | q1 | 0 | q2 | 0 |
q1 | q1 | 0 | q2 | 1 |
q2 | q1 | 1 | q2 | 0 |
Table 1
Step 1. First find out those states which have more than 1 outputs associated with them. q1 and q2 are the states which have both output 0 and 1 associated with them.
Step 2. Create two states for these states. For q1, two states will be q10 (state with output 0) and q11 (state with output 1). Similarly for q2, two states will be q20 and q21.
Step 3. Create an empty moore machine with new generated state. For moore machine, Output will be associated to each state irrespective of inputs.
Input=0 | Input=1 | ||
Present State | Next State | Next State | Output |
q0 | |||
q10 | |||
q11 | |||
q20 | |||
q21 |
Table 2
Step 4. Fill the entries of next state using mealy machine transition table shown in Table 1. For q0 on input 0, next state is q10 (q1 with output 0). Similarly, for q0 on input 1, next state is q20 (q2 with output 0). For q1 (both q10 and q11) on input 0, next state is q10. Similarly, for q1(both q10 and q11), next state is q21. For q10, output will be 0 and for q11, output will be 1. Similarly, other entries can be filled.
Input=0 | Input=1 | ||
Present State | Next State | Next State | Output |
q0 | q10 | q20 | 0 |
q10 | q10 | q21 | 0 |
q11 | q10 | q21 | 1 |
q20 | q11 | q20 | 0 |
q21 | q11 | q20 | 1 |
Table 3
This is the transition table of moore machine shown in Figure 1.
Method for conversion of Moore machine to Mealy machine
Let M = (Q, ∑, δ, λ, q0) be a Moore machine. The equivalent Mealy machine can be represented by M' = (Q, ∑, δ, λ', q0). The output function λ' can be obtained as:
Example 1:
Convert the following Moore machine into its equivalent Mealy machine.
Solution:
The transition table of given Moore machine is as follows:
Q | a | b | Output(λ) |
---|---|---|---|
q0 | q0 | q1 | 0 |
q1 | q0 | q1 | 1 |
The equivalent Mealy machine can be obtained as follows:
The λ for state q1 is as follows:
Hence the transition table for the Mealy machine can be drawn as follows:
The equivalent Mealy machine will be,
Note: The length of output sequence is 'n+1' in Moore machine and is 'n' in the Mealy machine.
Example 2:
Convert the given Moore machine into its equivalent Mealy machine.
Solution:
The transition table of given Moore machine is as follows:
Q | a | b | Output(λ) |
---|---|---|---|
q0 | q1 | q0 | 0 |
q1 | q1 | q2 | 0 |
q2 | q1 | q0 | 1 |
The equivalent Mealy machine can be obtained as follows:
The λ for state q1 is as follows:
The λ for state q2 is as follows:
Hence the transition table for the Mealy machine can be drawn as follows:
The equivalent Mealy machine will be,
Example 3:
Convert the given Moore machine into its equivalent Mealy machine.
Q | a | b | Output(λ) |
---|---|---|---|
q0 | q0 | q1 | 0 |
q1 | q2 | q0 | 1 |
q2 | q1 | q2 | 2 |
Solution:
The transaction diagram for the given problem can be drawn as:
The equivalent Mealy machine can be obtained as follows:
The λ for state q1 is as follows:
The λ for state q2 is as follows:
Hence the transition table for the Mealy machine can be drawn as follows:
The equivalent Mealy machine will be,