In the AAA methodology, an algorithm is specified as a directed acyclic graph (DAG) infinitely repeated. Directed means that for each edge representing a relation between vertices, the vertices tuple is ordered, i.e. its first element is the source vertex and the other one(s) is(are) the destination vertex(vertices).
Still in AAA, SynDEx algorithm vertices are operations; operation stands for a sequence of instructions which starts after all its input data are available and produces all its output data at the end of the sequence. Edges are dependences between two vertices.
In SynDEx there is a distinction between algorithm definition and algorithm reference. To each reference corresponds one and only one definition. To a given definition may correspond several references. A definition is a DAG similar to those in AAA, except that vertices are references or ports.
To a given reference contained in a definition corresponds a definition which may contain itself several references and so on.
In SynDEx, algorithms can be defined through hierarchy. A definition is said hierarchical when it defines an algorithm which contains at least one dependence (and possibly references), otherwise it is said atomic.
There are five types of atomic definitions: functions read data on input ports, execute instructions without any side-effect, write data on output ports, sensors are input vertices of the DAG producing data from a physical sensor, actuators are output vertices of the DAG consuming data for a physical actuator, constants are input vertices of the DAG, with null execution time, delays memorize data during one or several infinite repetition of the DAG, for use in next repetitions. These types are detailed in section 5.1.
A definition is said explicitly hierarchical when the algorithm contains at least one dependence (and possibly references). This includes conditioning (cf. section 5.2), repetitions (cf. section 5.3) of hierarchical definitions, and more generally definitions defined through several levels of hierarchy. Only a function may be defined through explicit hierarchy.
A definition is said implicitly hierarchical
when the algorithm does not contain any dependence
and yet will be transformed by SynDEx, for the adequation,
into a graph which contains dependences.
This happens only with
repetitions
(cf. section 5.3)
of atomic definitions.
Warning:
A hierarchical definition does not have to wait
for all its input data to be available before starting some computations.
Indeed, parts of the algorithm graph
of a hierarchical algorithm definition
may only require parts of the input data of the definition
and therefore can start as soon as this part is available
(and not all the data).
In the same way, some data may be produced
before the end of the complete sequence of computations.
There are two types of dependences:
A data dependence imposes that the reference at the source of the dependence, produces data and is executed before the reference at the destination of the dependence, which consumes the data. A precedence dependence only imposes an execution order between references, no data is produced or consumed.
Definitions and references are managed through an algorithm window. If necessary it is possible to open several algorithm windows.
![]()
Figure 5.1: Algorithm / New Algorithm Window
![]()
Figure 5.2: Algorithm Window
From the Algorithm menu, choose the New Algorithm Window option (cf. figure 5.1). It opens the edition window for algorithm definitions (cf. figure 5.2). Click on the background of a definition window: the algorithm window shows its Definition Properties. Click on a reference in this definition window: the algorithm window shows its Reference Properties. These definition or reference properties appear in the left bottom part of the algorithm window (cf. figure 5.4 for definition properties and figure 5.5 for reference properties).
SynDEx distinguishes five types of definitions with different edition rules:
![]()
Figure 5.3: Definition of a sensor
To create a new definition,
in the algorithm window, click on the + green button.
It opens a dialog window
in which you can select the definition’s type.
For example check Sensor
(cf. figure 5.3).
Type the name of the new sensor and optionally a list of parameters.
For example type input.
Then click OK.
It creates a definition of sensor
named input.
Parameters are local to the scope of a definition. Often,
parameters are used to create more generic definitions. For example,
to parameterized the size of a definition’s ports, we can create a
parameterized definition with one parameter standing for the port
size. Parameter names are given as a semi-colon separated list between
< and >, following the definition’s name. The user
can also edit the parameters list in the Definition Properties. Only
the main algorithm (cf. section
5.1.1) can instanciate its parameters thanks to
its field Values in its Definition Properties (cf.
figure 5.8).
This section refers to section 2.2.
![]()
Figure 5.4: C definition in examples/hierarchy/hierarchy.sdx
![]()
Figure 5.5: Opening B1 reference in examples/hierarchy/hierarchy.sdx
![]()
Figure 5.6: B definition in examples/hierarchy/hierarchy.sdx
Double click on a definition name in the Definition list (e.g. open the examples/hierarchy/hierarchy.sdx application and double click on C in the Definition list). You are now in a definition mode (cf. figure 5.4). From a definition mode, to open the definition corresponding to a reference in order to inspect and possibly modify its content, click on the target reference to select it. Red squares appear on its borders (cf. figure 5.5). Then double click on it. It displays the definition of the target reference (cf. figure 5.6).
![]()
Figure 5.7: Set Main definition as main algorithm in examples/hierarchy/hierarchy.sdx
![]()
Figure 5.8: Main mode in examples/hierarchy/hierarchy.sdx
To define an algorithm as main,
right click on the background of the target definition window.
Choose the Set As Main Definition option
(cf. figure 5.7).
The color of the background changes
and the adress is changed from a [Function]
to a (main),
meaning that you are now in the main mode
on the main algorithm
(cf. figure 5.8).
Note that the main algorithm
must be at the root level of a hierarchy;
it can not contain unconnected ports.
Only the main algorithm can instanciate its parameters
(cf. section 5.1)
thanks to its field Values in its Definition Properties
(cf. figure 5.8).
Click on the Main button of the algorithm window.
It displays the main algorithm in the main mode.
Click on a hierarchical reference
to browse down the main algorithm
(e.g.
click on the C reference of Main
then click on the B2 reference of C).
Then click on Up In Main to browse up the main algorithm.
Now you may construct a graph with references
to constants, sensors, actuators,
delays and functions.
If this definition
is intended to be referenced in an explicit hierarchy,
i.e. this reference
will belong to a certain level of hierarchy
(possibly a leaf),
you must use input and output ports.
If this definition
is intended to be referenced at the root level
of the hierarchy,
input ports are replaced by sensors
and output ports are replaced by actuators.
References to an explicitly hierarchical definition
are displayed with a double-border
(in the figure 5.4
B1
is a reference on an explicitly hierarchical definition
contrary to add).
Ports are communication interface of a definition with the outside world.
SynDEx distinguishes three types of ports:
![]()
Figure 5.9: Contextual menu → Add port
![]()
Figure 5.10: Name of the new port
![]()
Figure 5.11: A definition after port creation
To add a port to an atomic definition (cf. chapter 5):
You can undo and redo this action.
A port definition has the following syntax:
port_definition ::= direction type [ [ size ] ] name direction ::= ? | ! | &
where:
Hint: you can create several ports in one breath by simply putting several port definitions in a row in the dialog window.
definition ::= { port_definition }
If you plan to generate code, it is necessary to specify an order for ports which is consistent with the declaration of the corresponding executable function. To specify the ports order, right click on the background and choose the Ports Order option.
Input-output ports have a very specific behavior
concerning data memory allocation in the executives generated by SynDEx.
For any application, SynDEx makes data buffer allocations
for (and only for) the output ports of the atomic references
of your algorithm graph.
Input-output ports do not cause an allocation but instead an alias
on the output port of its predecessor.
The operation containing this input-output port directly modifies
the value of its predecessor port (side-effect).
This is useful to avoid reallocation of big data buffers of the same type
(for instances images)
by making successive computations on the same data buffer.
However, as side-effects are not supposed to happen in data-flow graphs,
this comes with some restrictions:
A reference can be thought as a call to a function in a traditional programming language. Here the called function is an algorithm definition.
![]()
Figure 5.12: A reference to myReferencedDef into myDefinition
To reference a definition (e.g. myReferencedDef) into another one (e.g. myDefinition), set the algorithm window in definition mode on myDefinition (cf. section 5.1.1). Then drag and drop myReferencedDef from the Definition list to the definition window (or select myReferencedDef in the Definition list, right click on the background of the definition window, and choose the Add reference option). It opens a dialog window. Type the name of the reference (e.g. myReference). See figure 5.12 to see the result.
To reference a parameterized definition, a valued expression is required for each parameter. This can be done by typing a semi-colon separated list of expressions between < and > after the reference’s name, in the dialog window. Note that the number of expressions must match the number of parameters of the referenced definition, and that types must match.
A dependence is an execution order relation between two references.
SynDEx distinguishes two types of dependences (cf. Dependences): data dependences and precedence dependences (without data). SynDEx automatically creates the right type of dependence depending on the context:
A superblock is a set of operations, edges and ports extracted as a new definition.
To create a definition as a superblock, select the target set of operations, edges and ports you want to extract (cf. section 4.1). Then right click and choose the Extract as superblock option. A new definition is created and a reference to this definition replaces the selected set. The new definition is available in the Definition list, You can rename both the definition and the reference.
You can undo and redo this action.
An abstract reference is a reference to a hierarchical definition in which the hierarchy is not taken into account, i.e. the flattening (cf. section 9.5) does not go into the hierarchical referenced definition that becomes therefore abstract. However, note that to perform the adequation this definition must have a duration.
To create an abstract reference, select the desired hierarchical reference then, check the option Abstract in the Reference properties of this reference.
You can undo and redo this action.
First make sure that the target definition contains an input port of type int for the conditioning port. Note that the SynDEx libs directory already provides an int library for operations on integer values.
![]()
Figure 5.13: switch definition mode for cond = 3 in examples/condition/simpleCondition/simpleCondition.sdx
Right click on the background of the definition window and choose the Create Condition option. It opens a dialog window for the new condition. A condition is a port = value expression where port is the name of the conditioning port and value is an integer. A new tab is created for the given condition. The conditioning port is now yellow colored (cf. figure 5.13).
If necessary, refresh the algorithm window (cf. section 4.6).
Note that there can be only one conditioning port. You have to construct one sub-graph per condition (cf. figure 5.13). For each other value of the conditioning port, the result is unspecified and will be inconsistent.
The adequation and the code generation will take into account the expanded graph (cf. section 9.5). SynDEx will introduce new vertices during the expansion: CondI and CondO vertices.
A CondI vertex consumes the conditioning data and connects the input ports of the conditioned operation according to its value.
A CondO vertex consumes the conditioning data and connects the output ports of the conditioned operation according to its value.
![]()
Figure 5.14: conditioned definition mode in examples/condition/simpleCondition/simpleCondition.sdx
In a definition mode (cf. section 5.1.1), references to conditioned definitions have their conditioning port yellow colored (cf. figure 5.14).
Right click on the background of the definition window and choose the Delete Condition option.
You can create a reference to a definition, and connect to its input (resp. output) ports some output (resp. input) ports with different sizes. The pre-condition is to have a unique common multiple between each pair of ports of different sizes. This multiple is the repetition factor of the reference.
![]()
Figure 5.15: AlgorithmMain1 definition mode in examples/tutorial/example4/example4.sdx
Suppose that you want to specify the multiplication
of a vector by a scalar giving a vector as result
(cf. AlgorithmMain1
in examples/tutorial/example4).
You can specify it by repeating the multiplication between two scalars
instead of defining a new one.
For example for N length vectors,
you may specify the repetition
by N multiplications
between scalars giving a scalar as a result
(cf. figure 5.15).
You have to:
The common multiple between each pair of ports with different sizes is N. It is the repetition factor that you have to set explicitely by using a symbolic numbered expression.
Since the output port of s_input has the same size as its connected input port of the multiplication function, it is replicated N times in order to be multiplicated by each element of v_input. This is a Diffuse operation.
Since the function operates on scalars and the v_input vector has N elements, each of its elements are provided separately in order to be multiplicated. This is a Fork operation.
Since the function operates on scalars and the v_output vector has N elements, each repetition of the multiplication is taken in order to be provided as a N elements vector. This is a Join operation.
![]()
Figure 5.16: matprodvec main mode from AlgorithmMain3 main algorithm in examples/tutorial/example4/example4.sdx
The repetition factor is displayed next to the name of the reference (e.g. in the figure 5.15 mul is repeated N times). The main algorithm (e.g. AlgorithmMain3) instanciates its parameters (cf. figure 5.8). From the main mode in examples/tutorial/example4/example4.sdx (cf. section 5.1.1), double click on the matprodvec reference, the dotprod reference is repeated three times (cf. figure 5.16).
The adequation and the code generation will take into account the expanded graph (cf. section 9.5). SynDEx will introduce new vertices during the expansion: Explode and Implode vertices.
An Explode vertex extracts for each repetition of a definition each element of the data it receives (cf. subsections Diffuse and Fork).
An Implode vertex builds the data it sends by concatenating each separated element produced by each repetition of the definition (cf. subsection Join).
In some cases, you may want to repeat a reference but have no difference between port sizes.
![]()
Figure 5.17: dp definition mode in examples/tutorial/example4/example4.sdx
Suppose that you want to specify the multiplication of two vectors giving a scalar as a result (cf. figure 5.17). You can specify it by repeating the multiplication between two scalars, that used an accumulator to store the partial sum. For example if for dpaccn length vectors, you may specify the repetition by dpaccn multiplications between three scalars (the i element of the first vector, the i element of the second one, and the accumulator, initialized to 0).
You have to:
The accumulator is initialized with {0}. Then the output of the repetition i becomes the accumulator of the repetition i+1. The output of the last repetition is the output of the repeated definition. This is an Iterate operation.
Double click on the definition name
in the Definition List
or double click on a reference from a definition mode
(cf. section 5.1.1).
It opens its definition window.
Right click on the background of the definition window.
Choose the Add dependence option
(cf. section 5.1.4),
Add port
(cf. section 5.1.2),
Add reference
(cf. section 5.1.3),
Create Condition or Delete Condition
(cf. section 5.2)
to modify the definition.
Click on the background of a definition window
(cf. Algorithm window in chapter 5).
Use its Definition Properties to modify its
Name, Description, Parameters or Values.
Note:
You can modify local and global definitions
(cf. section 3.1).
Modifications on a global definition
impact only the current application
and the library remains unchanged.
To modify a global definition over-all,
open the corresponding SynDEx library file
(e.g. libs/int.sdx).
Modifications on a definition in a library may have consequences
on all the applications using this library.
Click on a reference in a definition window (cf. Algorithm window in chapter 5). Use its Reference Properties to modify its Name, Parameters, Repeat or Period. For the period see the section 5.7 “To build mutli-periodic applications”.
To delete a definition,
in the algorithm window, click on the - red button.
Note:
Deleting a global definition
(cf. section 3.1)
impacts only the current application.
![]()
Figure 5.18: Edition of the conv code phases in examples/tutorial/example7/example7.sdx
![]()
Figure 5.19: Edition of the code associated with conv in examples/tutorial/example7/example7.sdx
![]()
Figure 5.20: Code associated with conv in loop phase in examples/tutorial/example7/example7.sdx
Right click on the background of a definition window. Choose the Edit code phases option (cf. figure 5.18). Check init (resp. end) to generate code in the initialization phase (resp. ending phase).
Right click on the background of a definition window. Choose the Edition of the associated source code option (cf. figure 5.19). It opens the code editor window on the initialization phase for the selected definition. Click on loop phase (resp. end phase) to edit the code associated in the loop phase (resp. ending phase) (cf. figure 5.20).
![]()
Figure 5.21: M4 macro code for conv in examples/tutorial/example7/example7_sdc.sdx
From the Code menu of the main window, check Generate m4x files. At code generation time, the code written in the code editor will be wrapped into M4 macro code, and outputed into an application_name_sdc.m4x file. These files contain one M4 macro definition per algorithm definition (cf. figure 5.21). The code editor offers several macros to abstract away the M4 nature of the output file. These macros are of two kinds: port and parameter names translation macros, and quoting macros (cf. macros directory).
Parameter and port names of an algorithm definition are encoded as parameters of the corresponding M4 macro. Because the M4 language uses positional parameters, when the user wants to refer to a parameter or port in the associated code he has to know its position in the M4 macro parameters list. More than being not very handy, this is fragile relatively to adds or deletions of ports and parameters in the definition: when the user adds a port or a parameter to a definition, he has to adjust (replace $n by $n+1 in) all references to parameters or ports coming after the added one in the parameters list of the M4 macro. To overcome this difficulty, the code editor recognizes the following macros (cf. figure 5.20):
Quoting macros are used to wrap or unwrap code by M4 quote. The code editor recognizes the following quoting macros:
The code editor supports various keyboard shortcuts
that could be handy when editing source code.
Ctr-Tab | Insert a tabulation. |
Tab | Complete a port name. Type the begining of a port name, then press Tab |
and as many times as necessary for the editor to find the wanted completion. | |
Ctr-I | Insert the @IN macro at cursor position. |
Ctr-O | Insert the @OUT macro at cursor position. |
Ctr-N | Insert the @INOUT macro at cursor position. |
Ctr-P | Insert the @PARAM macro at cursor position. |
Ctr-T | Insert the @TEXT macro at cursor position. |
Ctr-Q | Insert the @QUOTE macro at cursor position. |
Ctr-W | Cut the selected text into the clipboard. |
Ctr-K | Cut text from cursor position to the end of the line. |
Alt-W | Copy the selected text into the clipboard. |
Ctr-Y | Paste the clipboard content at cursor position. |
Ctr-A | Jump to the beginning of the line. |
Ctr-E | Jump to the end of the line. |
Ctr-up | Jump to the beginning of the buffer. |
Ctr-down | Jump to the end of the buffer. |
Until version 6 of SynDEx, a unique timing information (execution duration) is associated to each operation (resp. each data type of a dependence) relatively to the operators (resp. media) it may be distributed to. This timing information, which depends on the hardware, is associated to the definition of every operation. Applications specified by the user with version 6 are implicitely mono-periodic, meaning that all the operations of the algorithm graph have the same period which is equal to the total execution time of all the operations executed on the different components of the architecture, taking into account the duration of data communications through the media. This total execution time is displayed as the value of the “Cycle time” in the schedule window resulting from the adequation.
Version 7 of SynDEx allows the user to specify, in addition to a duration, a period to each operation. The period is a timing information associated to the reference of an operation instead of its definition, which does not depend on the hardware. This feature allows the user to specify an operation definition with the same execution duration each time it is referenced, whereas this operation may be referenced with several periods. Note that for a given operation it is necessary that its execution duration is smaller than its period to be schedulable.
As soon as a period is associated to at least one operation reference, the application becomes multi-periodic. In other words, an application is mono-periodic if no period is associated to operation references. In both cases execution durations must be associated to operation definitions and data type of dependences. A multi-periodic application has a global period equal to the LCM (Least Common Multiple) of all the periods associated to the operation references. That global period corresponds to the total execution time of all the operations executed on the different components of the architecture, taking into account the duration of data communications through the media. This total execution time is displayed as the value of the “Cycle time” in the schedule window resulting from the adequation.
Version 7 of SynDEx, using the period and the execution duration of every operation, performs a distributed real-time schedulability analysis to determine if the multi-periodic application is schedulable. If it is the case it will generate the corresponding macro-code.
Operations related by a dependence must have multiple or equal periods. While creating a dependence between operations which have inconsistent periods, an error message appears to help the user (e.g. Can not create dependence input.o -> compute.in in definition basicAlgorithm Error #1 [Inconsistent periods]).
While creating a dependence between operations which have multiple periods, there are two cases:
Verifications on periods are propagated to hierarchical references.
While setting the period to a hierarchical reference, SynDEx verifies that the new period is compatible with the periods of the references it contains. Actually, the period of a hierarchical reference must be equal (or multiple) to the Least Common Multiple (LCM) to the periods of the references it contains.
While setting the period to a reference contained in a hierarchical reference, SynDEx verifies that the new period is compatible with the period of the hierarchical reference. Actually, the period of a reference contained in a hierarchical reference must be equal (or must be a divisor) to the period of the hierarchical reference.
The user can edit the period of an operation only in its reference properties (cf. paragraph “Algorithm window” in section 5) unlike its name, its parameters and its repeat factor which can be also edited during the reference creation.
By default the period of an operation is equal to 0. Note that, as soon as an operation has a period equal to 0, the application is mono-periodic whatever the other periods are. In other words, to obtain a multi-periodic application the period of all the references must be edited.
See the section 9.4 for details about the adequation process in case of mutli-periodic applications.