# Difference between Mealy and Moore machine

## Mealy machine:

The finite automata which we considered in the earlier sections have binary output i.e. either they accept the string or they do not accept the string. This acceptability was decided on the basis of the reachability of the final state by the initial state.

Now, we remove this restriction and consider the model where the outputs can be chosen from some other alphabet. The value of the output function Z(t) in the most general case is a function of the present state q(t) and the present input x(t),

[no-highlight]Z(t) = λ(q(t), x(t))
[/no-highlight]

where λ is called the output function. This generalized model is usually called the Mealy machine.

The mealy machine is a six-tuple (Q, ∑, Δ, δ, λ, q0). Where all the symbols except λ have the same meaning as in the Moore machine. λ is the output function mapping ∑ x Q into Δ.

## Moore machine:

If the output function Z(t) depends only on the present state and is independent of the current input. the output function may be written as:

[no-highlight]Z(t) = λ(q(t))
[/no-highlight]

This restricted model is called the Moore machine. It is more convenient to use Moore’s machine in automata theory.

A Moore machine is a six-tuple (Q, ∑, Δ, δ, λ, q0) where
i. Q is a finite set of states
ii. ∑ is the input alphabet
iii. Δ is the output alphabet
iv. δ is the transition function ∑ x Q into Q.
v. λ is the output function mapping Q into Δ and
vi. q0 is the initial state.

## Mealy vs Moore machine:

Mealy machine
Moore machine
1. Output depends on the present state as well as the present input.1. Output depends only upon the present state.
2. Asynchronous output generation.2. Synchronous output generation.
3. If input changes, output also changes.3. If input changes, the output does not change.
4. Fewer states than the Moore machine.4. More states than the Mealy machine.
5. It requires less hardware5. It requires more hardware
6. The counter cannot be referred to as a Mealy Machine.6. The counter is referred to as a Moore Machine.
7. Difficult to Design7. Easy to Design
8. They respond to inputs more quickly.8. They respond to inputs more slowly.