基于分支标记的数据流模型的代码生成方法
作者:
作者简介:

苏卓(1995-),男,博士,CCF学生会员,主要研究领域为模型驱动开发.
张明睿(1997-),男,博士,主要研究领域为测试驱动生成.
王东艳(1996-),女,硕士,CCF学生会员,主要研究领域为计算机系统结构,数字图像处理.
姜宇(1989-),男,博士,副教授,博士生导师,CCF专业会员,主要研究领域为软件工程,物理信息融合系统.
杨镒箫(1991-),男,博士后,主要研究领域为嵌入式建模仿真开发.
孙家广(1946-),男,教授,博士生导师,主要研究领域为计算机图形学,计算机辅助设计,软件工程与系统.

通讯作者:

姜宇,jiangyu198964@126.com

基金项目:

国家自然科学基金(62022046,U1911401,61802223);科技部重点研发计划(2019YFB1706200);华为清华可信研究项目(20192000794)


Code Generation Method of Data Flow Model Based on Branch Marking
Author:
Fund Project:

National Natural Science Foundation of China (62022046, U1911401, 61802223); National Key Research and Development Project (2019YFB1706200); Huawei-Tsinghua Trustworthy Research Project (20192000794)

  • 摘要
  • | |
  • 访问统计
  • |
  • 参考文献 [21]
  • |
  • 相似文献 [20]
  • | | |
  • 文章评论
    摘要:

    模型驱动开发以其低错误率、易仿真、易验证的特点,在嵌入式软件开发中被广泛应用.近年来,基于模型的嵌入式软件开发方法及相应工具也在逐渐发展和完善.数据流模型是各种建模工具中使用最为频繁的语义模型,然而,各种工具对于数据流模型的代码生成能力却参差不齐,特别是对于数据分支组件的支持,当前主流的建模工具都采用各种方式来回避复杂的分支建模及对应的代码生成.但是,分支建模是非常重要的,使用分支组件可以更清晰地表现出数据流的数据传递逻辑.为了解决复杂分支建模带来的代码生成难题,针对具有复杂分支组合的数据流模型.提出了一种基于分支调度标记的代码生成方法.在所提出的算法中,首先通过拓扑排序确定模型的调度顺序,再根据不同分支的影响对组件进行分支标记;之后,根据组件的分支标记构造一个基于控制流的代码生成位置表;最后,即可根据代码生成位置表进行各种主流语言的代码生成.通过构造4个具有复杂分支的数据流模型实例进行代码生成,并在生成代码行数和运行时间等方面与Simulink和Ptolemy进行对比,进一步说明该代码生成方法在复杂分支组合情况下的通用性以及所做工作的价值和意义.

    Abstract:

    Model-driven development is widely used in embedded software development because it has a low error rate while it is easy to simulate and verify. In recent years, model-based embedded software development methods and their corresponding tools are also gradually developing and improving. Data flow model is the most frequently used semantic model among all kinds of modeling tools. Nonetheless, the code generation ability of various tools for data flow model is uneven, especially for the branching actors. It is well known that current mainstream modeling tools adopt various ways to avoid complex branch modeling and the generation of its corresponding code. However, branch modeling is very important, and it makes the data transfer logic of the data flow more clearly by using branch actors. In order to solve the problem of code generation caused by complex branch modeling, this study proposed a code generation method based on branch schedule marking for data flow model aimed at complex branch combinations. As for the algorithm proposed in this study, firstly, the scheduling order of the model was determined by topological sorting. Secondly, a code generation location table based on control flow was constructed according to the branch marks which marked by the influence of different branches. Finally, code generation of various mainstream languages could be carried out in terms of the code generation location table. By constructing four instances of data flow models with complex branches for code generation and comparing them with Simulink and Ptolemy in terms of lines of code generation and elapsed time, this study further illustrates the universality of proposed code generation methods in complex branch combinations and the value and significance of this work.

    参考文献
    [1] Christopher H, Edward AL, Liu J, Liu XJ, Steve N, Xiong YH, Zheng HY. Heterogeneous concurrent modeling and design in Java. Vol.1. California:California Univ Berkeley Dept of Electrical Engineering and Computer Science, 2008. 1-34.
    [2] Joseph TB, Soonhoi H, Edward AL. Ptolemy:A framework for simulating and prototyping heterogeneous systems. Readings in Hardware/Software Co-Design, 2002,4(1):527-543.
    [3] Jiang Y, Zhang H, Li Z, Deng YD, Song XY Gu M, Sun JG. Design and optimization of multiclocked embedded systems using formal techniques. IEEE Trans. on Industrial Electronics, 2015,62(2):1270-1278.
    [4] Edward AL, Xiong YH. A behavioral type system and its application in Ptolemy II. Formal Aspects of Computing, 2004,16(3):210-237.
    [5] Yang ZB, Pi L, Hu K, Gu ZH, Ma DF. AADL:An architecture design and analysis language for complex embedded real-time systems. Ruan Jian Xue Bao/Journal of Software, 2010,21(5):899-915(in Chinese with English abstract). http://www.jos.org.cn/1000-9825/3700.htm[doi:10.3724/SP.J.1001.2010.03700]
    [6] Duane AA. A computation model with data flow sequencing[Ph.D. Thesis]. Stanford:Stanford University, 1969.
    [7] Jiang Y, Zhang HH, Zhang HF, Liu H, Song XY, Gu M, Sun JG. Design of mixed synchronous/asynchronous systems with multiple clocks. IEEE Trans. on Parallel and Distributed Systems, 2015,26(8):2220-2232.
    [8] Philip B, Sanjeev K, Edward AL, Liu XJ, Zhao Y. Modeling of sensor nets in Ptolemy II. In:Proc. of the 3rd Int'l Symp. on Information Processing in Sensor Networks. New York:Association for Computing Machinery, 2004.359-368.
    [9] Christopher B, Edward AL, Stavros T. Exploring models of computation with Ptolemy II. In:Proc. of the 8th IEEE/ACM/IFIP Int'l Conf. on Hardware/Software Codesign and System Synthesis. New York:Association for Computing Machinery, 2010. 331-332.
    [10] Johan E, Jörn WJ, Edward AL, Liu J, Liu XJ, Jozsef L, Stephen N, Sonia S, Xiong YH. Taming heterogeneity-the Ptolemy approach. Proc. of the IEEE, 2003,91(1):127-144.
    [11] Jiang Y, Zhang HH, Zhang HF, Zhao XY, Liu H, Sun CN, Song XY, Gu M, Sun JG. Tsmart-Galsblock:A toolkit for modeling, validation, and synthesis of multi-clocked embedded systems. In:Proc. of the 22nd ACM SIGSOFT Int'l Symp. on Foundations of Software Engineering. New York:Association for Computing Machinery, 2014. 711-714.
    [12] Paul LG, Jean-Pierre T, Jean-Christophe LL. Polychrony for system design. Journal of Circuits, Systems, and Computers, 2003,12(3):261-303.
    [13] Jiang Y, Liu H, Song HB, Kong H, Wang R, Guan Y, Lui S. Safety-Assured model-driven design of the multifunction vehicle bus controller. IEEE Trans. on Intelligent Transportation Systems, 2017,19(10):3320-3333.
    [14] Jiang Y, Song HB, Yang YX, Liu H, Gu M, Guan Y, Sun JG, Lui S. Dependable model-driven development of CPS:From stateflow simulation to verified implementation. ACM Trans. on Cyber-Physical Systems, 2019,3(1):Article 12.
    [15] Alejandro C, Juan BP, Mercedes R. MEdit4CEP-Gam:A model-driven approach for user-friendly gamification design, monitoringand code generation in CEP-based systems. Information and Software Technology, 2018,95:238-264.
    [16] Gabriel S, Jose AG, Ricardo T. Code generation using model driven architecture:A systematic mapping study. Journal of Computer Languages, 2020,56:100935.
    [17] Du Y, Guo DH, Chen X, Ren L, Dai GZ. Model-driven visualization generation system. Ruan Jian Xue Bao/Journal of Software, 2016,27(5):1199-1211(in Chinese with English abstract). http://www.jos.org.cn/1000-9825/4959.html[doi:10.13328/j.cnki.jos. 004959]
    [18] Zhou G, Man-Kit L, Edward AL. A code generation frame-work for actor-oriented models with partial evaluation. In:Proc. of the Int'l Conf. on Embedded Software and Systems, Vol.29. Springer-Verlag, 2007. 193-206.
    附中文参考文献:
    [5] 杨志斌,皮磊,胡凯,顾宗华,马殿富.复杂嵌入式实时系统体系结构设计与分析语言:AADL.软件学报,2010,21(5):899-915. http://www.jos.org.cn/1000-9825/3700.htm[doi:10.3724/SP.J.1001.2010.03700]
    [17] 杜一,郭旦怀,陈昕,任磊,戴国忠.一种模型驱动的可视化生成系统.软件学报,2016,27(5):1199-1211. http://www.jos.org.cn/1000-9825/4959.html[doi:10.13328/j.cnki.jos.004959]
    引证文献
    网友评论
    网友评论
    分享到微博
    发 布
引用本文

苏卓,王东艳,杨镒箫,张明睿,姜宇,孙家广.基于分支标记的数据流模型的代码生成方法.软件学报,2021,32(6):1647-1662

复制
分享
文章指标
  • 点击次数:
  • 下载次数:
  • HTML阅读次数:
  • 引用次数:
历史
  • 收稿日期:2020-08-26
  • 最后修改日期:2020-12-19
  • 在线发布日期: 2021-02-07
  • 出版日期: 2021-06-06
文章二维码
您是第19728331位访问者
版权所有:中国科学院软件研究所 京ICP备05046678号-3
地址:北京市海淀区中关村南四街4号,邮政编码:100190
电话:010-62562563 传真:010-62562533 Email:jos@iscas.ac.cn
技术支持:北京勤云科技发展有限公司

京公网安备 11040202500063号