0% found this document useful (0 votes)
305 views39 pages

Moore and Mealy

The document discusses Moore and Mealy machines, which are two types of finite state machines that generate output. It provides details on the differences between Moore and Mealy machines, including how their outputs are determined. It also gives examples of applications for each type of machine and includes classwork problems for converting between Moore and Mealy machines using transition tables and diagrams.

Uploaded by

Vivek Tg
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
305 views39 pages

Moore and Mealy

The document discusses Moore and Mealy machines, which are two types of finite state machines that generate output. It provides details on the differences between Moore and Mealy machines, including how their outputs are determined. It also gives examples of applications for each type of machine and includes classwork problems for converting between Moore and Mealy machines using transition tables and diagrams.

Uploaded by

Vivek Tg
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 39

Moore and Mealy machine

By
Sangeeta Bhanja Chaudhuri
Finite Automata with outputs
• Finite automata may have outputs corresponding to each
transition.
• There are two types of finite state machines that generate
output.

Application of Moore Machine:


An elevator is a good example of a Moore machine. Imagine that each floor is a
different state in the machine.

Application of Mealy Machine:


One application of a Moore Machine is in telecommunications, and is used to
modify the stream of symbols on the fly
Mealy Machine

• A Mealy Machine is an FSM whose output depends on the present state as well as
the present input.
• The output is associated with the transition.
Mealy Machine
Mealy Machine
Mealy Machine

The state table of a Mealy Machine/ state diagram is shown below:

Present state Next state


Input = a Input= b

state output state Output


q0 q0 1 q1 0

q1 q0 1 q1 0
Mealy Machine
Q. Design a Mealy machine for a binary input sequence such that if it has a substring 101, the
machine output A, if the input has substring 110, it outputs B otherwise it outputs C.

Solution: For designing such a machine, we will check two conditions, and those are 101 and 110. If we get
101, the output will be A. If we recognize 110, the output will be B. For other strings the output will be C.
We then insert the possibilities of 0's and 1's for
each state. Thus, the Mealy machine becomes:
Moore Machine
Moore Machine
The state table of a Moore Machine/ state diagram is shown below:

Present Next state


state
Input = a Input= b Output

q0 q0 q1 1

q1 q0 q1 0
Use of Mealy and Moore Machine
Class work: Q1. Design a state table for the Mealy
machine and show the transition with input 11 and
output?

Hint: Solve
(δ (q0,11)) .
Output: 00
Class work: Q2. Design a state table for the Moore
machine and show the transition with input 11 and
output?

Hint: Solve
(δ (q0,11)) .
Output: 000
Conversion of Moore Machine to Mealy Machine

1. Transition Table
2. Transition Diagram
Q3. Design a Moore machine takes the binary number {0, 1} as input and produce residue
modulo ‘3’ as output. Convert the Moore Machine to Mealy Machine (Using Transition Table).

Hint: Residue modulo ‘3’ as output means when the equivalent decimal number of
binary input over {0, 1} is divided by 3 then it gives output as it’s remainder.

Let us start with number 1. We can see that remainder 1 is left when 1, 4, 7 .... are divided
When 1 is divided by 3, remainder is 1. by 3.
When 2 is divided by 3, remainder is 2.
When 3 is divided by 3, remainder is 0.
When 4 is divided by 3, remainder is 1.
When 5 is divided by 3, remainder is 2.
When 6 is divided by 3, remainder is 0.
When 7 is divided by 3, remainder is 1.
When 8 is divided by 3, remainder is 2.
When 9 is divided by 3, remainder is 0.
Q3. Design a Moore machine takes the binary number {0, 1} as input and produce residue
modulo ‘3’ as output. Convert the Moore Machine to Mealy Machine (Using Transition Table).

Solution: The Moore machine is :


To convert Moore M/c to Mealy M/c (Method 1: Transition
Table)
• Step1: Create a State Transition Table of the above Moore machine.

Present Next state


state
Input = 0 Input= 1 Output

X X Y 0

Y Z X 1

Z Y Z 2
To convert Moore M/c to Mealy M/c
In the above transition table, States ‘X’, ‘Y’ and ‘Z’ are kept in the first
column which on getting ‘0’ as the input it transits to ‘X’, ‘Z’ and ‘Y’
states respectively, kept in the second column and on getting ‘1’ as
the input it transits to ‘Y’, ‘X’ and ‘Z’ states respectively, kept in the
third column and In the fourth column under Δ, there are
corresponding outputs of the first column states. In the table, An
arrow (→) indicates the initial state.
To convert Moore M/c to Mealy M/c
• Step1: Create a State Transition Table for the Mealy machine from the above Moore machine.
• Step 2: Fill the next states first.
• Step 3: Then see the Moore transition table (present state and Output and fill them accordingly in the mealy machine transition table.

Present state Next state


Input = 0 Input= 1
Present state-Output
state output state Output Combination from
Moore M/c
X X 0 Y 1 X-0
Y-1
Y Z 2 X 0 Z-2
Z Y 1 Z 2
The final Mealy machine is:
Method 2: Transition diagram
Steps:

• To redraw the original states without the output. The starting state
remains the same.

• To draw the transitions as they are on the original machine.

• To add output to the transitions based on their destination's


output symbol in the original machine.
Q. Convert the Moore Machine to Mealy Machine
(Using Transition diagram).
• Step1: Redraw the states • Step2: Draw the transitions.
without output.
• Step3: Add output to the transitions based on the transition's
destination. This is the final Mealy Machine.
H.w: Convert Moore M/c to Mealy M/c ( Using
transition diagram and transition table method.
Q. Convert the Mealy Machine to Moore Machine
(Using Transition table).
Steps to convert Mealy Machine to Moore
Machine (Using Transition table)

1. Find the states that have more than one output associated with
them in each column. For such states, divide them into two.
2. Rewrite the transition table, including the new states, and add an
output column. Then, fill in the destination state entries using the
original table.
3. Check for the output of each state in the destination column and fill
in the output column.
4. Remove the output symbols from the destination columns.
Steps to convert Mealy Machine to Moore
Machine (Using Transition table)
• Draw the transition table

Present state Next state


Input = 0 Input= 1

state output state Output


q0 q1 b q0 a

q1 q0 a q1 a

Note: We found that next state, the state q1​ has two different outputs for the input symbols; hence we will
make them into two states q1a (q1 with output a) and q1b (q1 with output b).
Steps to convert Mealy Machine to Moore Machine (Using
Transition table)
• Now, let’s create the transition table for Moore machine. (the
transition of q0 on 0 is towards q1 in the Mealy machine, but in
this case, we have split q1 in two states. As a result, we see the
corresponding output of that transition. In this case, the
output is b; therefore, the destination will be q1b.)

Present Next state


state
Input = 0 Input= 1 Output

q0 q1b , b q0, a

q1a q0,a q1a , a

q1b q0,a q1a , a


Next, we fill in the output column:
The q0 state has the output a in both columns of the
destination; thus, the final output is also a.

Present Next state


state
Input = 0 Input= 1 Output

q0 q1b , b q0, a a

q1a q0,a q1a , a a

q1b q0,a q1a , a b


Q. Convert Mealy Machine to Moore Machine
(using Transition diagram)
The steps involved in this method are:
1.Select the initial state and draw the transitions by adding the output
symbol of that transition to the destination state.
2.Repeat the process for every single transition.
3.If a conflict occurs, that is, if a state requires to give two different
outputs, make a duplicate state.
4.Add transitions for all duplicate states on all input symbols.
Q. Convert Mealy Machine to Moore Machine (using Transition diagram)

Solution: Step 1: Take the initial state and draw its first transition. The transition had an output b , that is now
transferred to our destination node q1​.
Step 2: Now, for the second transition of state q0​:

Step 3: Repeat the process.


Step 4: We encounter a conflict on the transition q1​→q1 as it has an
output a , but the state q1 already has an input b. So, we make a
duplicate state.

Step 5: Now add transitions to the new state, we get the following state diagram. we know from the
Mealy machine that q1​ at 0 goes to q0​ and gives an output a, so we use the same logic to form the
new transition .
Question Bank
Q1. Draw a mealy machine from the given state transition table. Q2. Draw a Moore machine for the given state transition table.
Draw a Moore machine for the same table Draw a mealy machine for the same table.
Question Bank
Q3. Design a state transition table for the mealy machine. Design a moore machine for the same and draw the
state diagram.
Question Bank
Q4. Design a state transition table for the Moore machine.

Q5. Convert the given Moore machine to mealy machine (Using Transition Table and Transition Diagram).
Question Bank
Q6. Convert the given mealy machine to Moore machine (Using Transition Table and Transition Diagram).

Note: Any Moore/ Mealy machine diagram will be given in the question paper. Similarly, any state
transition table will be given. Practice from different examples.

Q7. Compare Mealy and Moore Machine.


Q8. Explain Moore and Mealy machine with examples.

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy