SynDEx v7 Tutorial

icon

70

pages

icon

English

icon

Documents

Le téléchargement nécessite un accès à la bibliothèque YouScribe Tout savoir sur nos offres

icon

70

pages

icon

English

icon

Ebook

Le téléchargement nécessite un accès à la bibliothèque YouScribe Tout savoir sur nos offres

SynDEx v7 Tutorial
Nicolas Dos Santos, Christophe Gensoul, Kim-Hwa Khoo
Christophe Macabiau, Quentin Quadrat, Daniel de Rauglaudre,
Yves Sorel, Cécile Stentzel
March 24, 2010 2 Contents
Introduction 5
1 Example 1: algorithm, architecture, and adequation 8
1.1 The main algorithm . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
1.1.1 Definition of a sensor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
1.1.2 Definition of an actuator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
1.1.3 Definition of a function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
1.1.4 Definition of the main algorithm . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
1.2 An architecture with one operator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
1.2.1 Definition of an operator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
1.2.2 Definition of the main architecture . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
1.3 An architecture with a SAM point-to-point comunication medium . . . . . . . . . . . . . . . . . 16
1.3.1 Definition of operators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
1.3.2 Definition of a medium . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
1.3.3 Definition of the main architecture . . . . . . . . . . . . . . . . . . . . . . . ...
Voir icon arrow

Publié par

Nombre de lectures

277

Langue

English

SynDEx v7 Tutorial
Nicolas Dos Santos, Christophe Gensoul, Kim-Hwa Khoo Christophe Macabiau, Quentin Quadrat, Daniel de Rauglaudre, Yves Sorel, Cécile Stentzel
March 24, 2010
2
Contents
Introduction 5 1 Example 1: algorithm, architecture, and adequation 8 1.1 The main algorithm . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 1.1.1 Denition of a sensor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 1.1.2 Denition of an actuator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11 1.1.3 Denition of a function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11 1.1.4 Denition of the main algorithm . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11 1.2 An architecture with one operator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14 1.2.1 Denition of an operator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14 1.2.2 Denition of the main architecture . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16 1.3 An architecture with a SAM point-to-point comunication medium . . . . . . . . . . . . . . . . . 16 1.3.1 Denition of operators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16 1.3.2 Denition of a medium . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17 1.3.3 Denition of the main architecture . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17 1.3.4 Connections between the operators and the medium . . . . . . . . . . . . . . . . . . . . . 17 1.4 An architecture with a SAM multipoint medium . . . . . . . . . . . . . . . . . . . . . . . . . . . 18 1.5 An architecture with a RAM medium . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18 1.6 The adequation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19 1.6.1 Without constraint . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19 1.6.2 With constraints . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19 2 Example 2: hierarchy in algorithm 24 2.1 Denition of the functionA. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .  24. . . . . . . 2.2 Denition of the functionB. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24 2.3 Denition of the algorithm with hierarchy . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26 3 Example 3: delay in algorithm 27 3.1 Denition of the operationsinput,output, andcalc 27. . . . . . . . . . . . . . . . . . . . . . . . . 3.2 Denition of the delay . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27 3.3 Denition of the algorithm with delay . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27 4 Example 4: repetition and library in algorithm 29 4.1 An algorithm with repetition without any library . . . . . . . . . . . . . . . . . . . . . . . . . . . 29 4.1.1 Denition of the scalarinsand the functionmulon scalars . . . . . . . . . . . . . . . . . 29 4.1.2 Denition of the vectorsinvandoutv. . . . . . . . . . . . . . . . . . . . . . . . . . . . 29 4.1.3 Denition of the algorithmlAia1nogirhtMm. . . . . . . . . . . . . . . . . . . . . . . . . 30 4.2 An algorithm with repetition with theintlibrary . 30 . . . . . . . . . . . . . . . . . . . . . . . . . 4.2.1 Inclusion of the libraryint. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31 4.2.2 Denition of the algorithmlgAaMmhtiro2ni. . . . . . . . . . . . . . . . . . . . . . . . . 31 4.3 An algorithm with repetition with thefloatlibrary . . . . . . . . . . . . . . . . . . . . . . . . . 32 4.3.1 Inclusion of the libraryfloat 32. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.3.2 Denition of the functiondpacc 32. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.3.3 Denition of the functiondp 32. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
3
5
6 7 8
9
4.3.4 Denition of the functiondmatproevc. . . . . . . . . . . . . . . . . . . . . . . . . . . . 33 4.3.5 Denition of the algorithmorithmMain3Agl 34. . . . . . . . . . . . . . . . . . . . . . . . . Example 5: condition and nested condition in algorithm 36 5.1 An algorithm with condition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36 5.1.1 Sensorsxandi, actuatoro 36. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5.1.2 Functionswitch1. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .  36. . . . . . . 5.1.3 Algorithm1nAlgorithmMai. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36 5.2 An algorithm with nested condition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40 5.2.1 Sensorsxandi, actuatoro 40. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5.2.2 Functionswitch2. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40 5.2.3 AlgorithmgoAlaimMthri2n. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40 Example 6: algorithm, architecture, adequation, and code generation 42 6.1 The main algorithm . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42 6.2 The main architecture . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42 6.3 The adequation and the code generation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43 Example 7: source code associated with an operation 45 7.1 Denition of the source code into the code editor window . . . . . . . . . . . . . . . . . . . . . . 45 7.1.1 To add parameters to an already dened operation . . . . . . . . . . . . . . . . . . . . . . 45 7.1.2 To edit the code associated with an operation . . . . . . . . . . . . . . . . . . . . . . . . 46 7.1.3 To generatem4x 49les . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Example 8: a complete realistic application from adequation to execution 52 8.1 The aim of the example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52 8.2 The model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52 8.3 The controllers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53 8.3.1 Block diagrams of controllers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53 8.3.2 Source code associated with the functions . . . . . . . . . . . . . . . . . . . . . . . . . . 55 8.4 The complete model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55 8.4.1 The car dynamics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56 8.4.2 The cars and their controllers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57 8.4.3 The main algorithm . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57 8.4.4 Source code associated with the sensor and the actuator . . . . . . . . . . . . . . . . . . . 57 8.4.5 Theexample8 sdc.m4x. . . . . . . . . . . . . . . . . . . . . . . . . . . . .  61. . . . . . . _ 8.4.6 To handwrite them.x4lp8exemale . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62 8.5 Scicos simulation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63 8.6 SynDEx simulation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63 8.6.1 In the case of a mono-processor architecture . . . . . . . . . . . . . . . . . . . . . . . . . 63 8.6.2 In the case of a bi-processor architecture . . . . . . . . . . . . . . . . . . . . . . . . . . . 65 8.6.3 In the case of a multi-processor architecture . . . . . . . . . . . . . . . . . . . . . . . . . 66 Example 9: a multiperiodic application 68 9.1 The main algorithm . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 68 9.2 The main architecture . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 68 9.3 A mono-phase schedule . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69 9.3.1 Durations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69 9.3.2 Adequation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69 9.4 A multi-phase schedule . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 70 9.4.1 Durations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 70 9.4.2 Adequation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 70
4
Introduction
This tutorial respects some writing conventions: menus, buttonsetc.are written inbold (eg.Algorithm / New Algorithm Window,OK,Denition list); command lines, SynDEx les, examplesetc.are written inComputer Modern (eg.-libs libs,amexesplloria/tut,! int o); To create an application workspace, run the SynDEx executab le, located at the root of your installation folder, with option-libs libs. See theSynDEx v7 User Manualfor more information. The examples presented in this tutorial are located in the su b-folderxemalpes/tutorial example is lo-. Each cated in its sub-folder. The example 7 is located in thel/iaamex/tesorut7elpmalpxe,elpmut/saxexample7_torial/eomon, andexamples/tutorial/example7 bifolders. _
Example 1 Algorithm, architecture, and adequation: we create a sensor denition, an actuator denition, and a function denition. Then, we create an algorithm and dene it as main. Finally, we create in the main algorithm two references to the sensor denition, three references to the actuator denition, and one reference to the function denition, and we create data dependences between these references by connecting their p orts; 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 co mmunication medium, –an architecture with three operators and a RAM communicatio n medium; we create constraints on the third architecture; we perform the adequation of the main algorithm onto the thir architecture dened as main, without con- d straint and then with constraints. Example 2 Hierarchy in algorithm: we create a function denition and a constant. Inside the function we create a reference to another function; inthatwaythisdenitionisdenedbyhierarchy.Then,wecreateathirdfunctionthatreferencesboth previous ones. Finally, we create an algorithm that referen ces the third function and dene it as main. In that way, the main algorithm references a hierarchical func tion; we create parameters names for an operation, and assign valu to these parameters. es
5
Example 3 Delay in algorithm: we create a delay denition; we create a  actuator, and a function and by connecting nmain algorithm by referencing a delay, a sensor, a them. Example 4 Repetition and library in algorithm: by repeating a multiplication function on scalars:we create a multiplication function of a vector by a scalar –rstly without any library, –secondly with a library; by repeating a multiplication function on vectors.we create a multiplication function of a matrix by a vector 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 :  three functions, and a constant and by tors,we create a main algorithm by referencing a sensor, two actua connecting them; we create an architecture with two operators of typeUand a communication medium of typeu/TCP; we perform the adequation; we perform the code generation, then we create manualy thelempxaex4m.6le (for operations not dened in libraries); we create manualy them4mepmax.6elle (to dene the hostname) and theortom.x4le (for the main oper-ator); we create manualy theileakefNGmU, then we execute the executives created after compilation. Example 7 Denition of the source code into the code editor window: we add parameters to theconvfunction ofExample 6;  a generic processor then in case of an ofwe modify the code associated with this function rst in case architecture with heterogenous processors; we create manualy theelpm4m.7mexale (to dene the hostname) and thero.mot4xle (for the main oper-ator); we create manualy theeilefNGmUka;
6
we perform the adequation, then we perform compilation, nally we compile the executives and launch the executables.
Denition of the source code in separateCles: we dene the code of a new function in a.cle, we dene the code of a new function in a.cle and we use a.hle.
Example 8 A complete realistic application from adequation to execution:
the model of a complete application for two cars;we build 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 we realize a mono-phase schedule we realize a multi-phase schedule
7
Chapter 1
Example 1: algorithm, architecture, and adequation
1.1 The main algorithm
Figure 1.1:Algorithm / New Algorithm Window From the main window, choose theFile / Save asoption and save your rst application under a new folder (eg.rtiuatlomy_) with the namexemalp1e. ChooseAlgorithm / New Algorithm Window(cf.gure 1.1). It opens the edition window for algorithm denitions.
1.1.1 Denition of a sensor To create aninputsensor denition: from the algorithm window, click on the+green button. It opens a dialog window, checkSensor(cf.gure 1.2). Type the sensor name and optionally a list of parameters for the sensor. For example typeinput, then
8
Figure 1.2:Dene Sensor
Figure 1.3:
Figure 1.4:
Name of the new sensor
Sensor denition window
9
Figure
1.5:
Contextual
Figure
1.6:
menu
Create
10
Add
Port
port
Figure 1.7: Sensor denition window after output port created
clickOK(cf.gure 1.3). It creates the denition of theinputsensor. To open it in denition mode, double click oninputin theDenition list(cf.gure 1.4); ininputdenition mode, right click on the background and selectAdd port(cf.gure 1.5). It opens a dialog window for the port's direction, type, name and optio nally its size. For example type o! int, then clickOK(cf.gure 1.6). It creates the integer output porto(cf.gure 1.7) in the sensor denition window.
1.1.2 Denition of an actuator To create anoutputactuator denition: from the algorithm window, click on the+green buttondialog window: checkActuatorthen typeoutput and clickOK; double click onoutputin theDenition list. Then right click on its background and selectAdd portdialog window: i? int. ClickOK. It creates the integer input portiin the sensor denition window.
1.1.3 Denition of a function To create aitnoucpamtofunction denition: from the algorithm window, click on the+green button checkdialog window:Functionthen type computationand clickOK; double click oncnoatitmoupin theDenition list. Thenright click on its background and selectAdd port dialog window: o int b ! int a ?? int. ClickOK. It creates the integer portsa,b, andoin the function denition window.
1.1.4 Denition of the main algorithm To create antimhglroAMainfunction denition:
11
Voir icon more
Alternate Text