Open In App

Construction of the machines that produce ‘A’, ‘B’, or ‘C’ if input ends with ‘1’, ‘0’, or nothing

Prerequisite: Mealy and Moore Machines, Difference between Mealy machine and Moore machine 
Problem: Construction of the machines that take set of all string over {0, 1} as input and produce ‘A’ as output if the input ends with ‘1’ or produce ‘B’ as output if the input ends with ‘0’ otherwise produce ‘C’ as the output. 
Assume, 
 

Ε = {0, 1, 2} and 
Δ = {A, B, C}  

where Ε and Δ are the input and output alphabet respectively. 



Explanation: 
The required Moore machine is constructed below: 
 



In the above diagram, the initial state ‘w’ on getting ‘2’ as the input it remains in the state of itself and prints ‘C’ as the output, on getting ‘1’ as the input it transmits to a state ‘Y’ and prints ‘A’ as the output and on getting ‘0’ as the input it transmits to a state ‘X’ and prints ‘B’ as the output and so on for the remaining states. 

Thus finally above Moore machine can easily produce ‘A’ as output if the input ends with ‘1’ or produce ‘B’ as output if the input ends with ‘0’ otherwise produce ‘C’ 

Above Moore machine takes set of all string over {0, 1} as input and produce ‘A’ as output if the input ends with ‘1’ or produce ‘B’ as output if the input ends with ‘0’ otherwise produce ‘C’ as the output. 

Now we need to transform the above transition diagram of Moore machine to equivalent Mealy machine transition diagram. 

Conversion from Moore machine to Mealy machine: 
Steps for the required conversion are given below:- 

Note: While converting from Moore to Mealy machine the number of states remains same for both Moore and Mealy machine but in case of Mealy to Moore conversion it does not give the same number of states.

Article Tags :