embedded functional programming in hume n.
Download
Skip this Video
Loading SlideShow in 5 Seconds..
Embedded Functional Programming in Hume PowerPoint Presentation
Download Presentation
Embedded Functional Programming in Hume

Loading in 2 Seconds...

play fullscreen
1 / 13

Embedded Functional Programming in Hume - PowerPoint PPT Presentation


  • 115 Views
  • Uploaded on

Embedded Functional Programming in Hume. Gergely Patai patai@iit.bme.hu Péter Hanák hanak@iit.bme.hu Budapest University of Technology and Economics Department of Control Engineering and Information Technology. Outline. Introducing Hume Example: lift control Example: light measurement

loader
I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.
capcha
Download Presentation

PowerPoint Slideshow about 'Embedded Functional Programming in Hume' - glyn


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.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript
embedded functional programming in hume

Embedded Functional Programming in Hume

Gergely Patai

patai@iit.bme.hu

Péter Hanák

hanak@iit.bme.hu

Budapest University of Technology and Economics

Department of Control Engineering and Information Technology

IASTED Software Engineering 2007, Innsbruck

outline
Outline
  • Introducing Hume
  • Example: lift control
  • Example: light measurement
  • Conclusions

The Hume language is developed at University of St Andrewsand Heriot-Watt University in Scotlandwithin theEmBounded Project (IST-510255).http://www.hume-lang.orghttp://www.embounded.org

IASTED Software Engineering 2007, Innsbruck

hume overview
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

IASTED Software Engineering 2007, Innsbruck

hume example counter
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

n

n’

nout

display

IASTED Software Engineering 2007, Innsbruck

hume basics
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 patternmatching on the input
    • if some outgoing wires needed by the rule are occupied,theresult is buffered until the wire is freed up by its consumer
  • Supersteps: global consume–produce cycles

IASTED Software Engineering 2007, Innsbruck

execution alternatives
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

IASTED Software Engineering 2007, Innsbruck

lift control
Lift control
  • Task: single-shaft lift simulation
  • Hardware: mitmót
    • ARM7 (32-bit) @ 54MHz(Philips LPC2106)
    • 128k flash, 64k RAM
  • OS: eCos
  • User code: compiled to native code

IASTED Software Engineering 2007, Innsbruck

lift control software
Lift control software

state

cache

→user

state’

cache’

C→

C←

D→

D←

state

position

→R

←R

→D

←D

Requests

Cabin

state’

position’

↑clk

R↑ R↓

enabled

state

Door

↑C ↓C

clk←

enabled’

state’

IASTED Software Engineering 2007, Innsbruck

light measurement
Light measurement
  • Task: remote measurement
  • Hardware: Tmote Sky
    • MSP430 (16-bit) @ 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

IASTED Software Engineering 2007, Innsbruck

light measurement software
Light measurement software

State (init/alive/dead)

Calibration(thresholds, speeds)

Control

Photo diode

Speed control

UDP packet

Receiver

Command

Ack/Light

( 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, *, *, *);

IASTED Software Engineering 2007, Innsbruck

experiences
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

IASTED Software Engineering 2007, Innsbruck

future work
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: http://www.inf.bme.hu/fp4es

IASTED Software Engineering 2007, Innsbruck

thank you for your attention

Thank you for your attention!

IASTED Software Engineering 2007, Innsbruck