13.07.2015 Views

Chapter D Finite State Machines

Chapter D Finite State Machines

Chapter D Finite State Machines

SHOW MORE
SHOW LESS
  • No tags were found...

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

D7. The usefulness of <strong>Finite</strong> <strong>State</strong> <strong>Machines</strong>Before we consider some further examples, it’ stime to sit back and reflect on theusefulness of FSM’s. Sure we have constructed some nice graphical diagrams tocapture the behaviour of some systems, but what can be do with these? Let’s addressthis question here, and summarise the most important characteristics of FSMs1. They give us a simple and intuitive way of describing a system which hasdiscrete dynamics (that’s our <strong>State</strong> Transition Diagrams).2. They give us a complete and unambiguous way of describing a system3. An FSM is an “abstract machine” That means that we can make amathematical description of the machine reason about its behaviour withoutactually building it.4. Since the description is mathematical, we can use mathematical proof to besure of the functioning of the machine.5. They can be directly and unambiguously converted into a computer program(e.g. via the “SDL” language).6. They can be directly and unambiguously converted into a digital electroniccircuits.Wow, that’s something, but what does this all mean? Well, simply that you’ll seeFSMs everywhere from now on! But of particular interest to the engineer are points(5) and (6) which tell us that if we can construct a FSM for a system, we can directlygenerate the computer program or digital electronic circuit which will make thatsystem work: The above traffic-light FSM can be concerted into an electronic circuitto run the traffic-lights, and so can the door counter. Also the examples we shall soonsee concerning recognition of words in sentences can be directly converted intocomputer programs. We shall return to discuss the mathematical aspects in chapter??D8. Acceptors and Transducers - Recognising LaughterImagine a microphone connected to your computer which was programmed torecognise whether someone was laughing in the room. It would have to recognise“Ha!”, “HaHa!”, “HaHaHa!” and so on. This is quite easy and could be constructedusing the FSM shown below, where we assume that the FSM gets a series ofcharacters as its input events. Have a look at Figure 9. From the starting state Q1, itmay only exit if a “H” is observed. If any other character is received, (which is not an“H”) then it returns to itself, that’s the loop labelled “~H” where the tilde “~” is thelogic symbol for “not”. Having received an “H” the FSM is in state Q2. If the nextcharacter received is then an “a”, then the machine proceeds to Q3. But any othercharacter does not fit into the required substring Ha and so a transition back to thestarting state must be made, this is labelled “~a”. Once in state Q3 three things canhappen; (i) a “!” is received signalling the end of the “Ha”, in which case we exit tothe terminal state Q4, (ii) a “h” is received in which case we return to Q2 inexpectation of an associated “a”, or (iii) any other character is received in which casewe have an incorrect string and we must exit to S1 the starting state.This FSM only outputs a response R=1 when it has recognised a specific pattern ofinput stimuli. Such FSMs are called “acceptors” since they are built to accept one or

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!