Presentation is loading. Please wait.

Presentation is loading. Please wait.

1.3 Finite State Machines.

Similar presentations


Presentation on theme: "1.3 Finite State Machines."— Presentation transcript:

1 1.3 Finite State Machines

2 What is a FSM? A theoretical tool used by computer scientists
Attempts to describe a protocol or algorithm Virtual machine that progresses through a series of stages of operation in response to various events State – status of a algorithm Transition – act of moving from one state to another Event – something that causes a transition to occur between states Action – response to an event before a transition

3 State Diagram of a Simple Soda Vending Machine

4 FSM Definition A finite state machine consists of a set of input symbols and if it produces output, a set of output symbols, a finite set of states and a transition function that maps a state-symbol pair to a state and possibly generates an output depending on the type of FSM.

5 Why FSM are useful? Modelling and designing Vending machines Lifts
Traffic light controllers Specifying a language Programs for Spell checking Grammar checking Processing HTML and XML

6 State transition diagrams
Symbol Meaning State Starting state – this usually has an arrow going towards it Accept (or end) state Connector (where i is the input) Connector (where i is the input and k is the output) A state transition diagram represents a FSM i i/k

7 State transition diagram for an FSM with outputs
b | a a | b

8 Transition table for the FSM
Current state s t Input symbol a b Next state Output symbol The FSM has a transition function that maps a state-symbol pair to a state and may generate an output. This table represents the transition function. What does this FSM do? s t b | a a | b

9 What is the output Y from the FSM when the input X is 001011
What is the output Y from the FSM when the input X is ? Assume that the bits are submitted to the FSM in the order of msb through to lsb. X Y FSM 1 | 0 S0 S1 0 | 0 0 | 1 000100

10 (Finite State Automata)
Types of FSM FSM With Output Without Output (Finite State Automata) Mealy Machine Moore Machine

11 Finite State Automata FSM without output
Restricted to decision problems Problems that are solved by answering Yes or No e.g. language syntax, parity operations S0 S1 b a S2 S3

12 FSMs with output Most common controller of machines
E.g. lifts, traffic lights, washing machines Mealy machines Moore machines See pedestrian crossing and traffic lights example pg 29 in A2 book

13 Moore machine A FSM that determines its outputs from the present state only The current state of a Moore FSM is determined by the sequence of inputs that it has processed Any electronic circuit with a memory is a Moore FSM

14 Mealy machines A FSM that determines its outputs from the present state and from the inputs See traffic light system page 30 in A2 book

15 Non-deterministic FSMs
For some states there is more than one transition labelled with the same trigger It is an FSM with several possible next states for each pair of input symbol and state E.g. searching documents


Download ppt "1.3 Finite State Machines."

Similar presentations


Ads by Google