Moore and Mealy Machines
A finite automaton (FA) is a simple idealized machine used to recognize patterns within input taken from some character set. It has a set of states and rules for moving from one state to another but it depends upon the applied input symbol. There are two types of Finite State Automata-
- Moore Machine (Output on State)
- Mealy Machine (Output on Transition)
Moore Machine
A Moore Machine is a finite-state machine whose output depends only on a state, i.e., the current state. It is efficient in simplifying a given behaviour. In a State Transition Diagram, each state is labelled with an output value. The name 'Moore' came from 'Edward F. Moore'.
Formal Definition of Moore Machine
The Moore Machine is classified in 6-tuple -
(Q, q0, ∑, O, δ, X)
Q - Finite set of states.
q0 - A start state or initial state
∑ - Finite set of symbols called an input alphabet.
O - Finite set of symbols called an output alphabet.
δ - An input transition function, δ: Q × ∑ → Q, it maps a state and the input alphabet to the next state.
X - A output transition function, X: Q × ∑ → O, it maps each state to the output alphabetically.
Mealy Machine
A Mealy Machine is a finite-state machine whose output depends on present input and a state, i.e., the current state. It is efficient in reducing the number of states. In a State Transition Diagram, each transition is labeled with an output value. In this, every transition for a particular input has a fixed output.
Formal Definition of Mealy Machine
The Mealy Machine is classified in 6-tuple -
(Q, q0, ∑, O, δ, X)
Q - Finite set of states.
q0 - A start state or initial state
∑ - Finite set of symbols called an input alphabet.
O - Finite set of symbols called an output alphabet.
δ - A input transition function, δ: Q × ∑ → Q, it maps pairs of a state and the input alphabet to next state.
X - A output transition function, X: Q → O, it maps pairs of a state to the output alphabetically.
Differences Between Moore and Mealy Machine
Moore Machine |
Mealy Machine |
The Moore state machine is simpler and easy to design. | The Mealy state machine has low response time. |
The output of Moore FSM depends on its present state. | The output of Mealy FSM depends on its present input and present state. |
If input changes, output does change. | If input changes, output also changes. |
In Moore machine, more number of states are required. | In Mealy machine, less number of states are required. |
It needs more logic to decode states into output, so more hardware requires to be designed. | It has fewer states than the Moore machine, so less hardware requires to be designed. |
In this, state changes synchronous to the clock and output generates asynchronously. | In this, state changes and output generate synchronous to the clock. |
A Moore machine is easy to design. | A Mealy machine is difficult to design. |
Applications of Moore and Mealy Machines
The basic applications implemented on Moore and Mealy machines are-
- Traffic Light Controller
- Vending Machine
- War Game
Block Diagrams of Moore and Mealy Machines
The fundamental of Moore and Mealy machines will be more clear with the block diagram.
Non Deterministic Finite Automata
Regular Expression