Melay and Moore machine in brief with example and diffrences




What is Moore and Mealy Machines?

Finite automata generate outputs related to each act. While two types of finite state machines creates output −
  • Mealy Machine
  • Moore machine

Mealy Machine

A Mealy Machine is considered as an FSM, the output will be based on the present state and the present input.
Mealy machine is explained as a 6 tuple (Q, ∑, O, δ, X, q0) where −
  • Q is a finite set of states.
  • ∑ is a finite set of symbols called the input alphabet.
  • O is a finite set of symbols called the output alphabet.
  • δ is the input transition function where δ: Q × ∑ → Q
  • X is the output transition function where X: Q × ∑ → O
  • q0 is the initial state from where any input is processed (q0 ∈ Q).
The state table of a Mealy Machine is mentioned below −
Present stateNext state
input = 0input = 1
StateOutputStateOutput
→ abx1cx1
bbx2dx3
cdx3cx1
ddx3dx2
The state diagram of the above Mealy Machine is −
state_diagram_of_mealy_machine

Moore Machine

Moore machine is also considered as an FSM and the outputs depend on the present state.
A Moore machine is also explained by a 6 tuple (Q, ∑, O, δ, X, q0) where −
  • Q is a finite set of states.
  • ∑ is a finite set of symbols called the input alphabet.
  • O is a finite set of symbols called the output alphabet.
  • δ is the input transition function where δ: Q × ∑ → Q
  • X is the output transition function where X: Q → O
  • q0 is the initial state from where any input is processed (q0 ∈ Q).
The state table of a Moore Machine is shown below −
Present stateNext StateOutput
Input = 0Input = 1
→ abcx2
bbdx1
ccdx2
dddx3
The state diagram of the above Moore Machine is −
moore_machine_state_diagram

Mealy Machine vs. Moore Machine

Let’s see the below table which highlights the points that creates a difference between a Mealy Machine and Moore Machine.
Mealy MachineMoore Machine
Output depends both upon present state and present input.Output depends only upon the present state.
Generally, it has fewer states than Moore Machine.Generally, it has more states than Mealy Machine.
Output changes at the clock edges.Input change can cause change in output change as soon as logic is done.
Mealy machines react faster to inputsIn Moore machines, more logic is needed to decode the outputs since it has more circuit delays.

Mealy MachineMoore Machine

Output depends both upon present state and present input.Output depends only upon the present state.
Generally, it has fewer states than Moore Machine.Generally, it has more states than Mealy Machine.
Output changes at the clock edges.Input change can cause change in output change as soon as logic is done.
Mealy machines react faster to inputsIn Moore machines, more logic is needed to decode the outputs since it has more circuit delays.
Moore Machine to Mealy Machine

Algorithm 4

Input − Moore Machine
Output − Mealy Machine
Step 1 − Take a blank Mealy Machine transition table format.
Step 2 − Copy all the Moore Machine transition states into this table format.
Step 3 – Now check the present states and their corresponding outputs in the Moore Machine state table; if for a state Qi output is m, copy it into the output columns of the Mealy Machine state table wherever Qi appears in the next state.

Example

Let’s see the following Moore machine −
Present StateNext StateOutput
a = 0a = 1
→ adb1
bad0
ccc0
dba1
Now we apply Algorithm 4 to convert it to Mealy Machine.
Step 1 & 2 −
Present StateNext State
a = 0a = 1
StateOutputStateOutput
→ adb
bad
ccc
dba
Step 3 
Present StateNext State
a = 0a = 1
StateOutputStateOutput
=> ad1b0
ba1d1
cc0c0
db0a1

Mealy Machine to Moore Machine

Algorithm 5

Input − Mealy Machine
Output − Moore Machine
Step 1 – Here measure the number of different outputs for each state (Qi) that are available in the state table of the Mealy machine.
Step 2 – Incase if all the outputs of Qi are same, copy state Qi. If it has n distinct outputs, break Qi into n states as Qin where n = 0, 1, 2.......
Step 3 − If the output of the initial state is 1, insert a new initial state at the beginning which gives 0 output.

Example

Let’s see the following Mealy Machine −
Present StateNext State
a = 0a = 1
Next StateOutputNext StateOutput
→ ad0b1
ba1d0
cc1c0
db0a1
While the states ‘a’ and ‘d’ provide only 1 and 0 outputs respectively, so we creates states ‘a’ and ‘d’. But states ‘b’ and ‘c’ delivers different outputs (1 and 0). So, we divide b into b0, b1 and cinto c0, c1.
Present StateNext StateOutput
a = 0a = 1
→ adb11
b0ad0
b1ad1
c0c1C00
c1c1C01
db0a0
Melay and Moore machine in brief with example and diffrences Melay and Moore machine in brief with example and diffrences Reviewed by Madhav Mohan on March 09, 2019 Rating: 5

No comments:

Theme images by MAYBAYBUTTER. Powered by Blogger.