Finite Automata With Output: Ege University Department of Computer Engineering

Download as ppt, pdf, or txt
Download as ppt, pdf, or txt
You are on page 1of 14

Finite Automata with Output

Automata Theory
Ege University
Department of Computer Engineering

Do. Dr. R. Cenk Erdur, 2013

F.A. With Output


Moore Machine
Mealey Machine

Do. Dr. R. Cenk Erdur, 2013

Moore Machines
A Moore machine a collection of five
things:
A finite set of states (q0, q1, q2, ....) where q0 is the
start state.
An alphabet of letters for forming the input string.
An alphabet of possible output characters.
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 output
characters alphabet is printed by each state as it is
entered.
Do. Dr. R. Cenk Erdur, 2013

Moore Machine Example-1


Input:abab Output:10010
b

q0 / 1

q1 / 0

q2 / 0
Do. Dr. R. Cenk Erdur, 2013

q3 / 1

Moore Machine Example-2


A Moore Machine that counts the number of aab" in a given string:

b
q0 / 0

q1 / 0

q2 / 0

q3 / 1

a
b

Do. Dr. R. Cenk Erdur, 2013

Moore Machine Example-2


Transition and Output Tables for Example-2:
Transition Table
Old State

Output Table

After input a After input b Character printed

q0
q1
q2
q3

q1
q2
q2
q1

Input String
State
Output

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

q0
0

Do. Dr. R. Cenk Erdur, 2013

q0
q0
q3
q0

0
0
0
1

Mealey Machine
A Mealy Machine is a collection of four
things:
A finite set of states (q0, q1, q2, ....) where q0 is the start
state.
An alphabet of letters for forming the input string.
An alphabet of possible output characters.
A pictorial representation with states represented by
small circles and directed edges indicating transitions
between states. Each edge is labeled with a compound
symbol of the form i/o, where i is an input letter and o is
an output character.
Do. Dr. R. Cenk Erdur, 2013

Example-1
Mealey Machine for 1s complement:
0/1, 1/0
q0

Do. Dr. R. Cenk Erdur, 2013

Example-2
Mealey Machine for incrementing a number by 1:
0/0, 1/1
0/1
Start

0/1
1/0

Do. Dr. R. Cenk Erdur, 2013

No
Carry

Owe
Carr
y

Input:1011
Output:1100
1/0

Note: For this example,


input is given begining
from the rightmost bit,
and output is formed from
right to left.

Example-3
Mealey Machine that finds the number of aa and bbs:
a/1
1

a/0

b/0

a/0

S
b/0

Do. Dr. R. Cenk Erdur, 2013

Input:aaa
Output:011
Input:ababbaab
b/1 Output:00001010

10

Example -4
Sequential logic circuits can be modeled using
Mealey Machines. An example is given below:

input

A
NAND

B
DELAY

OR

output

OR
Do. Dr. R. Cenk Erdur, 2013

11

Example- 4
Four states based on whether there is current at
points A and B in the circuit or not? (Current in a
wire is denoted by 1, no current by 0.)
q0: A=0
q1: A=0
q2: A=1
q3: A=1

B=0
B=1
B=0
B=1

Do. Dr. R. Cenk Erdur, 2013

12

Example-4
Old State

After input 0
New State Output

After input 1
New State Output

q0
q1
q2
q3

q2
q2
q3
q3

q2
q0
q1
q1

0
1
0
1
q0
1/1

1
1
1
1

0/0, 1/1

0/1
q1

q2
1/1
1/1

0/0
q3
0/1

Do. Dr. R. Cenk Erdur, 2013

13

Comparison Table for All FA Models


FA
Start
States
Final
States
Edge
Labels

TG

One

One or
more
Some
Some
or none or none
Letters Words
from from *

NFA

NFA- Moore

Mealy

One

One

One

One

Some
None
or none
Letters Letters
from from
and
Number One for Arbitrary Arbitrary Arbitrary One for
each
of Edges each
letter in
letter in
from
Each

State
DeterYes
No
No
No
Yes
ministic
?

None

Output No

Yes

Do. Dr. R. Cenk Erdur, 2013

No

Some
or none
Letters
from

No

No

Yes

i/o
i from
o from

One for
each
letter in

Yes

14

You might also like