Introduction
This tutorial respects some writing conventions:
- menus, buttons, etc.,
are written in bold
(e.g.
Algorithm / New Algorithm Window, OK,
Definition list); - command lines, SynDEx files, examples, etc.,
are written in Computer Modern
(e.g.
-libs libs, examples/tutorial,
! int o);
To create an application workspace, launch SynDEx with option
-libs libs. See the SynDEx v7 User Manual for more
information.
The examples presented in this tutorial are located in the sub-folder
examples/tutorial.
Each example is located in its sub-folder.
The example 7
is located in the examples/tutorial/example7,
examples/tutorial/example7_mono,
and examples/tutorial/example7_bi folders.
Example 1
Algorithm, architecture, and adequation:
- we create a sensor definition,
an actuator definition, and a function definition.
Then, we create an algorithm and define it as main.
Finally, we create in the main algorithm
two references to the sensor definition,
three references to the actuator definition,
and one reference to the function definition,
and we create data dependences
between these references by connecting their ports;
- we create four different architectures:
- an architecture with one operator,
- an architecture with two operators
and a SAM point-to-point communication medium,
- an architecture with three operators
and a SAM multipoint communication medium,
- an architecture with three operators
and a RAM communication medium;
- we create constraints on the third architecture;
- we perform the adequation of the main algorithm
onto the third architecture defined as main,
without constraint and then with constraints.
Example 2
Hierarchy in algorithm:
- we create a function definition and a constant.
Inside the function
we create a reference to another function;
in that way this definition is defined by hierarchy.
Then, we create a third function that references both previous ones.
Finally, we create an algorithm that references the third function
and define it as main.
In that way, the main algorithm references a hierarchical function;
- we create parameters names for an operation,
and assign values to these parameters.
Example 3
Delay in algorithm:
- we create a delay definition;
- we create a main algorithm
by referencing a delay, a sensor, an actuator, and a function
and by connecting them.
Example 4
Repetition and library in algorithm:
- we create a multiplication function of a vector by a scalar
by repeating a multiplication function on scalars:
- firstly without any library,
- secondly with a library;
- we create a multiplication function of a matrix by a vector
by repeating a multiplication function on vectors.
Example 5
Condition and nested condition in algorithm:
- we create an algorithm conditioned by a data dependence,
the value of which indicates the operation to be executed;
- we create an algorithm conditioned by a data dependence,
one operation of which is in turn conditioned
(nested condition) by the same data dependence.
Example 6
Algorithm, architecture, adequation, and code generation:
- we create a main algorithm by referencing
a sensor, two actuators, three functions, and a constant
and by connecting them;
- we create an architecture with two operators of type U
and a communication medium of type u/TCP;
- we perform the adequation;
- we perform the code generation,
then we create manualy the example6.m4x file
(for operations not defined in libraries);
- we create manualy the example6.m4m file
(to define the hostname)
and the root.m4x file
(for the main operator);
- we create manualy the GNUmakefile,
then we execute the executives created after compilation.
Example 7
Definition of the source code into the code editor window:
- we add parameters
to the conv function of Example 6;
- we modify the code associated with this function
first in case of a generic processor
then in case of an architecture with heterogenous processors;
- we create manualy the example7.m4m file
(to define the hostname)
and the root.m4x file
(for the main operator);
- we create manualy the GNUmakefile;
- we perform the adequation,
then we perform compilation,
finally we compile the executives
and launch the executables.
Definition of the source code in separate C files:
- we define the code of a new function in a .c file,
- we define the code of a new function in a .c file
and we use a .h file.
Example 8
A complete realistic application from adequation to execution:
- we build the model of a complete application for two cars;
- we perform the adequation;
- we generate the code for each processor;
- we compile and execute the code associated with each processor.
Example 9
A multiperiodic application:
- we build a basic multi-periodic application
- mono-phase schedule
- multi-phase schedule