Presentation is loading. Please wait.

Presentation is loading. Please wait.

15 February 2007IASTED Software Engineering 2007, Innsbruck1 Embedded Functional Programming in Hume Gergely Patai Péter Hanák

Similar presentations


Presentation on theme: "15 February 2007IASTED Software Engineering 2007, Innsbruck1 Embedded Functional Programming in Hume Gergely Patai Péter Hanák"— Presentation transcript:

1 15 February 2007IASTED Software Engineering 2007, Innsbruck1 Embedded Functional Programming in Hume Gergely Patai Péter Hanák Budapest University of Technology and Economics Department of Control Engineering and Information Technology

2 15 February 2007IASTED Software Engineering 2007, Innsbruck2 Outline  Introducing Hume  Example: lift control  Example: light measurement  Conclusions The Hume language is developed at University of St Andrews and Heriot-Watt University in Scotland within the EmBounded Project (IST ).

3 15 February 2007IASTED Software Engineering 2007, Innsbruck3 Hume overview  An experimental functionally based language for embedded systems  Pure functions: no side effects  Inherently parallel  Visual program structure  Static space-time guarantees  Verifiable properties  Increased dependability  Viable on low-end platforms

4 15 February 2007IASTED Software Engineering 2007, Innsbruck4 Hume example: counter program stream display to "std_out"; type integer = int 32; inc x = x+1; box counter in (n::integer) out (n’::integer, nout::integer) match n -> (inc n, n); wire counter (counter.n’ initially 0) (counter.n, display); Counter display nn’ nout

5 15 February 2007IASTED Software Engineering 2007, Innsbruck5 Hume basics  Hume programs are ‘boxes’ connected with ‘wires’  Wires:  are mailboxes that can hold one piece of data at a time  each connects strictly one output to one input  statically typed  Boxes:  map their inputs to their outputs with a pure function (combinational network)  the function consists of rules, exactly one of which is chosen by pattern matching on the input  if some outgoing wires needed by the rule are occupied, the result is buffered until the wire is freed up by its consumer  Supersteps: global consume–produce cycles

6 15 February 2007IASTED Software Engineering 2007, Innsbruck6 Execution alternatives  Source-level interpreter  HAM (Hume Abstract Machine) interpreter  Hume → HAM assembly compilation  Optional transformation to bytecode  Native code  HAM → C conversion (macro expansion)  Compiled with a C compiler, linked to a lightweight runtime system (RTS)  No endianness issues, no malloc, no threads

7 15 February 2007IASTED Software Engineering 2007, Innsbruck7 Lift control  Task: single-shaft lift simulation  Hardware: mitmót  ARM7 54MHz (Philips LPC2106)  128k flash, 64k RAM  OS: eCos  User code: compiled to native code

8 15 February 2007IASTED Software Engineering 2007, Innsbruck8 Lift control software Requests state cache →user state’ cache’ C→ C← D→ D← Cabin Door state position →R ←R →D ←D state’ position’ ↑clk R↑ R↓ enabled state ↑C ↓C clk← enabled’ state’

9 15 February 2007IASTED Software Engineering 2007, Innsbruck9 Light measurement  Task: remote measurement  Hardware: Tmote Sky  MSP430 8MHz  48k flash, 10k RAM  OS: Contiki with HAM interpreter  Stripped string and floating point support  Peripherals accessed as streams  User code: HAM bytecode loadable over the air

10 15 February 2007IASTED Software Engineering 2007, Innsbruck10 Light measurement software Control Receiver UDP packetCommandAck/Light Speed controlPhoto diode Calibration (thresholds, speeds) State (init/alive/dead) ( Init, _*, _, *) -> (Alive, (200, 400, 50, 10), 50, *) | ( _, _*, _, Reset) -> ( Init, *, *, 0) | ( Dead, _*, _, _*) -> ( Dead, *, *, *) | (Alive, _*, _, Calibrate t1 t2 d1 d2) -> (Alive, (t1, t2, d1, d2), *, 1) | (Alive, (t1, t2, d1, d2), p, *) -> if p < t1 then (Alive, (t1, t2, d1, d2), d1, p) else if p < t2 then (Alive, (t1, t2, d1, d2), d2, p) else (Dead, *, *, *);

11 15 February 2007IASTED Software Engineering 2007, Innsbruck11 Experiences  Short source code  Easy portability  Big native code (experimental compiler)  No significant speed loss with bytecode  Sufficiently fast for simple tasks  Great potentials for a future IDE

12 15 February 2007IASTED Software Engineering 2007, Innsbruck12 Future work  Improving the Tmote Sky port of the interpreter  New resource-constrained applications on a variety of platforms  Developing and evaluating extensions and tools for the language  Further information:

13 15 February 2007IASTED Software Engineering 2007, Innsbruck13 Thank you for your attention!


Download ppt "15 February 2007IASTED Software Engineering 2007, Innsbruck1 Embedded Functional Programming in Hume Gergely Patai Péter Hanák"

Similar presentations


Ads by Google