synERJY An Object-oriented Synchronous Programming Language - - PowerPoint PPT Presentation

synerjy
SMART_READER_LITE
LIVE PREVIEW

synERJY An Object-oriented Synchronous Programming Language - - PowerPoint PPT Presentation

synERJY An Object-oriented Synchronous Programming Language Synchrony - Ten Years After Reinhard Budde Axel Poign Karl-Heinz Sylla Overview Highlights Reactive Components Synchronous Styles Hybrid Systems


slide-1
SLIDE 1

synERJY

An Object-oriented Synchronous Programming Language Synchrony - Ten Years After Reinhard Budde Axel Poigné Karl-Heinz Sylla

slide-2
SLIDE 2

page

Overview

  • Highlights
  • Reactive Components
  • Synchronous Styles
  • Hybrid Systems
  • Semantics
  • Programming Environment
  • Conclusions & Outlook
slide-3
SLIDE 3

page

Highlights

  • supports object-oriented design (using a Java-like language)
  • integrates synchronous styles
  • targets micro controllers
slide-4
SLIDE 4

page

Reactive Components

class Basic { static final time timing = 250msec; Sensor button = new Sensor(new SimInput()); Signal red_led = new Signal(new SimOutput()); public Basic () { active { loop { await ?button; emit red_led; next; }; }; }; public static void main (String[] args) { while (instant() == 0) {}; }; }

read only interface to environment

slide-5
SLIDE 5

page

Reactive Compents II System Environment

Signals

Signal bus

Components = Objects

slide-6
SLIDE 6

page

Synchronous Styles

  • Imperative (Esterel - like)
  • Data Flow (Lustre - like)
  • Hierarchical State Machines (Statecharts - like)
slide-7
SLIDE 7

page

Synchronous Styles: Imperative Style - Syntax

Types Sensor, Sensor< type > type = primitive, restricted reference Signal, Signal< type > DelayedSignal, DelayedSignal<type> time Statements emit s; , emit s(v); assignment; method_call; if reactive = module next; await expr; await time_expr; cancel { } when () else when … activate { } when (); loop { }; if ( ) { } else { }; [[ || || ]] parallel

slide-8
SLIDE 8

page

Synchronous Styles: Imperative Style - New Features

Time Races

[[... data-op1 ...||... data-op2 ...]]

Resolved using precedence

precedence { data-op1 < data-op2; };

Restricted to classes

(attributes and methods are private)

slide-9
SLIDE 9

page

New Features Continued

Multiple Emittance

no combinators [[... emit s(v1); ...||... emit s(v2); ...]];

Either avoid or use labels and precedence

[[... l1::emit s(v1); ...||... l2::emit s(v2); ...]]; precedence { l1:: < l2:: ; };

slide-10
SLIDE 10

page

Synchronous Styles: Data Flow

sustain {| x := pre(x) + 1; |};

flow context

  • handled like any other statement (can be preempted)
  • flow expressions with all the Lustre operator
  • clocks
slide-11
SLIDE 11

page

Interrupt: Concerning Java

¬ Dynamic Loading ¬ No packages (yet ?) ¬ Exception Handling only top level ¬ No Hiding (for good software) ¬ Only one- and two-dimensional arrays (for efficiency) ¬ Semicolon “;” is a must as terminator + more integer types: int8, unint8,…, uint64, int64 + native C (constants and functions) + Parametrised Types “List<T>” All compiled to C (HW formats)

slide-12
SLIDE 12

page

Hybrid Systems: Bouncing Ball

x1 = x2 x1 > 0 x2 = -g Change direction if x1 <= 0 x1 = x2 x2 = -g x1 <= 0 / x2 = -x2

slide-13
SLIDE 13

page

Bouncing Ball II

automaton { init { emit x1(height); emit x2(0.0); next state move; }; state move during {| x1 := pre(x1) + x2*dt; x2 := -c*pre(x2) -> pre(x2) - g *dt; |} when ($x1 <= 0.0) { next state move; }; };

change of direction

  • pre and -> are defined relative to flow context
slide-14
SLIDE 14

page

Semantics: Signals

  • all Signals have a clock
  • Signals are present if updated
  • Signals may be updated using
  • emit Statement
  • flow equation: then clocks are checked
  • Signals that are emitted are always on base clocks
  • Clocks are part of a Signal type: Signal{clock}<type>

(Signal<type> = Signal{true}<type>)

slide-15
SLIDE 15

page

Semantics: Translation Scheme (Model of 93/98)

α β τ ω κ “front” preemption termination control “beta” flow context µ synchronous automaton

(Semantic Domain)

s <= φ r <- φ if s { a; };

  • Semantics is “compositional”
  • Realisation as denotational

semantics in ocaml

slide-16
SLIDE 16

page

Translation Scheme Example

emit s(v1); f(v2); s <= α; a1 <= α; if (a1) { $s = v1; }; γ <= α | CC(a1) a2 <= γ; if (a2) { f(v2}; }; ω <= γ | CC(a2) a2 <= α; if (a2) { f(v2}; }; ω <= α | CC(a2); s <= α; a1 <= α; if (a1) { $s = v1; }; ω <= α | CC(a1);

slide-17
SLIDE 17

page

LEGO-Lib ATMEL-Lib F4-Lib CAN-Lib

Compiler

ANSII - C

HW-Formate Windows Linux

RT-Linux

ARM PIC CAN TTA

Mac OSX

synERJY light Simulink

DSP FPGA

. . .

Simulink

MPC555 ATMEL

synERJY Programming Environment

slide-18
SLIDE 18

page

Conclusions

  • Language is stable / compiler reasonably mature
  • Usage
  • Teaching
  • Robotics Applications
  • Project on smart materials
  • Experience is somewhat annoying
  • people use only one style (imperative / state-machines), and
  • encode their standard programming style
slide-19
SLIDE 19

page

Outlook

  • allow several reactive engines (several calls of instant)
  • Support for Digital Signal Processing
  • Generate Code for DSP (more long term: FPGA)
  • Optimisation of the compiler with regard to different targets
  • Minor Points: add functional nodes, improve simulator, ...