400 likes | 612 Views
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.
E N D
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 • Situation 1 - stop light • Situation 2 - airplane flight computer • Situation 3 - vending machine • Situation 4 – anti-lock breaks
Reactive Systems • What are reactive systems • Why we need them • safety • efficient • quality control • Solutions to the situations
Features of Reactive systems • Deterministic • Formally Verifiable
Timeline • 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
Esterel – the language • Procedure Declarations • ProcedureDecls : • procedure ProcedureDeclList ; • Signal Declarations • Variable Declarations • Task Declarations • Sensor Declarations • Input Relation Declarations • Expressions • Statements • BNF Definition: • Module : • module ModuleIdentifier : • InterfaceDeclListopt • Statement • end moduleopt • Interface Declaration • Type Declarations • Constant Declarations • Function Declarations • FunctionDecls : • function FunctionDeclList;
Some definitions • Reactions • Instants or ticks • Status of a signal • Trace • Occurrences
Strong synchrony model • Also called Strong synchrony hypothesis • Import: Central to the theory of reactive systems
Some Syntax • var x := 0 : integer iniend; • 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.
Signals • 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
Await/Emit • 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)
Module example module simple: input A, B, C; output D, E, F; loop await A; emit D; await A end || every B do emit F end || await B; emit E; await C; emit E; .
Halt/Preemption and exceptions • Halt – fundamental time consumer in Esterel • Preemption do i1 watching o timeout i2 end • Exception trap E in i1 handle E do i2 end
Conditionals if e then i1 else i2 end present s then i1 else i2 end
Loops • Basic loop i end • do….upto • loop….each • every…do
trapHeartAttack in || runCheckHeart exitHeartAttack handle HeartAttackdo runRushToHospital end trap everyMorning do end every abort when 2 Lap abort everyStep do runJump|| runBreathe end every when15 Second; runFullSpeed loop eachLap abortrunSlowlywhen100 Meter; Signal Error Signal Process
The Stopwatch – Inputs/Outputs Lap/Reset Start/Stop Time Image Source:http://www.ewashtenaw.org/government/departments/cmhpsm/provider_information/images/Stopwatch%20for%20PI
The Stopwatch - Code module STOPWATCH: input SS, LR, SECOND; output TIME(integer); signal RESET, LAP, RUN, FROZEN in
The Stopwatch – Start/Stop Code loop await SS; do sustain RUN up to SS end ||
The Stopwatch – Lap/Reset Code every LR do present RUN then emit LAP else present FROZEN else emit RESET end end end ||
The Stopwatch – Frozen Display Code loop await LAP; trap T in sustain FROZEN || await LAP; exit T end end ||
The Stopwatch – Counter Code loop var second := 0 : integer in emit TIME(second) ; every SECOND do present RUN then second := second + 1 end ; present FROZEN else emit TIME(second) end end end upto RESET end .
Esterel as an FSM - Pros • Faster runtime • If FSM can be found, the program is guaranteed to run.
Esterel as an FSM - Cons • Exponential file size • Long compilation times • Debugging is challenging Exponential Growth of States
Esterel Compilation Alternatives • Intermediate code is generated instead of an FSM • Each instant is broken into a series of steps
Another example RESET module simple: input A, C; output B, E; every reset do loop await A; emit B; await A; emit E end || loop if B emit E; await C; emit A end end A B E B C A A E
A Typical Compiler C Void foo() { switch (st) { 0: if (IN=3) st = 5; goto L5; 1: if (RES) st = 3; goto L8; } L5: switch } Step 4: Generate C Esterel every RESET do loop await A; emit B; if C emit D; pause end || loop if B emit C; pause end end Step 1: Translate Step 2: Schedule Step 3: Sequentialize Concurrent Control-Flow Graph Scheduled CCFG Sequential Control-Flow Graph Stephen A.Edwards
Step 1: Build Concurrent CFG every RESET do loop await A; emit B; if C emit D; pause end || loop if B emit C; pause end end Reset 1 Fork 2 S A B B C C D S=2 S=1 Join
Step 2: Schedule Add arcs for communication RESET 1 s 2 A B B C C D S=1 S=2
RESET 1 s 2 A B B C C D s=2 s=1 Step 3: Concurrency removed RESET RESET RESET 1 S 2 1 1 s S A 2 2 B A T=0 T=1 B B B B B C 1 s 2 C C C 0 1 C T A D D C D s=2 s=1 s=1 S=2 S=1 s=1 S=2
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
Esterel Compiler Alternatives • Smaller filesize and compilation times • 20 min and 3.7mb vs 7s and 80kb • Causality checking is left to runtime present A else emit A end
Esterel Compiler Alternatives • Introduces several new elements within processes • Program counters • Set Calculator • Process status • Terminated (0) • Halted (1) • Waiting (-1)
Known Compilers • 1988: INRIA compiler (G. Berry) • 1999: SynopsysEsterel v5 Compiler (S. Edwards) • 1998: GMDEsterel compiler (A. Poigné, L. Holenderski) • 2001: Xerox TCCP time constraint language (V. Saraswat) • 2001: France TelecomEsterel->C compiler (Weil & Closse) • 2001: Cadence Esterel/C Language = ECL (Lavagno, Sentovich) • 2002: ColumbiaEsterel v5 Compiler (S. Edwards) • 2002: Kaiserslautern Quartz compiler / verifier (K. Schneider) • 2004: INRIAEsterel->FastC compiler (D. Potop) • 2005: DassaultSystèmesEsterel for PLCs compiler • 2006: KaiserslauternAverest system (K. Schneider)
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
Conclusion • Proposal for Esterel v7 to make it more efficient without the hardware. • Great with the right hardware. • started SCADE
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´ematiquesAppliqu´eesEcole 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
Esterel By: Geoff Houston Britney Mendez Jon Calhoun Travis Blanchette