Title: Einsterel: A Compiled Event-Driven Simulator for Esterel
1Einsterel A Compiled Event-DrivenSimulator for
Esterel
2Main contribution -Scheduling of events at run
time. This can give a substantial performance
advantage.
3It worked!
A subset of Esterel was successfully
implemented. Einsterel can simulate Esterel code
over 2.5 times faster than Berrys v5 compiler.
Furthermore it is at least some percentage faster
for all test benches ran.
nothing emit S present S then p else q end loop p end pause suspend p when S p q p q await S Boolean Logic (and, or, not) Do nothing Make S present this instant Run p is S is present, q otherwise Run p. Restart it when it terminates Stop here resume in the next instant Run p in this instant, but only in later instants when S is absent Run p and q concurrently terminate when both do. Run p, wait for it to terminate, then run q pause until the next cycle in which S is present Performs specified logic function
Einsterels implemented statements
4EinGraph
The event graph for Einsterel is referred to as
EinGraph. It consists of array of EinNodes
struct EinNode int numFanIns int
numFanOuts int level int fanIns
int fanOuts void pFunc Figure 1
EinNode
5Example 1
present A then emit B end
6Building EinGraph
ESUIF is used as front end to parse Esterel into
SUIF. Einsterels graph building code is built
off of ESUIFs pass on the SUIF to generate
Esterel. Essentially, instead of outputting
Esterel, it creates EinNodes and puts them in
an array. At the end of this pass the the
EinNodes are fully constructed with the exception
of their level.
7Levelizing EinGraph
changed1 while someones level has changed
changed0 for every node for every
fanout of this node FixLevel(parents_level
) Figure 2 Levelizing Algorithm -
Exceptions exist.
highest_level_seen parents_level for each
fanin if fanin_level gt highest level_seen
highest_level_seen fanin_level endfor if
highest_level_seen gt my_level my_level
highest_level_seen 1 changed1 Figure 3
FixLevel(parents_level)
8Example 1 (revisited)
present A then emit B end
A
B
Present
9Event Wheel Structure
Figure 4
numScheduledlevel wheellevelnumScheduled
levelnodeNumber inWheelnodeNumber
1 Figure 5 Inserting a node to the wheel
numScheduledlevel-- inWheelnodeNumber
0 Figure 6 Deleting a node from the wheel
10Scheduling and Running
for each level in the wheel while there are
nodes scheduled in this level then for each
node in this level delete it from the
wheel goto (its evaluation code) and set
eval if (eval ! last cycles eval) then
schedule its unscheduled fan-outs Figure 7
Basic simulation algorithm
11Figure 8 Running a sample program
cycle-by-cycle
12Synthesizing C
The Target C code is divided into two main
sections. 1. Initializing EinGraph
This changes for each Esterel input program.
EinGraph is looped over and written out. 2.
Simulation code Same for every program,
simply written out.
13Results
- Three trends Performance gap increases as
- The number of cycles increases
- The parallelism in the Esterel program increases
- The number of driven inputs decreases
14 Future Work
Implementing the full Esterel language. Decreasing
Compile time. Increase performance with
compile-time optimizations Detection of
instantaneous loops and illegal cycles