A Synchronous-Based Code Generator for Explicit Hybrid Systems Languages

  • Timothy Bourke
  • Jean-Louis Colaço
  • Bruno Pagano
  • Cédric Pasteur
  • Marc Pouzet
Part of the Lecture Notes in Computer Science book series (LNCS, volume 9031)

Abstract

Modeling languages for hybrid systems are cornerstones of embedded systems development in which software interacts with a physical environment. Sequential code generation from such languages is important for simulation efficiency and for producing code for embedded targets. Despite being routinely used in industrial compilers, code generation is rarely, if ever, described in full detail, much less formalized. Yet formalization is an essential step in building trustable compilers for critical embedded software development.

This paper presents a novel approach for generating code from a hybrid systems modeling language. By building on top of an existing synchronous language and compiler, it reuses almost all the existing infrastructure with only a few modifications. Starting from an existing synchronous data-flow language conservatively extended with Ordinary Differential Equations (ODEs), this paper details the sequence of source-to-source transformations that ultimately yield sequential code. A generic intermediate language is introduced to represent transition functions. The versatility of this approach is exhibited by treating two classical simulation targets: code that complies with the FMI standard and code directly linked with an off-the-shelf numerical solver (Sundials CVODE).

The presented material has been implemented in the Zélus compiler and the industrial Scade Suite KCG code generator of Scade 6.

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

References

  1. 1.
    Benveniste, A., Bourke, T., Caillaud, B., Pagano, B., Pouzet, M.: A type-based analysis of causality loops in hybrid systems modelers. In: Int. Conf. Hybrid Systems: Computation and Control (HSCC 2014). ACM Press, Berlin (2014)Google Scholar
  2. 2.
    Benveniste, A., Bourke, T., Caillaud, B., Pouzet, M.: A Hybrid Synchronous Language with Hierarchical Automata: Static Typing and Translation to Synchronous Code. In: ACM SIGPLAN/SIGBED Conf. on Embedded Software (EMSOFT 2011), Taipei, Taiwan (October 2011)Google Scholar
  3. 3.
    Benveniste, A., Bourke, T., Caillaud, B., Pouzet, M.: Divide and recycle: types and compilation for a hybrid synchronous language. In: ACM SIGPLAN/SIGBED Conf. on Languages, Compilers, Tools and Theory for Embedded Systems (LCTES 2011), Chicago, USA (April 2011)Google Scholar
  4. 4.
    Benveniste, A., Bourke, T., Caillaud, B., Pouzet, M.: Non-Standard Semantics of Hybrid Systems Modelers. Journal of Computer and System Sciences (JCSS) 78(3), 877–910 (2012), Special issue in honor of Amir PnueliGoogle Scholar
  5. 5.
    Benveniste, A., Caspi, P., Edwards, S., Halbwachs, N., Le Guernic, P., de Simone, R.: The synchronous languages 12 years later. Proc. IEEE 91(1) (January 2003)Google Scholar
  6. 6.
    Biernacki, D., Colaco, J.-L., Hamon, G., Pouzet, M.: Clock-directed modular code generation of synchronous data-flow languages. In: ACM Int. Conf. Languages, Compilers and Tools for Embedded Systems (LCTES), Tucson, Arizona (June 2008)Google Scholar
  7. 7.
    Bourke, T., Pouzet, M.: Zélus, a Synchronous Language with ODEs. In: Int. Conf. on Hybrid Systems: Computation and Control (HSCC 2013). ACM, Philadelphia (2013)Google Scholar
  8. 8.
    Carloni, L., Benedetto, M.D.D., Pinto, A., Sangiovanni-Vincentelli, A.: Modeling Techniques, Programming Languages, Design Toolsets and Interchange Formats for Hybrid Systems. Technical report, IST-2001-38314 WPHS, Columbus Project (March 2004)Google Scholar
  9. 9.
    Caspi, P., Curic, A., Maignan, A., Sofronis, C., Tripakis, S.: Translating Discrete-Time Simulink to Lustre. ACM Trans. on Embedded Computing Systems (2005), Special Issue on Embedded SoftwareGoogle Scholar
  10. 10.
    Colaço, J.-L., Pagano, B., Pouzet, M.: A Conservative Extension of Synchronous Data-flow with State Machines. In: ACM Int. Conf. on Embedded Software (EMSOFT 2005), Jersey city, New Jersey, USA (September 2005)Google Scholar
  11. 11.
    Cytron, R., Ferrante, J., Rosen, B.K., Wegman, M.N., Zadeck, F.K.: Efficiently computing static single assignment form and the control dependence graph. ACM Trans. Program. Lang. Syst. 13(4), 451–490 (1991)CrossRefGoogle Scholar
  12. 12.
    Denckla, B., Mosterman, P.: Stream and state-based semantics of hierarchy in block diagrams. In: Proc. of the 17th IFAC World Congress, pp. 7955–7960 (2008)Google Scholar
  13. 13.
    Esterel-Technologies. Scade language reference manual. Technical report, Esterel-Technologies (2014)Google Scholar
  14. 14.
    Halbwachs, N., Raymond, P., Ratel, C.: Generating efficient code from data-flow programs. In: 3rd Int. Symp. on Programming Language Implementation and Logic Programming, Passau, Germany (August 1991)Google Scholar
  15. 15.
    Harel, D.: StateCharts: A Visual Approach to Complex Systems. Science of Computer Programming 8(3), 231–275 (1987)CrossRefMATHMathSciNetGoogle Scholar
  16. 16.
    Hindmarsh, A.C., Brown, P.N., Grant, K.E., Lee, S.L., Serban, R., Shumaker, D.E., Woodward, C.S.: SUNDIALS: Suite of nonlinear and differential/algebraic equation solvers. ACM Trans. Mathematical Software 31(3), 363–396 (2005)CrossRefMATHMathSciNetGoogle Scholar
  17. 17.
    Lee, E.A., Zheng, H.: Operational semantics of hybrid systems. In: Morari, M., Thiele, L. (eds.) HSCC 2005. LNCS, vol. 3414, pp. 25–53. Springer, Heidelberg (2005)CrossRefGoogle Scholar
  18. 18.
    Lee, E.A., Zheng, H.: Leveraging synchronous language principles for heterogeneous modeling and design of embedded systems. In: Int. Conf. on Embedded Software (EMSOFT 2007), Salzburg, Austria (September/October 2007)Google Scholar
  19. 19.
    MODELISAR. Functional Mock-up Interface for Model Exchange v1.0 (2010)Google Scholar
  20. 20.
    Morel, L.: Array iterators in Lustre: From a language extension to its exploitation in validation. EURASIP Journal on Embedded Systems (2007)Google Scholar
  21. 21.
    Ptolemaeus, C. (ed.): System Design, Modeling, and Simulation using Ptolemy II. Ptolemy.org (2014)Google Scholar
  22. 22.
    Raymond, P.: Compilation efficace d’un langage déclaratif synchrone: le générateur de code Lustre-v3. PhD thesis, Institut National Polytechnique de Grenoble (1991)Google Scholar
  23. 23.
    Tripakis, S., Stergiou, C., Shaver, C., Lee, E.A.: A modular formal semantics for Ptolemy. Mathematical Structures in Computer Science 23(04), 834–881 (2013)CrossRefMATHMathSciNetGoogle Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 2015

Authors and Affiliations

  • Timothy Bourke
    • 1
    • 3
  • Jean-Louis Colaço
    • 2
  • Bruno Pagano
    • 2
  • Cédric Pasteur
    • 2
  • Marc Pouzet
    • 4
    • 3
    • 1
  1. 1.INRIA Paris-RocquencourtParisFrance
  2. 2.ANSYS/Esterel-TechnologiesToulouseFrance
  3. 3.DI, École normale supérieureParisFrance
  4. 4.Université Pierre et Marie CurieParisFrance

Personalised recommendations