ecexe - Lustre expanded code simulation

NAME

ecexe - Lustre expanded code simulation

SYNOPSIS

ecexe file.ec [ options ]

DESCRIPTION

This tool takes a stand-alone ec program, i.e. a program that does not require external constants and functions (see below for details). The predefined types are supported; more precisely, Booleans and integers are implemented by the machine type int, and reals are implemented by double values. It simulates the reactive behavior of the program, reading input values on stdin, and writing outputs on stdout.

Stand-alone ec program

Basically, an ec node is said to be stand-alone if it only deals with pre-defined types (bool, int, real), and does not require any external function or constant. This is the general rule, but however, there exist several exceptions:

Supported mathematical functions

Those functions must be declared in the lustre source with their exact names and parameter types. A file luslib/math.lus is provided in the distribution; it contains the following declarations:

function acos  (x: real) returns (y: real);
function asin  (x: real) returns (y: real);
function atan  (x: real) returns (y: real);
function cos   (x: real) returns (y: real);
function sin   (x: real) returns (y: real);
function tan   (x: real) returns (y: real);
function cosh  (x: real) returns (y: real);
function sinh  (x: real) returns (y: real);
function tanh  (x: real) returns (y: real);
function exp   (x: real) returns (y: real);
function log   (x: real) returns (y: real);
function log10 (x: real) returns (y: real);
function pow   (x: real) returns (y: real);
function sqrt  (x: real) returns (y: real);
function fabs  (x: real) returns (y: real);
function ceil  (x: real) returns (y: real);
function floor (x: real) returns (y: real);

Reactive Input Format (rif)

At each step, the interpretor reads on stdin a value for each input. The input flow is supposed to follow the rif (Reactive Input Format) conventions: the input flow consists of a sequence of basic values (Booleans, integers, reals, strings) separated by spaces (predicate ispace from ctype.h library). Moreover, comments and pragmas can be written in the input flow:

The only pragma supported by ecexe is the string reset, which causes the interpreter to restart in its initial state.

The syntax for integer and real values is the ansi-C one.

For Boolean values, the interpreter accepts:

When the interpreter has read all input values, it performs a computation step, writes the corresponding outputs on stdout, reads a new input vector and so on.

For instance, there is a valid input file for a node that takes one Boolean input and two integer inputs:

t 0 2 
#this line is ignored
f 5 6 t 56 -12 #two steps on a single line
#@
all 
those
characters are
ignored @# f 42 #this end of line is ignored
-10  #this is the end of the previous step
#reset
#@ the interpreter has been restarted @#
t 5 6

Note that new-lines have no special meaning: a new step is performed as soon as a whole input vector is available.

Missing values

In order to interpret programs whose inputs are not always defined (clocked inputs) the value ? is accepted for any type. For instance, the following input sequence is correct for a node whose header is

node CLOCKED(c : bool; (x : real) when c):

t 42e2
f ?
f ?
t 24  #integer notation is accepted for real values
t -3.14
f ?
f 22.2E-10 #this value will be ignored anyway...

The symbol ? is also used for undefined outputs.

Nil value

When some output takes the value of an uninitialized variable, the interpreter normally stops with error code 1. But there is an option that inhibits this feature: in this case the interpreter outputs the string nil and goes on.

Reset

All comments begining with the string reset, are interpreted as a reset command: the interpretation restarts from the begining, just as if a new process had been called for the remaining input file.

OPTIONS

-r (reactive)

inhibits all buffer mechanism on files (to be used with command pipes).

-n

outputs the string nil for non initialized value, instead of exiting with error code 1.

 ecexe - Lustre expanded code simulation