Download presentation
Presentation is loading. Please wait.
Published byVivian Hodge Modified over 9 years ago
1
Copyright © 2011-2014 - Curt Hill Finite State Machines The Simplest and Least Capable Automaton
2
Automata Lets imagine a simple machine as a model of computation It must have: Input –Assume a string of characters from some alphabet A control unit with an internal state Output –Output is determined by input and state Copyright © 2011-2014 - Curt Hill
3
Transition Function Each Finite State Automaton must have a transition function This transition function requires two parameters: –The current state –The current input value The result is the new state Any pair of parameters that has no defined result generates an error state Copyright © 2011-2014 - Curt Hill
4
Models This simple automaton may be modeled in several ways A state chart –On one side is the state –On the other is the inputs A graph –Each node represents a state –Each arc an input that causes the state change Copyright © 2011-2014 - Curt Hill
5
Examples Copyright © 2011-2014 - Curt Hill s0 s1 s2 a b b a a b s0 s1 s2 ba s0 s1 s2
6
Text Example Rosen gives the example of a vending machine This is more complicated that we can show in PowerPoint –7 States –5 possible inputs Copyright © 2011-2014 - Curt Hill
7
FSM or FSA? A Finite State Machine may also be known as a Finite State Automaton They come in two flavors –Producing Output –Not producing Output Strangely we will deal with the Output producing first Copyright © 2011-2014 - Curt Hill
8
More Formally An output producing finite state machine is 6 tuple M=(S,I,O,f,g,s 0 ) S is a set of states I is the set of inputs O is the set of outputs f is the transition function g is the output function s 0 is the initial state Copyright © 2011-2014 - Curt Hill
9
The functions The functions in the above are f and g The transition function, f, takes two inputs –Current state –Input symbol The function then produces the new state The output function, g, takes the same two inputs, but produces the output symbol instead of the next state Copyright © 2011-2014 - Curt Hill
10
Function Representation We have already seen the table representation of the transition function The output function has the same form, although the two are often combined into a single table In the graph form the arcs are labeled first by the input and then the output See next slide Copyright © 2011-2014 - Curt Hill
11
Output Example Copyright © 2011-2014 - Curt Hill s0 s1 s2 a,0 b,2 b,1 a,1 a,2 b,0 s0 s1 s2 ba s0 s1 s2 s0 s1 s2 ba 0 0 1 1 2 2 Transition, fOutput, g Initial is s0
12
Example Continued Copyright © 2011-2014 - Curt Hill s0 s1 s2 a,0 b,2 b,1 a,1 a,2 b,0 s0 s1 s2 ba s0 s1 s2 s0 s1 s2 ba 0 0 1 1 2 2 Transition, fOutput, g Initial is s0 What outputs with these inputs: ababbab aaabbbba aabaaaabab
13
Other Way Given a FSM and an input we should be able to show the output Can we go the other way? –Given a language can we compute the FSM? How do we specify that language? Copyright © 2011-2014 - Curt Hill
14
Problem We want an FSM that takes a bit string and outputs a modified bit string If we number the bits from 1 –Odd bits are output unchanged –Even bits are reversed Lets pause a moment and consider what the state table would look like Copyright © 2011-2014 - Curt Hill
15
Output Example Copyright © 2011-2014 - Curt Hill s0 s1 1,1 1,0 s0 s1 10 s0 s1 s0 Transition, fOutput, g Initial is s0 s0 s1 10 0 0 1 1 0,0 0,1
16
Finally Several different machines Mealy machines (G.H. Mealy) are the output machines considered here Moore machines (E.F. Moore) gives an output based only on state –This is not Gordon Moore of Moore’s Law Copyright © 2011-2014 - Curt Hill
17
Exercises 13.2 –3, 5, 13, 19 Copyright © 2011-2014 - Curt Hill
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.