Actor Model-to-C Embedded Programming
Man-Kit Leung, Gang Zhou, Teale Fristoe, Christopher Brooks and Edward A. Lee
The goal of the Ptolemy II [1-3] code generation framework is to provide a toolflow for building applications from actor models onto various embedded platforms. The task is to map abstract model specifications into concrete (platform-specific) code. While the modeling environment pushes for higher abstraction layers using data and behavioral polymorphism to provide flexibility, run-time code for specific platforms and applications is specialized for performance and efficiency. Thus, porting simulation code directly results in inefficient code. Compilation of actor models is necessary but not a straightforward process because of the different execution semantics given by directors (domain polymorphism). This presents a wide range of challenges and optimization opportunities. In this new version of the code generator, we propose a top-down mapping strategy using a special software architecture where helper classes are used as software containers to isolate the code complexity of director and actor classes. We also leverage meta-programming techniques to maximize code reuse and statically parameterize the output code.
A recent discovery made in the course of building our framework is that parameterization occurs at different levels in a model. Many components are designed to perform multiple operations with parameter customization. Port connections are implicitly parameterized for different communication semantics. Dynamic type checking and automatic data conversion are other forms of generalization techniques that allow greater compatibility of components in different contexts. These realizations present a wide range of research opportunities on how to generalize partial evaluation techniques  to perform aggressive optimization across domains.
In addition to building primitive interface code and general optimizations, we also recognize the tradeoffs between different styles of code structure in various metrics relevant to embedded systems (e.g., code/data memory size, run-time performance, and parallel execution). One of the main focuses in the future for our framework is to maximize code flexibility in meeting the specifications/requirements of various target platforms.
- C. Brooks, E. A. Lee, X. Liu, S. Neuendorffer, Y. Zhao, and H. Zheng (eds.), "Heterogeneous Concurrent Modeling and Design in Java (Volume 1: Introduction to Ptolemy II," UC Berkeley EECS Department Technical Report No. UCB/EECS-2007-7, January 11, 2007.
- C. Brooks, E. A. Lee, X. Liu, S. Neuendorffer, Y. Zhao, and H. Zheng (eds.), "Heterogeneous Concurrent Modeling and Design in Java (Volume 2: Ptolemy II Software Architecture)," UC Berkeley EECS Department Technical Report No. UCB/EECS-2007-8, January 11, 2007.
- C. Brooks, E. A. Lee, X. Liu, S. Neuendorffer, Y. Zhao, and H. Zheng (eds.), "Heterogeneous Concurrent Modeling and Design in Java (Volume 3: Ptolemy II Domains)," UC Berkeley EECS Department Technical Reports, UC Berkeley EECS Department Technical Report No. UCB/EECS-2007-9, January 11, 2007.
- G. Zhou, M.-K. Leung, and E. A. Lee, "A Code Generation Framework for Actor-Oriented Models with Partial Evaluation," Proceedings of International Conference on Embedded Software and Systems 2007, LNCS Vol. 4523, Daegu, South Korea, May 14-16, 2007, pp. 786-799.