#jsDisabledContent { display:none; } My Account |  Register |  Help

# Mealy machine

Article Id: WHEBN0000331512
Reproduction Date:

 Title: Mealy machine Author: World Heritage Encyclopedia Language: English Subject: Collection: Publisher: World Heritage Encyclopedia Publication Date:

### Mealy machine

In the theory of computation, a Mealy machine is a finite-state machine whose output values are determined both by its current state and the current inputs. (This is in contrast to a Moore machine, whose output values are determined solely by its current state.) A Mealy machine is a deterministic finite state transducer: for each state and input, at most one transition is possible.

## Contents

• History 1
• Formal definition 2
• Comparison 3
• Diagram 4
• Examples 5
• Simple 5.1
• Complex 5.2
• Applications 6
• Summary 7
• Footnotes 9
• References 10

## History

The Mealy machine is named after

• Mealy, George H. (1955). A Method for Synthesizing Sequential Circuits. Bell System Technical Journal. pp. 1045–1079.
• Holcombe, W.M.L. (1982). Algebraic automata theory. Cambridge Studies in Advanced Mathematics 1.
• Roth, Charles H., Jr. (2004). Fundamentals of Logic Design. Thomson-Engineering. pp. 364–367.
• Akhavi, Ali; Klimann, Ines; Lombardy, Sylvain; Mairesse, Jean; Picantin, Matthieu (2012). "On the finiteness problem for automaton (semi)groups". Int. J. Algebra Comput. 22 (6).

## References

1. ^ Mealy, George H. (September 1955). "A Method for Synthesizing Sequential Circuits". Bell System Technical Journal 34: 1045–1079.
2. ^ Akhavi et al (2012)

## Footnotes

Usually, it is harder to understand why the circuit does the right thing (i.e., implements the FSM) than it is to know how to build it. Certainly, one should devote time to both understanding why this technique works, as well as mastering the technique.

However, it does take practice to be able to do it reasonably fast, and is difficult to understand conceptually, at least, at first. One should trace out a few steps just to convince oneself of how it behaves. There is a subtle difference in the behavior of the implementation of a Mealy and Moore machine. Tracing out a few steps can show the differences more clearly.

Implementing a Moore or Mealy machine is not that hard, especially if one does not intend to minimize the circuit.

## Summary

• number classification
• watch with timer
• vending machine
• traffic light
• bar code scanner
• gas pumps

Some examples of applications:

By finding the intersection of two Finite state machines, one can design in a very simple manner concurrent systems that exchange messages for instance. For example, a traffic light is a system that consists of multiple subsystems, such as the different traffic lights, that work concurrently.

Simple software systems, particularly ones that can be represented using regular expressions, can be modeled as Finite State Machines. There are many of such simple systems, such as vending machines or basic electronics.

Moore/Mealy machines, are DFAs that have also output at any tick of the clock. Modern CPUs, computers, cell phones, digital clocks and basic electronic devices/machines have some kind of finite state machine to control it.

Mealy machines provide a rudimentary mathematical model for cipher machines. Considering the input and output alphabet the Latin alphabet, for example, then a Mealy machine can be designed that given a string of letters (a sequence of inputs) can process it into a ciphered string (a sequence of outputs). However, although one could use a Mealy model to describe the Enigma, the state diagram would be too complex to provide feasible means of designing complex ciphering machines.

## Applications

More complex Mealy machines can have multiple inputs as well as multiple outputs.

### Complex

A simple Mealy machine has one input and one output. Each transition edge is labeled with the value of the input (shown in red) and the value of the output (shown in blue). The machine starts in state S0. (In this example, the output is the exclusive-or of the two most-recent input values; thus, the machine implements an edge detector, outputting a one every time the input flips and a zero otherwise.)

State diagram for a simple Mealy machine with one input and one output.

## Examples

When the input and output alphabet are both Σ, one can also associate to a Mealy Automata an Helix directed graph.[2] (S × Σ, (x, i) → (T(x, i), G(x, i))) This graph has as vertices the couples of state and letters, every nodes are of out-degree one, and the successor of (x, i) is the next state of the automata and the letter that the automata output when it is instate x and it reads letter i. This graph is a union of disjoint cycles iff the automaton is bireversible.

The state diagram for a Mealy machine associates an output value with each transition edge (in contrast to the state diagram for a Moore machine, which associates an output value with each state).

## Diagram

1. Mealy machine tend to have fewer states:
• Different outputs on arcs (n2) rather than states (n).
2. Moore machine are safer to use:
• Outputs change at clock edge (always one cycle later).
• In Mealy machines, input change can cause output change as soon as logic is done—a big problem when two machines are interconnected – asynchronous feedback may occur if one isn't careful.
3. Mealy machine react faster to inputs:
• React in same cycle—don't need to wait for clock.
• In Moore machines, more logic may be necessary to decode state into outputs—more gate delays after clock edge.

## Comparison

In some formulations, the transition and output functions are coalesced into a single function T : S \times \Sigma \rightarrow S \times \Lambda.

• a finite set of states S
• a start state (also called initial state) S_0 which is an element of S
• a finite set called the input alphabet \Sigma
• a finite set called the output alphabet \Lambda
• a transition function T : S \times \Sigma \rightarrow S mapping pairs of a state and an input symbol to the corresponding next state.
• an output function G : S \times \Sigma \rightarrow \Lambda mapping pairs of a state and an input symbol to the corresponding output symbol.

A Mealy machine is a 6-tuple (S, S_0, \Sigma, \Lambda, T, G) consisting of the following:

## Formal definition

[1]

This article was sourced from Creative Commons Attribution-ShareAlike License; additional terms may apply. World Heritage Encyclopedia content is assembled from numerous content providers, Open Access Publishing, and in compliance with The Fair Access to Science and Technology Research Act (FASTR), Wikimedia Foundation, Inc., Public Library of Science, The Encyclopedia of Life, Open Book Publishers (OBP), PubMed, U.S. National Library of Medicine, National Center for Biotechnology Information, U.S. National Library of Medicine, National Institutes of Health (NIH), U.S. Department of Health & Human Services, and USA.gov, which sources content from all federal, state, local, tribal, and territorial government publication portals (.gov, .mil, .edu). Funding for USA.gov and content contributors is made possible from the U.S. Congress, E-Government Act of 2002.

Crowd sourced content that is contributed to World Heritage Encyclopedia is peer reviewed and edited by our editorial staff to ensure quality scholarly research articles.