17.11.2012 Views

Introduction to SDL - Julien

Introduction to SDL - Julien

Introduction to SDL - Julien

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

<strong>Julien</strong> Delange <br />

<strong>Introduction</strong> <strong>to</strong> <strong>SDL</strong><br />

(Specification and Description Language)<br />

<strong>Julien</strong> Delange <br />

This work is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License.<br />

To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-sa/3.0/ or<br />

send a letter <strong>to</strong> Creative Commons, 171 Second Street, Suite 300, San Francisco, California, 94105, USA.


<strong>Julien</strong> Delange <br />

About this course<br />

• <strong>Introduction</strong>, not a complete lecture<br />

• Cover most <strong>SDL</strong> concepts<br />

• For interested students, resources available on the internet<br />

• See the links section<br />

• Focused on main <strong>SDL</strong> aspects and practical use<br />

• Basic components<br />

• Code generation, <strong>SDL</strong> specs usage<br />

• Rely on RTDS when modeling<br />

software is used<br />

• Particularly for code generation<br />

• Thanks <strong>to</strong> Pragmadev for providing RTDS


<strong>Julien</strong> Delange <br />

Overview<br />

• <strong>Introduction</strong>, his<strong>to</strong>ry and rationale<br />

• <strong>SDL</strong> language<br />

• MSC diagrams<br />

• Code generation<br />

• Conclusion & links


<strong>Julien</strong> Delange <br />

Overview<br />

• <strong>Introduction</strong>, his<strong>to</strong>ry and rationale<br />

• <strong>SDL</strong> language<br />

• MSC diagrams<br />

• Code generation<br />

• Conclusion & links


<strong>Julien</strong> Delange <br />

<strong>Introduction</strong> and his<strong>to</strong>ry<br />

• International standard<br />

• First version late 80, refinements until late 2000<br />

• Primary use for telecommunication purposes<br />

• Messages exchange<br />

• Timing concerns<br />

• Deterministic specification of<br />

system behavior<br />

• System states and messages<br />

• Timing issues


<strong>Julien</strong> Delange <br />

Rationale for real-time systems<br />

• System design = error prone<br />

• Need for system behavior specification<br />

• Appropriate representation of system requirements<br />

• Avoid description of implementation concerns<br />

• Specify critical aspects (time, messages, etc.)<br />

• Dedicated formalism<br />

• For system verification<br />

• For au<strong>to</strong>matic implementation


<strong>Julien</strong> Delange <br />

A bit about existing <strong>SDL</strong> <strong>to</strong>olset<br />

• <strong>SDL</strong> Rational <strong>SDL</strong> suite<br />

• Based on TAU, previous reference <strong>to</strong>ol<br />

• RTDS (french product !)<br />

• <strong>SDL</strong>/<strong>SDL</strong>-RT/MSC edition<br />

• Code generation targeting C and many OS<br />

• Cinderella<br />

• <strong>SDL</strong>/<strong>SDL</strong>-RT/MSC edition<br />

• Code generation for C/C++


<strong>Julien</strong> Delange <br />

<strong>SDL</strong> ecosystem<br />

• <strong>SDL</strong> regular<br />

• First version late 80, refinements until late 2000<br />

• <strong>SDL</strong>-RT (Real-Time)<br />

• UML profile for <strong>SDL</strong><br />

• Standardized by ITU in 2007


<strong>Julien</strong> Delange <br />

Overview<br />

• <strong>Introduction</strong>, his<strong>to</strong>ry and rationale<br />

• <strong>SDL</strong> language<br />

• MSC diagrams<br />

• Code generation<br />

• Conclusion & links


<strong>Julien</strong> Delange <br />

<strong>SDL</strong> specification<br />

• Hierarchical components assembly<br />

• Root component: system<br />

• Behavior specification: process<br />

• Data types description<br />

• Signals (with parameters) specification<br />

• Behavior description<br />

• States/transitions/conditions<br />

of processes


<strong>Julien</strong> Delange <br />

<strong>SDL</strong> components (1)<br />

• Text<br />

• Data/variables/signals definition<br />

• Package dependencies<br />

• Packages<br />

• Organize components<br />

• Use with the USE clause in text sections<br />

• System<br />

• Contain processes/blocks<br />

• Defines signals<br />

PACKAGE mypkg<br />

<br />

SYSTEM mysystem<br />

<br />

DCL<br />

val integer;<br />

SIGNAL ok,<br />

code(integer);


• Block<br />

• Contain blocks or<br />

processes<br />

<strong>Julien</strong> Delange <br />

<strong>SDL</strong> components<br />

• Comment<br />

• Can also be inserted in text section<br />

using C-style comment (/* … */)<br />

• Process<br />

• Identification with a PID<br />

• Describe system functions behavior<br />

BLOCK myblock<br />


<strong>Julien</strong> Delange <br />

Process behavior specification (1)<br />

• State<br />

• Separated with signals or timers reception<br />

• Process abortion<br />

• Signal reception<br />

• Special SENDER variable<br />

(PID of the latest sender)<br />

• Signal emission<br />

• Specify recipient via TO clause


<strong>Julien</strong> Delange <br />

Process behavior specification (2)<br />

• Process data management<br />

• Text section<br />

• Timers (use the Time predefined type)<br />

• Set timers<br />

• Reset timers<br />

• Timer events as signal reception<br />

• Decision<br />

• Similar <strong>to</strong> a if


<strong>Julien</strong> Delange <br />

Process behavior specification (3)<br />

• All messages symbol: *<br />

• Previous state : -


<strong>Julien</strong> Delange <br />

First example<br />

• Ping-pong system<br />

• Ping process sends one integer<br />

• Pong returns the same integer<br />

• Basic <strong>SDL</strong> usage<br />

• One block, several processes<br />

• No instance, only regular processes<br />

• Predefined data types


Processes<br />

<strong>Julien</strong> Delange <br />

<strong>SDL</strong> block: example<br />

Sent and received signals<br />

between processes<br />

Text<br />

(signals descriptions)


Process data<br />

(variables)<br />

Initial state<br />

Data initialisation<br />

Timer initialisation<br />

State<br />

<strong>Julien</strong> Delange <br />

<strong>SDL</strong> example: ping process<br />

Timer event<br />

Send signal<br />

State<br />

Receive signal<br />

Data/timer<br />

processing


<strong>Julien</strong> Delange <br />

<strong>SDL</strong> example: pong process<br />

Process data<br />

(variables)<br />

Receive signal<br />

(put value in<strong>to</strong> val variable)<br />

Send signal<br />

(send value of the val variable)


<strong>Julien</strong> Delange <br />

Process semantics, constraints<br />

• FIFO order for signals queues<br />

• (Requested message != available message) = ERROR<br />

• Use conditions and previous states <strong>to</strong> avoid errors<br />

• Avoid instant reaction<br />

• Transition must wait for some inputs or timers<br />

• Similar <strong>to</strong> Esterel/LUSTRE approaches


Cyclic timer that sends values<br />

0, 1 and 2<br />

<strong>Julien</strong> Delange <br />

Extend the ping process<br />

Decision


• Boolean<br />

• Integer & Natural<br />

• Real<br />

• Character<br />

• Time (point in time)<br />

• Duration (time interval)<br />

• Charstring<br />

• Octet<br />

<strong>Julien</strong> Delange <br />

Predefined data types


<strong>Julien</strong> Delange <br />

Constraints data types: SYNTYPE<br />

SYNTYPE <br />

[type definition]<br />

ENDSYNTYPE;<br />

• Constraints on existing types : SYNTYPE<br />

SYNTYPE NumberOfProducts = Integer<br />

CONSTANTS 0..200<br />

ENDSYNTYPE;


<strong>Julien</strong> Delange <br />

Introduce new data types (1)<br />

NEWTYPE <br />

[type definition]<br />

ENDNEWTYPE;<br />

• Structure<br />

NEWTYPE article STRUCT<br />

name CHARSTRING;<br />

id INTEGER;<br />

ENDNEWTYPE;<br />

• Arrays<br />

Array index type<br />

NEWTYPE articles<br />

ARRAY (NumberOfArticles,<br />

article)<br />

ENDNEWTYPE;<br />

Array value type


• Enum<br />

• Choice<br />

<strong>Julien</strong> Delange <br />

Introduce new data types (2)<br />

NEWTYPE <br />

[type definition]<br />

ENDNEWTYPE;<br />

NEWTYPE MachineState<br />

LITERALS On, Off, Error<br />

ENDNEWTYPE;<br />

NEWTYPE menu<br />

CHOICE<br />

two-course Integer;<br />

three-course Integer;<br />

ENDNEWTYPE


<strong>Julien</strong> Delange <br />

Using structs, enum, choice and arrays<br />

• Access <strong>to</strong> struct/choice/enum members : opera<strong>to</strong>r !<br />

DCL myvariable article, tmp integer;<br />

myvariable!name := “computer”;<br />

tmp := myvariable!id;<br />

• Array values and assignment<br />

DCL myvariable articles, art article;<br />

art!name := “computer”;<br />

art!id := 1;<br />

articles (2) := art;<br />

NEWTYPE articles<br />

ARRAY (NumberOfArticles,<br />

article)<br />

ENDNEWTYPE;<br />

NEWTYPE article STRUCT<br />

name CHARSTRING;<br />

id INTEGER;<br />

ENDNEWTYPE;


<strong>Julien</strong> Delange <br />

Introduce new data types<br />

NEWTYPE <br />

[type definition]<br />

ENDNEWTYPE;<br />

• Structure<br />

NEWTYPE article STRUCT<br />

name CHARSTRING;<br />

id INTEGER;<br />

ENDNEWTYPE;<br />

• Arrays<br />

NEWTYPE articles<br />

ARRAY (NumberOfArticles,<br />

article)<br />

ENDNEWTYPE;


<strong>Julien</strong> Delange <br />

Data opera<strong>to</strong>rs<br />

• Assignment: :=<br />

• Equality: =<br />

• Non-Equality: /=<br />

• Superior, inferior: > <<br />

• Bit opera<strong>to</strong>r: and, or, not, xor


<strong>Julien</strong> Delange <br />

More on data types ...<br />

• Other operations/data types<br />

• Compatibility with ASN.1<br />

• Redefinition of data opera<strong>to</strong>r for new types


<strong>Julien</strong> Delange <br />

Integration of third-party code<br />

• Declaration<br />

PROCEDURE <br />

([IN/OUT paramname1 paramtype1,<br />

IN/OUT paramname2 paramtype2)<br />

EXTERNAL<br />

• Procedure use<br />

• Use regular <strong>SDL</strong> procedure<br />

• Potential assumptions breaks<br />

• No simulation available<br />

• Validate system according <strong>to</strong> ext. code


Call myproc with the<br />

value (val) <strong>to</strong> be<br />

sent <strong>to</strong> pong<br />

<strong>Julien</strong> Delange <br />

Third-party code in ping system


<strong>Julien</strong> Delange <br />

Integration of third-party, binary level<br />

• External procedure mapped in implementation language<br />

PROCEDURE myproc (IN val int, OUT val2 int)<br />

To C: Void myproc (int val, int* val2);<br />

To Ada: PROCEDURE MYPROC (IN val : INTEGER;<br />

OUT val2 : INTEGER);<br />

• No consistency check !!!<br />

• Semantics/types <strong>to</strong> be validated<br />

• User-provided object-code<br />

• Linked with RTDS generated code


<strong>Julien</strong> Delange <br />

Overview<br />

• <strong>Introduction</strong>, his<strong>to</strong>ry and rationale<br />

• <strong>SDL</strong> language<br />

• Message Sequence Chart (MSC) diagrams<br />

• Code generation<br />

• Conclusion & links


<strong>Julien</strong> Delange <br />

Message Sequence Charts<br />

• Standardized by ITU (1993)<br />

• Smooth integration in vendor <strong>to</strong>ols<br />

• Conceptually similar <strong>to</strong> UML sequence chart<br />

• Seem <strong>to</strong> fit better for large-scale systems<br />

• Trace system activity and agents interactions<br />

• Appropriate timing information<br />

• System agents (process, semaphore, ...)<br />

• Sent/received signals between agents


<strong>Julien</strong> Delange <br />

Relation between MSC and <strong>SDL</strong><br />

• <strong>SDL</strong>: system behavior specification<br />

• Does not specify exchanged messages<br />

• Cannot trace messages sent across a distributed system<br />

• MSC: one execution scenario<br />

• Show all information<br />

• Relevant <strong>to</strong> one particular configuration<br />

• �Complementary formalisms<br />

• MSC for behavior analysis<br />

• Support language for <strong>SDL</strong> specs.


<strong>Julien</strong> Delange <br />

MSC usage<br />

• Debugging<br />

• Generate MSC diagrams from system execution<br />

• Show activity, messages<br />

• Trace and find errors<br />

• Test<br />

• Send unexpected signals <strong>to</strong> asses system robustness<br />

• Test various system configuration<br />

• Performance analysis<br />

• Useless states<br />

• Irrelevant signals


• Time from <strong>to</strong>p <strong>to</strong> bot<strong>to</strong>m<br />

<strong>Julien</strong> Delange <br />

MSC : representation (1)<br />

• Show agent activity<br />

• S<strong>to</strong>p condition specification<br />

• Partial specification (continuous lifetime)<br />

• Agents can be spawned by others


• Signal between agents<br />

• Timers activity<br />

• Set timer<br />

<strong>Julien</strong> Delange <br />

MSC : representation (2)<br />

• Timer events


Time<br />

<strong>Julien</strong> Delange <br />

MSC : example<br />

States<br />

Signals<br />

Timer<br />

expiration<br />

Agents


<strong>Julien</strong> Delange <br />

MSC : going further<br />

• More operations on signals<br />

• Lost signals<br />

• Saved signals<br />

• Add comments<br />

• More on time operations<br />

• Specify time interval<br />

• See the links section !


<strong>Julien</strong> Delange <br />

Agenda<br />

• <strong>Introduction</strong>, his<strong>to</strong>ry and rationale<br />

• <strong>SDL</strong> language<br />

• MSC diagrams<br />

• Code generation<br />

• Conclusion & links


<strong>Julien</strong> Delange <br />

Code generation: target platforms<br />

• Support for different OS<br />

• Linux, Solaris, Windows<br />

• Support for some RTOS<br />

• POSIX compliance<br />

• Use pthread routines<br />

• Ease port <strong>to</strong> non-supported OS<br />

• Interface with gdb debugger


<strong>Julien</strong> Delange <br />

Code generation<br />

• General purpose files (for all <strong>SDL</strong> agents)<br />

• RTDS_gen.h: resources identifiers (PID, signals ID, etc.)<br />

• RTDS_Start.c: process, semaphores, data initialization<br />

• RTDS_String.c: OS-agnostic manipulation of strings<br />

• RTDS_Set.c: OS-agnostic set handling<br />

• Process specific files<br />

• .[c|h]<br />

• Operations performed by process<br />

• Initialization and infinite loop


<strong>Julien</strong> Delange <br />

Code generation: RTDS_gen.h<br />

• Process identifiers<br />

#define RTDS_process_ping 1<br />

#define RTDS_process_pong 2<br />

#define RTDS_process_RTDS_Env 3<br />

• Signals/timers identifiers<br />

#define sping 1<br />

#define spong 2<br />

#define mytimer 3<br />

• States identifiers<br />

#define Wait_Pong 1<br />

#define Idle 2<br />

#define RTDS_Idle 3


<strong>Julien</strong> Delange <br />

Code generation: RTDS_Start.c<br />

• RTDS_Start()<br />

• Initialize data and environment (see var RTDS_currentContext)<br />

• Create resources (cf. RTDS_STARTUP_PROCESS_CREATE())<br />

• RTDS_MAIN()<br />

• Initialize network stack (if necessary)<br />

• Call <strong>to</strong> RTDS_Start()


<strong>Julien</strong> Delange <br />

Code generation: .c<br />

• RTDS_TASK_ENTRY_POINT()<br />

• Single entry point<br />

• Called by RTDS_Start()<br />

• Process initialization<br />

• Local data<br />

• Timers, etc.<br />

• Infinite loop (for ( ; ; ) )<br />

Process init<br />

Receive signal<br />

Action depending<br />

on received signal<br />

Send signal<br />

• Signal and environment infos with globvar RTDS_currentContext)<br />

• Signal handling (cf. RTDS_MSG_QUEUE_READ,<br />

RTDS_MSG_SEND__TO_NAME)<br />

• States management (cf. RTDS_<strong>SDL</strong>_STATE_SET)<br />

• Timer handling (RTDS_SET_TIMER)<br />

Infinite loop


<strong>Julien</strong> Delange <br />

Code generation: going further<br />

• Define your own code generation templates<br />

• Adaptation <strong>to</strong> other OS and/or requirements<br />

• See $RTDS_HOME/share/ccg direc<strong>to</strong>ry<br />

• Template organization<br />

• Must define generic functions (task creation, etc.)<br />

• Target-specific options (boot, configure<br />

environment, etc.)<br />

• Integration within RTDS environment<br />

(configuration with GUI, etc.)


<strong>Julien</strong> Delange <br />

Agenda<br />

• <strong>Introduction</strong>, his<strong>to</strong>ry and rationale<br />

• <strong>SDL</strong> language<br />

• MSC diagrams<br />

• Code generation<br />

• Conclusion & links


<strong>Julien</strong> Delange <br />

Conclusion<br />

• Formal specification of application concerns<br />

• Ease system validation and test<br />

• Extended existing <strong>to</strong>olset<br />

• <strong>SDL</strong> edi<strong>to</strong>r<br />

• MSC generation & edi<strong>to</strong>r <strong>to</strong>ols<br />

• Require integration for implementation


<strong>Julien</strong> Delange <br />

Useful links<br />

• ITU website: http://www.itu.int<br />

• <strong>SDL</strong> Data types: www.lcc.uma.es/~pedro/docencia/sc/UsingDataTypes.pdf<br />

• MSC specification: http://www.sdl-rt.org/standard/V2.1/html/<strong>SDL</strong>-RTa6.html


<strong>Julien</strong> Delange <strong>Introduction</strong> <strong>to</strong> <strong>SDL</strong>(Specification and Description Language)<strong>Julien</strong> Delange This work is licensed under the Creative Comons Atribution-NonComercial-ShareAlike 3.0 Unported License.To view a copy of this license, visit htp:/creativecomons.org/licenses/by-nc-sa/3.0/ or send a leter <strong>to</strong> Creative Comons, 171 Second Stret, Suite 30, San Francisco, California, 94105, USA.


<strong>Julien</strong> Delange About this course•<strong>Introduction</strong>, not a complete lecture•Cover most <strong>SDL</strong> concepts•For interested students, resources available on the internet•Se the links section•Focused on main <strong>SDL</strong> aspects and practical use•Basic components•Code generation, <strong>SDL</strong> specs usage•Rely on RTDS when modelingsoftware is used•Particularly for code generation•Thanks <strong>to</strong> Pragmadev for providing RTDS


<strong>Julien</strong> Delange Overview•<strong>Introduction</strong>, his<strong>to</strong>ry and rationale•<strong>SDL</strong> language•MSC diagrams•Code generation•Conclusion & links


<strong>Julien</strong> Delange Overview•<strong>Introduction</strong>, his<strong>to</strong>ry and rationale•<strong>SDL</strong> language•MSC diagrams•Code generation•Conclusion & links


<strong>Julien</strong> Delange <strong>Introduction</strong> and his<strong>to</strong>ry•International standard•First version late 80, refinements until late 20•Primary use for telecomunication purposes•Mesages exchange•Timing concerns•Deterministic specification of system behavior•System states and mesages•Timing isues


<strong>Julien</strong> Delange Rationale for real-time systems•System design = eror prone•Ned for system behavior specification•Apropriate representation of system requirements•Avoid description of implementation concerns•Specify critical aspects (time, mesages, etc.)•Dedicated formalism•For system verification•For au<strong>to</strong>matic implementation


<strong>Julien</strong> Delange A bit about existing <strong>SDL</strong> <strong>to</strong>lset•<strong>SDL</strong> Rational <strong>SDL</strong> suite•Based on TAU, previous reference <strong>to</strong>l•RTDS (french product !)•<strong>SDL</strong>/<strong>SDL</strong>-RT/MSC edition•Code generation targeting C and many OS•Cinderela•<strong>SDL</strong>/<strong>SDL</strong>-RT/MSC edition•Code generation for C/C+


<strong>Julien</strong> Delange <strong>SDL</strong> ecosystem•<strong>SDL</strong> regular•First version late 80, refinements until late 20•<strong>SDL</strong>-RT (Real-Time)•UML profile for <strong>SDL</strong>•Standardized by ITU in 207


<strong>Julien</strong> Delange Overview•<strong>Introduction</strong>, his<strong>to</strong>ry and rationale•<strong>SDL</strong> language•MSC diagrams•Code generation•Conclusion & links


<strong>Julien</strong> Delange <strong>SDL</strong> specification•Hierarchical components asembly•Rot component: system•Behavior specification: proces•Data types description•Signals (with parameters) specification•Behavior description•States/transitions/conditions of proceses


<strong>Julien</strong> Delange <strong>SDL</strong> components (1)•Text•Data/variables/signals definition•Package dependencies•Packages•Organize components•Use with the USE clause in text sections•System•Contain proceses/blocks•Defines signalsDCLval integer;SYSTEM mysystemPACKAGE mypkgSIGNAL ok,code(integer);


<strong>Julien</strong> Delange <strong>SDL</strong> components•Block•Contain blocks orproceses•Coment•Can also be inserted in text sectionusing C-style coment (/* … */)•Proces•Identification with a PID•Describe system functions behaviorBLOCK myblock


<strong>Julien</strong> Delange Proces behavior specification (1)•State•Separated with signals or timers reception•Proces abortion•Signal reception•Special SENDER variable(PID of the latest sender)•Signal emision•Specify recipient via TO clause


<strong>Julien</strong> Delange Proces behavior specification (2)•Proces data management•Text section•Timers (use the Time predefined type)•Set timers•Reset timers•Timer events as signal reception•Decision•Similar <strong>to</strong> a if


<strong>Julien</strong> Delange Proces behavior specification (3)•Al mesages symbol: *•Previous state : -


<strong>Julien</strong> Delange First example•Ping-pong system•Ping proces sends one integer•Pong returns the same integer•Basic <strong>SDL</strong> usage•One block, several proceses•No instance, only regular proceses•Predefined data types


<strong>Julien</strong> Delange <strong>SDL</strong> block: exampleText(signals descriptions)ProcesesSent and received signalsbetwen proceses


<strong>Julien</strong> Delange <strong>SDL</strong> example: ping procesProces data(variables)Initial stateData initialisationTimer initialisationStateTimer eventSend signalStateReceive signalData/timerprocesing


<strong>Julien</strong> Delange <strong>SDL</strong> example: pong procesProces data(variables)Receive signal(put value in<strong>to</strong> val variable)Send signal(send value of the val variable)


<strong>Julien</strong> Delange Proces semantics, constraints•FIFO order for signals queues•(Requested mesage != available mesage) = EROR•Use conditions and previous states <strong>to</strong> avoid erors•Avoid instant reaction•Transition must wait for some inputs or timers•Similar <strong>to</strong> Esterel/LUSTRE aproaches


<strong>Julien</strong> Delange Extend the ping procesDecisionCyclic timer that sends values0, 1 and 2


<strong>Julien</strong> Delange Predefined data types•Bolean•Integer & Natural•Real•Character•Time (point in time)•Duration (time interval)•Charstring•Octet


<strong>Julien</strong> Delange Constraints data types: SYNTYPESYNTYPE [type definition]ENDSYNTYPE;•Constraints on existing types : SYNTYPESYNTYPE NumberOfProducts = Integer CONSTANTS 0.20ENDSYNTYPE;


<strong>Julien</strong> Delange Introduce new data types (1)NEWTYPE [type definition]ENDNEWTYPE;•StructureNEWTYPE article STRUCT name CHARSTRING; id INTEGER;ENDNEWTYPE;•AraysNEWTYPE articles ARAY (NumberOfArticles, article)ENDNEWTYPE;Aray index typeAray value type


<strong>Julien</strong> Delange Introduce new data types (2)NEWTYPE [type definition]ENDNEWTYPE;•EnumNEWTYPE MachineStateLITERALS On, Of, ErorENDNEWTYPE;•ChoiceNEWTYPE menuCHOICE two-course Integer; thre-course Integer;ENDNEWTYPE


<strong>Julien</strong> Delange Using structs, enum, choice and arays•Aces <strong>to</strong> struct/choice/enum members : opera<strong>to</strong>r ! DCL myvariable article, tmp integer; myvariable!name := “computer”; tmp := myvariable!id;•Aray values and asignment DCL myvariable articles, art article; art!name := “computer”; art!id := 1; articles (2) := art;NEWTYPE article STRUCT name CHARSTRING; id INTEGER;ENDNEWTYPE;NEWTYPE articles ARAY (NumberOfArticles, article)ENDNEWTYPE;


<strong>Julien</strong> Delange Introduce new data typesNEWTYPE [type definition]ENDNEWTYPE;•StructureNEWTYPE article STRUCT name CHARSTRING; id INTEGER;ENDNEWTYPE;•AraysNEWTYPE articles ARAY (NumberOfArticles, article)ENDNEWTYPE;


<strong>Julien</strong> Delange Data opera<strong>to</strong>rs•Asignment: :=•Equality: =•Non-Equality: /=•Superior, inferior: >


<strong>Julien</strong> Delange More on data types .•Other operations/data types•Compatibility with ASN.1•Redefinition of data opera<strong>to</strong>r for new types


<strong>Julien</strong> Delange Integration of third-party code•DeclarationPROCEDURE ([IN/OUT paramname1 paramtype1, IN/OUT paramname2 paramtype2)EXTERNAL•Procedure use•Use regular <strong>SDL</strong> procedure•Potential asumptions breaks•No simulation available•Validate system acording <strong>to</strong> ext. code


<strong>Julien</strong> Delange Third-party code in ping systemCal myproc with the value (val) <strong>to</strong> besent <strong>to</strong> pong


<strong>Julien</strong> Delange Integration of third-party, binary level•External procedure maped in implementation languagePROCEDURE myproc (IN val int, OUT val2 int)To C: Void myproc (int val, int* val2);To Ada: PROCEDURE MYPROC (IN val : INTEGER; OUT val2 : INTEGER);•No consistency check !•Semantics/types <strong>to</strong> be validated•User-provided object-code•Linked with RTDS generated code


<strong>Julien</strong> Delange Overview•<strong>Introduction</strong>, his<strong>to</strong>ry and rationale•<strong>SDL</strong> language•Mesage Sequence Chart (MSC) diagrams•Code generation•Conclusion & links


<strong>Julien</strong> Delange Mesage Sequence Charts•Standardized by ITU (193)•Smoth integration in vendor <strong>to</strong>ls•Conceptualy similar <strong>to</strong> UML sequence chart•Sem <strong>to</strong> fit beter for large-scale systems•Trace system activity and agents interactions•Apropriate timing information•System agents (proces, semaphore, .)•Sent/received signals betwen agents


<strong>Julien</strong> Delange Relation betwen MSC and <strong>SDL</strong>•<strong>SDL</strong>: system behavior specification•Does not specify exchanged mesages•Canot trace mesages sent acros a distributed system•MSC: one execution scenario•Show al information•Relevant <strong>to</strong> one particular configuration•�Complementary formalisms•MSC for behavior analysis•Suport language for <strong>SDL</strong> specs.


<strong>Julien</strong> Delange MSC usage•Debuging•Generate MSC diagrams from system execution•Show activity, mesages•Trace and find erors•Test•Send unexpected signals <strong>to</strong> ases system robustnes•Test various system configuration•Performance analysis•Useles states•Irelevant signals


<strong>Julien</strong> Delange MSC : representation (1)•Time from <strong>to</strong>p <strong>to</strong> bo<strong>to</strong>m•Show agent activity•S<strong>to</strong>p condition specification•Partial specification (continuous lifetime)•Agents can be spawned by others


<strong>Julien</strong> Delange MSC : representation (2)•Signal betwen agents•Timers activity•Set timer•Timer events


<strong>Julien</strong> Delange MSC : exampleTimerexpirationAgentsTimeStatesSignals


<strong>Julien</strong> Delange MSC : going further•More operations on signals•Lost signals•Saved signals•Ad coments•More on time operations•Specify time interval•Se the links section !


<strong>Julien</strong> Delange Agenda•<strong>Introduction</strong>, his<strong>to</strong>ry and rationale•<strong>SDL</strong> language•MSC diagrams•Code generation•Conclusion & links


<strong>Julien</strong> Delange Code generation: target platforms•Suport for diferent OS•Linux, Solaris, Windows•Suport for some RTOS•POSIX compliance•Use pthread routines•Ease port <strong>to</strong> non-suported OS•Interface with gdb debuger


<strong>Julien</strong> Delange Code generation•General purpose files (for al <strong>SDL</strong> agents)•RTDS_gen.h: resources identifiers (PID, signals ID, etc.)•RTDS_Start.c: proces, semaphores, data initialization•RTDS_String.c: OS-agnostic manipulation of strings•RTDS_Set.c: OS-agnostic set handling•Proces specific files•.[c|h] •Operations performed by proces•Initialization and infinite lop


<strong>Julien</strong> Delange Code generation: RTDS_gen.h•Proces identifiers #define RTDS_proces_ping 1 #define RTDS_proces_pong 2 #define RTDS_proces_RTDS_Env 3•Signals/timers identifiers #define sping 1 #define spong 2 #define mytimer 3•States identifiers #define Wait_Pong 1 #define Idle 2 #define RTDS_Idle 3


<strong>Julien</strong> Delange Code generation: RTDS_Start.c•RTDS_Start()•Initialize data and environment (se var RTDS_curentContext)•Create resources (cf. RTDS_STARTUP_PROCES_CREATE()•RTDS_MAIN()•Initialize network stack (if necesary)•Cal <strong>to</strong> RTDS_Start()


<strong>Julien</strong> Delange Code generation: .c•RTDS_TASK_ENTRY_POINT()•Single entry point•Caled by RTDS_Start()•Proces initialization•Local data•Timers, etc.•Infinite lop (for ( ; ; ) )•Signal and environment infos with globvar RTDS_curentContext)•Signal handling (cf. RTDS_MSG_QUEUE_READ,RTDS_MSG_SEND__TO_NAME)•States management (cf. RTDS_<strong>SDL</strong>_STATE_SET)•Timer handling (RTDS_SET_TIMER)Proces initReceive signalAction dependingon received signalSend signal<br />

Inf


<strong>Julien</strong> Delange Code generation: going further•Define your own code generation templates•Adaptation <strong>to</strong> other OS and/or requirements•Se $RTDS_HOME/share/cg direc<strong>to</strong>ry•Template organization•Must define generic functions (task creation, etc.)•Target-specific options (bot, configurenvironment, etc.)•Integration within RTDS environment(configuration with GUI, etc.)


<strong>Julien</strong> Delange Agenda•<strong>Introduction</strong>, his<strong>to</strong>ry and rationale•<strong>SDL</strong> language•MSC diagrams•Code generation•Conclusion & links


<strong>Julien</strong> Delange Conclusion•Formal specification of aplication concerns•Ease system validation and test•Extended existing <strong>to</strong>lset•<strong>SDL</strong> edi<strong>to</strong>r•MSC generation & edi<strong>to</strong>r <strong>to</strong>ls•Require integration for implementation


<strong>Julien</strong> Delange Useful links•ITU website: htp:/w.itu.int•<strong>SDL</strong> Data types: w.lc.uma.es/~pedro/docencia/sc/UsingDataTypes.pdf•MSC specification: htp:/w.sdl-rt.org/standard/V2.1/html/<strong>SDL</strong>-RTa6.html

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!