FSM Lecture 3- Mealy and Moore State Transition Table

  • Post author:
  • Post category:Blog

 

Mealy and Moore State Transition Table

 

 

Mealy and Moore are two popular models used for designing finite state machines (FSMs). Both models define the behavior and transitions of states in an FSM, but they differ in how they handle outputs.

Let’s look at the state transition table for our Light control Mealy machine.

A state transition table is nothing but a table that explains the transition between states and the output produced. The below table will help you to implement the code.

 

State transition table light control Mealy machine

Figure 1. State transition table light control Mealy machine
Figure 1. State transition table light control Mealy machine

If you want to write a state transition table for a Mealy machine, look at Figure 1, there is a column of Output for every event of the system. 

Our application has two events, ‘ON’ and ‘OFF.’ Hence, there are two output columns. Because, in the Mealy machine, the output produced depends on the present state as well as the received event.

 

How to understand this table?

  • First, take the row. Let’s understand the row (Figure 2). When the state machine is in the ‘OFF’ state and if input event ‘ON’ is received, the state machine produces the output ‘Make the light Dim,’ and it transitions to the ‘Dim’ state, that’s the next state.
Mealy and Moore machines
Figure 2. State machine is in ON state

 

Mealy and Moore machines
Figure 3. State machine is in OFF state
  • When the state machine is in the ‘OFF’ state, if input event ‘OFF’ is received, that event is ignored as per our application. I mean, no output is defined, so the event is ignored. (Figure 3)

And the next state will be the same as the present state, and there is no state change. So, that’s how you understand this state transition table.

The only point you should remember here is, there are multiple output columns, one for each event of the system.

 

State transition table light control Moore machine:

Mealy and Moore machines
Figure 4. State transition table light control Moore machine

There is only one column in the Moore machine, which explains the output. Because the output is not depending on the received events, that’s why you see only one output column, and that is one column that explains the next state.

That’s about the state transition table.

 

Harel state charts

In 1984, David Harel published a paper, and paper name is “A VISUAL FORMALISM FOR COMPLEX SYSTEMS.” This is publicly available online; you can download and read it.

And in this paper, he introduces the concept of statecharts. The statecharts,  extend conventional state-transition diagrams with essentially three elements, dealing, respectively, with the notions of hierarchy, concurrency and communication.

The statecharts proposed by him consist of features from both the Mealy machine, Moore machine, and on top of that he adds a lot of other features. 

 

Harel statecharts feature:

  • It introduces the concept of substates and superstates 
  • Composite states 
  • History states(shallow and deep)
  • Orthogonality
  • Communication between state machines
  • Conditional transitions(guards)
  • Entry and exit actions for a state or for a composite state
  • Activities inside a state
  • Parameterized states
  • Overlapping states
  • Recursive statecharts 

 

UML state Machines

Summary:

If you read the latest UML specification from ‘OMG,’ then you can find the specific form of finite state automata used in UML based on an object-oriented variant of David Harel’s statecharts formalism. 

(However, readers who are familiar with that formalism should note that there is a small number of semantic differences that distinguish the UML version from the original). 

In this article, we will be learning the UML state machines, which are specification-oriented. And the specification number is 2.5.1. 

 

FastBit Embedded Brain Academy Courses

Click here: https://fastbitlab.com/course1

 

 

FastBitLab

The FastBit Embedded Brain Academy uses the power of internet to bring the online courses related to the field of embedded system programming, Real time operating system, Embedded Linux systems, etc at your finger tip with very low cost. Backed with strong experience of industry, we have produced lots of courses with the customer enrolment over 3000+ across 100+ countries.