Information Technology Reference
In-Depth Information
2.1 Compilation of Multi-clocked Synchronous Languages
The compilation scheme for
to an imperative, sequential languages
(s.a. C, ADA) proceeds as follows. The statements of a
Signal
Signal
program
P
form
a Set of Logical Equations (
SLE
) on the flows of
P
and their associated clocks.
Solutions of
for a given set of input/register values determine the next state
of the system. The compiler derives from
SLE
which con-
sists of one main loop whose task is to repeatedly compute such solutions of the
SLE
P
an imperative program
C
a conditional depen-
dency graph on flows and another linear equation system { the, so called, clock
calculus [3] { which records the dependencies amongst clocks. The produced
code contains statements originating from the clock calculus and assignments to
variables (representing the flows of
. In order to do so, the compiler computes from
SLE
) whose order must be consistent with the
dependency graph. These assignments are performed if the corresponding flow
is currently present in the source program, i.e. the clocks of flows determine the
control structure of the generated program.
The C program which is generated by the compiler from the DEC program
consists of a main program containing two functions:
{ An initialization function, which is called once to provide initial values to
the program variables.
{ An iteration function which is called repeatedly in an innite loop. This
function, whose body calculates the eect of one synchronous \step" of the
abstract program, is the essential part of the concrete code.
The iteration function obtained by compiling DEC is given by:
P
logical DEC_iterate()
l0:
h1 c =TRUE;
h2 c =ZN c <
l1:
=1;
l2:
if (h2 c )
l2.1:
read(FB c );
l3:
if (h2 c )
l3.1:
N c =FB c ;
else
l3.2:
N c =ZN c
1;
l4:
write(N c );
l5:
ZN c =N c ;
return TRUE;
g
The labels in function DEC iterate() are not generated by the compiler but
have been added for reference. We added 'c' as subscript for the program vari-
ables, to distinguish them from the
variables.
The C-code introduces explicit boolean variables to represent the clocks of
Signal
Signal
variables. Variable h1 c is the clock of N c and ZN c , and h2 c is the clock
of FB c .
 
Search WWH ::




Custom Search