1 / 18

Finite State Machine(FSM)

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 possible states with a set of allowable inputs that change the state and a set of possible outputs.

Download Presentation

Finite State Machine(FSM)

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

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. • 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.

  7. If the elevator is on the floor 2 and the floor requested is the floor 2, then the elevator remains on the floor 2. If the elevator is on the floor 2 and the floor 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. If the elevator is on the floor 3 and the floor requested is the floor 2, then the elevator is lowered down 1 floor. If the elevator is on the floor 3 and the floor requested is the floor 3, then the elevator remains on the floor 3.

  8. 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

  9. 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.

  10. 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.

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

  12. 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.

  13. State transition table for ballpoint(FSM)

  14. 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’

  15. Decision table for the logical expression

  16. 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.

  17. 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’.

More Related