# Finite State Machine: Mealy State Machine and Moore State Machine

The finite state machines (FSMs) are significant for understanding the decision making logic as well as control the digital systems. In the FSM, the outputs, as well as the next state, are a present state and the input function. This means that the selection of the next state mainly depends on the input value and strength lead to more compound system performance. As in sequential logic, we require the past inputs history for deciding the output. Therefore FSM proves very cooperative in understanding sequential logic roles. Basically, there are two methods for arranging a sequential logic design namely mealy machine as well as more machine. This article discusses the theory and implementation of a finite state machine or FSM, types, finite state machine examples, advantages, and disadvantages.

## What is an FSM (Finite State Machine)?

The definition of a finite state machine is, the term finite state machine (FSM) is also known as finite state automation. FSM is a calculation model that can be executed with the help of hardware otherwise software. This is used for creating sequential logic as well as a few computer programs. FSMs are used to solve the problems in fields like mathematics, games, linguistics, and artificial intelligence. In a system where specific inputs can cause specific changes in state that can be signified with the help of FSMs.

This finite state machine diagram explains the various conditions of a turnstile. Whenever placing a coin into a turnstile will unbolt it, and after the turnstile has been pressed, it bolts gain. Placing a coin into an unbolted turnstile, otherwise pressing against a bolted turnstile will not alter its state.

## Types of Finite State Machine

The finite state machines are classified into two types such as Mealy state machine and Moore state machine.

### Mealy State Machine

When the outputs depend on the current inputs as well as states, then the FSM can be named to be a mealy state machine. The following diagram is the mealy state machine block diagram. The mealy state machine block diagram consists of two parts namely combinational logic as well as memory. The memory in the machine can be used to provide some of the previous outputs as combinational logic inputs.

Based on the current inputs as well as states, this machine can produce outputs. Thus, the outputs can be suitable only at positive otherwise negative of the CLK signal. The mealy state machine’s state diagram is shown below.

The state diagram of mealy state machine mainly includes three states namely A, B, and C. These three states are tagged within the circles as well as every circle communicates with one state. Conversions among these three states are signified by directed lines. In the above diagram, the inputs and outputs are denoted with 0/0, 1/0, and 1/1. Based on the input value, there are two conversions from every state.

Generally, the amount of required states in the mealy machine is below or equivalent to the number of required states in Moore state machine. There is an equal Moore state machine for every Mealy state machine. As a result, based on the necessity we can employ one of them.

### Moore State Machine

When the outputs depend on current states then the FSM can be named as Moore state machine. The Moore state machine’s block diagram is shown below. The Moore state machine block diagram consists of two parts namely combinational logic as well as memory.

In this case, the current inputs, as well as current states, will decide the next states. Thus, depending on further states, this machine will generate the outputs. So, the outputs of this will be applicable simply after the conversion of the state.

The Moore state machine state diagram is shown below. In the above state, the diagram includes four states like a mealy state machine namely A, B, C, and D. the four states as well as individual outputs are placed in the circles.

In the above figure, there are four states, namely A, B, C & D. These states and the respective outputs are labeled inside the circles. Here, simply the input worth is marked on every conversion. In the above figure includes two conversions from every state depending on the input value.

Generally, the amount of required states in this machine is greater than otherwise equivalent to the required number of states in the mealy state machine

Generally, the number of required states in this machine is more than otherwise equivalent to the required states in MSM (Mealy state machine). For every Moore state machine, there is a corresponding Mealy state machine. Consequently, depending on the necessity we can utilize one of them.

There is an equal mealy state machine for every Moore state machine. As a result, based on the necessity we can employ one of them.

### Finite State Machine Applications

The finite state machine applications mainly include the following.

FSMs are used in games; they are most recognized for being utilized in artificial intelligence, and however, they are also frequent in executions of navigating parsing text, input handling of the customer, as well as network protocols.

These are restricted in computational power; they have the good quality of being comparatively simple to recognize. So, they are frequently used by software developers as well as system designers for summarizing the performance of a difficult system.

The finite state machines are applicable in vending machines, video games, traffic lights, controllers in CPU, text parsing, analysis of protocol, recognition of speech, language processing, etc.

### Advantages of Finite State Machine

The advantages of Finite State Machine include the following.

• Finite state machines are flexible
• Easy to move from a significant abstract to a code execution