1 / 10

Finite-state Machines

Finite-state Machines. Chapter 14. Designing with FSMs. Finite state machines are ideal for reactive systems. A typical way of thinking about an FSM is “state-stimulus-response”: In a particular state , a stimulus will provoke a particular response. Formal Finite-state Automata.

nitsa
Télécharger la présentation

Finite-state Machines

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 Chapter 14

  2. Designing with FSMs • Finite state machines are ideal for reactive systems. • A typical way of thinking about an FSM is “state-stimulus-response”: In a particular state, a stimulus will provoke a particular response.

  3. Formal Finite-state Automata • Simple graphical representation: Simulus/Response State A State B

  4. Example FSM specification • The controller will respond to a over-temperature condition with a system shutdown reaction. System over temperature / Emergency Shutdown Normal Operation Emergency Shutdown

  5. Model Checking • FSM has a basis in mathematics: Finite state automata. This allows checking for forbidden conditions. • FSMs must be deterministic: for each and every state, there must be one and only one response for that simulus in that state. • As FSMs become more complex, manual checking for determinism becomes more and more difficult, so automation of checking is more desirable.

  6. Coding an FSM Design • FSM code lends itself to automatic generation by tools. • Hand-coded FSMs are often table driven, with two sets of tables, one representing the state-response relationship (indexed by stimulus), the other representing the current state-next state relationship (also indexed by stimulus).

  7. z/S A B C s/Q y/R Finite State Machine with Pseudo code A: Get next event E CASE E OF x: Do action Q GOTO B z: Do action S GOTO C ESAC Print ‘Illegal first event’ and abort B: Get next event if not y THEN Print ‘Event must be y’ and abort FI Do action R GOTO C C: IF any next event THEN Print ‘No more events allow3ed’ and abort FI

  8. Page 55, Figure 2.2 State Diagrams for Alarm Clock Example

  9. States for the Tool Booth Controller

  10. State Diagram for Toll Booth Controller

More Related