• 中国计算机学会会刊
  • 中国科技核心期刊
  • 中文核心期刊

计算机工程与科学

• 软件工程 • 上一篇    下一篇

Mediator模型的SystemC代码自动生成

张琦1,2,李屹1,孙猛1   

  1. (1.北京大学数学科学学院,北京 100871;2.西安电子科技大学计算机学院,陕西 西安 710126)
  • 收稿日期:2018-10-16 修回日期:2018-12-04 出版日期:2019-05-25 发布日期:2019-05-25
  • 基金资助:

    国家自然科学基金(61772038,61532019)

Automatic generation of SystemC code from Mediator

ZHANG Qi1,2,LI Yi1,SUN Meng1   

  1. (1.School of Mathematical Sciences,Peking University,Beijing 100871;
    2.School of Computer Science and Technology,Xidian University,Xi’an 710126,China)
  • Received:2018-10-16 Revised:2018-12-04 Online:2019-05-25 Published:2019-05-25

摘要:

Mediator是一种基于组件的建模语言,该语言主要通过自动机和系统对模型进行描述。将Mediator语言描述的模型自动生成为可执行代码,可以避免编码过程中由于人为疏忽而造成的错误,从而提高编码的可靠性,同时缩短模型开发周期。介绍一种从Mediator模型到SystemC代码的自动生成工具,该工具旨在将基于特定平台的模型转换为能直接仿真运行的代码。首先对Mediator语言的语法语义进行分析,选择合适的SystemC代码组织形式,然后针对Mediator模型的每一个组成部分
设计生成规则,其中重点对类型生成、状态转移语句生成、同步语句的生成进行分析。最后,通过一个机器掉电检测系统说明该工具运行结果的正确性。

关键词: Mediator, SystemC, 代码自动生成, 基于组件建模

Abstract:

Mediator is a hierarchical componentbased modeling language that provides proper description of models by using automata and systems. By transforming the models described in Mediator to executable code, we can avoid errors caused by human negligence in the encoding process and enhance encoding reliability, and shorten model development cycle. We present a new automatic code generation tool, which can convert Mediator model to SystemC code. The tool is designed to generate models on specific platforms (SystemC in this case) into directly executable code without any manual adaption.We first analyze the syntax and semantics of Mediator, and select a proper SystemC organization. Then, we design generation rules for each component of the Mediator model, in which we mainly focus on analysis of the generation of types, the generation of transition statement,and the generation of synchronize statement. Finally, we build a power failure detection model by Mediator and convert it to SystemC executable code through our code generator, and it has been executed successfully in C++ environment.
 

Key words: Mediator, SystemC, code automatic generation, component-based modeling