The Esterel v5 21 System Manual - Courses
The Esterel v5 21 System Manual - Courses
The Esterel v5 21 System Manual - Courses
You also want an ePaper? Increase the reach of your titles
YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.
3.5. TASK HANDLING 45<br />
3.4.7 Warnings and Advises<br />
• Since assignments of initial values to valued interface signals are performed<br />
by the reset function, it is highly mandatory to always call the<br />
reset function before initialization if there are initialized signals.<br />
• <strong>The</strong> relations between input signals specified in the source program<br />
are not checked when the automaton is called in direct embedded<br />
execution. <strong>The</strong> code may behave strangely if called with inputs which<br />
do not satisfy the relations. However, the simulation interface does<br />
enforce relations.<br />
• <strong>The</strong> combination functions associated with combined signals must be<br />
commutative and associative. Otherwise, the results of signal combinations<br />
can be arbitrary.<br />
• <strong>The</strong> automaton code is not reentrant and its execution must be atomic.<br />
<strong>The</strong>refore, during a call to the automaton, it is forbidden to call it<br />
again and to call input C functions. Arbitrarily strange behaviors can<br />
arise otherwise. In particular, interrupt handling routines should never<br />
call directly input C functions or the automaton. <strong>The</strong>y should instead<br />
fill event queues to be read when the automaton call terminates. One<br />
can also use interruption masking during the automaton execution.<br />
• Access to uninitialized variables and uninitialized signal values are not<br />
checked when the reaction function is called in direct execution. But<br />
the simulation engine does enforce that check.<br />
3.5 Task Handling<br />
We now describe the interface of the C code generated by the <strong>Esterel</strong> compiler<br />
for an exec statement. This code reflects concretely the way tasks are<br />
handled abstractly in <strong>Esterel</strong>. It is organized in two layers. <strong>The</strong> low-level<br />
layer is a direct interface to run-time C data structures that contain all the<br />
required information about the status of exec statements. <strong>The</strong> optional<br />
higher-level layer provides the user with a functional interface.<br />
Our design might look heavy at first glance, but it intends to provide<br />
the user with maximal flexibility with respect to actual task handling. <strong>The</strong><br />
functional interface is reasonably simple, but not fully general since other<br />
ways of interfacing exec statements can be thought of, in particular as<br />
far as task suspension is concerned. <strong>The</strong> low-level interface is meant to be<br />
convenient for any user who wants to design its own fine-grain task handling.