Moore Machine Sequence Detector

Posted on by

Design example: Sequence Detector (using Moore Machine) Design example: Sequence Detector (using Mealy Machine) Implementation. Last Updated: 01 Apr, 2021 Prerequisite – Mealy and Moore machines A sequence detector is a sequential state machine that takes an input string of bits and generates an output 1 whenever the target sequence has been detected. In a Mealy machine, output depends on the present state and the external input (x). Example: sequence detector for 01 or 10 CS 150 - Fall 2005 – Lec #7: Sequential Implementation – 4. Example Moore machine implementation 1 0 0 0 1 1 zero 0. ' Introduction to finite-state machines #Moore versus Mealy machines #Synchronous Mealy machines #Example: A parity checker! Today ' Example: A sequence detector FSM ' Example: A vending machine FSM 2 FSM design! FSM-design procedure 1. State diagram and state-transition table 2. State minimization 3. State assignment (or state encoding) 4. Example: Design a simple sequence detector for the sequence 011. Include three outputs that indicate how many bits have been received in the correct sequence. (For example, each output could be connected to an LED.) 1) Draw a State Diagram (Moore) and then assign binary State Identifiers. A 000 B 001 C 011 D 111 X=0 X=0 X=0 X=0 X=1 X=1 X=1 X=1.

In this post, let’s look at some examples of sequence detectors (110 & 11011). A sequence detector is a sequential circuit that outputs a 1 when a particular pattern of bits sequentially arrives at its data input.

Moore Machine:

A finite state machine, whose output is a function of the present state only. Moore model requires more number of states for implementing the function.


Mealy Machine:

A finite state machine, whose output is a function of the present state and the present input. It requires less number of states for implementing the function.

Sequence: 110

State diagram – Moore
Code (Verilog)

State diagram – Mealy
Code (Verilog)

Simulation Results
Moore machine:
Mealy machine:

Overlap and Non-Overlap:

Overlap: The final bits of one sequence can be the start of another sequence.
Non-Overlap: The detector resets itself to the start state when the sequence has been detected.

  • Automata Theory Tutorial
  • Classification of Grammars
  • Regular Grammar
  • Context-Free Grammars
  • Pushdown Automata
  • Turing Machine
  • Decidability
  • Automata Theory Useful Resources
  • Selected Reading

Finite automata may have outputs corresponding to each transition. There are two types of finite state machines that generate output −

101 Sequence Detector

  • Mealy Machine
  • Moore machine
Moore Machine Sequence Detector

Mealy Machine

Detector

A Mealy Machine is an FSM whose output depends on the present state as well as the present input.

It can be described by a 6 tuple (Q, ∑, O, δ, X, q0) where −

  • Q is a finite set of states.

  • is a finite set of symbols called the input alphabet.

  • O is a finite set of symbols called the output alphabet.

  • δ is the input transition function where δ: Q × ∑ → Q

  • X is the output transition function where X: Q × ∑ → O

  • q0 is the initial state from where any input is processed (q0 ∈ Q).

The state table of a Mealy Machine is shown below −

Present stateNext state
input = 0input = 1
StateOutputStateOutput
→ abx1cx1
bbx2dx3
cdx3cx1
ddx3dx2

The state diagram of the above Mealy Machine is −

Moore Machine

Moore machine is an FSM whose outputs depend on only the present state.

A Moore machine can be described by a 6 tuple (Q, ∑, O, δ, X, q0) where −

  • Q is a finite set of states.

  • is a finite set of symbols called the input alphabet.

  • O is a finite set of symbols called the output alphabet.

  • δ is the input transition function where δ: Q × ∑ → Q

  • X is the output transition function where X: Q → O

  • q0 is the initial state from where any input is processed (q0 ∈ Q).

The state table of a Moore Machine is shown below −

Present stateNext StateOutput
Input = 0Input = 1
→ abcx2
bbdx1
ccdx2
dddx3

The state diagram of the above Moore Machine is −

Mealy Machine vs. Moore Machine

The following table highlights the points that differentiate a Mealy Machine from a Moore Machine.

Mealy MachineMoore Machine
Output depends both upon the present state and the present inputOutput depends only upon the present state.
Generally, it has fewer states than Moore Machine.Generally, it has more states than Mealy Machine.
The value of the output function is a function of the transitions and the changes, when the input logic on the present state is done.The value of the output function is a function of the current state and the changes at the clock edges, whenever state changes occur.
Mealy machines react faster to inputs. They generally react in the same clock cycle.In Moore machines, more logic is required to decode the outputs resulting in more circuit delays. They generally react one clock cycle later.

Moore Machine to Mealy Machine

Algorithm 4

Input − Moore Machine

Output − Mealy Machine

Step 1 − Take a blank Mealy Machine transition table format.

Step 2 − Copy all the Moore Machine transition states into this table format.

Step 3 − Check the present states and their corresponding outputs in the Moore Machine state table; if for a state Qi output is m, copy it into the output columns of the Mealy Machine state table wherever Qi appears in the next state.

Example

Let us consider the following Moore machine −

Present StateNext StateOutput
a = 0a = 1
→ adb1
bad0
ccc0
dba1

Now we apply Algorithm 4 to convert it to Mealy Machine.

Step 1 & 2

Os x lion installesd.dmg download

Present StateNext State
a = 0a = 1
StateOutputStateOutput
→ adb
bad
ccc
dba

Step 3

Present StateNext State
a = 0a = 1
StateOutputStateOutput
=> ad1b0
ba1d1
cc0c0
db0a1

Mealy Machine to Moore Machine

Algorithm 5

Input − Mealy Machine

Output − Moore Machine

Step 1 − Calculate the number of different outputs for each state (Qi) that are available in the state table of the Mealy machine.

Step 2 − If all the outputs of Qi are same, copy state Qi. If it has n distinct outputs, break Qi into n states as Qin where n = 0, 1, 2....

Step 3 − If the output of the initial state is 1, insert a new initial state at the beginning which gives 0 output.

Example

Moore Machine 1101 Sequence Detector

Let us consider the following Mealy Machine −

Present StateNext State
a = 0a = 1
Next StateOutputNext StateOutput
→ ad0b1
ba1d0
cc1c0
db0a1

Here, states ‘a’ and ‘d’ give only 1 and 0 outputs respectively, so we retain states ‘a’ and ‘d’. But states ‘b’ and ‘c’ produce different outputs (1 and 0). So, we divide b into b0, b1 and c into c0, c1.

Present StateNext StateOutput
a = 0a = 1
→ adb11
b0ad0
b1ad1
c0c1C00
c1c1C01
db0a0