StateCharts Peter Marwedel Informatik 12 Univ. Dortmund Germany.

Slides:



Advertisements
Similar presentations
Fakultät für informatik informatik 12 technische universität dortmund Specifications and Modeling Peter Marwedel TU Dortmund, Informatik 12 Graphics: ©
Advertisements

Fakultät für informatik informatik 12 technische universität dortmund SDL Peter Marwedel TU Dortmund, Informatik 12 Graphics: © Alexandra Nolte, Gesine.
Communicating finite state machines
Technische universität dortmund fakultät für informatik informatik 12 Specifications and Modeling Peter Marwedel TU Dortmund, Informatik
Embedded System, A Brief Introduction
Construction process lasts until coding and testing is completed consists of design and implementation reasons for this phase –analysis model is not sufficiently.
Technische universität dortmund fakultät für informatik informatik 12 Specifications, Modeling, and Model of Computation Jian-Jia Chen (slides are based.
technische universität dortmund fakultät für informatik informatik 12 Early design phases Jian-Jia Chen (slides are based on Peter Marwedel) TU Dortmund,
UML Statechart semantics Speaker: Fei Mo Tutor: Priv.-Doz. Dr. Thomas Noll Lehrstuhl für Informatik 2 RWTH Aachen SS 07.
Hardware/ Software Partitioning 2011 年 12 月 09 日 Peter Marwedel TU Dortmund, Informatik 12 Germany Graphics: © Alexandra Nolte, Gesine Marwedel, 2003 These.
Week 6Fall 2001 CS5991 The STATEMATE Semantics of Statecharts D. Harel and A. Naamand Ahmad Alsawi 1-4 Bob Chen 5-8 Dapeng Xie 9-11.
UPPAAL Introduction Chien-Liang Chen.
CS 290C: Formal Models for Web Software Lecture 4: Implementing and Verifying Statecharts Specifications Using the Spin Model Checker Instructor: Tevfik.
fakultät für informatik informatik 12 technische universität dortmund Early design phases Peter Marwedel TU Dortmund, Informatik 12 Graphics: © Alexandra.
Programming Languages Marjan Sirjani 2 2. Language Design Issues Design to Run efficiently : early languages Easy to write correctly : new languages.
Why Behavioral Wait statement Signal Timing Examples of Behavioral Descriptions –ROM.
Models of Computation for Embedded System Design Alvise Bonivento.
4/10/20081 Lab 9 RT methodology introduction Register operations Data Path Control Path ASM Example TA: Jorge Crichigno.
CS 290C: Formal Models for Web Software Lecture 2: Modeling States with Statecharts Instructor: Tevfik Bultan.
- 1 -  P. Marwedel, Univ. Dortmund, Informatik 12, 2003 Universität Dortmund Hoofdstuk 2 Systeemspecificatietechnieken 2.1 Functionele specificatie Prof.
A. Frank - P. Weisberg Operating Systems Introduction to Tasks/Threads.
ECE 301 – Digital Electronics Introduction to Sequential Logic Circuits (aka. Finite State Machines) and FSM Analysis (Lecture #17)
ECE 331 – Digital Systems Design Introduction to Sequential Logic Circuits (aka. Finite State Machines) and FSM Analysis (Lecture #19)
SE-565 Software System Requirements More UML Diagrams.
- 1 -  P. Marwedel, Univ. Dortmund, Informatik 12, 2003 Universität Dortmund Actual design flows and tools.
Lecture 6 Template Semantics CS6133 Fall 2011 Software Specification and Verification.
02/06/05 “Investigating a Finite–State Machine Notation for Discrete–Event Systems” Nikolay Stoimenov.
System Modelling and Verification
Ch.2 Part A: Requirements, State Charts EECE **** Embedded System Design.
- 1 - Embedded Systems—State charts Specifications.
- 1 -  P. Marwedel, Univ. Dortmund, Informatik 12, 2005/6 Universität Dortmund Specifications.
Lecture 4 Finite State Machine CS6133 Software Specification and Verification.
Timed UML State Machines Ognyana Hristova Tutor: Priv.-Doz. Dr. Thomas Noll June, 2007.
Computer Architecture Computational Models Ola Flygt V ä xj ö University
- 1 -  P. Marwedel, Univ. Dortmund, Informatik 12, 2005/6 Universität Dortmund Some general properties of languages 1. Synchronous vs. asynchronous languages.
Enhancing Understanding of Model Behavior Through Collaborative Interactions: Explaining Why C. M. Overstreet I.B. Levinstein Computer Science Dept. Old.
Benjamin Gamble. What is Time?  Can mean many different things to a computer Dynamic Equation Variable System State 2.
- 1 - Embedded Systems - SDL Some general properties of languages 1. Synchronous vs. asynchronous languages Description of several processes in many languages.
CS 3850 Lecture 3 The Verilog Language. 3.1 Lexical Conventions The lexical conventions are close to the programming language C++. Comments are designated.
CIS 540 Principles of Embedded Computation Spring Instructor: Rajeev Alur
Ch. 2. Specification and Modeling 2.1 Requirements Describe requirements and approaches for specifying and modeling embedded systems. Specification for.
Finite State Machines CT101 – Computing Systems. FSM Overview Finite State Machine is a tool to model the desired behavior of a sequential system. The.
Module : FSM Topic : types of FSM. Two types of FSM The instant of transition from the present to the next can be completely controlled by a clock; additionally,
Fall 2004EE 3563 Digital Systems Design EE 3563 VHSIC Hardware Description Language  Required Reading: –These Slides –VHDL Tutorial  Very High Speed.
Conformance Test Experiments for Distributed Real-Time Systems Rachel Cardell-Oliver Complex Systems Group Department of Computer Science & Software Engineering.
SOFTWARE DESIGN. INTRODUCTION There are 3 distinct types of activities in design 1.External design 2.Architectural design 3.Detailed design Architectural.
Ch.2 Part E: VHDL, SystemC EECE **** Embedded System Design.
Processor Architecture
Object Oriented Analysis & Design & UML (Unified Modeling Language)1 Part VI: Design Continuous Activity Diagams State Diagrams.
CSCI1600: Embedded and Real Time Software Lecture 7: Modeling II: Discrete Systems Steven Reiss, Fall 2015.
1 Copyright  2001 Pao-Ann Hsiung SW HW Module Outline l Introduction l Unified HW/SW Representations l HW/SW Partitioning Techniques l Integrated HW/SW.
CS3773 Software Engineering Lecture 06 UML State Machines.
technische universität dortmund fakultät für informatik informatik 12 Early design phases Jian-Jia Chen (slides are based on Peter Marwedel) TU Dortmund,
Finite State Machines (FSM) OR Finite State Automation (FSA) - are models of the behaviors of a system or a complex object, with a limited number of defined.
VHDL Discussion Subprograms IAY 0600 Digital Systems Design Alexander Sudnitson Tallinn University of Technology 1.
Digital System Design using VHDL
CIS 540 Principles of Embedded Computation Spring Instructor: Rajeev Alur
From Natural Language to LTL: Difficulties Capturing Natural Language Specification in Formal Languages for Automatic Analysis Elsa L Gunter NJIT.
3/12/2013Computer Engg, IIT(BHU)1 OpenMP-1. OpenMP is a portable, multiprocessing API for shared memory computers OpenMP is not a “language” Instead,
1 Advanced Embedded Systems Lecture 3 Specification Languages.
EMT 351/4 DIGITAL IC DESIGN Verilog Behavioral Modeling  Finite State Machine -Moore & Mealy Machine -State Encoding Techniques.
Pusat Pengajian Kejuruteraan Mikroelektronik EMT 351/4 DIGITAL IC DESIGN Verilog Behavioural Modeling (Part 4) Week #
Lecture 2 Specification and Requirement Analysis of Embedded System.
Processes and threads.
Introduction Introduction to VHDL Entities Signals Data & Scalar Types
Graph Coverage for Specifications CS 4501 / 6501 Software Testing
Computer Engg, IIT(BHU)
Graph Coverage for Specifications CS 4501 / 6501 Software Testing
Dynamic Modeling Lecture # 37.
Specifications and Modeling
Presentation transcript:

StateCharts Peter Marwedel Informatik 12 Univ. Dortmund Germany

- 2 -  P. Marwedel, TU Dortmund, Informatik 12, 2007 TU Dortmund StateCharts Used here as a (prominent) example of a model of computation based on shared memory communication.  appropriate only for local (non- distributed) systems

- 3 -  P. Marwedel, TU Dortmund, Informatik 12, 2007 TU Dortmund StateCharts: recap of classical automata Classical automata: Moore-automata: Y = (Z); Z + =  (X, Z) Mealy-automata Y = (X, Z); Z + =  (X, Z) Moore-automata: Y = (Z); Z + =  (X, Z) Mealy-automata Y = (X, Z); Z + =  (X, Z) Internal state Z input Xoutput Y Next state Z + computed by function  Output computed by function Z0Z1 Z2Z3 e= clock Moore- + Mealy automata=finite state machines (FSMs)

- 4 -  P. Marwedel, TU Dortmund, Informatik 12, 2007 TU Dortmund StateCharts Classical automata not useful for complex systems (complex graphs cannot be understood by humans).  Introduction of hierarchy  StateCharts [Harel, 1987] StateChart = the only unused combination of „flow“ or „state“ with „diagram“ or „chart“

- 5 -  P. Marwedel, TU Dortmund, Informatik 12, 2007 TU Dortmund Introducing hierarchy FSM will be in exactly one of the substates of S if S is active (either in A or in B or..)

- 6 -  P. Marwedel, TU Dortmund, Informatik 12, 2007 TU Dortmund Definitions  Current states of FSMs are also called active states.  States which are not composed of other states are called basic states.  States containing other states are called super-states.  For each basic state s, the super-states containing s are called ancestor states.  Super-states S are called OR-super-states, if exactly one of the sub-states of S is active whenever S is active. ancestor state of E superstate substates

- 7 -  P. Marwedel, TU Dortmund, Informatik 12, 2007 TU Dortmund Default state mechanism Try to hide internal structure from outside world!  Default state Filled circle indicates sub-state entered whenever super-state is entered. Not a state by itself!

- 8 -  P. Marwedel, TU Dortmund, Informatik 12, 2007 TU Dortmund History mechanism For input m, S enters the state it was in before S was left (can be A, B, C, D, or E). If S is entered for the very first time, the default mechanism applies. History and default mechanisms can be used hierarchically. (behavior different from last slide) km

- 9 -  P. Marwedel, TU Dortmund, Informatik 12, 2007 TU Dortmund Combining history and default state mechanism same meaning

 P. Marwedel, TU Dortmund, Informatik 12, 2007 TU Dortmund Concurrency Convenient ways of describing concurrency are required. AND-super-states: FSM is in all (immediate) sub-states of a super-state; Example:

 P. Marwedel, TU Dortmund, Informatik 12, 2007 TU Dortmund Entering and leaving AND-super-states Line-monitoring and key-monitoring are entered and left, when service switch is operated. incl.

 P. Marwedel, TU Dortmund, Informatik 12, 2007 TU Dortmund Types of states In StateCharts, states are either  basic states, or  AND-super-states, or  OR-super-states.

 P. Marwedel, TU Dortmund, Informatik 12, 2007 TU Dortmund Timers Since time needs to be modeled in embedded systems, timers need to be modeled. In StateCharts, special edges can be used for timeouts. If event a does not happen while the system is in the left state for 20 ms, a timeout will take place.

 P. Marwedel, TU Dortmund, Informatik 12, 2007 TU Dortmund Using timers in an answering machine.

 P. Marwedel, TU Dortmund, Informatik 12, 2007 TU Dortmund General form of edge labels Events:  Exist only until the next evaluation of the model  Can be either internally or externally generated Conditions:  Refer to values of variables that keep their value until they are reassigned Reactions:  Can either be assignments for variables or creation of events Example:  service-off [not in Lproc] / service:=0 event [condition] / reaction

 P. Marwedel, TU Dortmund, Informatik 12, 2007 TU Dortmund The StateCharts simulation phases (StateMate Semantics) How are edge labels evaluated? Three phases: 1.Effect of external changes on events and conditions is evaluated, 2.The set of transitions to be made in the current step and right hand sides of assignments are computed, 3.Transitions become effective, variables obtain new values. Separation into phases 2 and 3 guarantees deterministic and reproducible behavior.

 P. Marwedel, TU Dortmund, Informatik 12, 2007 TU Dortmund Example In phase 2, variables a and b are assigned to temporary variables. In phase 3, these are assigned to a and b. As a result, variables a and b are swapped. In a single phase environment, executing the left state first would assign the old value of b (=0) to a and b. Executing the right state first would assign the old value of a (=1) to a and b. The execution would be non-deterministic.

 P. Marwedel, TU Dortmund, Informatik 12, 2007 TU Dortmund Reflects model of clocked hardware In an actual clocked (synchronous) hardware system, both registers would be swapped as well. Same separation into phases found in other languages as well, especially those that are intended to model hardware.  StateCharts using StateMate semantics is a synchronous language.

 P. Marwedel, TU Dortmund, Informatik 12, 2007 TU Dortmund Steps Execution of a StateMate model consists of a sequence of (status, step) pairs Status= values of all variables + set of events + current time Step = execution of the three phases (StateMate semantics) Status= values of all variables + set of events + current time Step = execution of the three phases (StateMate semantics) Status phase 2 phase 3 phase 1 Other implementations of StateCharts do not have these 3 phases (and hence are nondeterministic)!

 P. Marwedel, TU Dortmund, Informatik 12, 2007 TU Dortmund Other semantics Several other specification languages for hierarchical state machines (UML, dave, …) do not include the three simulation phases. These correspond more to a SW point of view with no synchronous clocks. LabView seems to allow turning the multi- phased simulation on and off.

 P. Marwedel, TU Dortmund, Informatik 12, 2007 TU Dortmund Broadcast mechanism Values of variables are visible to all parts of the StateChart model New values become effective in phase 3 of the current step and are obtained by all parts of the model in the following step.  StateCharts implicitly assumes a broadcast mechanism for variables (  implicit shared memory communication –other implementations would be very inefficient -).  StateCharts is appropriate for local control systems ( ), but not for distributed applications for which updating variables might take some time (  ).  StateCharts implicitly assumes a broadcast mechanism for variables (  implicit shared memory communication –other implementations would be very inefficient -).  StateCharts is appropriate for local control systems ( ), but not for distributed applications for which updating variables might take some time (  ). !

 P. Marwedel, TU Dortmund, Informatik 12, 2007 TU Dortmund Lifetime of events Events live until the step following the one in which they are generated („one shot-events“).

 P. Marwedel, TU Dortmund, Informatik 12, 2007 TU Dortmund Evaluation of StateCharts (1) Pros:  Hierarchy allows arbitrary nesting of AND- and OR- super states.  (StateMate-) Semantics defined in a follow-up paper to original paper.  Large number of commercial simulation tools available (StateMate, StateFlow, BetterState,...)  Available „back-ends“ translate StateCharts into C or VHDL, thus enabling software or hardware implementations.

 P. Marwedel, TU Dortmund, Informatik 12, 2007 TU Dortmund Evaluation of StateCharts (2) Cons:  Generated C programs frequently inefficient,  Not useful for distributed applications,  No program constructs,  No description of non-functional behavior,  No object-orientation,  No description of structural hierarchy. Extensions:  Module charts for description of structural hierarchy. Extensions:  Module charts for description of structural hierarchy.

Some general properties of languages Peter Marwedel Informatik 12 Univ. Dortmund Germany

 P. Marwedel, TU Dortmund, Informatik 12, 2007 TU Dortmund 1. Specifying timing (1) 4 types of timing specs required [Burns, 1990]: Means for delaying processes t ? t execute Measure elapsed time Check, how much time has elapsed since last call

 P. Marwedel, TU Dortmund, Informatik 12, 2007 TU Dortmund 2. Specifying timing (2) Possibility to specify timeouts Stay in a certain state a maximum time.  StateCharts comprises a mechanism for specifying timeouts. Other types of timing specs not supported. Methods for specifying deadlines Not available or in separate control file. t execute

 P. Marwedel, TU Dortmund, Informatik 12, 2007 TU Dortmund 2. Properties of processes (1) Number of processes static; dynamic (dynamically changed hardware architecture?) Nesting:  Nested declaration of processes process { process { process { }}}  or all declared at the same level process { … } process { … } process { … }

 P. Marwedel, TU Dortmund, Informatik 12, 2007 TU Dortmund 2. Properties of processes (2) Different techniques for process creation  Elaboration in the source (c.f. ADA, below) declare process P1 …  explicit fork and join (c.f. Unix) id = fork();  process creation calls id = create_process(P1);  StateCharts comprises a static number of processes, nested declaration of processes, and process creation through elaboration in the source.

 P. Marwedel, TU Dortmund, Informatik 12, 2007 TU Dortmund 3. Using non-standard I/O devices - Direct access to switches, displays etc; No protection required; OS can be much faster than for operating system with protection.  No support in standard StateCharts.  No particular OS support anyhow.

 P. Marwedel, TU Dortmund, Informatik 12, 2007 TU Dortmund 4. Synchronous vs. asynchronous languages (1) Description of several processes in many languages non- deterministic: The order in which executable tasks are executed is not specified (may affect result). Synchronous languages: based on automata models. „Synchronous languages aim at providing high level, modular constructs, to make the design of such an automaton easier [Halbwachs]. Synchronous languages describe concurrently operating automata. „.. when automata are composed in parallel, a transition of the product is made of the "simultaneous" transitions of all of them“.

 P. Marwedel, TU Dortmund, Informatik 12, 2007 TU Dortmund Synchronous languages implicitly assume the presence of a (global) clock. Each clock tick, all inputs are considered, new outputs and states are calculated and then the transitions are made. This requires a broadcast mechanism for all parts of the model. Idealistic view of concurrency. Has the advantage of guaranteeing deterministic behavior. 4. Synchronous vs. asynchronous languages (2)

 P. Marwedel, TU Dortmund, Informatik 12, 2007 TU Dortmund Summary StateCharts as an example of shared memory MoCs  AND-states  OR-states  Timer  Broadcast  Semantics multi-phase models single-phase models Some general language properties  Process creation techniques,  asynchronous/synchronous languages