Title: Partial evaluation for optimized compilation of actororiented models
1Partial evaluation for optimized compilation of
actor-oriented models
Gang Zhou, Man-Kit Leung and Edward A. Lee
with contributions from Christopher Brooks and Ye
Zhou
2 Goals
- Design of embedded system based on understandable
concurrency formalism - Provide appropriate abstraction level
- Provide useful modeling properties
- Easy to reason about and guarantee correctness
- Yield static analyzability
- Automatically derive efficient implementation
based on partial evaluation - Generate semantically equivalent code
- Performance close to manually written code
Functions, requirements, specifications
Designs expressed through programming model
Partial evaluation
Implementations
3How embedded software has been traditionally
written
- Assembly language is used to maximize efficiency
and predictability - C is used to improve productivity and portability
- Threads are used as concurrency formalism
provided by underlying operating system - Very low level mechanisms (e.g., mutual exclusion
locks) are used for synchronization
Problem Interacting threads are not
compositional, therefore they are difficult to
reason about and guarantee correctness. Solution
We need alternative concurrency formalisms to
match the abstractions with the embedded
applications.
4Actor-oriented design a formalized model of
concurrency
object oriented
actor oriented
- Actor-oriented design hides the states of each
actor and makes them inaccessible from other
actor - The emphasis of data flow over control flow leads
to conceptually concurrent execution of actors - The interaction between actors happens in a
highly disciplined way - Threads and mutexes become implementation
mechanism instead of part of programming model
5Simulink time-based block diagram
- Physical plant is modeled by continuous time
dynamics - Controller is modeled by discrete time system
- Real-Time Workshop (RTW) is used for code
generation
6Embedded system needs decidable formalism
- Decidable formalism yields static analyzability
- Avoid deadlock
- Bound on memory consumption
- Bound on execution time
- .
- Some examples with decidable formalism
- Synchronous dataflow (SDF) (Lee and
Messerschmitt) - Cyclo-static dataflow (CSDF) (Bilsen et al.)
- FORTRAN before 90
- Synchronous languages (Berry et al., Halbwachs et
al., Guernic et al.)
7From SDF to modal models
- Synchronous dataflow (SDF) a decidable MoC
amenable to static analysis
rA 2 rB 3 gt fA 3 fB 2
A
B
rA
rB
- Schedule (for one complete iteration)
- AAABB
- AABAB
Balance equation fArA fBrB
(Each actor has fixed rate)
- We want to augment SDF to describe dynamic
behavior in a convenient, compact and
understandable way
Refinement C
Refinement B
Refinement A
(Each refinement can have different rate)
8Heterochronous Dataflow (HDF) SDF FSM
transition constraints(Girault, Lee, Lee, 97)
Constraint State transitions are only allowed to
be taken when the model completes one iteration
(i.e., one complete SDF schedule) in the given
state.
HDF
HDFFSM
HDFFSM
HDF
SDF
SDF
SDF
Consequence HDF retains static analyzability
due to the nature of the FSM.
HDFFSM
SDF
SDF
9Execution trace and configurations
Between state transitions, the model is in a
well-defined configuration represented by a
single SDF model
Configuration i1
Configuration i2
Configuration i3
Configuration i4
Configuration i
State transitions
The code generation framework provides a
systematic way to statically analyze and derive
all possible configurations for a given model.
10Ptolemy II a software lab for experimenting with
multiple concurrency formalisms
Observation great as a prototyping environment,
but the resulting inefficiency induced by
indirection overhead is unacceptable for embedded
system implementation.
Design
Implementation
- Generic components
- Well-defined interface
- Highly specialized components
- No communication overhead
Solution Partial evaluation based compilation
(code generation).
11Partial evaluation and automatic program
generation (Jones, Gomard, Sestoft 1993)
data
static input in1
program
partial evaluator mix
subject program p
residual program Pin1
dynamic input in2
output
run time program generation
compile time program generation
12Partial evaluation in practice
- General purpose software
- Functional language (Bondorf 1989, Gomard and
Jones 1989) - Logic language (Lloyd and Shepherdson 1991)
- Imperative language (Anderson 1994)
- Object-oriented language (Schultz 1999)
- Embedded software
- The click model optimizations for modular router
configurations - Optimization tools click-fastclassifier,
click-devirtualize, click-xform, click-undead - (Kohler et al., 2002, MIT)
- The Koala Component Model for Consumer
Electronics Software - (Ommering et al., 2000, Philips Research Lab)
13My approach partial evaluation for
actor-oriented programs
data
execution context data types, buffer
sizes, schedules, parameters, model structure,
etc.
program
model analysis
partial evaluator (code generator)
model (actor-oriented program)
highly optimized target code blocks
code generation
monolithic and efficient executable
input
output
target code execution
14Realization of partial evaluation with
helper-based mechanism
Actor
Actor helper
- Each actor has a corresponding helper class which
is responsible for generating the target code for
that actor under the given execution context. - Each director (which is responsible for governing
the interaction between actors) has a
corresponding helper class for providing
MoC-specific information and orchestrating the
code generation for the model. - The helper class hierarchy and package structure
parallel those of the corresponding actors, to
achieve modularity, maintainability, portability,
efficiency and extensibility in code generation.
Director
Director helper
15Key classes in helper-based mechanism
Key classes that support actor execution
Key classes that support code generation
- Key points
- The helper based-mechanism preserves the actor
interface (ports and parameters). Each helper
discovers the interface by interrogating its
associated actor. - It realizes code generation for multiple MoC by
using the associated director helper for the
corresponding director. - It realizes code generation for multiple target
languages by using corresponding set of actor
helpers.
16Actor and helper libraries
Actor libraries
Helper classes
ptolemy.actor.lib
ptolemy.codegen.c.actor.lib
AbsoluteValue Accumulator AddSubtract Average Bern
oulli Commutator Const Counter Differential Discar
d ElementsToArray Gaussian GradientAdaptivelattice
Limiter LookupTable Maximum Minimum MonitorValue
MultiplyDivide Pulse Quantizer Ramp Remainder
AbsoluteValue Accumulator AddSubtract Average Bern
oulli Commutator Const Counter Differential Discar
d ElementsToArray Gaussian GradientAdaptivelattice
Limiter LookupTable Maximum Minimum MonitorValue
MultiplyDivide Pulse Quantizer Ramp Remainder
ptolemy.codegen.c.actor.lib.comm
ptolemy.actor.lib.comm
HammingCoder HammingDecoder
HammingCoder HammingDecoder
ptolemy.actor.lib.conversion
ptolemy.codegen.c.actor.lib.conversion
BooleanToAnything CartesianToPolar
BooleanToAnything CartesianToPolar
ptolemy.codegen.c.actor.lib.gui
ptolemy.actor.lib.gui
Display SequencePlotter
Display SequencePlotter
ptolemy.codegen.c.actor.lib.logic
ptolemy.actor.lib.logic
Equals LogicFunction
Equals LogicFunction
17Director and helper libraries
Directors and domain-specific actors
Helper classes
ptolemy.domains.fsm.kernel
ptolemy.codegen.c.domains.fsm.kernel
FSMActor FSMDirector MultirateFSMDirector
FSMActor FSMDirector MultirateFSMDirector
ptolemy.domains.fsm.modal
ptolemy.codegen.c.domains.fsm.modal
ModalController ModalModel Refinement TransitionRe
finement
ModalController ModalModel Refinement TransitionRe
finement
ptolemy.domains.hdf.kernel
ptolemy.codegen.c.domains.hdf.kernel
HDFDirector HDFFSMDirector
HDFDirector HDFFSMDirector
ptolemy.domains.sdf.kernel
ptolemy.codegen.c.domains.sdf.kernel
SDFDirector
SDFDirector
ptolemy.domains.sdf.lib
ptolemy.codegen.c.domains.sdf.lib
Repeat SampleDelay
Repeat SampleDelay
18A simple helper example
Actor ptolemy.actor.lib.Ramp (in Java)
Helper java class ptolemy.codegen.c.actor.li
b.Ramp (in Java)
C code template file ptolemy.codegen.c.actor.lib
.Ramp.c
/preinitBlock/ static int
actorSymbol(state) // /initBlock/
actorSymbol(state) val(init) // /fireBl
ock/ ref(output) actorSymbol(state)
actorSymbol(state) val(step) //
19A flow chart for the code generation process
These files include, e.g., math.h, stdio.h,
needed by some actors in their generated code.
Generate Include files.
The shared code includes macro definitions, new
data type definitions, function definitions, etc.
Generate shared code.
These are variables that are directly modified by
actors, e.g., during mode transition.
Collect modified variables.
New variables other than those resulting from
ports and parameters could be defined here.
Generate preinitialize code.
These offset variables are used to record the
circular buffer positions during code generation.
Create offset variables.
Variables are initialized here. Make sure the
code generated here can be executed multiple
times, e.g., after a reset transition in a FSM.
Generate initialize code.
The code generated here performs major functions,
corresponding to actor firings.
Generate body code.
The code generated here does some wrapup work,
e.g., closing open files.
Generate wrapup code.
These variables are those resulting from ports
and parameters. Some can only be determined after
the code generation is complete.
Generate variable definitions.
The code generated here is necessary to support
dynamic type conversion.
Generate type-conversion code.
20Advantages of helper-based code generation
framework
- A flexible and extensible framework
- new actors and helpers, new directors and
helpers, new target language - seamless integration between the specification
and simulation phase and the code generation
phase - code generation framework functions as a
coordination language - leverage the huge legacy code repository
- leverage many years and many researchers work on
compiler optimization techniques for the target
language - accessible to the huge base of programmers
- generated code is (semi-)human readable
21Partial evaluation based code generation in action
22Partial evaluation based code generation in action
include ltstdio.hgt static double
_model_ModalModel_state1_scaleFactor_ static
double _model_ModalModel_state2_input static
double _model_ModalModel_state2_output3 static
double _model_ModalModel_state2_Repeat_input stat
ic double _model_ModalModel_state2_Scale_input3
static double _model_ModalModel_state1_input sta
tic double _model_ModalModel_state1_output static
int _model_currentConfiguration static int
_model_ModalModel_output_readoffset 0 static
int _model_ModalModel_output_writeoffset
0 static int iteration 0 ................. mai
n(int argc, char argv)
_model_ModalModel_state1_scaleFactor_ 1
_model_ModalModel_currentConfiguration 1
_model_currentConfiguration 0
_model_ModalModel_currentConfiguration 1 0
/ Static schedule / for (iteration 0
iteration lt 4 iteration )
switch (_model_currentConfiguration)
case 0 _model_ModalModel_input
_model_Ramp_state _model_Ramp_state
1.0 _model_ModalModel__Controller_
input _model_ModalModel_state2_input
_model_ModalModel_input
_model_ModalModel_state2_Repeat_input
_model_ModalModel_state2_input
_model_ModalModel_state2_Scale_input0
_model_ModalModel_state2_Scale_input1
_model_ModalModel_state2_Scale_
input2 _model_ModalModel_state2_Repeat_input
_model_ModalModel_state2_output0
4 _model_ModalModel_state2_Scale_input0
_model_ModalModel_state2_output1 4
_model_ModalModel_state2_Scale_input1
_model_ModalModel_state2_output2 4
_model_ModalModel_state2_Scale_input2
.. case 1
................. _model_ModalModel_s
tate1_Scale_input _model_ModalModel_state1_input
_model_ModalModel_state1_output
_model_ModalModel_state1_scaleFactor_
_model_ModalModel_state1_Scale_input
_model_ModalModel_output(_model_Modal
Model_output_writeoffset 0)3
_model_ModalModel__Controller_output(_mode
l_ModalModel__Controller_output_writeoffset
0)3 _model_ModalModel_sta
te1_output _model_ModalModel_output_
writeoffset (_model_ModalModel_output_writeoffse
t 1)3 _model_ModalModel__Controll
er_output_writeoffset (_model_ModalModel__Contro
ller_output_writeoffset 1)3
............... if
(_model_ModalModel_fired) switch
(_model_ModalModel__Controller_currentState)
case 0 if
((_model_ModalModel__Controller_input gt 0))
_model_ModalModel_state1_scale
Factor_ _model_ModalModel__Controller_input
_model_ModalModel__Controller
_currentState 1
_model_ModalModel_currentConfiguration 1
break
case 1 if (true)
_model_ModalModel__Contr
oller_currentState 0
_model_ModalModel_currentConfiguration 0
break
_model_ModalModel_fired 0
. ................
23Partial evaluation based code generation in action
include ltstdio.hgt static double
_model_ModalModel_state1_scaleFactor_ static
double _model_ModalModel_state2_input static
double _model_ModalModel_state2_output3 static
double _model_ModalModel_state2_Repeat_input stat
ic double _model_ModalModel_state2_Scale_input3
static double _model_ModalModel_state1_input sta
tic double _model_ModalModel_state1_output static
int _model_currentConfiguration static int
_model_ModalModel_output_readoffset 0 static
int _model_ModalModel_output_writeoffset
0 static int iteration 0 ................. mai
n(int argc, char argv)
_model_ModalModel_state1_scaleFactor_ 1
_model_ModalModel_currentConfiguration 1
_model_currentConfiguration 0
_model_ModalModel_currentConfiguration 1 0
/ Static schedule / for (iteration 0
iteration lt 4 iteration )
switch (_model_currentConfiguration)
case 0 _model_ModalModel_input
_model_Ramp_state _model_Ramp_state
1.0 _model_ModalModel__Controller_
input _model_ModalModel_state2_input
_model_ModalModel_input
_model_ModalModel_state2_Repeat_input
_model_ModalModel_state2_input
_model_ModalModel_state2_Scale_input0
_model_ModalModel_state2_Scale_input1
_model_ModalModel_state2_Scale_
input2 _model_ModalModel_state2_Repeat_input
_model_ModalModel_state2_output0
4 _model_ModalModel_state2_Scale_input0
_model_ModalModel_state2_output1 4
_model_ModalModel_state2_Scale_input1
_model_ModalModel_state2_output2 4
_model_ModalModel_state2_Scale_input2
.. case 1
................. _model_ModalModel_s
tate1_Scale_input _model_ModalModel_state1_input
_model_ModalModel_state1_output
_model_ModalModel_state1_scaleFactor_
_model_ModalModel_state1_Scale_input
_model_ModalModel_output(_model_Modal
Model_output_writeoffset 0)3
_model_ModalModel__Controller_output(_mode
l_ModalModel__Controller_output_writeoffset
0)3 _model_ModalModel_sta
te1_output _model_ModalModel_output_
writeoffset (_model_ModalModel_output_writeoffse
t 1)3 _model_ModalModel__Controll
er_output_writeoffset (_model_ModalModel__Contro
ller_output_writeoffset 1)3
............... if
(_model_ModalModel_fired) switch
(_model_ModalModel__Controller_currentState)
case 0 if
((_model_ModalModel__Controller_input gt 0))
_model_ModalModel_state1_scale
Factor_ _model_ModalModel__Controller_input
_model_ModalModel__Controller
_currentState 1
_model_ModalModel_currentConfiguration 1
break
case 1 if (true)
.................
init 0.0 step 1.0
data type
memory allocation
24Partial evaluation based code generation in action
include ltstdio.hgt static double
_model_ModalModel_state1_scaleFactor_ static
double _model_ModalModel_state2_input static
double _model_ModalModel_state2_output3 static
double _model_ModalModel_state2_Repeat_input stat
ic double _model_ModalModel_state2_Scale_input3
static double _model_ModalModel_state1_input sta
tic double _model_ModalModel_state1_output static
int _model_currentConfiguration static int
_model_ModalModel_output_readoffset 0 static
int _model_ModalModel_output_writeoffset
0 static int iteration 0 ................. mai
n(int argc, char argv)
_model_ModalModel_state1_scaleFactor_ 1
_model_ModalModel_currentConfiguration 1
_model_currentConfiguration 0
_model_ModalModel_currentConfiguration 1 0
/ Static schedule / for (iteration 0
iteration lt 4 iteration )
switch (_model_currentConfiguration)
case 0 _model_ModalModel_input
_model_Ramp_state _model_Ramp_state
1.0 _model_ModalModel__Controller_
input _model_ModalModel_state2_input
_model_ModalModel_input
_model_ModalModel_state2_Repeat_input
_model_ModalModel_state2_input
_model_ModalModel_state2_Scale_input0
_model_ModalModel_state2_Scale_input1
_model_ModalModel_state2_S
cale_input2
_model_ModalModel_state2_Repeat_input
_model_ModalModel_state2_output0 4
_model_ModalModel_state2_Scale_input0
_model_ModalModel_state2_output1 4
_model_ModalModel_state2_Scale_input1
_model_ModalModel_state2_output2 4
_model_ModalModel_state2_Scale_input2
.............. case 1
............... _model_ModalModel_sta
te1_Scale_input _model_ModalModel_state1_input
_model_ModalModel_state1_output
_model_ModalModel_state1_scaleFactor_
_model_ModalModel_state1_Scale_input
_model_ModalModel_output(_model_Modal
Model_output_writeoffset 0)3
_model_ModalModel__Controller_output(_mode
l_ModalModel__Controller_output_writeoffset
0)3 _model_ModalModel_sta
te1_output _model_ModalModel_output_
writeoffset (_model_ModalModel_output_writeoffse
t 1)3 _model_ModalModel__Controll
er_output_writeoffset (_model_ModalModel__Contro
ller_output_writeoffset 1)3
............... if
(_model_ModalModel_fired) switch
(_model_ModalModel__Controller_currentState)
case 0 if
((_model_ModalModel__Controller_input gt 0))
_model_ModalModel_state1_scale
Factor_ _model_ModalModel__C
ontroller_input
_model_ModalModel__Controller_currentState 1
_model_ModalModel_currentCon
figuration 1
static parameter
25Partial evaluation based code generation in action
include ltstdio.hgt static double
_model_ModalModel_state1_scaleFactor_ static
double _model_ModalModel_state2_input static
double _model_ModalModel_state2_output3 static
double _model_ModalModel_state2_Repeat_input stat
ic double _model_ModalModel_state2_Scale_input3
static double _model_ModalModel_state1_input sta
tic double _model_ModalModel_state1_output static
int _model_currentConfiguration static int
_model_ModalModel_output_readoffset 0 static
int _model_ModalModel_output_writeoffset
0 static int iteration 0 ................. mai
n(int argc, char argv)
_model_ModalModel_state1_scaleFactor_ 1
_model_ModalModel_currentConfiguration 1
_model_currentConfiguration 0
_model_ModalModel_currentConfiguration 1 0
/ Static schedule / for (iteration 0
iteration lt 4 iteration )
switch (_model_currentConfiguration)
case 0 _model_ModalModel_input
_model_Ramp_state _model_Ramp_state
1.0 _model_ModalModel__Controller_
input _model_ModalModel_state2_input
_model_ModalModel_input
_model_ModalModel_state2_Repeat_input
_model_ModalModel_state2_input
_model_ModalModel_state2_Scale_input0
_model_ModalModel_state2_Scale_input1
_model_ModalModel_state2_Scale_
input2 _model_ModalModel_state2_Repeat_input
_model_ModalModel_state2_output0
4 _model_ModalModel_state2_Scale_input0
_model_ModalModel_state2_output1 4
_model_ModalModel_state2_Scale_input1
_model_ModalModel_state2_output2 4
_model_ModalModel_state2_Scale_input2
.. case 1
................. _model_ModalModel_s
tate1_Scale_input _model_ModalModel_state1_input
_model_ModalModel_state1_output
_model_ModalModel_state1_sc
aleFactor_
_model_ModalModel_state1_Scale_input
_model_ModalModel_output(_model_ModalModel_outpu
t_writeoffset 0)3
_model_ModalModel__Controller_output(_model_Modal
Model__Controller_output_writeoffset 0)3
_model_ModalModel_state1_output
_model_ModalModel_output_writeoffset
(_model_ModalModel_output_writeoffset 1)3
_model_ModalModel__Controller_output_w
riteoffset (_model_ModalModel__Controller_output
_writeoffset 1)3
............... if
(_model_ModalModel_fired) switch
(_model_ModalModel__Controller_currentState)
case 0 if
((_model_ModalModel__Controller_input gt 0))
_model_ModalModel_state1_scale
Factor_ _model_ModalModel__
Controller_input
_model_ModalModel__Controller_currentState 1
_model_ModalModel_currentCon
figuration 1
break case 1
dynamic parameter
26Partial evaluation based code generation in action
include ltstdio.hgt static double
_model_ModalModel_state1_scaleFactor_ static
double _model_ModalModel_state2_input static
double _model_ModalModel_state2_output3 static
double _model_ModalModel_state2_Repeat_input stat
ic double _model_ModalModel_state2_Scale_input3
static double _model_ModalModel_state1_input sta
tic double _model_ModalModel_state1_output static
int _model_currentConfiguration static int
_model_ModalModel_output_readoffset 0 static
int _model_ModalModel_output_writeoffset
0 static int iteration 0 ................. mai
n(int argc, char argv)
_model_ModalModel_state1_scaleFactor_ 1
_model_ModalModel_currentConfiguration 1
_model_currentConfiguration 0
_model_ModalModel_currentConfiguration 1 0
/ Static schedule / for (iteration 0
iteration lt 4 iteration )
switch (_model_currentConfiguration)
case 0 _model_ModalModel_input
_model_Ramp_state _model_Ramp_state
1.0 _model_ModalModel__Controller_
input _model_ModalModel_state2_input
_model_ModalModel_input
_model_ModalModel_state2_Repeat_input
_model_ModalModel_state2_input
_model_ModalModel_state2_Scale_input0
_model_ModalModel_state2_Scale_input1
_model_ModalModel_state2_S
cale_input2
_model_ModalModel_state2_Repeat_input
_model_ModalModel_state2_output0 4
_model_ModalModel_state2_Scale_input0
_model_ModalModel_state2_output1 4
_model_ModalModel_state2_Scale_input1
_model_ModalModel_state2_output2 4
_model_ModalModel_state2_Scale_input2
.............. case 1
............... _model_ModalModel_sta
te1_Scale_input _model_ModalModel_state1_input
_model_ModalModel_state1_output
_model_ModalModel_state1_scaleFactor_
_model_ModalModel_state1_Scale_input
_model_ModalModel_output(_model_Modal
Model_output_writeoffset 0)3
_model_ModalModel__Controller_output(_mode
l_ModalModel__Controller_output_writeoffset
0)3 _model_ModalModel_sta
te1_output _model_ModalModel_output_
writeoffset (_model_ModalModel_output_writeoffse
t 1)3 _model_ModalModel__Controll
er_output_writeoffset (_model_ModalModel__Contro
ller_output_writeoffset 1)3
............... if
(_model_ModalModel_fired) switch
(_model_ModalModel__Controller_currentState)
case 0 if
((_model_ModalModel__Controller_input gt 0))
_model_ModalModel_state1_scale
Factor_ _model_ModalModel__C
ontroller_input
_model_ModalModel__Controller_currentState 1
_model_ModalModel_currentCon
figuration 1
model structure
27Partial evaluation based code generation in action
include ltstdio.hgt static double
_model_ModalModel_state1_scaleFactor_ static
double _model_ModalModel_state2_input static
double _model_ModalModel_state2_output3 static
double _model_ModalModel_state2_Repeat_input sta
tic double _model_ModalModel_state1_input static
double _model_ModalModel_state1_output static
int _model_currentConfiguration static int
_model_ModalModel_output_readoffset 0 static
int _model_ModalModel_output_writeoffset
0 static int iteration 0 ................. mai
n(int argc, char argv)
_model_ModalModel_state1_scaleFactor_ 1
_model_ModalModel_currentConfiguration 1
_model_currentConfiguration 0
_model_ModalModel_currentConfiguration 1 0
/ Static schedule / for (iteration 0
iteration lt 4 iteration )
switch (_model_currentConfiguration) case
0 _model_ModalModel_input
_model_Ramp_state _model_Ramp_state
1.0 _model_ModalModel__Controller_
input _model_ModalModel_state2_input
_model_ModalModel_input
_model_ModalModel_state2_Repeat_input
_model_ModalModel_state2_input
_model_ModalModel_state2_Scale_input0
_model_ModalModel_state2_Scale_input1
_model_ModalModel_state2_Scale_
input2 _model_ModalModel_state2_Repeat_input
_model_ModalModel_state2_output0
4 _model_ModalModel_state2_Scale_input0
_model_ModalModel_state2_output1 4
_model_ModalModel_state2_Scale_input1
_model_ModalModel_state2_output2 4
_model_ModalModel_state2_Scale_input2
.. case 1
................. _model_ModalModel_s
tate1_Scale_input _model_ModalModel_state1_input
_model_ModalModel_state1_output
_model_ModalModel_state1_scaleFactor_
_model_ModalModel_state1_Scale_input
_model_ModalModel_output(_model_Modal
Model_output_writeoffset 0)3
_model_ModalModel__Controller_output(_mode
l_ModalModel__Controller_output_writeoffset
0)3 _model_ModalModel_sta
te1_output _model_ModalModel_output_
writeoffset (_model_ModalModel_output_writeoffse
t 1)3 _model_ModalModel__Controll
er_output_writeoffset (_model_ModalModel__Contro
ller_output_writeoffset 1)3
if (_model_ModalModel_fired)
switch (_model_ModalModel__Controller_currentState
) case 0 if
((_model_ModalModel__Controller_input gt 0))
_model_ModalModel_state1_scale
Factor_ _model_ModalModel__Controller_input
_model_ModalModel__Controller
_currentState 1
_model_ModalModel_currentConfiguration 1
break
case 1 if (true)
_model_ModalModel__Controller_curren
tState 0
MoC-specific scheduling
firing sequence
firing sequence
state transition
28Performance
Ratio of time per iteration
970
Ratio of time per iteration
520
Ratio of time per iteration
710
29Future direction
- Explore code generation for other MoCs suited for
embedded system design and for other target
languages (e.g., VHDL) - Integrate code generation with PTIDES a
time-synchronized distributed run time environment
30Conclusion
- The partial evaluation based compilation (code
generation) framework provides a rapid path from
a design environment with understandable
concurrency formalism to efficient implementation - HDF formalism balances the need for
schedulability analysis for embedded software and
the more expressive support of modal behavior - Combined with timed MoC (DE-variant), we can
realize a run time environment with precise
timing control