Finite State Machine

You might also like

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 3

Pramuka Ehagama CSIS 221

Page |1

Finite State Machine


Finite state machine is a mathematical model used to design computer programs and digital logic circuits. It is developed over the basics of an abstract machine that can be in states of one to finite number of times. Finite state machine can be in one stage at a time and changes into another state in sequence. This change into another state is transition and it happens by triggering an event or condition. Finite state machine can also be described as a simplest model of expressing of behaviors of a system or a complex machine with limited number of defined conditions or states where transition can be take place with one state to another. Finite state machines can be dragged into few small states into large number of steps with regard to what we want to implement. It is expandable to many states and can be reduced to few states as well. Due to this paradigm, finite state diagrams are used as structural blueprints of implementations such as electrical designs and even in programming algorithms. In terms of Computer systems, finite state machine can be shown as fetch decode execute store model as its simplest form of description. Computer can be described in many models of finite state machine. Central Processing Unit also can be gathered into a finite state machine model. It may take Input Process Output model as its simplest version of executing certain commands and generating or controlling via output. As a model regarding to CPU structure, we can get the example of LC3 computer CPU in the syllabus. In LC3 CPU, inputs were taken in and transported through the Main Data Path BUS and given into the finite state machine. When given in steps of the flow of states, it may take the fetch decode evaluate address fetch operands execute store result model of view. In the CPU, the states will take part as this. First, data will be input into the CPU by RAM and written into the registers in one state. Then the data will be passed into CPU and decoded and processed as Arithmetic operations or Control operations. Then those will be returned into registers again and when it comes to next state, it will be back to RAM and then moved into its output positions. The transitions of finite state machine will be managed in CPU structure by the CPU clock. Only few states will be there with large number of occurrences. So the CPU can be viewed as a somewhat complex finite state machine with few internal states, but with large executing frequency.

Pramuka Ehagama CSIS 221


Page |2

Consider ON and OFF states of a switch of a bulb. It also makes a finite state machine. When you got an input of 0/1, then initial state we shall take as OFF which can be shown as state of 0. Eventually, the next state will be 1 which is the ON state. When we start with the initial state; 0, we input 0. Then the bulb will remain OFF and will not be changed into the next state. Also, it will not give any output. When we give input as 1, from the current state of 0 which is OFF, bulb will be triggered by that event of input and changed into the next state which is ON state. Then the bulb will be lit. In that state, we can enter 0 to toggle into OFF state again. If the input is 1, then bulb will remain lightened and remained in the state of ON. Output will be the lightened bulb. We can see another example of finite state machine by looking at the vending machines we get coke cans. As finite state machine models, vending machine holds coins, selection of drink and money back option as inputs to the finite state model. Then it gives us the outputs of coke can or money return. As in terms, only one output will be at the end of one sequence. States of this finite model can be viewed as initial state, money input, selection state of drink, money return state and drop coke can. When we start by the initial state, which is idle at all it means. Then we input coin. This is a state. After the input, we give another input of selection of drink or money back option. Those are two states which handle two different inputs and if you choose one, you skip the other. After that state, we enter into chosen state regards to the money back or selected drink. In the selected drink state, we then moved into the drop the can state. In the money back state, we passed into the money returning state and the output has given. In either state, we come to an end of the sequence and presented the output. Through this state flow and input-output, we find a finite state machine model representation. Although this is a very simplest form of this finite state model, this can be expandable into many levels of states that describe more states and input selections.

Pramuka Ehagama CSIS 221


Page |3

References:
1. "Finite-state Machine." Wikipedia, the Free Encyclopedia. Wikipedia, 1 Nov. 2011. Web. 20 Nov. 2011. <http://en.wikipedia.org/wiki/Finite-state_machine>. 2. Brownlee, Jason. "Finite State Machines (FSM)." Artificial Intelligence Depot. Web. 20 Nov. 2011. <http://ai-depot.com/FiniteStateMachines/FSM-Background.html>. 3. Devadas, Srinivas. "Finite State Machines." Csail.mit.edu. 24 Feb. 1998. Web. 21 Nov. 2011. <http://6004.csail.mit.edu/Spring98/Lectures/lect6/index.htm>.

You might also like