Oversampling in a Dataflow Synchronous Language (Heptagon) 2011-12-13 Oversampling in a Dataflow Synchronous Language (Heptagon) erard 1 L´ eonard G´ 1 PARKAS team ENS Synchron’11 Oversampling in a Dataflow Synchronous Language (Heptagon) erard 1 L´ eonard G´ 1 PARKAS team ENS Synchron’11 1 / 19
Heptagon Oversampling in a Dataflow Synchronous Language (Heptagon) A small Scade v6 Heptagon ◮ Automaton 2011-12-13 ◮ Arrays and iterators ◮ Modular reset ◮ Static parameters Novelties A small Scade v6 Heptagon ◮ Memory optimization for arrays ◮ Controller synthesis ◮ and WIP ◮ asynchronous computations ◮ Automaton ◮ oversampling ◮ lucy-n generation ◮ ... Soon to be released as open source... ◮ Arrays and iterators ◮ Modular reset ◮ Static parameters Novelties ◮ Memory optimization for arrays ◮ Controller synthesis ◮ and WIP ◮ asynchronous computations ◮ oversampling ◮ lucy-n generation ◮ ... Soon to be released as open source... 2 / 19
Classic oversampling example Oversampling in a Dataflow Synchronous Language (Heptagon) node f(x :int) returns (cpt , y :int) Classic oversampling example let 2011-12-13 y = x + 1 cpt = (0 fby cpt) + 1 tel node g(x :int; c :bool) returns (out :int) var t, cpt , y, last_y :int; node f(x :int) returns (cpt , y :int) let Classic oversampling example (cpt , y) = f(t); t = merge c x (last_y whenot c); last_y = 0 fby y; let out = y whenot c; tel node main () returns (out :int; c :bool) var x :int; y = x + 1 let x = 0 fby (x+10); c = true fby false fby c; out = g(x,c); cpt = (0 fby cpt) + 1 tel tel node g(x :int; c :bool) returns (out :int) var t, cpt , y, last_y :int; let (cpt , y) = f(t); t = merge c x (last_y whenot c); last_y = 0 fby y; out = y whenot c; tel node main () returns (out :int; c :bool) var x :int; let x = 0 fby (x+10); c = true fby false fby c; out = g(x,c); 3 / 19 tel
Classic oversampling example Oversampling in a Dataflow Synchronous Language (Heptagon) node g(x :int; c :bool) returns (out :int) Classic oversampling example var t, cpt , y, last_y :int; 2011-12-13 let (cpt , y) = f(t); t = merge c x (last_y whenot c); last_y = 0 fby y; out = y whenot c; tel node g(x :int; c :bool) returns (out :int) Classic oversampling example val g:: (. on c, c : .) -> . on not c c true false true false true . . . var t, cpt , y, last_y :int; x x 0 x 1 x 2 . . . t x 0 f ( x 0 ) x 1 f ( x 1 ) x 2 . . . f 2 ( x 0 ) f 2 ( x 1 ) y f ( x 0 ) f ( x 1 ) f ( x 2 ) . . . cpt 1 2 3 4 5 let . . . f 2 ( x 0 ) f 2 ( x 1 ) out . . . (cpt , y) = f(t); Oversampling with clock given as argument. t = merge c x (last_y whenot c); last_y = 0 fby y; out = y whenot c; tel val g:: (. on c, c : .) -> . on not c c true false true false true . . . x x 0 x 1 x 2 . . . t x 0 f ( x 0 ) x 1 f ( x 1 ) x 2 . . . f 2 ( x 0 ) f 2 ( x 1 ) y f ( x 0 ) f ( x 1 ) f ( x 2 ) . . . cpt 1 2 3 4 5 . . . f 2 ( x 0 ) f 2 ( x 1 ) out . . . 4 / 19
Why hiding the oversampling clock? Oversampling in a Dataflow Synchronous Language (Heptagon) ◮ It is strange to define the clock outside of g . Why hiding the oversampling clock? 2011-12-13 ◮ The node g communicate at each of its steps, even if no value for x and out is meaningful. ◮ From the outside, the clocks of x and out are needlessly complex. We would like Why hiding the oversampling clock? ◮ It is strange to define the clock outside of g . val g:: . -> . x x 0 x 1 x 2 . . . c [ true false ] [ true false ] [ true false ] . . . t [ x 0 f ( x 0 )] [ x 1 f ( x 1 )] [ x 2 f ( x 2 )] . . . ◮ The node g communicate at each of its steps, cpt [1 2] [3 4] [5 6] . . . f 2 ( x 0 )] f 2 ( x 1 )] y [ f ( x 0 ) [ f ( x 1 ) [ f ( x 2 ) f ( f ( x 2 ))] . . . out f 2 ( x 0 ) f 2 ( x 1 ) f 2 ( x 2 ) . . . even if no value for x and out is meaningful. ◮ From the outside, the clocks of x and out are needlessly complex. We would like val g:: . -> . x x 0 x 1 x 2 . . . c [ true false ] [ true false ] [ true false ] . . . t [ x 0 f ( x 0 )] [ x 1 f ( x 1 )] [ x 2 f ( x 2 )] . . . cpt [1 2] [3 4] [5 6] . . . f 2 ( x 0 )] f 2 ( x 1 )] y [ f ( x 0 ) [ f ( x 1 ) [ f ( x 2 ) f ( f ( x 2 ))] . . . f 2 ( x 0 ) f 2 ( x 1 ) f 2 ( x 2 ) out . . . 5 / 19
Local Hiding of Oversampling in Heptagon Oversampling in a Dataflow Synchronous Language (Heptagon) Local Hiding of Oversampling in Heptagon Any node which would be given the usually illegal signature 2011-12-13 val n:: . on c -> . on c is transformed into a node with signature val n:: . -> . with a simple transformation in the generated sequential code: Local Hiding of Oversampling in Heptagon step_n(x) { Any node which would be given the usually illegal signature step_n(x) { [vars_n] [vars_n] do { [code_n] = [code_n] ⇒ return y; } while (!c); } return y; } val n:: . on c -> . on c is transformed into a node with signature val n:: . -> . with a simple transformation in the generated sequential code: step_n(x) { step_n(x) { [vars_n] [vars_n] do { = [code_n] [code_n] ⇒ return y; } while (!c); } return y; } 6 / 19
Local Hiding of Oversampling in Heptagon (bis) Oversampling in a Dataflow Synchronous Language (Heptagon) Local Hiding of Oversampling in Heptagon (bis) val n:: (c : . on e on d, . on e on d on c) 2011-12-13 -> . on e on d on c is transformed into a node with signature val n:: ( c : . , . on c) -> . on c step_n(x) { Local Hiding of Oversampling in Heptagon (bis) step_n(c,x) { [vars_n] [vars_n] do { val n:: (c : . on e on d, . on e on d on c) [code_n] = [code_n] ⇒ return y; } while (!(d && e)); } return y; } -> . on e on d on c PS: The common root of the clocks of the signature is the local oversampling. Here . on e on d . is transformed into a node with signature val n:: ( c : . , . on c) -> . on c step_n(x) { step_n(c,x) { [vars_n] [vars_n] do { = [code_n] [code_n] ⇒ return y; } while (!(d && e)); } return y; } PS: The common root of the clocks of the signature is the local oversampling. Here . on e on d . 7 / 19
First attempt to use LHO, before LHO transformation Oversampling in a Dataflow Synchronous Language (Heptagon) node g(x :int) returns (out :int) First attempt to use LHO, before LHO transformation var c :bool; t, cpt , y, last_y :int; 2011-12-13 let c = true fby false fby c; (cpt , y) = f(t); t = merge c x (last_y whenot c); last_y = 0 fby y; out = y when c; tel First attempt to use LHO, before LHO transformation val g:: . on c -> . on c node g(x :int) returns (out :int) c true false true false true . . . x x 0 x 1 x 2 . . . t x 0 f ( x 0 ) x 1 f ( x 1 ) x 2 var c :bool; t, cpt , y, last_y :int; . . . y f ( x 0 ) f 2 ( x 0 ) f ( x 1 ) f 2 ( x 1 ) f ( x 2 ) . . . cpt 1 2 3 4 5 . . . out f ( x 0 ) f ( x 1 ) f ( x 2 ) . . . let c = true fby false fby c; We are asked to give the same sampling to the input and the output. So (cpt , y) = f(t); naively we do so. t = merge c x (last_y whenot c); last_y = 0 fby y; out = y when c; tel val g:: . on c -> . on c c true false true false true . . . x x 0 x 1 x 2 . . . t x 0 f ( x 0 ) x 1 f ( x 1 ) x 2 . . . f 2 ( x 0 ) f 2 ( x 1 ) y f ( x 0 ) f ( x 1 ) f ( x 2 ) . . . cpt 1 2 3 4 5 . . . out f ( x 0 ) f ( x 1 ) f ( x 2 ) . . . 8 / 19
First attempt to use LHO, LHO done Oversampling in a Dataflow Synchronous Language (Heptagon) node g(x :int) returns (out :int) First attempt to use LHO, LHO done var c :bool; t, cpt , y, last_y :int; 2011-12-13 let c = true fby false fby c; (cpt , y) = f(t); t = merge c x (last_y whenot c); last_y = 0 fby y; out = y when c; tel First attempt to use LHO, LHO done val g:: . -> . node g(x :int) returns (out :int) c [ true ] [ false true ] [ false true ] [ . . . x [ x 0 ] [ x 1 ] [ x 2 ] [ . . . t [ x 0 ] [ f ( x 0 ) x 1 ] [ f ( x 1 ) x 2 ] [ . . . var c :bool; t, cpt , y, last_y :int; y [ f ( x 0 ) ] [ f 2 ( x 0 ) f ( x 1 ) ] [ f 2 ( x 1 ) f ( x 2 ) ] [ . . . cpt [ 1 ] [ 2 3 ] [ 4 5 ] [ . . . out [ f ( x 0 ) ] [ f ( x 1 ) ] [ f ( x 2 ) ] [ . . . let c = true fby false fby c; • The square brackets are used to display the oversampling : from the (cpt , y) = f(t); outside of the node, the signature hide the inner steps of these t = merge c x (last_y whenot c); brackets. last_y = 0 fby y; out = y when c; • Nothing new, to be able to do oversampling, we need to loose one tel instant. See the Lucid V3 manual page 24. val g:: . -> . c [ true ] [ false true ] [ false true ] [ . . . x [ x 0 ] [ x 1 ] [ x 2 ] [ . . . t [ x 0 ] [ f ( x 0 ) x 1 ] [ f ( x 1 ) x 2 ] [ . . . [ f ( x 0 ) ] [ f 2 ( x 0 ) f ( x 1 ) ] [ f 2 ( x 1 ) y f ( x 2 ) ] [ . . . cpt [ 1 ] [ 2 3 ] [ 4 5 ] [ . . . out [ f ( x 0 ) ] [ f ( x 1 ) ] [ f ( x 2 ) ] [ . . . 9 / 19
Recommend
More recommend