State Machines. What are they? Sometimes called a “Finite State Machine” Depicted as a “state diagram” It’s a tool for specifying a system’s behavior.

Slides:



Advertisements
Similar presentations
Sequential Logic Circuits. Set-Reset Latch The Set-Reset latch or bistable is a simple sequential logic circuit that remembers what has happened to the.
Advertisements

State Charts Mehran Najafi. Reactive Systems A reactive, event-driven, object is one whose behavior is best characterized by its response to events dispatched.
Denise Landau Fundamentals of Problem Solving Finite State Machines Denise Landau 2013 AQA Computing COMP1.
Give qualifications of instructors: DAP
Sequential Circuits1 DIGITAL LOGIC DESIGN by Dr. Fenghui Yao Tennessee State University Department of Computer Science Nashville, TN.
Circuits require memory to store intermediate data
CHAPTER 1: AN OVERVIEW OF COMPUTERS AND LOGIC. Objectives 2  Understand computer components and operations  Describe the steps involved in the programming.
Finite state machines.
CS 151 Digital Systems Design Lecture 37 Register Transfer Level
1 CS 106, Winter 2009 Class 4, Section 4 Slides by: Dr. Cynthia A. Brown, Instructor section 4: Dr. Herbert G. Mayer,
ECE 331 – Digital System Design
Using UML, Patterns, and Java Object-Oriented Software Engineering Chapter 5, Analysis: Dynamic Modeling.
The Control Unit: Sequencing the Processor Control Unit: –provides control signals that activate the various microoperations in the datapath the select.
State Diagram. What is State Diagram?  State diagram is used to show the state space of a given class, the events that cause a transition from one state.
Component and Deployment Diagrams
UML Sequence Diagrams Eileen Kraemer CSE 335 Michigan State University.
Practical Object-Oriented Design with UML 2e Slide 1/1 ©The McGraw-Hill Companies, 2004 PRACTICAL OBJECT-ORIENTED DESIGN WITH UML 2e Chapter 10: Statecharts.
Midterm Wednesday Chapter 1-3: Number /character representation and conversion Number arithmetic CMOS logic elements Combinational logic elements and design.
SE-565 Software System Requirements More UML Diagrams.
Sequential Circuit  It is a type of logic circuit whose output depends not only on the present value of its input signals but on the past history of its.
9/15/09 - L22 Sequential Circuit Design Copyright Joanne DeGroat, ECE, OSU1 Sequential Circuit Design Creating a sequential circuit to address a.
Counters and Registers
UML Sequence Diagrams Michael L. Collard, Ph.D. Department of Computer Science Kent State University.
UML for Java Programmers Object Mentor, Inc. Copyright  by Object Mentor, Inc All Rights Reserved
Lecture 4 Finite State Machine CS6133 Software Specification and Verification.
Chapter 8: Modelling Interactions and Behaviour UML Activity Diagram
1 Object-Oriented Modeling Using UML (2) CS 3331 Fall 2009.
Instructor: Alexander Stoytchev CprE 281: Digital Logic.
Business Informatics Group Institute of Software Technology and Interactive Systems Vienna University of Technology Favoritenstraße 9-11/188-3, 1040 Vienna,
Introduction Each logical element or condition must always have a logic value of either "0" or "1", we also need to have ways to combine different logical.
Guide to State Transition Diagram. 2 Contents  What is state transition diagram?  When is state transition diagram used?  What are state transition.
Object-Oriented Modeling Using UML CS 3331 Section 2.3 of Jia 2003.
CS 3850 Lecture 3 The Verilog Language. 3.1 Lexical Conventions The lexical conventions are close to the programming language C++. Comments are designated.
1 Lecture 22 Sequential Circuits Analysis. 2 Combinational vs. Sequential  Combinational Logic Circuit  Output is a function only of the present inputs.
The Unified Modeling Language Part II Omar Meqdadi SE 2730 Lecture 9 Department of Computer Science and Software Engineering University of Wisconsin-Platteville.
Task analysis Chapter 5. By the end of this chapter you should be able to... Describe HTA and its features Explain the purpose of task analysis and modelling.
Anurag Dwivedi. Basic Block - Gates Gates -> Flip Flops.
1 Finite State Machines (FSMs) Now that we understand sequential circuits, we can use them to build: Synchronous (Clocked) Finite State Machines Finite.
State Table Problem #1 An electronic lock is controlled by a keypad, which has three buttons labeled A, B, and R. The keypad is restricted such that, at.
1 ENGG 1203 Tutorial Combinational Logic (II) and Sequential Logic (I) 8 Feb Learning Objectives  Apply Karnaugh map for logic simplification  Design.
CS 5204 Spring 99 1 A Simple Agent A CCS agent is described both by a structural diagram and one or more algebraic equations. The diagram is for readability.
Visual Basic for Application - Microsoft Access 2003 Programming applications using Objects.
UML: State Chart Diagrams
CS3773 Software Engineering Lecture 06 UML State Machines.
1 RLL: Relay Ladder Logic CONTENTS 1. PLC operation 2. PLC programming 3. Ladder logic 4. Memory and gates.
SOFTWARE DESIGN AND ARCHITECTURE LECTURE 26. Review UML behavioral Diagrams – Sequence diagram.
Chapter 3 Digital Logic Structures. Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 3-2 Transistor: Building.
Digital System Design using VHDL
Practical Object-Oriented Design with UML 2e Slide 1/1 ©The McGraw-Hill Companies, 2004 PRACTICAL OBJECT-ORIENTED DESIGN WITH UML 2e Chapter 10: Statecharts.
Instructor: Alexander Stoytchev CprE 281: Digital Logic.
REGISTER TRANSFER LANGUAGE (RTL) INTRODUCTION TO REGISTER Registers1.
UML Activity and Sequence Diagrams David Millard
Finite Automata (FA) with Output FA discussed so far, is just associated with R.Es or language. Is there exist an FA which generates an output string corresponding.
Automata-Based Programming
Systems Analysis and Design in a Changing World, Fourth Edition
Business Process and Functional Modeling
State Machine Diagram.
State Machine Diagrams
Finite State Machines Dr K R Bond 2009
Chapter 5 Task analysis.
Unified Modeling Language
Chapter 8: Modelling Interactions and Behaviour UML Activity Diagram
Advanced State Chart diagrams
Classification of UML Diagrams
Instructor:Po-Yu Kuo 教師:郭柏佑
332:437 Lecture 8 Verilog and Finite State Machines
Dynamic Modeling Lecture # 37.
332:437 Lecture 8 Verilog and Finite State Machines
ECE 352 Digital System Fundamentals
Presentation transcript:

State Machines

What are they? Sometimes called a “Finite State Machine” Depicted as a “state diagram” It’s a tool for specifying a system’s behavior Used in many disciplines –Language parsing –Software design –Systems design –Hardware design –Giving directions and other “every day life things”

Example Consider a subway turnstile system –The gate is either locked or unlocked –If locked, the patron inserts a coin to unlock it –If unlocked, the patron passes through This “wordy” definition is somewhat awkward although it does get the message across

A Better Description Through Symbols Subway turnstile as a state machine LockedUnlocked Insert coin Pass thru States Transitions Triggers (events) /Unlock gate /Lock gate Actions (outputs)

Example Subway turnstile as a state machine –There 2 “states” that the gate can be in Unlocked Locked These are represented as circles in the diagram –There are 2 events that can change the state of the system Insert coin Pass thru These are represented as state-to-state lines with text designators (before the “/” character) –There are 2 outputs/actions from the system Lock gate Unlock gate These are represented as state-to-state lines with text designators (after the “/” character)

Symbology (notation) The start state LockedUnlocked Insert coin/Unlock gate Pass thru/Lock gate

Symbology (notation) System is always in exactly one state –The solid circle marks the start state –When the system starts up this is the first state visited –The link out of the start state has no event associated with it –There are no links into the start state –This is called an unconditional transition and always happens

Symbology (notation) LockedUnlocked Insert coin/Unlock gate Pass thru/Lock gate Close down The final (end) state

Symbology (notation) The system may have zero or more final states –The solid circle with the ring around it –Anytime the system transitions into one of these states, this diagram is completed The system may shut down The system may transition to another state machine (up in the hierarchy – more later)

Better than words? In this case the “wordy” version wasn’t too bad But what if we need to add more, unforeseen stuff?

Example Let’s add some more options –If the gate is locked and someone passes through, set off an alarm –If the gate us unlocked and someone inserts money, thank them for the “donation” The “wordiness” just doubled

Example lockedunlocked Coin/unlock Pass/lock Coin/”thank you”Pass/sound alarm close But the picture still isn’t overly complicated

Additions Changing things “midstream” isn’t even that hard –Instead of sounding an alarm on a dead- beat perhaps we might want to do more

Example lockedunlocked Coin/unlock Pass/lock Coin/”thank you” Pass/sound alarm close violation reset Addition of states/transitions/actions

Additions We could go on and on, but we won’t

Implementation The software implementation is basically a switch statement in Java (or the equivalent if/else if/else) switch (state) { case locked:… case unlocked:… case violation:… }

Implementation The implementation in hardware is through sequential circuits with flip-flops (memory elements) and gates

And so on… There are a lot more features related to state machines –They can be “Hierarchical” One “super state” can contain many “sub states”

Hierarchical AB Enters state C at start state Enters state C at sub-state B C

Parallel Two state machines may run in parallel, interacting with one another

Parallel A B C D event_1/action_1 action_1/action_2

And so on… They can contain “conditional connectors” –Can put “if statements” on the transitions

Conditional connectors AB C eventcase x case y

And so on… Guarded transitions –Like a conditional transition but with just one “case”

Guarded Transitions AB event [case x]

And so on… States can have –Entry actions These are things that occur as soon as the state is entered –Transition actions These are things that occur on the transition to/from the state –Exit actions These are things that occur as a state is being exited

Summary They can be as simple or as complicated as necessary. But, if they get too complicated they are not serving their stated purpose and should be broken up into multiple state machines

Assignment Create a state-diagram describing the operation of the “4 Button Digital Watch” –Be neat! If you must draw it by hand, make sure it is clean, clear, and readable