abstraction of clocks in synchronous data flow systems
play

Abstraction of Clocks in Synchronous Data-flow Systems A. Cohen 1 L. - PowerPoint PPT Presentation

Abstraction of Clocks in Synchronous Data-flow Systems A. Cohen 1 L. Mandel 2 F. Plateau 2 M. Pouzet 23 (1) INRIA Saclay - Ile-de-France, Orsay, France (2) LRI, Univ. Paris-Sud 11, Orsay, France and INRIA Saclay (3) Institut Universitaire de


  1. Abstraction of Clocks in Synchronous Data-flow Systems A. Cohen 1 L. Mandel 2 F. Plateau 2 M. Pouzet 23 (1) INRIA Saclay - Ile-de-France, Orsay, France (2) LRI, Univ. Paris-Sud 11, Orsay, France and INRIA Saclay (3) Institut Universitaire de France Synchron Workshop - 2 December 2008

  2. N-Synchronous Model: A Relaxed Notion of Synchrony h b h a A B ◮ 0-synchronous : no buffers ( h a = h b ). For instance ( 1010 ) � = ( 0110 ). ◮ n-synchronous : buffer of size n ( h a < : h b ). For instance ( 1010 ) < : ( 0110 ) Interest: more flexible, as much guaranties as in synchronous model.

  3. N-Synchronous Model: picture in picture example vf = (1 720 0 720 1 720 0 720 0 720 1 720 0 720 0 720 1 720 ) hf = (10100100) reorder = 0 3600 (1) 0"1&2/()+# α on hf on reorder on vf β 1 β 1 on hf β 2 β 2 on reorder β 3 β 3 on vf α !"#$%"&'() .+#'$/() ,+"#-+# *)'+# *)'+# incrust α 3 on incrust α 1 α 1 on hf on reorder on vf 0"1&2/()+# α 3 4+#5+ α 3 on not incrust α 2 on not incrust α 2 13+& not incrust ◮ Previous work: subtyping relation can be checked provided clocks are periodic. ◮ Motivations: 1. dealing with long patterns in periodic clocks 2. modelizing jitter How to deal with “almost periodic” clocks ? For instance α on w with w = 00 . ( ( 10 ) + ( 01 ) ) ω (e.g. w = 00 01 10 01 01 10 01 10 . . . )

  4. Clocks as Infinite Binary Words 13 O w 1 Number of ones 12 11 O w 2 w ::= 0 . w | 1 . w 10 9 8 7 Notations: 6 5 | w 1 [1 .. 8] | 1 w [ i ] : element at index i O w 3 4 [ w ] j : position of the j th 1 3 2 O w ( i ): number of 1 s seen 1 0 in w until index i . 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 Instants [ w 1 ] 6 w 1 buffer size ( w 1 , w 2 ) = max i ∈ N ( O w 1 ( i ) − O w 2 ( i )) def precedence w 1 � w 2 ⇔ ∀ i , O w 1 ( i ) ≥ O w 2 ( i ) def synchronizability w 1 ⊲ ⊳ w 2 ⇔ ∃ b 1 , b 2 ∈ Z , ∀ i , b 1 ≤ O w 1 ( i ) − O w 2 ( i ) ≤ b 2 def subtyping w 1 < : w 2 ⇔ ( w 1 � w 2 ) / ( w 2 � w 2 ) composed clocks c ::= w | not w | c on c

  5. Abstraction of Infinite Binary Words [SYNCHRON’07, APLAS’08] : abs ( w ) = [ d , D ] ( T ) concr ([ d , D ] ( T )) def ⇔ { w , ∀ j ≥ 0 , T × j + d ≤ [ w ] j +1 ≤ T × j + D } a 1 { 7 Number of ones f w 1 f w 2 } a 2 6 5 4 3 2 1 0 0 1 2 3 4 5 6 7 8 9 10 11 12 Instants [ w 2 ] 5 d = 5 T = 5 3 3 w 2 D = 9 T = 5 3 3

  6. Drawbacks ◮ sets of 1 s in prefix are badly abstracted. 14 Number of ones 13 f not w 4 12 11 10 9 8 7 6 f w 4 5 4 3 2 1 0 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 Instants ⇒ a ⊆ not ∼ not ∼ a . ◮ words with finite number number of 1 s cannot be abstracted. ⇒ not ∼ can not be applied to 000(1).

  7. New Abstraction [JFLA’09] : �� def �� b 0 , b 1 , r concr ⇔ � O w ( i − 1) < r × i + b 1 � w [ i ] = 1 ⇒ w , ∀ i ≥ 1 , ∧ w [ i ] = 0 ⇒ O w ( i − 1) ≥ r × i + b 0 7 Number of ones O w 1 6 O w 2 5 4 3 2 1 0 0 1 2 3 4 5 6 7 8 9 10 11 12 Instants

  8. ◮ Initial sets of 1 s are well abstracted. 14 Number of ones 13 O w 4 12 11 10 9 8 7 6 5 4 3 2 1 0 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 Instants

  9. ◮ Clocks with a nul rate can be abstracted. 9 Number of ones 8 7 O w 5 6 5 4 3 2 1 0 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 Instants

  10. Abstract Clocks as Automata 0 6 , 2 7 , 2 1 1 0 4 , 1 5 , 1 1 1 0 0 0 0 0 0 1 , 0 2 , 0 3 , 0 4 , 0 1 1 , 0 2 , 0 3 , 0 4 , 0 1 1 − 9 5 , − 7 5 , 3 − 3 2 , − 2 2 , 1 � � � � a 2 = a 4 = 5 2 A a = � Q , Σ , δ, q o � with: ◮ The set of states Q = { ( i , j ) ∈ N 2 } : coordinates in the 2D-chronograms. Finite number of state equivalence classes. ◮ The initial state q o is (0 , 0) ◮ The alphabet Σ is { 0 , 1 } ◮ The transition function δ is defined by: nf ( i + 1 , j + 1) if O w ( i − 1) < r × i + b 1 δ ( 1 , ( i , j )) = nf ( i + 1 , j ) if O w ( i − 1) ≥ r × i + b 0 δ ( 0 , ( i , j )) = It is undefined otherwise.

  11. Checking Clocks are in an Abstraction type rat = { num: int; den: int; } (* "+:", "<:" ... are operations over rat *) let norm { num = n; den = l; } i j = if i >= l && j >= n then (i - l, j - n) else (i, j) let node check (b0, b1, r) clk = ok where rec i, j = (1,0) fby norm r (i+1) (if clk then j + 1 else j) and ok = if clk then (rat_of_int j) <: r *: (rat_of_int i) +: b1 else (rat_of_int j) >=: r *: (rat_of_int i) +: b0

  12. Generating Clocks in an Abstraction let node generate choice (b0, b1, r) = clk where rec i, j = (1,0) fby norm r (i+1) (if clk then j + 1 else j) and one = (rat_of_int j) <: (r *: (rat_of_int i) +: b1) and zero = (rat_of_int j) >=: (r *: (rat_of_int i) +: b0) and clk = choice one zero let node early a = generate (fun x y -> x) a let node late a = generate (fun x y -> not y) a

  13. Generating Clocks in an Abstraction with Lustre Compiler (Pascal Raymond) node generate(x : bool) returns (clk: bool); let -- we simply copy the input on the output clk = x ; -- but we enforce the correctness of x assert check(-9, -7, 3, 5, x) ; tel node early() returns (clk: bool); let clk = generate(true); tel node late() returns (clk: bool); let clk = generate(false); tel

  14. 1/1 1/1 1/1 1/1 1/1 1/1 1/1 1/1 1/1 1/1 1/1 1/1 1/1 1/1 1/1 1/1 1/1 0/0 0/0 0/0 0/0 0/0 0/0 0/0 0/0 0/0 0/0 0/0 0/0 0/0 0/0 0/0 0/0 0/0 ~/1 ~/1 ~/1 ~/1 ~/1 ~/1 ~/1 ~/1 ~/1 ~/1 ~/1 ~/1 ~/1 ~/1 ~/1 ~/1 ~/1 ~/0 ~/0 ~/0 ~/0 ~/0 ~/0 ~/0 ~/0 ~/0 ~/0 ~/0 ~/0 ~/0 ~/0 ~/0 ~/0 ~/0 1/1 1/1 1/1 1/1 1/1 1/1 1/1 1/1 1/1 1/1 1/1 1/1 1/1 1/1 1/1 1/1 1/1 ~/1 ~/1 ~/1 ~/1 ~/1 ~/1 ~/1 ~/1 ~/1 ~/1 ~/1 ~/1 ~/1 ~/1 ~/1 ~/1 ~/1 ~/0 ~/0 ~/0 ~/0 ~/0 ~/0 ~/0 ~/0 ~/0 ~/0 0/0 0/0 0/0 0/0 0/0 ~/0 ~/0 ~/0 ~/0 ~/0 ~/0 ~/0 ~/0 ~/0 ~/0 0/0 0/0 0/0 0/0 0/0 ~/0 ~/0 ~/0 ~/0 ~/0 ~/0 ~/0 ~/0 ~/0 ~/0 ~/0 ~/0 ~/0 ~/0 0/0 0/0 0/0 0/0 0/0 0/0 0/0 ~/1 ~/1 ~/1 ~/1 ~/1 ~/1 ~/1 ~/1 ~/1 ~/1 ~/1 ~/1 ~/1 ~/1 ~/1 ~/1 ~/1

  15. Abstract Operators: ◮ abstract not operator: − b 1 − ε, − b 0 − ε, 1 − r b 0 , b 1 , r not ∼ �� �� � � = b 0 = k 0 b 1 = k 1 with r = n ε = l − 1 l , l , l , l Property: a = not ∼ not ∼ a ◮ abstract on operator: � b 0 1 , b 1 1 , r 1 � on ∼ � b 0 2 , b 1 2 , r 2 � � b 0 12 , b 1 12 , r 12 � = with: r 12 = r 1 × r 2 , b 0 12 = b 0 1 × r 2 + b 0 2 , b 1 12 = b 1 1 × r 2 + b 1 2 + ε .

  16. Abstraction of a composed clock ◮ abs ( c ) def not ∼ abs ( w ) abs ( not w ) ⇔ def abs ( c 1 ) on ∼ abs ( c 2 ) abs ( c 1 on c 2 ) ⇔ Proposition: c ∈ concr ( abs ( c ))

  17. Abstract Relations ◮ synchronizability: � b 0 1 , b 1 1 , r 1 � ⊳ ∼ � b 0 2 , b 1 2 , r 2 � ⊲ ⇔ r 1 = r 2 ⊳ ∼ abs ( c 2 ) ⇔ c 1 ⊲ Proposition: abs ( c 1 ) ⊲ ⊳ c 2 ◮ precedence: b 0 1 ≥ b 1 2 ⇒ a 1 � ∼ a 2 Proposition: abs ( c 1 ) � ∼ abs ( c 2 ) ⇒ c 1 � c 2 ◮ subtyping: a 1 < : ∼ a 2 ⇔ ( a 1 ⊲ ⊳ ∼ a 2 ) ∧ ( a 1 � ∼ a 2 ) ⇒ can be checked in constant time.

  18. Proofs in Coq �� def �� b 0 , b 1 , r concr ⇔ � O w ( i − 1) < r × i + b 1 � w [ i ] = 1 ⇒ w , ∀ i ≥ 1 , O w ( i − 1) ≥ r × i + b 0 ∧ w [ i ] = 0 ⇒ Definition in_abstractionj (w: ibw) (a:abstractionj) := forall i: nat, forall H_i_ge_1: (i >= 1)%nat, (w i = true -> ones w (pred i) < absj_r a * i + absj_b1 a) /\ (w i = false -> ones w (pred i) >= absj_r a * i + absj_b0 a).

  19. Proofs in Coq For instance, on ∼ correctness: Property on_correctness: forall (w1:ibw) (w2:ibw), forall H_wf_w1: well_formed_ibw w1, forall H_wf_w2: well_formed_ibw w2, forall (a1:abstractionj) (a2:abstractionj), forall H_wf_a1: well_formed_abstractionj a1, forall H_wf_a2: well_formed_abstractionj a2, forall (H_a1_eq_absj_w1: in_abstractionj w1 a1), forall (H_a2_eq_absj_w2: in_abstractionj w2 a2), in_abstractionj (on w1 w2) (on_absj a1 a2).

  20. Other Applications - Modelizing Execution Time 7 Number of ones 6 5 4 3 2 1 0 0 1 2 3 4 5 6 7 8 9 10 11 12 Instants 0 , 0 , 1 − 3 2 , − 1 2 , 1 f :: ∀ α.α on ∼ � � → α on ∼ � � 2 2 Composed twice: 0 , 0 , 1 − 6 2 , − 2 2 , 1 f o f :: ∀ α.α on ∼ � � → α on ∼ � � 2 2

  21. Other Applications Modelizing Several Reads (or writes) at the Same Instant 14 Number of ones 13 12 11 10 9 8 7 6 5 4 3 2 1 0 0 1 2 3 4 5 6 7 8 9 10 11 12 Instants

Recommend


More recommend