Moore Machine

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 12

MOORE MACHINE

(Finite Automata With Output)

By: Dr Ayesha Naseer


Finite Automata With Output
 Finite Automata without output (DFA, NFA, ε-NFA)
 These Mathematical Models take a computer program as
input and recognizes the language.
 Finite Automata with Output
 Moore Machine ( created by E. F. Moore, 1956)
 Mealy Machine ( created by G. H. Mealy, 1955)
 The purpose of these FA with output is
 To design a mathematical model for sequential circuits ( such
as AND, OR, NOT) which are the basic component of
computer architecture.
 To design a mathematical model for pattern recognition.
RECAP
 First, we study models of Finite Automata without output (
DFA, NFA, epsilon NFA) that recognizes computer language.

 Now, we are going to investigate the models of Finite


Automata with output ( Moore Machine, Mealy Machine)
that mainly help us to design sequential circuits for computer
architecture and mathematical models for pattern
recognition.
MOORE MACHINE

Definition
Moore Machine
 Moore machine is a FSM (finite state machine) 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).
Moore Machine - Example

 Q = { q0, q1, q2, q3}


 ∑ = { a, b}
 O = { 0, 1}
 δ: Q × ∑ → Q ( such as (q0 x a) → q1)
 X: Q → O ( such as q0 → 1, q1 → 0)
 Start State: q0
 No Final State is required
Transition Table
How to generate output for a specific
input?

 Input: abab
 Output: 10010
 Processing:

a b a b
q0 q1 q1 q3 q2

1 0 0 1 0
Application: Construct a Moore Machine that takes binary
number as input and produces its 1’s complement

 1’s complement of a binary number: 011001 → 100110


 ∑ = { 0, 1}
 O = { 0, 1}

Transition Table
State input output
0 1
q0 q1 q0 0
q1 q1 q0 1
Processing for input: 011001

0 1 1 0 0 1
q0 q1 q0 q0 q1 q1 q0

0 0 0 1 1 0
1
Application: Construct sequential circuit (AND Gate) using
Moore Machine.
Application: Pattern Recognition Using
Moore Machine.
 Suppose we were interested in knowing exactly how many
times the substring aab occurs in a long input string.The
following Moore machine will print ‘1’ as output for every
occurrence of ‘aab’ as substring.
Class Activity.
 Design following Moore Machines:
1. Construct Moore Machine that takes a binary input and
produces 2’s complement as output.
2. Construct Moore Machine for OR, NOT and XOR Gates.
3. Construct Moore Machine that takes set of all string over
alphabet { a, b} as input and prints ‘1’ as output for every
occurrence of ‘ab’ as substring.

 Read chapter 8 of Introduction to Computer


Theory By Daniel I.A. Cohen

You might also like