Download presentation

Presentation is loading. Please wait.

Published byAugust Porritt Modified over 2 years ago

1
Denise Landau 2013 3.1.1 Fundamentals of Problem Solving Finite State Machines Denise Landau 2013 AQA Computing COMP1

2
Denise Landau 2013 What is a Finite State Machine? A state machine is any device that stores the status of something at a given time, and can operate on input to change the status and/or cause to take place for any given change. It consists of: states, input, and outputs Suitable for controlling processes that react to local conditions only. The machine is in only one state at a time – the current state. It can change from one state to another when initiated by a triggering event or condition – the transition. Have limited memory – which is limited by the number of states.

3
Denise Landau 2013 Mealy Machine Mealy machine is a finite-state machine whose output values are determined both by its current state and the current inputs The Mealy machine is named after George H. Mealy, who presented the concept in a 1955 paper, “A Method for Synthesizing Sequential Circuits”. This is in contrast to a Moore machine, which is an FSM whose output values are determined solely by its current state.

4
Denise Landau 2013 Mealy Machine A simple Mealy machine has one input and one output. More complex Mealy machines can have multiple inputs as well as multiple outputs. Mealy machines provide a rudimentary mathematical model for cipher machines - a Mealy machine can be designed that given a string of letters (a sequence of inputs) can process it into a ciphered string (a sequence of outputs

5
Denise Landau 2013 Examples of FSM Vending machines (dispense products when the proper combination of coins is deposited) Lifts (stop at the upper floors before going down) Traffic lights (change sequence when cars are waiting) Combination locks (numbers must be input in the right order) Protocols and communication systems (WLAN, Bluetooth, 3G, 4G) Satellites critical systems – modelled, implemented or tested using FSM KEYWORD: Automation

6
Denise Landau 2013 Finite State Machines with Outputs When an FSM produces a response when making a transition, this is an output.

7
Denise Landau 2013 Finite State Machines without Outputs An FSM without outputs is called a Finite State Automaton (FSA)

8
Denise Landau 2013 Extension – Stretch and Challenge TCP has been modelled using an Extended FSM 1- Always remembers the current state in the variable (CurrState) and the previous state in the variable (PrevState) 2- The TCP endpoint has unlimited buffer space (e.g., buffer space to queue SENDs and RECEIVEs is always available) 3- In any state, whenever a segment is sent, the segment is added to the Retransmission Queue (Rexmt Queue) and the retransmission timer (REXMT) is started. 4- The (REXMT TIMEOUT) event has been modeled in all states except (FIN-WAIT-2, TIME-WAIT, CLOSED), since in these states the endpoint have already received an ACK of its FIN segment (i.e., will not transmit any segments afterwards). 5- The (TIMEWAIT TIMEOUT) event has been modeled in (TIME-WAIT) state only. In all other states, this timer is irrelevant. Follow this link for more information: http://www.lisha.ufsc.br/teaching/dos/ine5357-2009-1/work/g2/final/TR2005-07-22-tcp-EFSM.pdf

9
Denise Landau 2013 State Transition Diagrams You must be able to draw and interpret simple state transition diagrams A finite state machine expressed visually is a State transition diagram Shows all the states, inputs and outputs. Not all FSMs will have an accept states and it is possible they could run for ever 1. Each state is represented with a circle 2. Each transition is shown with an arrow. Transitions are labelled with an input that causes a transition and possibly an output that results from it. 3. Double circle signifies the accept state.

10
Denise Landau 2013 State Transition Diagrams In this diagram we can see that it starts in state S1 An input of 1 will keep it in state one 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: A finite state automaton (no outputs) accepting binary input 110011001001110011

11
Denise Landau 2013 State Transition Diagrams 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.

12
Denise Landau 2013 State Transition Diagrams Try: You will be stuck in state S2 and the FSM has not accepted. 110011011 The rules: An input of 1 will keep it in state one 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.

13
Denise Landau 2013 State Transition Diagrams- Exercise Which of these inputs are valid: 1.aaacdb 2.ababacdaaac 3.abcdb 4.acda 5.acdbdb

14
Denise Landau 2013 Exercise Answer Answer : 1.aaacdb (CORRECT) 2.ababacdaaac(CORRECT) 3.abcdb (ERROR no input that accepts b then c) 4.acda (ERROR S1 is not a accepting state) 5.ac (CORRECT)

15
Denise Landau 2013 State Transition Tables You must be able to draw and interpret simple state transition tables A state transition table is a table showing what state (or states ) finite state machine will move to, based on the current state and other inputs. It is essentially a truth table in which some of the inputs are the current state, and the outputs include the next state, along with other outputs.

16
Denise Landau 2013 Exercise Create a state transition table for the following FSM:

17
Denise Landau 2013 Exercise Answer

18
Denise Landau 2013 Example: Turnstile State diagram for a turnstile A turnstile, used to control access to subways and amusement park rides, is a gate with three rotating arms at waist height, one across the entryway. Initially the arms are locked, barring the entry, preventing customers from passing through. Depositing a coin or token in a slot on the turnstile unlocks the arms, allowing a single customer to push through.token After the customer passes through, the arms are locked again until another coin is inserted. Considered as a state machine, the turnstile has two states: Locked and Unlocked. [2] [2]

19
Denise Landau 2013 Example: Turnstile There are two inputs that affect its state: putting a coin in the slot (coin) and pushing the arm (push). In the locked state, pushing on the arm has no effect; no matter how many times the input push is given, it stays in the locked state. Putting a coin in – that is, giving the machine a coin input – shifts the state from Locked to Unlocked. In the unlocked state, putting additional coins in has no effect; that is, giving additional coin inputs does not change the state. However, a customer pushing through the arms, giving a push input, shifts the state back to Locked.

20
Denise Landau 2013 Example: Turnstile The turnstile state machine can be represented by a state transition table, showing for each state the new state and the output (action) resulting from each input

21
Denise Landau 2013 References http://www.swisseduc.ch/compscience/ http://www.swisseduc.ch/compscience/karatojava/docs/programming _general_education.pdf https://en.wikibooks.org/wiki/A- level_Computing/AQA/Problem_Solving,_Programming,_Data_Represe ntation_and_Practical_Exercise/Problem_Solving/Finite_state_machine s

Similar presentations

OK

AQA AS Level Finite state machines Computer Science Unit 2

AQA AS Level Finite state machines Computer Science Unit 2

© 2017 SlidePlayer.com Inc.

All rights reserved.

Ads by Google

Ppt on postal life insurance Ppt on seed production technology Ppt on tcp/ip protocol suite ppt Ppt on conservation of environment natural resources Animated ppt on magnetism worksheet Ppt on digestive system of human body download Ppt on ramayana in hindi Ppt on data hiding in video using least bit technique Ppt on trial and error band Ppt on recycling of waste fabric