next up previous contents
Next: To condition an algorithm Up: Algorithm Previous: Algorithm   Contents

To create an algorithm definition

To create a new local definition, choose the option NEW LOCAL DEFINITION / FUNCTION-CONSTANT-SENSOR-ACTUATOR-DELAY in the menu ALGORITHM of the principal window, this will open a window for text edition in order to input its name and possibly a list of parameter names, and will create a new definition window labeled "name".

The paramater are used to create more generic definitions (for example for the ports of type array, to parametrize the dimension of the array) and are separated by semi-colons.

Delay definitions must have a single input/output port and two parameters. The first one is the initial values, which will be a list (L), and the second one the number of graph repetitions (N) during which values will be memorized. Be aware that the delay must have initial values for the N first infinite repetitions of the graph. Therefore, if your delay input/output port is of size M, your list L must contain M*N elements.

Now you may construct a graph with references to constants, sensors, actuators, delays and function. 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.

To create an input or an output port, choose the option CREATE PORT in the menu EDIT of the definition window, this will open a window for text edition in order to input for each port its name, direction (input, output, or input/output), and type that you can arbitrarily define: for example integer or int, float, bool, ... or array of integer, float, bool, ... WARNING: each type must be associated to a duration (cf. chapter 7). Array types are specified with the classical square brackets delimiter. You can use a parameter to specify the size of an array port. You can either directly use the name of the parameter between the square brackets if the parameter is an integer (e.g. ``? float[N] i'') or put the name of the parameter between pipes for the length of the parameter if the parameter is a list (e.g. ``? float[|L|] i''). Parameter values won't be evaluated by SynDEx until you choose a main algorithm.

If you plan to generate code, it is necessary to specify an order for the ports, consistent with the declaration of the corresponding executable function. To specify the ports order, choose the option PORTS ORDER of the contextual menu.

To create a reference to a definition, choose the option CREATE REFERENCE in the menu EDIT of the definition window, this will open a window for text edition in order to input the reference name and possibly a list of arguments values and a repetition factor. Arguments can be lists, separated by semi-colons. Values in lists are separated by comas and the whole list is delimited with round brackets (e.g. ``delay <{5,6,4,3};2>''). For the repetition factor, see section ``To modify an algorithm definition or a reference''.

To create dependences between references or ports, point the cursor at an output of the source reference, or at an input port, and click the middle button of the mouse (or CTRL+click the left button of the mouse) and drag to an input of a destination reference, or at an output port. When the button is released the edge will be drawn. Notice that you can point on the name of the port and not only on the small black square.

Connecting two vertices will create a dependence which type is the default type. To set the default type of the dependences choose DEFAULT EDGE TYPE in the menu EDIT of the definition window.

To change an edge type, point the cursor at this edge which will highlight, then click the right button of the mouse and choose the new type.


next up previous contents
Next: To condition an algorithm Up: Algorithm Previous: Algorithm   Contents
Julien Forget 2003-03-21