week3-HierarchicalStateMachines
更新时间:2023-03-20 16:52:01 阅读量: 实用文档 文档下载
山东大学嵌入式课设PPT
Introduction to Embedded Systems
Edward A. Lee & Sanjit A. SeshiaUC Berkeley
Copyright © 2008-11, Edward A. Lee & Sanjit A. Seshia, All rights reserved
Chapter 5: Hierarchical State Machines
山东大学嵌入式课设PPT
The StateCharts paper
Lee & Seshia, UC Berkeley: 2
山东大学嵌入式课设PPT
Recall Synchronous Composition:
Synchronous composition
Lee & Seshia, UC Berkeley: 3
山东大学嵌入式课设PPT
Recall Asynchronous Composition:
Asynchronous composition with interleaving semantics
Lee & Seshia, UC Berkeley: 4
山东大学嵌入式课设PPT
Recall program that does something for 2 seconds, then stopsvolatile uint timerCount = 0; void ISR(void) { … disable interrupts if(timerCount != 0) { timerCount--; } … enable interrupts } int main(void) { // initialization code SysTickIntRegister(&ISR); ... // other init timerCount = 2000; while(timerCount != 0) { ... code to run for 2 seconds } }
Is synchronous composition the right model for this?Is asynchronous composition (with interleaving semantics) the right model for this? Answer: no to both.
Lee & Seshia, UC Berkeley: 5
山东大学嵌入式课设PPT
Position in the program is part of the statevolatile uint timerCount = 0; void ISR(void) { … disable interrupts D if(timerCount != 0) { E timerCount--; } … enable interrupts } int main(void) { // initialization code SysTickIntRegister(&ISR); … // other init timerCount = 2000; A while(timerCount != 0) { B … code to run for 2 seconds } C … whatever comes next }
A key question: Assuming interrupt occurs infinitely often, is position C always reached?
Lee & Seshia, UC Berkeley: 6
山东大学嵌入式课设PPT
State machine modelvolatile uint timerCount = 0; void ISR(void) { … disable interrupts D if(timerCount != 0) { E timerCount--; } … enable interrupts } int main(void) { // initialization code SysTickIntRegister(&ISR); … // other init timerCount = 2000; A while(timerCount != 0) { B … code to run for 2 seconds } C … whatever comes next }
Is asynchronous composition the right thing to do here?Lee & Seshia, UC Berkeley: 7
山东大学嵌入式课设PPT
Asynchronous composition
A
CThis has transitions that will not occur in practice, such as A,D to B,D. Interrupts have priority over application code.
BLee & Seshia, UC Berkeley: 8
山东大学嵌入式课设PPT
Modeling an interrupt controllerFSM model of a single interrupt handler in an interrupt controller:
Lee & Seshia, UC Berkeley: 9
山东大学嵌入式课设PPT
Modeling an interrupt controllerint main(void) { // initialization code SysTickIntRegister(&ISR); … // other init timerCount = 2000; while(timerCount != 0) { … code to run for 2 seconds } }
Note that states can share refinements.volatile uint timerCount = 0; void ISR(void) { … disable interrupts if(timerCount != 0) { timerCount--; } … enable interrupts }
Lee & Seshia, UC Berkeley: 10
山东大学嵌入式课设PPT
Hierarchical State MachinesOR state (being B means being in C or D) Reaction: 1. First, the refinement of the current state (if any) reacts. 2. Then the top-level machine reacts. If both produce outputs, they are required to not conflict. The two steps are part of the same reaction.
refinement
Lee & Seshia, UC Berkeley: 11
山东大学嵌入式课设PPT
Hierarchical
State Machines
simultaneous transitions
Example trace:
Simultaneous transitions can produce multiple outputs. These are required to not conflict.Lee & Seshia, UC Berkeley: 12
山东大学嵌入式课设PPT
Hierarchical State Machines
history transition
Example trace:
A history transition implies that when a state with a refinement is left, it is nonetheless necessary to remember the state of the refinement.Lee & Seshia, UC Berkeley: 13
山东大学嵌入式课设PPT
Flattening the state machine (assuming history transitions):
A history transition implies that when a state with a refinement is left, it is nonetheless necessary to remember the state of the refinement. Hence A,C and A,D.Lee & Seshia, UC Berkeley: 14
山东大学嵌入式课设PPT
Hierarchical State Machines with Reset Transitions A reset transition alwaysinitializes the refinement of the destination state to its initial state.
reset transition
Example trace:
A reset transition implies that when a state with a refinement is left, you can forget the state of the refinement.Lee & Seshia, UC Berkeley: 15
山东大学嵌入式课设PPT
Flattening the state machine (assuming reset transitions):
A reset transition implies that when a state with a refinement is left, it is not necessary to remember the state of the refinement. Hence there are fewer states.Lee & Seshia, UC Berkeley: 16
山东大学嵌入式课设PPT
Preemptive Transitions
A preemptive transition specifies that the guard should be evaluated before the current state refinement reacts, and if it is true, then the current state should not react.
Lee & Seshia, UC Berkeley: 17
山东大学嵌入式课设PPT
Modeling an interrupt controllerint main(void) { // initialization code SysTickIntRegister(&ISR); … // other init timerCount = 2000; while(timerCount != 0) { … code to run for 2 seconds } }
Note that states can share refinements.volatile uint timerCount = 0; void ISR(void) { … disable interrupts if(timerCount != 0) { timerCount--; } … enable interrupts }
Lee & Seshia, UC Berkeley: 18
山东大学嵌入式课设PPT
Simplified interrupt controllerThis abstraction assumes that an interrupt is always handled immediately upon being asserted:
A B
C
int main(void) { // initialization code SysTickIntRegister(&ISR); … // other init timerCount = 2000; while(timerCount != 0) { … code to run for 2 seconds } }
D E
volatile uint timerCount = 0; void ISR(void) { … disable interrupts if(timerCount != 0) { timerCount--; } … enable interrupts }
Lee & Seshia, UC Berkeley: 19
山东大学嵌入式课设PPT
Hierarchical interrupt controllerThis model assumes further that interrupts are disabled in the ISR:A key question: Assuming interrupt occurs infinitely often, is state C always reached?
Lee & Seshia, UC Berkeley: 20
山东大学嵌入式课设PPT
Hierarchical interrupt controllerThis model assumes interrupts are disabled in the ISR:Reset, preemptive transitionHistory transition
Lee & Seshia, UC Berkeley: 21
正在阅读:
week3-HierarchicalStateMachines03-20
JNI详解12-20
兰花作文250字07-09
马原第二章试题11-14
e-learning与知识管理05-25
03-北京六建工程公司-海关信息管理中心施工组织设计04-19
广西艺术学院2016届本、专科文案综述封面+要求(1)12-09
中级会计职称《财务管理》知识点:购买或经营租赁固定资产的决策11-01
课堂观察与分析之教学目标达成度的报告105-08
- 1操作系统week04实验报告
- 2操作系统week07实验报告
- 3操作系统week01实验报告
- 4操作系统week06实验报告
- 5COMP5318 Knowledge Discovery and Data Mining_2011 Semester 1_week3chap6_basic_association_analysis
- 6COMP5318 Knowledge Discovery and Data Mining_2011 Semester 1_week3chap6_basic_association_analysis
- 7听说1-Week10口试题型-201503
- 8五年级上册英语Unit 2 My days of the Week
- 9五年级第二单元_My_Week_单元知识点总结
- 102016秋人教PEP版英语五上《Unit+2+My+week》word单元试卷
- 教学能力大赛决赛获奖-教学实施报告-(完整图文版)
- 互联网+数据中心行业分析报告
- 2017上海杨浦区高三一模数学试题及答案
- 招商部差旅接待管理制度(4-25)
- 学生游玩安全注意事项
- 学生信息管理系统(文档模板供参考)
- 叉车门架有限元分析及系统设计
- 2014帮助残疾人志愿者服务情况记录
- 叶绿体中色素的提取和分离实验
- 中国食物成分表2020年最新权威完整改进版
- 推动国土资源领域生态文明建设
- 给水管道冲洗和消毒记录
- 计算机软件专业自我评价
- 高中数学必修1-5知识点归纳
- 2018-2022年中国第五代移动通信技术(5G)产业深度分析及发展前景研究报告发展趋势(目录)
- 生产车间巡查制度
- 2018版中国光热发电行业深度研究报告目录
- (通用)2019年中考数学总复习 第一章 第四节 数的开方与二次根式课件
- 2017_2018学年高中语文第二单元第4课说数课件粤教版
- 上市新药Lumateperone(卢美哌隆)合成检索总结报告
- HierarchicalStat
- eMachines
- week