30.07.2013 Views

The Esterel v5 21 System Manual - Courses

The Esterel v5 21 System Manual - Courses

The Esterel v5 21 System Manual - Courses

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

2.3. CONTROLLING CODE GENERATION 19<br />

<strong>The</strong> drawback is of course that causality errors are not reported at compile-time<br />

when the -I option is used, which may be misleading. Fortunately,<br />

the <strong>Esterel</strong> <strong>v5</strong> <strong>21</strong> compiler provides a way to check that a program is constructive.<br />

Just type<br />

esterel -W -Icheck foo.strl<br />

This calls the aforementioned sccausal processor, performs the full constructiveness<br />

analysis, but does not generate code. If option -Icheck succeeds,<br />

the generated code will never encounter a causality error and it is<br />

safe to embed it. Other properties such as single emission of single signals<br />

are also checked on the way. If errors are found during the check, they are<br />

reported graphically using a variant of the xes processor.<br />

WARNING: Option -Icheck should always be used before<br />

embedding code generated with option -I. Since this option also<br />

checks single emission of single signals, which is not checked by<br />

default, the option should also be used before embedding any <strong>Esterel</strong><br />

generated code.<br />

2.3.3 Automaton Code Generation<br />

A third possibility for software code generation is to generate an automatonbased<br />

code. <strong>The</strong> main advantage is speed: reactions using automata are<br />

usually faster than reactions using sorted or unsorted circuit code. <strong>The</strong> main<br />

drawback is size: in the worst case, the automaton table can be exponentially<br />

bigger than the source code, while the circuit’s size is most often linear and<br />

worst-case square. Automata are usually preferred for small applications<br />

(man-machine interface drivers, communication protocols, etc). Try both<br />

automata and circuits for a given application, and choose the best. <strong>The</strong>re<br />

is no general choice rule.<br />

Automaton code generation can be done in three ways. First, one can<br />

use the -A option:<br />

esterel -A [-simul] foo.strl<br />

<strong>The</strong> processor chain is strlic, iclc, lcsc, scssc, sscoc, and occ. Second,<br />

one can use the -A option in conjunction with the -causal option:<br />

esterel -causal -A [-simul] foo.strl<br />

<strong>The</strong>n scssc is replaced by sccausal. This process generates an automaton<br />

from any constructive <strong>Esterel</strong> program, but it can be quite expensive. Third,<br />

one can use the former <strong>Esterel</strong> v3 technology:

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!