330 likes | 514 Vues
Esterel Programming Language. Synchronous Programming Language: Reactive systems that interact continuously with their environment, at a speed imposed by the environment Imperative programming style:
E N D
Synchronous Programming Language: • Reactive systems that interact continuously with their environment, at a speed imposed by the environment • Imperative programming style: • A programming paradigm that describes computation in terms of statements that change a program state. It defines a sequence of commands for the computer to perform. • This is opposed to declarative programming which expresses what a program should do without saying how it should do it. Main Characteristics
Design Goals: • A natural expression of control allowing instantaneous propagation of control • Simple and intuitive way of modeling system design and physical reality • Ideal usage for hardware system control Development Input Output Input Output Input Output time Execution instants
1984: • Jean-Paul Marmorat and Jean-Paul Rigaultwere researchers in Control Theory and Computer Science at the Ecole des Mines de Paris. While attempting to design a robotic car, they become frustrated in their attempts to express control algorithms in a natural and powerful way. • In response they invent an original, mathematically defined formal notation that allows them to control the car. • First Esterel Compiler is made Development Jean-Paul Marmorat Jean-Paul Rigault
1988: • Gerard Berry develops formal semantics and a first generation of code generation and formal verification tools • 1989: • Simulog, a French software company, develops a prototype version of the Esterel toolset for commercial use (Esterel v3 with enhanced compiler). • First Industrial use with AT&T Bell Labs, Dassault Aviation, and Bertin. Development Gerard Berry
1991: • Esterel v4 integrates a hardware compiler for use with FPGA’s • 1999: • Esterel Technologies is launched as a spinoff of Simulog and continues development • 2003: • Esterel v7 launches adding improved program structures, arrays of signals, delayed emissions, and multi-lock support • 2006: • Standardization process begun for IEEE approval Development
Multiform Notion of Time • Physical time is replaced with the notion of order • Only the simultaneity and presence of events are considered, thus physical time is ignored • Esterel describes a totally ordered sequence of logical events, with an arbitrary number of events happening in each instant • Events that happen with in the same instant are considered to occur simultaneously • Two types of events: • Those that start and end in the same instant (which is considered instantaneous execution) • Those that delay for a certain amount of cycles Characteristics
Multiform Notion of Time Characteristics
Primitive statements Characteristics
Derived statements Characteristics
R R A B R AB/O B/0 A/O • Module Example: Characteristics “Wait until both A and B have occurred, then output O, unless the reset R occurs” Esterel programs built from modules module ABRO: input A, B, R; output O; loop [ await A || await B ]; emit O each R end module Each module has an interface of input and output signals O
R R A B R AB/O B/0 A/O O • Simpler, Faster Code: module ABRO: input A, B, R; output O; loop [ await A || await B ]; emit O each R end module Characteristics switch(state){ case 0: state=1; break; case 1: if(!R)if(A)if(B) {O=1;state=4;} else state=2; else if(B)state=3;break; case 2: if(R)state=1; else if(B){O=1;state=4;} break; case 3: if(R)state=1; else if(A){O=1;state=4;} break; case 4: if(R)state=1;break; }
Esterel Signals: • Signals are the only means of communication • Two types: • Non-valued contains not data, they either exist or don’t exist (think true/false) • Valued also contains data in addition to the state of its existence • Any process can read or write a signal, which are broadcast across the program • The default status of signals is absent, and must be explicitly set to present using the “emit” statement • Signals are transmitted instantaneously (visible immediately within the cycle it is transmitted) • Signal coherency is maintained by enforcement that all writers occur before any readers do Signals
A signal emitted in a cycle is visible immediately [ pause; emit A; pause; emit A || pause; present A then emit B end ] Groups of statements separated by || run concurrently and terminate when all groups have terminated [ emit A; pause; emit B; || pause; emit C; pause; emit D ]; emit E Signals A B C D E Cycles A B A Cycles
Processes can communicate back and forth in the same cycle [ pause; emit A; present B then emit C end; pause; emit A || pause; present A then emit B end ] Signals A B C A Cycles • Signals are the only way for concurrent processes to communicate • Esterel does have variables, but they cannot be shared • Signal coherence rules ensure deterministic behavior • Language semantics clearly defines who must communicate with • whom when
The await statement waits for a particular cycle await S waits for the next cycle in which S is present [ emit A ; pause ; pause; emit A || await A; emit B ] Await Statement A A B Cycles Await normally waits for a cycle before beginning to check await immediate also checks the initial cycle [ emit A ; pause ; pause; emit A || await immediate A; emit B ] A B A Cycles
Esterel has an infinite loop statement • Rule: loop body cannot terminate instantly it needs at least one pause, await, etc. Can’t do an infinite amount of work in a single cycle loop emit A; pause; pause; emit B end Await Statement A B A B A B A Cycles Instantaneous nature of loops plus await provide very powerful synchronization mechanisms loop await 60 Sec; emit Min end 1 2 4 5 3 59 60 … Sec Sec Sec Sec Sec Sec Sec Cycles Min
A loop [ await A || await B ]; emit O; halt every R Circuit Translation R O boot RESET = R & !BOOT A_TRIGGER = A_OUT & !RESET A_THEN = A_TRIGGER & A A_ELSE = A_TRIGGER & !A A_TERM = A_THEN | ! A_TRIGGER A_IN = BOOT | RESET | A_ELSE B_TRIGGER = B_OUT & !RESET B_THEN = B_TRIGGER & B B_ELSE = B_TRIGGER & !B B_TERM = B_THEN | ! B_TRIGGER B_IN = BOOT | RESET | B_ELSE ACTIVE = A_TRIGGER | B_TRIGGER O = A_TERM & B_TERM & ACTIVE
Esterel: When Control is Essential • Model of time gives programmer precise control • Concurrency convenient for specifying control systems • Completely deterministic • Guaranteed: no need for locks, semaphores, etc. • Finite-state language • Easy to analyze • Execution time predictable • Much easier to verify formally • Amenable to implementation in both hardware and software
Esterel: When Control is Essential • Finite-state nature of the language limits flexibility • No dynamic memory allocation • No dynamic creation of processes • Virtually nonexistent support for handling data • Really suited for simple decision-dominated controllers • Synchronous model of time can lead to over-specification • Semantic challenges • Avoiding causality violations often difficult • Difficult to compile • Limited number of users, tools, etc.