1 / 24

FINITE STATE MACHINES AND STATE TRANSITION DIAGRAMS

FINITE STATE MACHINES AND STATE TRANSITION DIAGRAMS. TOPIC REVIEW. A technical support company writes a decision table to diagnose printer problems based upon symptoms described to them over the phone from their clients. They type the following data into the advice program :

chessa
Download Presentation

FINITE STATE MACHINES AND STATE TRANSITION DIAGRAMS

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 MACHINES AND STATE TRANSITION DIAGRAMS

  2. TOPIC REVIEW • A technical support company writes a decision table to diagnose printer problems based upon symptoms described to them over the phone from their clients. They type the following data into the advice program: • Printer does print • Red light is flashing • Printer is recognized • The program then uses the decision table to find the correct actions to perform, namely that of Check / Replace ink. • Printer troubleshooter

  3. Finite State machines A Finite State Machine (FSM) is an abstract machine, although it can be implemented using electronics, mechanics or software. A lot of processors use a finite state machine at their core. A FSM is a machine that consists of a set of possible states with a set of allowable inputs that change the state and a set of possible outputs. A finite state machine is abstract; so state transition diagrams and tables are used to show them in either a tabular or a diagrammatic form.

  4. Finite: the states that the FSM can be ‘in’ are finite (for AS-level they will also be very simple) • State: the FSM can be in one of a number of states at any one time • Machine: the FSM works according to a number of rules: when it is in a state and sees a particular input (key press, digit, signal) it moves to another state (possibly the same state) and (possibly) outputs a result

  5. Example A ballpoint pen has two states: • Ballpoint retracted • Ballpoint extended It has one input: • Clicking the pen’s button It has two outputs: • Retracting the ballpoint • Extending the ballpoint You can describe the FSM in pictorial terms, in a state transition diagram:

  6. click button, retract State 1: extended State 0: retracted click button, extend

  7. TERMINOLOGY • If there are no outputs then the FSM is known as a Finite State Automaton (FSA): FSMs and FSAs are particularly useful for recognising sequences, e.g., the sequences of characters that make up a valid identifier in a programming language.

  8. Looking at the above diagram we can see that it starts in state S1, an input of 1 will keep it in state one, and an input of 0 will move it to state S2. Once in S2 an input of 1 will keep it there, and an input of 0 will switch it back to S1. This means that the following inputs are valid: 110011001 001110011

  9. It might appear to accept any binary value, but this isn't true. The only state it can accept in is state S1. This places the following rule on all accepted inputs: "A combination of binary digits involving an even number of zeros". This is useful for parity checks. If you try the following: 110011011

  10. For the FSM,which of these inputs are valid: aaacdb ababacdaaac abcdb acda acdbdb

  11. Draw a finite state automata that will accept the word Banana whilst using only 3 states

  12. FSM with outputs • This type of machine is used when we want to do more than just recognise a sequence, such as the sequence of letters in the word Banana.

  13. Mealy Machine • In the Mealy machine the labels on the Transition lines have changed to reflect the action that would initiate the Transition and the Output from the Machine • We might want a machine starting in the initial state S0 to translate and Output a sequence of received 0s, 1s and 2s into plain text consisting of the letters X, Y and * according to the following rules:

  14. CREATE THE FOLLOWING OUTLINE FSM

  15. The system begins receiving in the initial state S0. • If the received digit is 0 and the system is in state S0, output letter X. • If the received digit is 1 and the system is in state S0, change state to S1 and output letter Y. • If the received digit is 2 and the system is in state S0, change state to S2 and output the character *. • If the received digit is 0 and the system is in state S1, change state to S0 and output letter X. • If the received digit is 1 and the system is in state S1, output letter Y. • If the received digit is 2 and the system is in state S1, change state to S2 and output the character *.

  16. State transition tables Rather than draw out a diagram to determine what an FSM does we can use a State transition table. A State transition table shows the effect on the current state of an FSM of particular inputs and any corresponding outputs. Referring to the previous example, with the inputs 0s, 1s and 2s and outputs X, Y and *, a State transition table for this would be:

  17. Example Suppose we have an FSM that turns the inputs 0, 1, 2 into the outputs A, B,! The state transition diagram looks like this: Draw the State Transition Table for the example

  18. For the Mealy machine, what do the following inputs output? 50 20,10,20 10,10,10,20 What does this machine do, what do the outputs tell you?

  19. Complete Question 4 of the 2012 exam paper

More Related