top of page
SiliconCrafters

A primer on Mealy and Moore Finite State Machines

This is going to be a short article on Mealy and Moore state machines. It is common to get asked which one would you prefer to build a state machine and why in an interview. I will cover their common characteristics and differences to help you decide which one you should prefer next time you are building something using state machines.


Mealy State Machine:

  1. Mealy state machine output depends on present state and present inputs. Due to this, the outputs of a Mealy Machine can change asynchronously in response to any change in the inputs.

  2. Mealy outputs allow an input to appear after the cycle has started. Hence, there is a possibility of propagating a glitch on Mealy output.

  3. Due to the same reason mentioned in point 2, Mealy machines are hard to meet timing.

  4. Mealy machine has output associated with inputs. For this reason, they generally need one less state as compared to Moore machine.

  5. Mealy machines react faster to input, they generally react in the same clock cycle in which the input was seen.

Moore State Machine:

  1. Moore state machine output depends only on present state.

  2. There is less possibility of a glitch getting propagated to Moore output.

  3. Moore machines have a full cycle to settle through the combinatorial logic and are therefore easier to meet required cycle times.

  4. Moore has output associated with states. We need 1 extra state in Moore than in Mealy, because to generate output, we need to go to another state.

  5. Moore machines react to input a cycle late.

This picture perfectly resonates my points for Mealy and Moore machines mentioned above.


Picture taken from Sunburst Design Paper


Conclusion:

You should not use Mealy machine unless absolutely necessary. It has far more cons than pros in comparison to Moore machines.


I would like to end this article with a question for you. What can you do to avoid propagating glitches in Mealy output?


Think about it. See you in the next article!

89 views0 comments
Never Miss a Post. Subscribe Now!

I plan to write about anything and everything I find interesting.

Thanks for submitting!

© 2024 SiliconCrafters.com

Powered and secured by Wix

bottom of page