0% found this document useful (0 votes)
8 views

Lecture 7

This document discusses finite automata with output capabilities. It introduces Moore machines and Mealy machines, which are models for finite automata that can produce output. Moore machines output based on their current state, while Mealy machines output based on transitions between states. Examples are given to illustrate how these machines work and their applications, such as representing sequential circuits.

Uploaded by

wannabedaniel77
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views

Lecture 7

This document discusses finite automata with output capabilities. It introduces Moore machines and Mealy machines, which are models for finite automata that can produce output. Moore machines output based on their current state, while Mealy machines output based on transitions between states. Examples are given to illustrate how these machines work and their applications, such as representing sequential circuits.

Uploaded by

wannabedaniel77
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 23

Automata and Languages

Finite Automata with Output


Recap

• Motivation for FA => to design a mathematical model for a computer:


• Input string => represents the program and input data
• Reading the letters from the string => executing instructions (it changes the
state of the machine i.e. Memory contents, control section of processor etc..)
• What about output?
• If our FA's and TG's represent actual physical machines, then we
should also consider FA with output capabilities, not just as language
acceptors or recognizers.
Topics

• Moore Machines
• Mealy Machines
• An application
A bit of History...

• Moore Machines and Mealy Machines are two models for FA's with
output.
• Mealy Machines were created by G. H. Mealy in 1955 while Moore
Machines were created (independently) by E. F. Moore in 1956.
• The original purpose of the inventors was to design a mathematical
model for sequential circuits.
Moore Machines - Definition

• A Moore Machine consists of:


• A finite set of states q0, q1, q2… where q0 is designated the start state
• An alphabet of input letters  = {a, b, c…}
• An alphabet of output characters  = {x, y, z…}
• A transition table that shows for each state and each
input letter what state is reached next.
• An output table that shows what character from  is printed by each state
that is entered
An example of a Moore Machine

• Input alphabet  = {a, b}


• Output alphabet  = {0,1}
• Names of states: q0, q1, q2, q3, (q0 = start state)
An example of a Moore Machine (cont.)

Old state New state Output


After input a After input b (Printed in
old state)
- qo q1 q3 1
q1 q3 q1 0
q2 q0 q3 0
q3 q3 q2 1
Transition diagram of Moore Machine

a b
q0/1 q1/0

b a
a

b
q2/0 q3/1 a
b
Trace the operation of this machine on the input string
abab.
A Moore string counter for ‘aab’…

b a
a b
q0/0 q1/0 q2/0 q3/1
b
a
b
This moore machine will count exactly how many times the
substring aab occurs in a long input string. Trace the
operation of this machine on the string aaababbaabb.
Mealy Machines - Definition

A Mealy machine consists of:


• A finite set of states q0, q1, q2… where q0 is designated the start state
• An alphabet of input letters  = {a, b, c…}
• An alphabet of output characters  = {x, y, z…}
• A transition diagram where each edge is labelled with a compound
symbol i/o where i is an input letter and o is and output character.
Every state must have one edge for each possible input letter.
An example Mealy machine

a/0 q1 b/1
a/1
q0 q2
b/0 a/0
b/1
q3
b/1
a/1
Some useful Mealy machines

• 1’s complement (of a binary number)


• A binary increment machine
Increment Mealy machine

0/0, 1/1
no
carry
0/1

0/1
start

owe
carry
1/0 1/0
Trace the operation of this Mealy machine on the binary representation
of decimal 11.
How can we build a subtracting machine from the two example Mealys?
An Application – using a Mealy machine to
represent a sequential circuit

• Refresher on Logic gates:

• NAND => not and

• DELAY => D-flip flop delays the transmission of the signal along the wire by one step
(clock pulse)
Example sequential circuit

input A B output
NAND DELAY OR

OR
State representation of circuit

A B
q0 0 0
q1 0 1
q2 1 0
q3 1 1
Circuit Logic

• The state of the circuit changes whenever a 1 or 0 is input, based on


the logic of its gates as follows
new B = old A
new A = (input) NAND (old A OR old B)
output = (input) OR (old B)
• At various discrete pulses of a time clock input is received, the state
changes and output is generated.
Transition table

Old state After input 0 After input 1

new state output new state output

q0 q2 0 q2 1

q1 q2 1 q0 1

q2 q3 0 q1 1

q3 q3 1 q1 1
Transition Diagram

1/1 q0 0/0, 1/1


0/1
q2
q1

1/1
1/1 0/0
q3

0/1
Summary

• Finite automata with output


• Moore machines output at state
• Mealy machines output at edges
• Moore and Mealy machines are equivalent in expressive power
• Moore and Mealy machines have useful application such as
representation of sequential circuits
Another Application of FA with output – A
bilingual dictionary

• Exploits the idea of relations (set theory)


• e.g. {“cat”,”chat”}, {“girl”,”fille”}, {“table”,”table”},
{“house”,”maison”}....
• Such an FA would both accept L1 and output the corresponding
L2where {L1,L2}.
• This machine is both a language acceptor (recognizer) but has output
capabilities!
Exercises

• Each of the following is a moore machine with input alphabet  = {a,


b} and output alphabet  = {0, 1}. Draw the corresponding machines
given the following transition and output tables:
Exercises
Construct the transition table for each of the two Mealy
machines shown below:

a/0 b/0 a/0 a/0


b/1
q0 q1 q2 q3
a/1
b/0 b/1

You might also like