1 / 30

Esterel Tutorial Winter 2004

Esterel Tutorial Winter 2004. University of Washington EE400/590 Bill Hippe Brigette Huang. Tutorial Outline. Introduction Circuit Modeling Interface Objects: Data ( type, constant, function, procedure, task) Signals & Sensors Variables Expressions Statements Demo. Introduction.

rcorbin
Download Presentation

Esterel Tutorial Winter 2004

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Esterel TutorialWinter 2004 University of Washington EE400/590 Bill Hippe Brigette Huang EE400/590 - Winter 2004

  2. Tutorial Outline • Introduction • Circuit Modeling • Interface Objects: • Data ( type, constant, function, procedure, task) • Signals & Sensors • Variables • Expressions • Statements • Demo EE400/590 - Winter 2004

  3. Introduction • What is Esterel?Esterel is both a programming language, dedicated to programming reactive systems, and a compiler which translates Esterel programs into finite-state machines. It is one of a family of synchronous languages, like SyncCharts, Lustre, Argos or Signal, which are particularly well-suited to programming reactive systems, including real-time systems and control automata. • What is SystemC?SystemC is a new Hardware modeling language based on C++. EE400/590 - Winter 2004

  4. What is the benefit of using Esterel? • System On Chip technology – Integration of both digital hardware and embedded software on a single chip create new challenges at all stages of the design process. • A single design environment (software algorithm and hardware-based constructs and concepts coexist) have the benefits of: • Reduce the error introduced in communication between 2 environments. • Simplify system design, alternation and verification process; increase design productivity. • Reduce time to market, SAVE COST. EE400/590 - Winter 2004

  5. Basic Procedure of Using Esterel • Download the following files • http://www-sop.inria.fr/meije/esterel/esterel-eng.htmlclick on Getting Esterel v5_21, to download the Esterel Compiler!! We will continue this when we get to DEMO…. EE400/590 - Winter 2004

  6. Modulemodule_name (port_list); Declarations: input, output, wire, parameter….. System Modeling: describe the system in gate-level, data-flow, or behavioral style… endmodule MODULE module_name : Interface Declarations input, output, signal, functions….. System Modeling describe the system in statements… endmodule Basic Syntax of a Module EE400/590 - Winter 2004

  7. Data objects, which are declared abstractly in Esterel. Their actual value is supposed to be given in the host language and linked to the Esterel compiled code in a way that depends on the compiler and target language. Signals and sensors, which are the primary objects the Esterel program deals with. Which host objects correspond to signal and sensors depends on the host language and code generation type. Declarations – Interface Objects EE400/590 - Winter 2004

  8. Data Objects • Types and Operators • Boolean, integer, float, double, and string, user defined type. • =,<>( for all types) • and, or, not( boolean) • +.-, *, /,<,<=,>,>= (integer, float, double) • Constants constant WatchBeep : Beep, AlarmBeep : Beep; constant WordLength = 16 : integer; • Functions function CombineBeeps (Beep, Beep) : Beep; function MakeRectangle (Coord, Coord) : Rectangle; • Procedures procedure IncrementTime (Time) (integer); procedure TranslateAndRotate (Rectangle) (Coord, integer); • Tasks task MoveRobotInsideRectangle (Coord) (Rectangle); EE400/590 - Winter 2004

  9. Signals and Sensors • Signals and sensors are the logical objects received and emitted by the program or used for internal bookkeeping. • Signals are instantaneously broadcast throughout the program, which implies that all statements see each of them in a consistent way. • Pure signals have a presence status, present or absent. • Valued signals carry status anda value of arbitrary type. • For single valued signals, only one statement can emit the signal in an instant. For combined valued signals, multiple emitters are allowed. • Sensors have a value but no status. EE400/590 - Winter 2004

  10. Signals and Sensors • Interface Signal Declarations • input, output, inputoutput, or return. • Single and Combined Valued Signals • Example: input UL, UR, LL, LR; % the four watch buttons input S, HS; % second and 1/100 second output CurrentTime := Noon : Time; output Beeper : combine Beep with CombineBeeps; output YesVotes := 0 : combine integer with +; return RobotInRectangle; inputoutput BusRequest; EE400/590 - Winter 2004

  11. Signals and Sensors • Sensors • Sensors are valued input signalswithout presence information. A sensor is declared by giving its name and type: sensor Temperature : integer; • Input Relations • Input relations declare some Boolean condition about input or return signals that are assumed to be guaranteed by the environment. relation UL # UR # LL # LR; % incompatibility relation S => HS; % implication EE400/590 - Winter 2004

  12. Signals and Sensors • Local Signal Declaration • A local signal declaration is performed by the following construct: signal Alarm, Distance : integer, Beep := OneBeep : combine Beep with CombineBeeps in p end signal EE400/590 - Winter 2004

  13. Variables • Variables are assignable objects that have a name and a type. Variables are declared by the local variable declaration construct, which has the form: var X : double, Count := ? Distance : integer, Deadline : Time in p end var • Unlike a signal, a variable can take several successive values in the same instant. X := 0; emit S1(X); X:= X+1; emit S2(X) EE400/590 - Winter 2004

  14. Expressions • Data expressions • Data expressions are built as usual by combining basic objects using operators and function calls. Their evaluation is instantaneous. All expressions must type-check. X * WordLength FloatToInteger(?Temperature) * (??ExitCode + 5) • Signal expressions • Signal expressions are Boolean expressions over signal statuses. • Binding conventions: not>and>or Meter and not Second Bit1 and Bit2 and not (Bit3 or Bit4) EE400/590 - Winter 2004

  15. Expressions • Delay expressions • Delay expressions are used in temporal statements such as await or abort. Meter and not Second %standard elapses in the next instant in which a meter occurs without a simultaneous second. immediate [Meter and not Second] %immediate elapses instantaneously if a meter and no second are present when the delay is initiated 3 [Second and not Meter] %count EE400/590 - Winter 2004

  16. Statements • Basic Control Statements nothing, pause, halt • The nothing statement terminates instantaneously when started. • The pause statement pauses for one instant. More precisely, it pauses when started, and it terminates in the next instant. • The halt statement pauses forever and never terminates. EE400/590 - Winter 2004

  17. Statements • Assignment and Procedure Call X := e • where X is a variable and e is a data expression. The variable and expression must have the same type. Assignments are instantaneous. call P (X, Y) (e1, e2) • X and Y are variables and the ei are expressions. The types must match those of the declaration. The variables are modified by the call. The call is instantaneous. EE400/590 - Winter 2004

  18. Statements • Signal Emission emit S emit S(e) • For a pure signal S, the emit statement simply emits S and terminates instantaneously. • For a valued signal, the emit S(e) statement evaluates the data expression e, emits S with that value, and terminates instantaneously. EE400/590 - Winter 2004

  19. Statements • Sequencing p ; q • Looping loop p end loop • The body p is instantaneously restarted afresh upon termination, this forever. • If p exits some enclosing traps, the exits are propagated instantaneously and the loop stops. This is the only way to exit a loop from inside. EE400/590 - Winter 2004

  20. Statements • Repeat loop repeat e times p end repeat • A repeat loop executes its body for a finite number of times. • The expression e must be of type integer. EE400/590 - Winter 2004

  21. Statements • The present signal test • present S then p else q end present • present case Meter do Distance := Distance+1; emit Distance(Distance) case Second do emit Speed(Distance) end present EE400/590 - Winter 2004

  22. Statements • If statement • if X>=0 then p else q end if • if X=Y and Y<>?Z then p end • if ?Flag else q end • if X > 5 then p elsif X > 3 then q else r end if EE400/590 - Winter 2004

  23. Statements • The await statement • await 2 Second • await immediate Second • await 2 Second do emit Beep end await EE400/590 - Winter 2004

  24. Statements • The abort statements • An abortion statement kill its body when a delay elapses. abort % or weak abort p when 3 Meter do q end abort EE400/590 - Winter 2004

  25. Statements • Temporal Loops • Temporal loops are loops over strong abortion statements. Example1: loop p each d Example3: every 3 Second do p end every Example3II: await 3 Second; loop p each 3 Second Example2: every d do p end EE400/590 - Winter 2004

  26. Statements • The suspend statement suspend abort sustain O when J when I • emits O in the first instant and in all subsequent instants where I is absent. • until the first instant where I is absent and J present. Then the suspend statement terminates and O is not emitted. EE400/590 - Winter 2004

  27. Statements • The Parallel statement • The parallel operator puts statements in synchronous parallel. • the sequencing operator ‘;’ binds tighter than the parallel operator ‘||’. • p; q || r means [ p; q ] || r • p; [ q || r ] where the brackets are mandatory. EE400/590 - Winter 2004

  28. Run a Module module ABCRO: input A, B, C, R; output O; signal AB in run ABRO [ signal AB / O] || run ABRO [ signal AB / A, C / B] end signal end module module M : input I; emit I end module module N : output I; run M end module module ABRO: input A, B, R; output O; loop [ await A || await B ]; emit O each R end module EE400/590 - Winter 2004

  29. DEMO… EE400/590 - Winter 2004

  30. References • The Esterel v5 Language Primer, Version 5.21 release 2.0, G´erard Berry, ftp://ftp-sop.inria.fr/meije/esterel/papers/primer.pdf EE400/590 - Winter 2004

More Related