Presentation is loading. Please wait.

Presentation is loading. Please wait.

Finite State Machine(FSM)

Similar presentations


Presentation on theme: "Finite State Machine(FSM)"— Presentation transcript:

1 Finite State Machine(FSM)

2 What is meant by “Finite”?
Finite means countable. What is Finite State Machine? A machine that consists of a fixed set of possible states with a set of allowable inputs that change the state and a set of possible outputs.

3 A finite state machine consists of
States Inputs Outputs. The number of states is fixed; when an input is executed, the state is changed and an output is possibly produced.

4 Example: Vending machines, traffic signals, Elevators, combination locks etc. A lift is very common example of a finite state machine. The lift system has inputs and outputs. One input occurs when a person on second floor press the request button. One output will occur to that person showing him the current position of the lift.

5 Memory and logic device
A lift must have a memory to store the current state of the lift to move in desired direction. A lift must have a logic device to determine the next step and update the memory to reflect the new state. To move in desired direction the lift must know the current state of lift and what step to take next.

6 Elevator steps If the elevator is on the floor 1 and the floor
requested is the floor 1, then the elevator remains on the floor 1. requested is the floor 2, then the elevator is raised up 1 floor. requested is the floor 3, then the elevator is raised up 2 floors. If the elevator is on the floor 2 and the floor requested is the floor 1, then the elevator is lowered down 1 floor.

7

8 If the elevator is on the floor 2 and the floor
requested is the floor 2, then the elevator remains on the floor 2. requested is the floor 3, then the elevator is raised up 1 floor. If the elevator is on the floor 3 and the floor requested is the floor 1, then the elevator is lowered down 2 floors. requested is the floor 2, then the elevator is lowered down 1 floor. requested is the floor 3, then the elevator remains on the floor 3.

9 State Transition Diagram
State transition diagram represent an FSM graphically. Each state is represented by a circle. Each transition is represented by an arrow. It is used to show all the states, inputs and outputs

10 Significance of FSM FSMs are so useful because they can recognise sequences. The set of recognisable sequences can be legal and valid programs in a given programming language.

11 Example of an FSM A ball point is an example of an FSM.
It has finite number of states: Ballpoint extended Ballpoint retracted. It has a set of possible inputs : clicking the pen’s button. It has a set of possible outputs: retracting or extending of ballpoint.

12 State transition diagram for a ballpoint
State 0 = ballpoint retracted. State 1 = ballpoint extended. Button clicked State 0 State 1

13 State Transition table
A state transition table is a table showing what state a finite state machine will move to, based on the current state and other inputs.

14 State transition table for ballpoint(FSM)
Input Current state Next state Button clicked Ballpoint retracted Ballpoint extended

15 Decision table A table that show the possible outcomes for a given logical condition. Decision table makes it easy to observe what are all possible conditions? Example if X > 6 and Y < 7 then output ‘pass’ else output ‘fail’

16 Decision table for the logical expression
Rules & condition options: T for true and F for False Conditions X > 6 T F Y < 7 Actions Output ‘pass’ X Output ’fail’

17 Finite state automata A finite state machine with no output is called finite state automata. FSA have an initial state and one or more accepting state and a double circle to indicate the accepting state or goal state.

18 Mealy machine FSMs with outputs have an initial state and usually no accepting states. They are called mealy machines. The intial state is indicated with a special arrow labelled ‘start’.


Download ppt "Finite State Machine(FSM)"

Similar presentations


Ads by Google