Title: Compiling ESTEREL circuits into finite states machines
1Compiling ESTEREL circuitsinto finite states
machines
BRES Yannis Stage de DEA dInformatique 1998/1999
2Esterel constructive semantics
Gives, for each statement p
, provided an initial environment E
A new environment E
A completion code k (terminated, paused or trap
exit level)
A derivative statement p, to be executed on next
step
E
k
,
p
p
E
3Circuit compilation
Thus, each statement p of the language can be
compiled into a circuit
E are wires indicating present signals
E are wires indicating emitted signals
k indicates which completing code wire will be on
p is a another circuit activated by k wire
4Generated circuits
Directed graphs
logical gates (and, or, not, )
registers (memory elements)
wires
5Example of circuit
abort sustain O when I
6Circuits vs. automata
Circuits are roughly linear while automata are
exponential
? No automata for big circuits
Up to medium-sized circuits
Automata are faster (run-time minimal)
Control flow computed at compile-time
? Only input/test dependent stuff remain at
run-time
Ex Motorola measures maximal application speed
7Current compilation chain
8Future compilation chain
Esterel source
.strl
.strl
.strl
strlic
strlic
strlic
intermediate code
.ic
.ic
.ic
iclc
linked code
.lc
lcsc
circuit code
.sc
automaton code
.oc
9SSCOC automaton generation
Circuit is seen like a set of boolean equations
To be evaluated, equations must be sorted (?.ssc)
Sorting fails on several kind of cyclic circuits !
Code unmaintained...
10SCOC automaton compilation
Algorithm follows electrical current
new informations (hot) propagated informations
(cold)
11SCOC automaton compilation
Building initial state
Propagating registers
new informations (hot) propagated informations
(cold)
12SCOC automaton compilation
Building initial state
Propagating registers
new informations (hot) propagated informations
(cold)
13SCOC automaton compilation
Building initial state
Propagating registers
new informations (hot) propagated informations
(cold)
14SCOC automaton compilation
Building initial state
Propagating registers
new informations (hot) propagated informations
(cold)
15SCOC automaton compilation
Building initial state
Propagating registers
new informations (hot) propagated informations
(cold)
16SCOC automaton compilation
Building initial state
Propagating registers
new informations (hot) propagated informations
(cold)
17SCOC automaton compilation
Building initial state
Propagating registers
new informations (hot) propagated informations
(cold)
18SCOC automaton compilation
Building initial state
Propagating registers
new informations (hot) propagated informations
(cold)
19SCOC automaton compilation
Building initial state
Propagating registers
new informations (hot) propagated informations
(cold)
20SCOC automaton compilation
Building initial state
Propagating registers
new informations (hot) propagated informations
(cold)
21SCOC automaton compilation
Initial state built
new informations (hot) propagated informations
(cold)
22SCOC automaton compilation
Initial state built
Building state 1
new informations (hot) propagated informations
(cold)
23SCOC automaton compilation
Initial state built
Building state 1
new informations (hot) propagated informations
(cold)
Loading registers values
24SCOC automaton compilation
Initial state built
Building state 1
new informations (hot) propagated informations
(cold)
Loading registers values
Propagating registers
25SCOC automaton compilation
Initial state built
Building state 1
new informations (hot) propagated informations
(cold)
Loading registers values
Propagating registers
26SCOC automaton compilation
Initial state built
Building state 1
new informations (hot) propagated informations
(cold)
Loading registers values
Propagating registers
27SCOC automaton compilation
Initial state built
Building state 1
new informations (hot) propagated informations
(cold)
Loading registers values
Propagating registers
28SCOC automaton compilation
Initial state built
Building state 1
new informations (hot) propagated informations
(cold)
Loading registers values
Propagating registers
Forking on input signal I
29SCOC automaton compilation
Initial state built
Building state 1
new informations (hot) propagated informations
(cold)
Loading registers values
Propagating registers
Forking on input signal I
Building branch where I is present
30SCOC automaton compilation
Initial state built
Building state 1
new informations (hot) propagated informations
(cold)
Loading registers values
Propagating registers
Forking on input signal I
Building branch where I is present
31SCOC automaton compilation
Initial state built
Building state 1
new informations (hot) propagated informations
(cold)
Loading registers values
Propagating registers
Forking on input signal I
Building branch where I is present
32SCOC automaton compilation
Initial state built
Building state 1
new informations (hot) propagated informations
(cold)
Loading registers values
Propagating registers
Forking on input signal I
Building branch where I is present
33SCOC automaton compilation
Initial state built
Building state 1
new informations (hot) propagated informations
(cold)
Loading registers values
Propagating registers
Forking on input signal I
Building branch where I is present
34SCOC automaton compilation
Initial state built
Building state 1
new informations (hot) propagated informations
(cold)
Loading registers values
Propagating registers
Forking on input signal I
Building branch where I is present
35SCOC automaton compilation
Initial state built
Building state 1
new informations (hot) propagated informations
(cold)
Loading registers values
Propagating registers
Forking on input signal I
Building branch where I is present
36SCOC automaton compilation
Initial state built
Building state 1
new informations (hot) propagated informations
(cold)
Loading registers values
Propagating registers
Forking on input signal I
Building branch where I is present
37SCOC automaton compilation
Initial state built
Building state 1
new informations (hot) propagated informations
(cold)
Loading registers values
Propagating registers
Forking on input signal I
Building branch where I is present
Final state reached
38SCOC automaton compilation
Initial state built
Building state 1
new informations (hot) propagated informations
(cold)
Loading registers values
Propagating registers
Forking on input signal I
Building branch where I is present
Building branch where I is absent
39SCOC automaton compilation
Initial state built
Building state 1
new informations (hot) propagated informations
(cold)
Loading registers values
Propagating registers
Forking on input signal I
Building branch where I is present
Building branch where I is absent
40SCOC automaton compilation
Initial state built
Building state 1
new informations (hot) propagated informations
(cold)
Loading registers values
Propagating registers
Forking on input signal I
Building branch where I is present
Building branch where I is absent
41SCOC automaton compilation
Initial state built
Building state 1
new informations (hot) propagated informations
(cold)
Loading registers values
Propagating registers
Forking on input signal I
Building branch where I is present
Building branch where I is absent
42SCOC automaton compilation
Initial state built
Building state 1
new informations (hot) propagated informations
(cold)
Loading registers values
Propagating registers
Forking on input signal I
Building branch where I is present
Building branch where I is absent
43SCOC automaton compilation
Initial state built
Building state 1
new informations (hot) propagated informations
(cold)
Loading registers values
Propagating registers
Forking on input signal I
Building branch where I is present
Building branch where I is absent
44SCOC automaton compilation
Initial state built
Building state 1
new informations (hot) propagated informations
(cold)
Loading registers values
Propagating registers
Forking on input signal I
Building branch where I is present
Building branch where I is absent
45SCOC automaton compilation
Initial state built
Building state 1
new informations (hot) propagated informations
(cold)
Loading registers values
Propagating registers
Forking on input signal I
Building branch where I is present
Building branch where I is absent
46SCOC automaton compilation
Initial state built
Building state 1
new informations (hot) propagated informations
(cold)
Loading registers values
Propagating registers
Forking on input signal I
Building branch where I is present
Building branch where I is absent
State 1 reached again
47Circuit saving and restoring
To avoid saving the whole circuit at each step of
automata building
Restoration data are stored in a stack of stacks
48Circuit saving and restoring
To avoid saving the whole circuit at each step of
automata building
Restoration data are stored in a stack of stacks
49Circuit saving and restoring
To avoid saving the whole circuit at each step of
automata building
Restoration data are stored in a stack of stacks
50Circuit saving and restoring
To avoid saving the whole circuit at each step of
automata building
Restoration data are stored in a stack of stacks
51Circuit saving and restoring
To avoid saving the whole circuit at each step of
automata building
Restoration data are stored in a stack of stacks
52Circuit saving and restoring
To avoid saving the whole circuit at each step of
automata building
Restoration data are stored in a stack of stacks
53Circuit saving and restoring
To avoid saving the whole circuit at each step of
automata building
Restoration data are stored in a stack of stacks
54Circuit saving and restoring
To avoid saving the whole circuit at each step of
automata building
Restoration data are stored in a stack of stacks
55Signal relations processing
Stored in a directed graph
Example
3 ? 2
2 ? 1
1 4 5
56Signal relations processing
Stored in a directed graph
Example
3 ? 2
2 ? 1
1 4 5
57Signal relations processing
Stored in a directed graph
Example
3 ? 2
2 ? 1
1 4 5
58Signal relations processing
Stored in a directed graph
Example
3 ? 2
2 ? 1
1 4 5
59Signal relations processing
Stored in a directed graph
Example
3 ? 2
2 ? 1
1 4 5
60Signal relations processing
Stored in a directed graph
Example
3 ? 2
2 ? 1
1 4 5
61Signal relations processing
Stored in a directed graph
Example
3 ? 2
2 ? 1
1 4 5
62Signal relations processing
Stored in a directed graph
Example
3 ? 2
2 ? 1
1 4 5
63Smart circuit evaluation
Circuit evaluation algorithm stops as soon as all
required nets are stabilized
Registers (determine next state)
K0/K1 (determine whether automaton has terminated)
Output signals
Action nets (side-effects operating on values)
64Input partitionning
Depending on current state, parts of the circuit
are disabled
After registers propagation
Inputs reachable from required nets will be
processed first
Other inputs will probably not be processed at all
65Input sorting
Example bus arbiter
Set of cells requesting the access to a data bus
Cells have rotating priorities
66Input sorting
Inputs are sorted upon the number of reachable
registers
This turns transitions from full trees (2n-sized)
to combs (n-sized)
67DAG sharing
Goals
Saving memory
Emphazing semantic aspects
present A emit A' end present
present B emit B' end present
68Performance comparison