40
Esterel By: Geoff Houston Britney Mendez Jon Calhoun Travis Blanchette

Esterel

  • Upload
    byrd

  • View
    55

  • Download
    0

Embed Size (px)

DESCRIPTION

Esterel. By: Geoff Houston Britney Mendez Jon Calhoun Travis Blanchette. Content. Compliers Alternative New Summary Conclusion References. Intro Reactive systems Features of reactive systems The Language Syntax examples FSM pro/con compiling diagrams. Introduction. - PowerPoint PPT Presentation

Citation preview

Page 1: Esterel

Esterel By: Geoff Houston

Britney MendezJon Calhoun

Travis Blanchette

Page 2: Esterel

Intro Reactive systems Features of

reactive systems The Language

◦ Syntax◦ examples◦ FSM pro/con◦ compiling diagrams

Compliers◦ Alternative◦ New

Summary Conclusion References

Content

Page 3: Esterel

Situation 1 - stop light Situation 2 - airplane flight computer Situation 3 - vending machine Situation 4 – anti-lock breaks

Introduction

Page 4: Esterel

What are reactive systems Why we need them

◦ safety◦ efficient◦ quality control

Solutions to the situations

Reactive Systems

Page 5: Esterel

Deterministic Formally Verifiable

Features of Reactive systems

Page 6: Esterel

1983 Developed by Gérard Berry 1984 First semantics, LISP-based V2 compiler 1988 Better semantics, Efficient V3 compiler 1990 First hardware synthesis to FPGAs (DEC) 1992 BDD-based verification facilities (Dassault) 1995 Causality and cyclic circuits 1997 Sequential optimization 1999 V7 specification started 2001 Esterel Technologies founded 2003 Esterel V7 compiler released 2005 First silicon produced by Esterel V7 2007 Fast code generation, System C backend 2008 IEEE Standardization process started

Timeline

Page 7: Esterel

• BNF Definition:• Module :

– module ModuleIdentifier :– InterfaceDeclListopt– Statement– end moduleopt

• Interface Declaration• Type Declarations• Constant Declarations• Function Declarations

– FunctionDecls :• function FunctionDeclList ;

• Procedure Declarations– ProcedureDecls :

• procedure ProcedureDeclList ;

• Signal Declarations• Variable Declarations• Task Declarations• Sensor Declarations• Input Relation

Declarations• Expressions• Statements

Esterel – the language

Page 8: Esterel

Reactions Instants or ticks Status of a signal Trace Occurrences

Some definitions

Page 9: Esterel

Also called Strong synchrony hypothesis Import: Central to the theory of reactive

systems

Strong synchrony model

Page 10: Esterel

• var x := 0 : integer in i end; • Type identifier is either integer or boolean• Execution

– In Parallel with the || operator– Sequentially with the ; operator

• Modules are interfaces and instructions.• Modules are executed in parallel in an

Esterel program.

Some Syntax

Page 11: Esterel

A channel on which events occur Two kinds:

◦ Pure – present or absent in an instant, not both◦ Valued – pure signals with an associated value

which only changes on event boundaries

Signals

Page 12: Esterel

Await – waits for its occurrence to elapse, then terminates◦ await s

Emit – triggers an event on a signal s in the current instant and terminates instantly◦ emit s◦ emit s (e)

Await/Emit

Page 13: Esterel

module simple:input A, B, C;output D, E, F;

loop await A; emit D; await Aend

||every B doemit Fend

||await B; emit E; await C; emit E;

.

Module example

Page 14: Esterel

Input/output of module simple

Page 15: Esterel

• Halt – fundamental time consumer in Esterel

• Preemptiondo

i1watching otimeout i2 end

• Exception trap E in i1handle E do i2end

Halt/Preemption and exceptions

Page 16: Esterel

if e then i1else i2end

present s then i1else i2 end

Conditionals

Page 17: Esterel

Basic loop iend do….upto loop….each every…do

Loops

Page 18: Esterel

trap HeartAttack in

|| run CheckHeart

exit HeartAttack

handle HeartAttack do run RushToHospitalend trap

abort

when 2 Lap

every Morning do

end every

abort every Step do run Jump || run Breathe end every when 15 Second ; run FullSpeed

loop

each Lap

abort run Slowly when 100 Meter ;

Signal

Error Signal

Process

Page 19: Esterel

The Stopwatch – Inputs/Outputs

Start/Stop

Time

Lap/Reset

Image Source: http://www.ewashtenaw.org/government/departments/cmhpsm/provider_information/images/Stopwatch%20for%20PI

Page 20: Esterel

The Stopwatch - Code

module STOPWATCH:

input SS, LR, SECOND;output TIME(integer);

signal RESET, LAP, RUN, FROZEN in

Page 21: Esterel

The Stopwatch – Start/Stop Code

loopawait SS;do

sustain RUNup to SS

end

||

Sustain RUN translates to

Every TICK do emit RUNend

Page 22: Esterel

The Stopwatch – Lap/Reset Code

every LR dopresent RUN then emit LAP

else present FROZENelse emit RESET

endend

end||

Page 23: Esterel

The Stopwatch – Frozen Display Code

loopawait LAP;trap T in

sustain FROZEN||

await LAP; exit Tend

end||

Page 24: Esterel

The Stopwatch – Counter Codeloop

var second := 0 : integer inemit TIME(second) ;every SECOND do

present RUN thensecond := second + 1

end ;present FROZEN else

emit TIME(second)end

endend

upto RESETend .

Page 25: Esterel

Esterel as an FSM - Pros

Faster runtime

If FSM can be found, the program is guaranteed to run.

Page 26: Esterel

Esterel as an FSM - Cons

Exponential file size

Long compilation times

Debugging is challenging

2 Signals 4 States3 Signals 8 States4 Signals 16States5 Signals 32 States6 Signals 64Statesn Signals 2n States

Exponential Growth of States

Page 27: Esterel

Esterel Compilation Alternatives Intermediate code is generated instead of

an FSM Each instant is broken into a series of steps

Page 28: Esterel

Another examplemodule simple:input A, C;output B, E;

every reset do loop await A; emit B; await A; emit Eend

||loopif B emit E; await C; emit Aend

end

RESET

BA

A

B

E

E

C

A

Page 29: Esterel

every RESET do loop await A; emit B; if C emit D; pause end|| loop if B emit C; pause endend

s=2

CB

DCB

A21 s

s=1

RESET

s=2

CB

DCB

A21 s

s=1

RESET

t=0 t=1

DCs=2 s=1

RESET

A1 s

B2

B C

t0 1

Esterel

Concurrent Control-Flow

GraphScheduled

CCFGSequential

Control-Flow Graph

Step 1: Translate

Step 2: Schedule

Step 3: Sequentialize

Void foo(){ switch (st) { 0: if (IN=3) st = 5; goto L5; 1: if (RES) st = 3; goto L8; } L5: switch}

C

Step 4: Generate C

A Typical Compiler

Stephen A.Edwards

Page 30: Esterel

every RESET do loop await A; emit B; if C emit D; pause end|| loop if B emit C; pause endend

Reset

Step 1: Build Concurrent CFG

Fork

Join

S2

1

S=1S=2

C

B

C

B

D

A

Page 31: Esterel

Step 2: Schedule

RESET

S=2S=1

C

s

B

A

C

B

D

21

Add arcs for communication

Page 32: Esterel

B

Step 3: Concurrency removed

s=2

CD

C

B

A21 s

s=1

RESETRESET

SB A

1 2

B

A21 s

T=1T=0

B CC

B

T0 1

S=2

C D

s=1S=2

CD

s=1

s=2 CBDCBA 21 s s=1RESET

RESET

S=1

S 21

Page 33: Esterel

Step 3: Sequentialize Hardest part: Removing concurrency

Simulate the Concurrent CFG

Main Loop:◦ For each node in scheduled order,

Insert context switch if from different thread

Page 34: Esterel

Esterel Compiler Alternatives Smaller filesize and compilation times

◦ 20 min and 3.7mb vs 7s and 80kb

Causality checking is left to runtimepresent A else emit A end

Page 35: Esterel

Esterel Compiler Alternatives Introduces several new elements within

processes◦ Program counters◦ Set Calculator◦ Process status

Terminated (0) Halted (1) Waiting (-1)

Page 36: Esterel

• 1988: INRIA compiler (G. Berry)• 1999: Synopsys Esterel v5 Compiler (S. Edwards)• 1998: GMD Esterel compiler (A. Poigné, L. Holenderski)• 2001: Xerox TCCP time constraint language (V. Saraswat)• 2001: France Telecom Esterel->C compiler (Weil & Closse)• 2001: Cadence Esterel/C Language = ECL (Lavagno, Sentovich)• 2002: Columbia Esterel v5 Compiler (S. Edwards)• 2002: Kaiserslautern Quartz compiler / verifier (K. Schneider)• 2004: INRIA Esterel->FastC compiler (D. Potop)• 2005: Dassault Systèmes Esterel for PLCs compiler• 2006: Kaiserslautern Averest system (K. Schneider)

Known Compilers

Page 37: Esterel

Summary Features – reactive template, concurrency,

signals, Benefits – C files, Concurrency for control

systems, deterministic, finite state lang, implemented in hardware

Suckage - bad for data flow, C files huge, C files inefficient and bulky, Semantic challenges: loop emit E end impossible

Page 38: Esterel

Conclusion Proposal for Esterel v7 to make it more

efficient without the hardware. Great with the right hardware. started SCADE

Page 39: Esterel

References Prof. Stephen A. Edwards Columbia University,

New York www.cs.columbia.edu/~sedwards The Esterel v5 Language Primer Version 5.21

release 2.0 G´erard Berry Centre de Math´ematiques Appliqu´ees Ecole des Mines and INRIA http://dvlabweb.soe.ucsc.edu/ucsc/esterel/esterel_primer.pdf

An Esterel Compiler for a Synchronus / Reactive Development System by Stephan Edwards

Page 40: Esterel

Esterel By: Geoff Houston

Britney MendezJon Calhoun

Travis Blanchette