Mealy Vs. Moore Machine

Design of sequential circuit can be composed of designing combinational circuit and state register. Sequential circuits are implemented in two different ways:

  1. Mealy Machine
  2. Moore Machine

We can represent a sequential machine as M = <I,O,S,f,g>; where

I: Input set
O: Output set
S: State space
<em>f</em>: A function mapping IxS =&gt; O
<em>g</em>: A function mapping IxS =&gt; S

Let’s understand both type of sequential machines and compare them.

Mealy Machine

In case of Mealy machine, output is a function of not only the present inputs but also past inputs. In other words we can say; in case of Mealy, both output and the next state depends on the present input and the present state.

Mealy Machine
Mealy Machine: (a) Block Diagram, (b) State Transition Diagram
PS: Present State
NS: Next State [NS becomes PS after every sensitive edge of clock pulse]
CLK: Clock Signal

f: IxS => O

So, output function:

o(t) = f(i(t),s(t))

       = f(i(t),PS(t))

Similarly

g: IxS => S

So, Next state function:

s(t+1) = g(i(t),s(t))

NS(t)  = g(i(t),PS(t))

Moore Machine

In case of Moore machine, present output is not a function of present inputs but is a function of past inputs. The next state is a function of both the present input and the present state.

In this case the output is not associated with the transition but are associated with the state unlike the Mealy machine. This is because the output “O” is a function of present state (PS) and independent of present input “I”.

Of-course present input I influences the next state (NS) and that’s how it is going to influence the output but there is a time lag between the input and output. The present inputs are going to influence the outputs that are going to come after the next clock.

Moore Machine
Moore Machine: (a) Block Diagram, (b) State Transition Diagram

f: S => O

So, output function:

o(t) = f(s(t))

       = f(PS(t))

Similarly

g: IxS => S

So, Next state function:

s(t+1) = g(i(t),s(t))

NS(t)  = g(i(t),PS(t))


 

Click here to learn how to transform a Mealy machine to a Moore machine and vice versa.


 

Mealy Vs. Moore: A Comparison

Mealy MachineMoore Machine
Mealy machine changes its output based on its current input and present stateOutput of Moore machine only depends on its current state and not on the current input
From presentation point of view, output is placed on transition Output is placed on state
Mealy will be faster, in the sense that output will change as soon as an input transition occursMoore machine may be safer to use, because they change states on the clock edge
Asynchronous output generation though the state changes synchronous to the clockBoth output and state change synchronous to the clock edge
FasterPredictable
Generally needs less states for synthesis. So less hardware required to design. Less states doesn’t always mean simpler to implementIn general needs more states for synthesis. Advantage of Moore model is simplification of behavior and easy to design

6 comments for “Mealy Vs. Moore Machine

  1. Hi, there is one major and important difference between these two : mealy removes glitches but Moore doesn’t. Hence mealy circuits are preferred mostly. Interviewer generally ask about this glitch issue.

    • Hi Jatin,

      Thanks for raising the point. But I think the generation of glitch is other way around. There is a possibility of glitches in case of Mealy while Moore is a more stable model.

        • Arvind,

          Yeah, I don’t know what Jatin is driving at, in that “mealy removes glitches and the moore doesn’t”. I think it’s the other way around. In the moore machine the output is dependent only on the current state. The state and output will change on a positive edge clock cycle, and be locked in for the duration of the negative edge clock cyle-This prevents ‘glitches’.

          On the other hand, the Mealy maching output is dependent on BOTH the current state and the input. This means fluctuations in the input produces fluctuations in the output regardless if the clock cycle is negative or positive (THE OUTPUT IS NOT LOCKED IN). This has the potential for producing ‘glitches’.

          The Mealy’s benefit is that the finite state machine can usually be constructed with a fewer number of states when compared to the Moore.

          • Thanks Chirag for the clear explanation. Moore is a more stable state machine model as its output changes at the clock edge. While Mealy changes its out put asynchronously (that means whenever there is a change in the input). But in most of the times Mealy takes less state to implement the state machine leading to less hardware cost.

Leave a Reply

Your email address will not be published. Required fields are marked *