Difference between Mealy Model and Moore Model - mbits-mirafra/digitalDesignCourse GitHub Wiki
Serial No. | Mealy Model | Moore Model |
---|---|---|
1 | Output is function of both current state and the input. | Output is function of only the current state. |
2 | The output is produced immediately after the transition to the next state. | The output is produced at the beginning of the next clock cycle. |
3 | Mealy machines are more complex because of dependency of both input and the present state. | Moore machines are less complex because of fewer states and transitions as output depends only on current state. |
4 | Mealy machines are less robust as there is a chance of glitches to occur. | Moore machines are more robust as they have clear separation between the input and output, which reduces risk of glitches and errors. |
When to Use Mealy model and when to use Moore model:
Example 1:
In this system, a user can enter a password to unlock the door. The system needs to be designed to ensure that the correct password is entered, and the door is unlocked.
Mealy Model: If we use the Mealy model, the output of the system depends on both the current state and the inputs. For example, if a user enters an incorrect password, the Mealy model will immediately display an error message and request a new input. This ensures a fast response time and improves the user experience.
Moore Model: If we use the Moore model, the output of the system depends only on the current state. For example, if a user enters an incorrect password, the Moore model will not display an error message immediately. Instead, the system will wait until the user enters a new input and checks if the new input is valid. This ensures a simpler design and reduces power consumption, but it may not respond as quickly to incorrect inputs.
In this example, the Mealy model may be a better choice as the response time to incorrect inputs is critical to ensure security. Using the Mealy model can ensure a fast response time and improve the user experience.
Example 2:
Let's consider another practical example of a escalator to understand when to use the Moore models. The escalator can be modeled as a Moore machine, where the output (the movement of the steps) depends solely on the current state of the machine (the direction and speed of the escalator).So even if there is no movement of a person it will still transits to another state. Hence we use the Moore model to build escalators.