Presentation is loading. Please wait.

Presentation is loading. Please wait.

Esterel Overview Roberto Passerone ee249 discussion section.

Similar presentations


Presentation on theme: "Esterel Overview Roberto Passerone ee249 discussion section."— Presentation transcript:

1 Esterel Overview Roberto Passerone ee249 discussion section

2 June 15, 2015Esterel notes2 Classes of applications Transformational Interactive Reactive

3 June 15, 2015Esterel notes3 Model of Time Totally ordered sequence of instants Instants are also called ticks There is nothing in between instants

4 June 15, 2015Esterel notes4 Esterel Esterel is a reactive programming language Esterel is also a Synchronous language Everything proceeds in lock-step

5 June 15, 2015Esterel notes5 You might hear that... In Esterel computation takes zero time Communication also takes zero time In other words, reactions to events are instantaneous

6 June 15, 2015Esterel notes6 Model of Execution There is a set of events E We have a sequence of instants For each instant a subset of the events in E is present Hence the execution is a totally ordered sequence of events

7 June 15, 2015Esterel notes7 Model of a System The System implicitly represents the execution The System is a collection of processes executing concurrently Processes are placed in parallel using the parallel operator ||

8 June 15, 2015Esterel notes8 Interaction of Processes Processes interact by through signals that carry events Events in signals can be either Present or Absent Processes do NOT interact through shared variables

9 June 15, 2015Esterel notes9 Checking for presence Processes can test for the presence or absence of events in signals –present A then … else...

10 June 15, 2015Esterel notes10 Awaiting an event Processes can stop their execution until an event is present in a signal –await A; –await [ A or B ]

11 June 15, 2015Esterel notes11 Emitting an event Processes can emit an event to a signal to make it present –emit A –emit A, 10

12 June 15, 2015Esterel notes12 Execution of the System Input events are posted for the current instant The System reacts to the input event in the current instant The System posts the output events for the current instant Only at this point does the instant increment

13 June 15, 2015Esterel notes13 When things occur present tests the presence of signals in the current reaction await stops the execution for the current reaction, until at least the next instant emit emits the event during the current reaction

14 June 15, 2015Esterel notes14 Important There is no ordering of events within a reaction All events present during a reaction occur at the same exact time (instant) Hence when executing a present: –if the signal is present continue with the “then” –if absent, must wait until it either becomes present or can prove it will not be emitted during the current reaction

15 June 15, 2015Esterel notes15 Atomicity of reaction The triple (input, reaction, output) is executed atomically –Atomic means that others cannot observe the intermediate steps. It is not necessarily instantaneous –Intermediate steps are only necessary to compute the overall reaction –All goes as if the computation took zero time –There are micro-steps: they converge to a fixed point

16 June 15, 2015Esterel notes16 How to execute Start with the input events present Activate all processes awaiting a present event If events are emitted, activate processes that may be waiting If presence is tested, wait until you know the outcome Stop a process when it reaches an await

17 June 15, 2015Esterel notes17 Compiling Esterel The interpreter does the previous procedure –might have to look ahead The compiler computes the reaction for all possible patterns of events –it constructs a finite automaton –construction similar to the derivative construction

18 June 15, 2015Esterel notes18 Causality Problems A reaction ends when all processes arrive at an await What if you never hit one? –Loop – emit A; – X = X + 1; –end loop Same as combinational loops in hardware

19 June 15, 2015Esterel notes19 The fixed point may not exist There are no solutions –present X then nothing else emit X; There are too many solutions –present X then emit X end;

20 June 15, 2015Esterel notes20 Esterel supports exceptions Useful to jump out of a fragment of code Abort when an event occurs –abort – code –when A;

21 June 15, 2015Esterel notes21 Seat-belt If the driver turns on the key, and does not fasten the seat belt within 5 seconds then an alarm beeps for 5 seconds, or until the driver fastens the seat belt, or until the driver turns off the key If the driver turns on the key, and does not fasten the seat belt within 5 seconds then an alarm beeps for 5 seconds, or until the driver fastens the seat belt, or until the driver turns off the key present KEY_ON then input KEY_ON If the driver turns on the key, and does not fasten the seat belt within 5 seconds then an alarm beeps for 5 seconds, or until the driver fastens the seat belt, or until the driver turns off the key emit START_TIMER(5); await END_TIMER;, END_TIMER output START_ TIMER emit START_TIMER(5); abort sustain BEEP when END_TIMER; end abort when KEY_OFF or BELT_ON If the driver turns on the key, and does not fasten the seat belt within 5 seconds then an alarm beeps for 5 seconds, or until the driver fastens the seat belt, or until the driver turns off the key If the driver turns on the key, and does not fasten the seat belt within 5 seconds then an alarm beeps for 5 seconds, or until the driver fastens the seat belt, or until the driver turns off the key, KEY_OFF, BELT_ON, BEEP; loop each RESET, RESET;

22 June 15, 2015Esterel notes22 You can run examples Compile with -simul to run textual simulation Use xes for graphical debugging If we have time we can look at a simple example

23 June 15, 2015Esterel notes23 Immediate reactions Alternative formulation of await It doesn’t wait until the next reaction if the signal is present Often creates causality problems –loop – await immediate A – X = X + 1; –end loop


Download ppt "Esterel Overview Roberto Passerone ee249 discussion section."

Similar presentations


Ads by Google