Mealy v/s. Moore

Viewed 54811

What is the difference between Mealy & Moore type of finite state machines?

6 Answers

Explanation by Example / Anecdote.

This is perhaps best illustrated with an example and an anecdote.

I hate airports, and getting to them, but I love being on the plane. There are three distinct states that I have to enter into before getting on the plane:

  1. State: In Taxi (event: then I pay the fare, and transition to the next state:)
  2. State: In Lounge (event: wait 2 hours, and transition to the next state: )
  3. State: In Plane

But what is the outcome?

In a Mealy machine, the preceding state from which you come from makes a difference - how you get somewhere is very important. In a Moore machine, how you get to a state makes no difference.

Let's add in an outcome to the above to create a Moore representation of a state machine:

Example of a Moore Representation of a State Machine:

  1. State: In Taxi (event: pay fare and then transition to the next state). (Outcome: unhappy).
  2. State: In Lounge (event: wait 2 hours, and then transition to the next state) (outcome: unhappy)
  3. State: In Plane (outcome: happy).

With a Moore representation the outcome is attached directly to the state. With a Mealy representation - the particular outcome/output depends on where you have come from. For example, if I can get to the plane without having to catch a taxi and wait in the lounge, then I would be happy. Inputs make a difference. The where you come from is important. A Mealy representation state machine allows for this to be shown in the diagram. In other words, the output/outcome is shown OUTSIDE the state, during the transition.

  • Mealy machine output depend on both upon current state and current input whereas Moore output depend only the current state.

  • Generally Mealy machine has fever state than Moore machine.

  • Mealy Output changes at the clock edged but Moore output change as soon as logic is done.

  • Mealy react faster to input whereas Moore login is needed to decode the output since it has more circuits delays.

Related