Download presentation
Presentation is loading. Please wait.
1
CSCI1600: Embedded and Real Time Software
Lecture 12: Modeling IV: Compositions of State Machines Steven Reiss, Fall 2016 Hand out digital watch statechart Without the introductory discussion of the circuit, this lecture would have run short. Might want to look at some of the material in the text and see if it can augment the lecture.
2
Circuit Review Lecture 12: Modeling Compositions 10/31/2019
3
Modeling Tasks We can model individual tasks using FSMs
Extended FSMs, Timed automata, … Hybrid automata to reflect state of outside world This is sufficient for coding We need to model the overall application We need this to prove properties of the system We need this to understand overall system behavior What was in chapter 5? Lecture 12: Modeling Compositions 10/31/2019
4
Digital Watch Lots of features Four buttons for input
How does it work? How would you model it? Lecture 12: Modeling Compositions 10/31/2019
5
Statecharts Here is one model Lets look at it in detail
Understand what it means Map to a single FSM How many think they could explain/understand this? Lecture 12: Modeling Compositions 10/31/2019
6
Example : Concurrent Machines
This diagram is not readable. Replace Lecture 12: Modeling Compositions 10/31/2019
7
Example: Concurrency Lecture 12: Modeling Compositions 10/31/2019
8
Example: Concurrency Lecture 12: Modeling Compositions 10/31/2019
9
Example : Communicating Tasks
Lecture 12: Modeling Compositions 10/31/2019
10
Example: Hierarchical
Lecture 12: Modeling Compositions 10/31/2019
11
Example: Hierarchical
Lecture 12: Modeling Compositions 10/31/2019
12
Example: Hierarchical
Lecture 12: Modeling Compositions 10/31/2019
13
Microwave Oven Lecture 12: Modeling Compositions 10/31/2019
14
Digital Watch Can you understand this now?
Lecture 12: Modeling Compositions 10/31/2019
15
Example Tic-Tac-Toe Lecture 12: Modeling Compositions 10/31/2019
16
Implementing a Statechart
Handling concurrency The FSM is in multiple states What does this mean formally (single FSA) What does this mean in a statechart What do you do with an input How is this implemented What if the results are contradictory (set x = 1, set x = 0) What does this mean for your implementation Lecture 12: Modeling Compositions 10/31/2019
17
Mapping to Code Direct sequential coding Explicit state variables
Determine state from various conditions Act accordingly Allows common operations for multiple states Explicit state variables switch (state) { … } Table-driven Approximate the state machine Lecture 12: Modeling Compositions 10/31/2019
18
Homework Read 6.1, 6.2, 6.4 Exercise 6.7
Lecture 12: Modeling Compositions 10/31/2019
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.