finite state machine(fsm). what is meant by “finite”? finite means countable. what is finite...
TRANSCRIPT
![Page 1: Finite State Machine(FSM). What is meant by “Finite”? Finite means countable. What is Finite State Machine? A machine that consists of a fixed set of](https://reader036.vdocument.in/reader036/viewer/2022082817/56649da75503460f94a92d95/html5/thumbnails/1.jpg)
Finite State Machine(FSM)
![Page 2: Finite State Machine(FSM). What is meant by “Finite”? Finite means countable. What is Finite State Machine? A machine that consists of a fixed set of](https://reader036.vdocument.in/reader036/viewer/2022082817/56649da75503460f94a92d95/html5/thumbnails/2.jpg)
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.
![Page 3: Finite State Machine(FSM). What is meant by “Finite”? Finite means countable. What is Finite State Machine? A machine that consists of a fixed set of](https://reader036.vdocument.in/reader036/viewer/2022082817/56649da75503460f94a92d95/html5/thumbnails/3.jpg)
• 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.
![Page 4: Finite State Machine(FSM). What is meant by “Finite”? Finite means countable. What is Finite State Machine? A machine that consists of a fixed set of](https://reader036.vdocument.in/reader036/viewer/2022082817/56649da75503460f94a92d95/html5/thumbnails/4.jpg)
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.
![Page 5: Finite State Machine(FSM). What is meant by “Finite”? Finite means countable. What is Finite State Machine? A machine that consists of a fixed set of](https://reader036.vdocument.in/reader036/viewer/2022082817/56649da75503460f94a92d95/html5/thumbnails/5.jpg)
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.
![Page 6: Finite State Machine(FSM). What is meant by “Finite”? Finite means countable. What is Finite State Machine? A machine that consists of a fixed set of](https://reader036.vdocument.in/reader036/viewer/2022082817/56649da75503460f94a92d95/html5/thumbnails/6.jpg)
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.• If the elevator is on the floor 1 and the floor• requested is the floor 2, then the elevator is• raised up 1 floor.• If the elevator is on the floor 1 and the 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.
![Page 7: Finite State Machine(FSM). What is meant by “Finite”? Finite means countable. What is Finite State Machine? A machine that consists of a fixed set of](https://reader036.vdocument.in/reader036/viewer/2022082817/56649da75503460f94a92d95/html5/thumbnails/7.jpg)
![Page 8: Finite State Machine(FSM). What is meant by “Finite”? Finite means countable. What is Finite State Machine? A machine that consists of a fixed set of](https://reader036.vdocument.in/reader036/viewer/2022082817/56649da75503460f94a92d95/html5/thumbnails/8.jpg)
If the elevator is on the floor 2 and the floorrequested is the floor 2, then the elevatorremains on the floor 2.If the elevator is on the floor 2 and the floorrequested is the floor 3, then the elevator israised up 1 floor.If the elevator is on the floor 3 and the floorrequested is the floor 1, then the elevator islowered down 2 floors.If the elevator is on the floor 3 and the floorrequested is the floor 2, then the elevator islowered down 1 floor.If the elevator is on the floor 3 and the floorrequested is the floor 3, then the elevatorremains on the floor 3.
![Page 9: Finite State Machine(FSM). What is meant by “Finite”? Finite means countable. What is Finite State Machine? A machine that consists of a fixed set of](https://reader036.vdocument.in/reader036/viewer/2022082817/56649da75503460f94a92d95/html5/thumbnails/9.jpg)
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
![Page 10: Finite State Machine(FSM). What is meant by “Finite”? Finite means countable. What is Finite State Machine? A machine that consists of a fixed set of](https://reader036.vdocument.in/reader036/viewer/2022082817/56649da75503460f94a92d95/html5/thumbnails/10.jpg)
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.
![Page 11: Finite State Machine(FSM). What is meant by “Finite”? Finite means countable. What is Finite State Machine? A machine that consists of a fixed set of](https://reader036.vdocument.in/reader036/viewer/2022082817/56649da75503460f94a92d95/html5/thumbnails/11.jpg)
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.
![Page 12: Finite State Machine(FSM). What is meant by “Finite”? Finite means countable. What is Finite State Machine? A machine that consists of a fixed set of](https://reader036.vdocument.in/reader036/viewer/2022082817/56649da75503460f94a92d95/html5/thumbnails/12.jpg)
State transition diagram for a ballpoint
State 0 State 1
• State 0 = ballpoint retracted.• State 1 = ballpoint extended.
Button clicked
Button clicked
![Page 13: Finite State Machine(FSM). What is meant by “Finite”? Finite means countable. What is Finite State Machine? A machine that consists of a fixed set of](https://reader036.vdocument.in/reader036/viewer/2022082817/56649da75503460f94a92d95/html5/thumbnails/13.jpg)
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.
![Page 14: Finite State Machine(FSM). What is meant by “Finite”? Finite means countable. What is Finite State Machine? A machine that consists of a fixed set of](https://reader036.vdocument.in/reader036/viewer/2022082817/56649da75503460f94a92d95/html5/thumbnails/14.jpg)
State transition table for ballpoint(FSM)
Input Current state Next state
Button clicked Ballpoint retracted Ballpoint extended
Button clicked Ballpoint extended Ballpoint retracted
![Page 15: Finite State Machine(FSM). What is meant by “Finite”? Finite means countable. What is Finite State Machine? A machine that consists of a fixed set of](https://reader036.vdocument.in/reader036/viewer/2022082817/56649da75503460f94a92d95/html5/thumbnails/15.jpg)
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’
![Page 16: Finite State Machine(FSM). What is meant by “Finite”? Finite means countable. What is Finite State Machine? A machine that consists of a fixed set of](https://reader036.vdocument.in/reader036/viewer/2022082817/56649da75503460f94a92d95/html5/thumbnails/16.jpg)
Decision table for the logical expression
Rules & condition options: T for true and F for False
Conditions X > 6 T T F F
Y < 7 T F T F
Actions Output ‘pass’
X
Output ’fail’ X X X
![Page 17: Finite State Machine(FSM). What is meant by “Finite”? Finite means countable. What is Finite State Machine? A machine that consists of a fixed set of](https://reader036.vdocument.in/reader036/viewer/2022082817/56649da75503460f94a92d95/html5/thumbnails/17.jpg)
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.
![Page 18: Finite State Machine(FSM). What is meant by “Finite”? Finite means countable. What is Finite State Machine? A machine that consists of a fixed set of](https://reader036.vdocument.in/reader036/viewer/2022082817/56649da75503460f94a92d95/html5/thumbnails/18.jpg)
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’.