Abstract
We study abstract, compositional and executable representations of synchronous models in general and hierarchical synchronous block diagrams in particular. Our work is motivated by the problem of modular code generation, where sequential code (in, say, C or Java) must be generated for a given block independently of its context, that is, independently of the diagrams in which this block may be embedded.
We propose non-monolithic interfaces called profiles as a representation of blocks. A profile contains a set of interface functions that implement the semantics of the block, and a set of dependencies between these functions. Profiles are executable through the implementation of their interface functions. Profiles are compositional in the sense that a diagram of profiles can be represented as a single profile without loss of important information, such as input-output dependencies. This is contrary to traditional methods which use monolithic interfaces that contain a fixed number of interface functions, usually just one or two. Monolithic interfaces generally result in loss of input-output dependency information and are non-compositional. Profiles are abstract in the sense that they hide most of the internal details of a diagram (e.g., functionality).
We provide methods for profile synthesis and modular code generation: to automatically produce profiles and profile implementations of composite blocks, given profiles of their sub-blocks. Our work reveals fundamental trade-offs between the size and reusability of a profile, as well as between characteristics of the generated code and complexity of the synthesis algorithms. We discuss various algorithms that explore these trade-offs, among which algorithms that achieve maximal reusability with optimal profile size.
This paper unifies and extends the work presented in [30,31,32]. We gratefully acknowledge the contributions of our co-author Christian Szegedy. Roberto Lublinerman contributed to this work while he was at Cadence Design Systems; he is now at Google. We also thank the anonymous Reviewers of earlier versions of this work. This work was partially supported by the National Science Foundation (awards #1329759 and #1139138), and by the Academy of Finland. We gratefully acknowledge the support of Edward Lee, without whom this work would not have been possible.
This is a preview of subscription content, log in via an institution.
Buying options
Tax calculation will be finalised at checkout
Purchases are for personal use only
Learn about institutional subscriptionsNotes
- 1.
- 2.
- 3.
Primarily software code generators, since software is becoming predominant in embedded systems, but also hardware code generators in some cases.
- 4.
A Reviewer of an earlier version of this article correctly pointed out that there may be potential problems with the specification of trigger-initial values. In particular, complications may arise if downstream models are only valid for certain inputs: what happens if a trigger-initial value is not a legal input for the downstream model? While we agree that this is a problem, we feel that it is not confined to the use of triggers. The same problem might arise in a diagram without triggers. In general, the problem arises from non-input-receptive components. For a thorough study of such components, we refer the reader to [36, 45].
- 5.
For sequential blocks (i.e., blocks with internal state) profiles contain a special init function that initializes the state. In our framework, init functions of macro blocks are synthesized from init functions of their sub-blocks. This is a simple procedure whose details are omitted.
- 6.
If f and g belong to the same cluster, a local variable in the corresponding interface function of M can be used to store the value of y.
- 7.
Note that information about triggers is lost in the SDG of M: indeed, in the SDG, dependencies arising due to triggers and those arising due to port connections are indistinguishable.
- 8.
t cannot be produced by A, as this would result in a cycle in the SDG of M.
References
de Alfaro, L., Henzinger, T.: Interface automata. In: Foundations of Software Engineering (FSE). ACM Press (2001)
Alur, R., Henzinger, T.: Reactive modules. Formal Methods Syst. Des. 15, 7–48 (1999)
Benveniste, A., Caspi, P., Edwards, S., Halbwachs, N., Le Guernic, P., de Simone, R.: The synchronous languages 12 years later. Proc. IEEE 91(1), 64–83 (2003)
Benveniste, A., Le Guernic, P., Aubry, P.: Compositionality in dataflow synchronous languages: specification & code generation. Technical report 3310, Irisa - Inria (1997)
Berry, G.: The Constructive Semantics of Pure Esterel (1999). http://www-sop.inria.fr/members/Gerard.Berry/Papers/EsterelConstructiveBook.pdf
Berry, G., Gonthier, G.: The Esterel synchronous programming language: design, semantics, implementation. Sci. Comput. Program. 19(2), 87–152 (1992)
Blochwitz, T., Otter, M., et al.: The functional mockup interface for tool independent exchange of simulation models. In: Proceedings of the 8th International Modelica Conference. Linkoping University Electronic Press (2011). http://www.ep.liu.se/ecp/063/013/ecp11063013.pdf
Blochwitz, T., Otter, M., et al.: Functional mock-up interface 2.0: the standard for tool independent exchange of simulation models. In: Proceedings of the 9th International Modelica Conference. Linkoping University Electronic Press (2012). http://www.ep.liu.se/ecp/076/017/ecp12076017.pdf
Bogomolov, S., Greitschus, M., Jensen, P.G., Larsen, K.G., Mikucionis, M., Strump, T., Tripakis, S.: Co-simulation of hybrid systems with SpaceEx and Uppaal. In: Proceedings of the 11th International Modelica Conference. Linkoping University Electronic Press (2015). http://www.ep.liu.se/ecp_article/index.en.aspx?issue=118;article=017
Brandt, J., Schneider, K.: Separate compilation for synchronous programs. In: SCOPES 2009: 12th International Workshop on Software and Compilers for Embedded Systems, pp. 1–10 (2009)
Broman, D., Brooks, C., Greenberg, L., Lee, E.A., Tripakis, S., Wetter, M., Masin, M.: Determinate composition of FMUs for co-simulation. In: Proceedings of the 13th ACM and IEEE International Conference on Embedded Software (EMSOFT 2013), pp. 2:1–2:12. IEEE (2013)
Broman, D., Greenberg, L., Lee, E.A., Masin, M., Tripakis, S., Wetter, M.: Requirements for hybrid cosimulation standards. In: Hybrid Systems: Computation and Control (HSCC 2015) (2015)
Caspi, P.: Clocks in dataflow languages. Theor. Comput. Sci. 94, 125–140 (1992)
Caspi, P., Pilaud, D., Halbwachs, N., Plaice, J.: LUSTRE: a declarative language for programming synchronous systems. In: 14th ACM Symposium POPL. ACM (1987)
Caspi, P., Raymond, P., Tripakis, S.: Synchronous programming. In: Lee, I., Leung, J., Son, S. (eds.) Handbook of Real-Time and Embedded Systems, pp. 14-1–14-21. Chapman & Hall, London (2007)
Cremona, F., Lohstroh, M., Broman, D., Natale, M.D., Lee, E.A., Tripakis, S.: Step revision in hybrid co-simulation with FMI. In: 14th ACM-IEEE International Conference on Formal Methods and Models for System Design (MEMOCODE) (2016)
Cremona, F., Lohstroh, M., Tripakis, S., Brooks, C., Lee, E.: FIDE - an FMI integrated development environment. In: 31st ACM/SIGAPP Symposium on Applied Computing, Embedded Systems Track (SAC), pp. 1759–1766. ACM (2016)
Dragomir, I., Preoteasa, V., Tripakis, S.: Compositional semantics and analysis of hierarchical block diagrams. In: Bošnački, D., Wijs, A. (eds.) SPIN 2016. LNCS, vol. 9641, pp. 38–56. Springer, Cham (2016). https://doi.org/10.1007/978-3-319-32582-8_3
Edwards, S., Lee, E.: The semantics and execution of a synchronous block-diagram language. Sci. Comput. Program. 48, 21–42 (2003)
Gamatié, A.: Designing Embedded Systems with the SIGNAL Programming Language. Springer, New York (2009). https://doi.org/10.1007/978-1-4419-0941-1
Gautier, T., Le Guernic, P.: Code generation in the SACRES project. In: Redmill, F., Anderson, T. (eds.) SSS 1999, pp. 127–149. Springer, London (1999). https://doi.org/10.1007/978-1-4471-0823-8_9
Geilen, M., Tripakis, S., Wiggers, M.: The earlier the better: a theory of timed actor interfaces. In: 14th International Conference Hybrid Systems: Computation and Control (HSCC 2011). ACM (2011)
Girault, A.: A survey of automatic distribution method for synchronous programs. In: International Workshop on Synchronous Languages, Applications and Programs, SLAP 2005. ENTCS, Elsevier, Edinburgh, April 2005. ftp://ftp.inrialpes.fr/pub/bip/pub/girault/Publications/Slap05/main.pdf
Hainque, O., Pautet, L., Le Biannic, Y., Nassor, É.: Cronos: a separate compilation tool set for modular esterel applications. In: Wing, J.M., Woodcock, J., Davies, J. (eds.) FM 1999. LNCS, vol. 1709, pp. 1836–1853. Springer, Heidelberg (1999). https://doi.org/10.1007/3-540-48118-4_47
Henzinger, T., Sifakis, J.: The discipline of embedded systems design. IEEE Comput. 40(10), 32–40 (2007)
Henzinger, T.A., Kirsch, C.M., Matic, S.: Composable code generation for distributed Giotto. In: Proceedings of the 2005 ACM SIGPLAN/SIGBED Conference on Languages, Compilers, and Tools for Embedded Systems, LCTES 2005, pp. 21–30. ACM, New York (2005). https://doi.org/10.1145/1065910.1065914
Le Guernic, P., Gautier, T., Borgne, M.L., Lemaire, C.: Programming real-time applications with signal. Proc. IEEE 79(9), 1321–1336 (1991)
Lee, E., Messerschmitt, D.: Synchronous data flow. Proc. IEEE 75(9), 1235–1245 (1987)
Lee, E., Zheng, H.: Leveraging synchronous language principles for heterogeneous modeling and design of embedded systems. In: EMSOFT 2007: Proceedings of 7th ACM and IEEE International Conference on Embedded software, pp. 114–123. ACM (2007)
Lublinerman, R., Szegedy, C., Tripakis, S.: Modular code generation from synchronous block diagrams - modularity vs. code size. In: 36th ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages (POPL 2009), pp. 78–89. ACM, January 2009
Lublinerman, R., Tripakis, S.: Modular code generation from triggered and timed block diagrams. In: 14th IEEE Real-Time and Embedded Technology and Applications Symposium (RTAS 2008), pp. 147–158. IEEE CS Press, April 2008
Lublinerman, R., Tripakis, S.: Modularity vs. reusability: code generation from synchronous block diagrams. In: Design, Automation, and Test in Europe (DATE 2008), pp. 1504–1509. ACM, March 2008
Malik, S.: Analysis of cyclic combinational circuits. IEEE Trans. Comput.-Aided Des. 13(7), 950–956 (1994)
Potop-Butucaru, D., Edwards, S., Berry, G.: Compiling Esterel. Springer, New York (2007). https://doi.org/10.1007/978-0-387-70628-3
Pouzet, M., Raymond, P.: Modular static scheduling of synchronous data-flow networks: an efficient symbolic representation. In: ACM International Conference on Embedded Software (EMSOFT 2009), pp. 215–224, October 2009
Preoteasa, V., Dragomir, I., Tripakis, S.: The refinement calculus of reactive systems. CoRR abs/1710.03979 (2017)
Preoteasa, V., Tripakis, S.: Refinement calculus of reactive systems. In: Proceedings of the 14th ACM and IEEE International Conference on Embedded Software (EMSOFT 2014), pp. 2:1–2:10. ACM, October 2014
Raymond, P.: Compilation séparée de programmes Lustre. Master’s thesis, IMAG (1988). (in French)
Schneider, K., Brandt, J., Vecchié, E.: Modular compilation of synchronous programs. In: Kleinjohann, B., Kleinjohann, L., Machado, R.J., Pereira, C.E., Thiagarajan, P.S. (eds.) DIPES 2006. IIFIP, vol. 225, pp. 75–84. Springer, Boston (2006). https://doi.org/10.1007/978-0-387-39362-9_9
Shin, I., Lee, I.: Compositional real-time scheduling framework with periodic model. ACM Trans. Embed. Comput. Syst. 7, 30:1–30:39 (2008). https://doi.org/10.1145/1347375.1347383
Strom, R.E., Yemini, S.: Typestate: a programming language concept for enhancing software reliability. IEEE Trans. Softw. Eng. 12(1), 157–171 (1986)
Tripakis, S., Bui, D., Geilen, M., Rodiers, B., Lee, E.A.: Compositionality in synchronous data flow: modular code generation from hierarchical SDF graphs. ACM Trans. Embed. Comput. Syst. (TECS) 12(3), 83:1–83:26 (2013)
Tripakis, S.: Bridging the semantic gap between heterogeneous modeling formalisms and FMI. In: International Conference on Embedded Computer Systems: Architectures, Modeling and Simulation - SAMOS XV (2015)
Tripakis, S.: Compositionality in the science of system design. Proc. IEEE 104(5), 960–972 (2016)
Tripakis, S., Lickly, B., Henzinger, T.A., Lee, E.A.: A theory of synchronous relational interfaces. ACM Trans. Program. Lang. Syst. (TOPLAS) 33(4), 14 (2011)
Tripakis, S., Stergiou, C., Shaver, C., Lee, E.A.: A modular formal semantics for Ptolemy. Math. Struct. Comput. Sci. 23, 834–881 (2013)
Zeng, J., Edwards, S.A.: Separate compilation for synchronous modules. In: Yang, L.T., et al. (eds.) ICESS 2005. LNCS, vol. 3820, pp. 129–140. Springer, Heidelberg (2005). https://doi.org/10.1007/11599555_15
Zhou, Y., Lee, E.: Causality interfaces for actor networks. ACM Trans. Embed. Comput. Syst. 7(3), 1–35 (2008)
Author information
Authors and Affiliations
Corresponding author
Editor information
Editors and Affiliations
Rights and permissions
Copyright information
© 2018 Springer International Publishing AG, part of Springer Nature
About this chapter
Cite this chapter
Tripakis, S., Lublinerman, R. (2018). Modular Code Generation from Synchronous Block Diagrams: Interfaces, Abstraction, Compositionality. In: Lohstroh, M., Derler, P., Sirjani, M. (eds) Principles of Modeling. Lecture Notes in Computer Science(), vol 10760. Springer, Cham. https://doi.org/10.1007/978-3-319-95246-8_26
Download citation
DOI: https://doi.org/10.1007/978-3-319-95246-8_26
Published:
Publisher Name: Springer, Cham
Print ISBN: 978-3-319-95245-1
Online ISBN: 978-3-319-95246-8
eBook Packages: Computer ScienceComputer Science (R0)