Code360 powered by Coding Ninjas X Naukri.com. Code360 powered by Coding Ninjas X Naukri.com
Table of contents
1.
Introduction
2.
What is Mealy Machine?
2.1.
Characteristics of a Mealy Machine
3.
What is Moore Machine?
3.1.
Characteristics of a Moore Machine
4.
Differences Between Mealy Machine and Moore Machine
5.
 
6.
 
7.
 
8.
 
9.
Frequently Asked Questions
9.1.
Is Moore machine a finite state machine?
9.2.
Can Mealy and Moore Machines be categorized as Transducers?
9.3.
Does Mealy machine require more hardware to design than Moore?
10.
Conclusion
Last Updated: Mar 27, 2024
Medium

Difference Between Mealy and Moore Machine

Author Muskan Gupta
5 upvotes
Master Python: Predicting weather forecasts
Speaker
Ashwin Goyal
Product Manager @

Introduction

When we talk about the Mealy and Moore machine, then the first thing that we should know is about finite state machines. Machines with a limited number of states are known as finite state machines(FSM), and these machines are sequential circuits with a limited number of ways in which their history might affect their future behavior. And, they are used because there is no machine with an infinite storage capacity.  In this blog, we will learn about the Difference Between Mealy and Moore Machine.

mealy and moore machine

Also see, Turing Machine in TOC.

What is Mealy Machine?

It is a finite state machine whose current output is determined by its current state, and the existing external input and output symbol is linked to the transition state and Input of a finite state machine.                                                                                         

The mealy machine can be symbolized as (Q, ∑, O, δ, X, q0) where −

  • Q is a finite set of states.
  • ∑ It is a finite set of symbols known as the input alphabet.
  • O is a finite set of symbols known as the output alphabet.
  • δ is the input transition function (δ: Q × ∑ → Q)
  • X is the output transition function (X: Q × ∑ → O)
  • q0 is the initial state; any input is processed from this state(q0 ∈ Q).

Also See, Moore Machine

We can design a Mealy machine that generates 2's complement of a binary number.

The state diagram of the Mealy Machine is −         

diagram of the Mealy Machine

The state table of a Mealy Machine is shown below −

states(Q) State Input Output State Output
A A 0 0 B 1
B B 1 1 B 0

Here, the finite set of states(Q) is {A, B}. And, input alphabets are Ʃ = (0,1) and output alphabets are ∆ = (0,1). Also, Input is 1100, read input is 0011, and output is 0100. Input taking and output giving processes are done from right to left.

Also Read - Simplification of CFG

Characteristics of a Mealy Machine

The characteristics of a Mealy machine are mentioned below:

  • Output Dependency: Outputs depend on both the current state and inputs.
  • Output Timing: Outputs can change immediately upon a state transition and input change.
  • Output Function: Output function is defined by a state transition table that specifies outputs for each state and input combination.
  • Number of Outputs: Each state-input combination can have a unique output.
  • Behavior: More responsive to input changes as outputs can change with every input transition.
  • State Transitions: State transitions are triggered by input changes.
  • Complexity: Potentially more complex than Moore machines due to the immediate dependency on input changes.
  • Applications: Well-suited for systems where output changes are closely tied to specific input conditions.
Get the tech career you deserve, faster!
Connect with our expert counsellors to understand how to hack your way to success
User rating 4.7/5
1:1 doubt support
95% placement record
Akash Pal
Senior Software Engineer
326% Hike After Job Bootcamp
Himanshu Gusain
Programmer Analyst
32 LPA After Job Bootcamp
After Job
Bootcamp

What is Moore Machine?

It is a finite state machine whose current output is solely determined by its current state, and each state of a finite state machine has an output symbol. The current state and input symbol are responsible for the next state. 

Moore machine can be symbolized as (Q, ∑, O, δ, X, q0) where −

  • Q is a finite set of states.
  • ∑ It is a finite set of symbols known as the input alphabet.
  • O is a finite set of symbols known as the output alphabet.
  • δ is the input transition function (δ: Q × ∑ → Q)
  • X is the output transition function (X: Q → O)
  • q0 is the initial state; any input is processed from this state(q0 ∈ Q).

Also See, Symbol Table Operations

We can design a Moore machine that takes a set of all strings having symbols {a, b} as input and can print '1' as output for each occurrence of 'ab' as a substring. 

The state diagram of the Moore Machine is −

diagram of the Moore Machine

The state table of a Moore Machine is shown below −

states(Q)  Ʃ = (a, b)  ∆ = (0,1)
A BA 0
B BC 0
C BA 1

Here, the finite set of states(Q) is {A, B, C}. And, input alphabets are Ʃ = (a, b) and output alphabets are ∆ = (0,1). Also, Input is abaababaa, and output is 0010010100.

Characteristics of a Moore Machine

The characteristics of a Moore machine are mentioned below:

  • Output Dependency: Outputs depend only on the current state.
  • Output Timing: Outputs change only when a state transition occurs.
  • Output Function: Output function is defined by a state transition table that specifies outputs for each state.
  • Number of Outputs: Each state has a fixed output.
  • Behavior: Less responsive to immediate input changes; outputs remain constant during a state's duration.
  • State Transitions: State transitions are triggered by input changes, but outputs are associated with states.
  • Complexity: Potentially simpler than Mealy machines due to the delayed dependency on input changes.
  • Applications: Suitable for systems where output changes are determined primarily by the current state and less by immediate input conditions.

Differences Between Mealy Machine and Moore Machine

The differences between the Mealy and Moore machine are as follows:-

Parameters             Mealy Machine                 Moore Machine
Definition A type of finite state machine where the output depends on both the current state and inputs, changing as soon as inputs change. A type of finite state machine where the output depends only on the current state, remaining constant throughout the state's duration.
Current Output It is a finite state machine whose current output is determined by its current state and the existing external input and output symbol is linked to the transition state and input of a finite state machine.  It is a finite state machine whose current output is solely determined by its current state, and each state of a finite state machine has an output symbol.
States It needs fewer states for the same functions' implementation than the Moore machine. It needs a more significant number of states for the same functions' implementation than the Mealy machine.
Design It isn't straightforward to design a Mealy machine. It is easy to design Moore's machine.
Reaction to Changes Mealy machines react to changes more quickly. They all seem to respond in the same way. Decoding the output necessitates more logic, resulting in longer circuit delays. They usually react after one clock cycle.
Hardware It requires less hardware for designing purposes. It requires more hardware for designing purposes.
Counter A counter can’t be referred to as a mealy machine. A counter can be referred to as a Moore machine.
Output Function Value The output function's value becomes a function of transitions and changes when the input logic is done in the present state. The output function’s value becomes the function of its current state along with the changes at the edges of the clock whenever a change occurs in the state.
Synchronous and Asynchronous changes On the present clock, the asynchronous generation of output by its state changes to synchronous. The synchronous changes to its clock edge by state and output.

 

 

 

 

 

Also read, Arden's theorem

Frequently Asked Questions

Is Moore machine a finite state machine?

Yes, a Moore machine is a type of finite state machine (FSM) used in digital electronics and sequential logic circuits.

Can Mealy and Moore Machines be categorized as Transducers?

Yes, both Mealy and Moore Machines can be categorized as transducers. A transducer is a device or machine that transforms input signals into output signals. 

Does Mealy machine require more hardware to design than Moore?

No, Mealy machines do not inherently require more hardware than Moore machines. Hardware complexity depends on the specific requirements and implementation details of each design.

Conclusion

This blog covered the concepts of Mealy Machine and Moore Machine along with their differences, examples, and frequently asked questions. After brushing up on your concepts about this topic, the next thing you can learn is the regular expression and finite automata.

Recommended Reading:

You can also consider our Online Coding Courses such as the Machine Learning Course to give your career an edge over others.

Previous article
Difference between Mealy Machine and Moore Machine
Next article
Conversion of Moore To Mealy Machine
Live masterclass