Playing with Time and Space in Circuits and Programs - PowerPoint PPT Presentation

ayame
playing with time and space in circuits and programs n.
Skip this Video
Loading SlideShow in 5 Seconds..
Playing with Time and Space in Circuits and Programs PowerPoint Presentation
Download Presentation
Playing with Time and Space in Circuits and Programs

play fullscreen
1 / 56
Download Presentation
Playing with Time and Space in Circuits and Programs
105 Views
Download Presentation

Playing with Time and Space in Circuits and Programs

- - - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript

  1. Playing with Time and Spacein Circuits and Programs Gérard Berry Collège de France Chaire Algorithmes, machines et langages PPS, 24/04/2013

  2. Agenda • 2-adic numbers and space / time exchange in synchronous circuits • Never determinize non-deterministic automata ! • Use hierarchical automata for another exponential gain in space and timing optimization G. Berry, PPS,

  3. Agenda • 2-adic numbers and space / time exchange in synchronous circuits • Never determinize non-deterministic automata ! • Use hierarchical automata for another exponential gain in space and timing optimization G. Berry, PPS,

  4. Source of the 2-adic Part J. Vuillemin. On circuits and numbers, IEEE Trans. on Computers, 43:8:868-79, 1994 G. Berry, PPS,

  5. 2-adic Numbers (Hensel, ~1900) • R is a completion de Q. Is it the only one ? • No : p-adic numbers for p prime • infinite numbers written low-order bits first • Beautiful, but physical ? cf. Matière à Pensée, p. 32 • Alain Connes / JP Changeux • Jean Vuillemin : 2-adiques integers are the right model • Jean Vuillemin : of arithmetic digital circuits • Jean Vuillemin : Let us create their physics! 2-adic numbers unify computable arithmetic with Boolean logic G. Berry, PPS,

  6. 2Z : the Ring of 2-adic Numbers x 2x0x1x2… low-order bits first operations  and  from left to right 0200000...  2(0) 1210000... 21(0) 2201000...  201(0) 1211111...  2(1) 2201111...  20(1) x 2101010...2(10) y 2010101... 2(01) x2100000...  2001010... y 2x or x y 1 x14x x 1/3 y 2/3 G. Berry, PPS,

  7. 2Z : the Ring of 2-adic Numbers p/q exists for all integer p, q iff q est odd (cf. Euclide) 1/2 does not exist because x0x0cannot have value 1 No order compatible with the operations 1  0  1 G. Berry, PPS,

  8. 2Z as a Boolean Algebra • 2-adic x seen as the set {i|xi1 } • example:1/3 2101010...  { i|ieven } • pointwise Boolean operations • x  yx  y  x • (x  y)n xnynetc. • Fundamental arithmetico-logical equality : 2100011... x  x  1 2011100... 2111111... G. Berry, PPS,

  9. Cantor Metric Space d(x,x) 0 d(x,y)  2nn minimal s.t. xnyn Example: d(201111..., 201101...  1/8) • Lemma :2Z isultrametric : • d(x,z) max(d(x,y),d(y,z)) x y  z d(x,z)  min(d(x,y),d(y,z)) G. Berry, PPS,

  10. Cantor Metric Space • Open set basis : finite prefixes • x0x1...xn  {2x0x1...xny0y1...yn...| y2Z} ex.: open set for 210010 1 1 0 0 0 • Compact – very different from reals ! G. Berry, PPS,

  11. Continuous functions Lemma :f: 2Z 2Z continuous iff f(x)ndepends on a finite number of xm 2x0x1......xm... 2y0y1...yn... Continuity  preservation of information finiteness G. Berry, PPS,

  12. Synchronous Functions f(x) x 0x0x1...xn... x0x1...xn... G. Berry, PPS,

  13. Synchronous and Contracting Functions f(x) x • Definition :f: 2Z 2Z synchronous iff computable by a synchronous circuit (with finite or infinite memory) • Theorem :f: 2Z 2Z is synchronous iff f(x)n only depends on x0x1...xn, i.e., iff f is contracting x,y. d(f(x),f(y)) d(x,y) Preuve : « only if » trivial, Preuve : for « if » see SDD construction later on G. Berry, PPS,

  14. Moore Circuits and Strict Contraction • A Moore synchronous circuit is such that any wire between an input and an output traverses a register Moore Circuit • A function f: 2Z 2Z is strictly contracting • iff f(x)n only depends on x0x1...xn1  x,y. d(f(x),f(y)) d(x,y) Theorem : a function is computable by a Moore circuit if and only if it is contracting G. Berry, PPS,

  15. Feedbacks in Moore Circuits are Legal Moore Circuit f(x) x G. Berry, PPS,

  16. Feedbacks in Moore Circuits are Legal Moore Circuit f(x)  x f(x) x,y. d(f(x),f(y)) d(x,y)  x,y. d(f(x),f(y)) 0,6 d(x,y) Lipschitz Banach theorem:any Lipschitzian function over a compact set has a unique fixpoint G. Berry, PPS,

  17. + + Full Adder s a xor a s b b r c c and r bits and or and s  axorbxorc r  (a and b) or (b and c) or (c and a) G. Berry, PPS,

  18. r r = 0 s + + 1 0 0 + + a b s r 2 1 1 1 a b r s 3 2 2 2 Addition in Space + a 0 + b s  ab but within infinite time! 0 continuity: cut at n bits for n output bits x2n x mod 2n s2n1 a2nb2n  G. Berry, PPS,

  19. + + Full Adder s a xor a s b b r c c and r bits and or abc  s2r and s  axorbxorc r  (a and b) or (b and c) or (c and a) G. Berry, PPS,

  20. + + Basic 2-adic Operators a s abc  s2r b r c 20x0x1...xn... 2x0x1...xn... 2x0x1...xn... x 12x x 2x 21x0x1...xn... G. Berry, PPS,

  21. s s Addition and Subtraction Over Time a a + + b b + + 2r r r 12r ab2r  s2r ab12r  s2r bb 1 s  ab b1 b same equation as over space! ab  s tick ! s  ab G. Berry, PPS,

  22. Mixed Space / Time Addition a  aeao x y 2x0y0x1y1... ao ae se so + + be bo re + + b  be bo s  se so tick ! s  ab 2ro ro still the same equation ! Same source code for any space / time tradeoff G. Berry, PPS,

  23. s Stereo Addition a + b + se so  (aebe)(ao bo) r stereo adder Alternates 2 additions over time (even / odd bits) stereo  left / right channels G. Berry, PPS,

  24. s s Addition and Subtraction Over Time a a + + b b + + a a   s s b b tick ! G. Berry, PPS,

  25. x 3x  x _ y  x/3 Multiplication and division by a constant proof : x2x  3x proof : yx2y division only by odd integers! G. Berry, PPS,

  26. Quasi-inverse y1/(12x) y2xy 1 y12xy ?  x y12xy1/(12x) contracting  synchronous but infinite memory (cf. SDD construction) G. Berry, PPS,

  27. x z y   Quasi Square Root y 18x ... but tells us nothing about bit transformations! y 14z y2 18z16z2 zx2z2 y2 18x16z216z2 G. Berry, PPS,

  28. Spatio-Temporal Decomposition of f Synchronous f0 first bit output by f for inputs 0... f1 ... 1... fw last bit output by f for the finite word w f00-predictor : f0w=f(w0) for any word w f11-predictor : f1w=f(w1) fuu-predictor : fuw=f(wu) for any words w,u G. Berry, PPS,

  29. x 3x + Automaton of x  3x 0/0 1/1 00 10 0/1 0/1 1/0 0/0 01 11 1/0 1/1 G. Berry, PPS,

  30. x 3x + Predictor0 of x  3x 0/0 0/0 0/ 1/1 1/ 1/1 00 00 10 10 0/1 0/ 0/0 0/1 0/0 0/ 1/0 1/ 1/0 0/0 0/1 0/ 01 11 01 11 1/0 1/0 1/ 1/1 1/ 1/0 G. Berry, PPS,

  31. x f1 1 f(x) 0 f0 SDD Decomposition Step f(x) = mux(x, f12f1(x), f02f0(x)) f1 f0 G. Berry, PPS,

  32. x f11 f11 1 x f10 f10 0 f1 1 f1 f(x) x f0 0 f0 f01 f01 1 f00 0 f00 SDD Space/Time Normal Form of f ... ... ... ... Truth-table in space and time ultra-fast : critical path  one mux Half of the bits disappear at each cycle G. Berry, PPS,

  33. x f11 f11 1 x f10 f10 0 1 f1 f1 f(x) x f0 0 f0 f01 f01 1 f00 0 f00 Shared SDD of f with Finite Memory ... ... ... ... f finite memory  finitely many distinct predictors fu n f with n registers  SDD(f) may have22registers G. Berry, PPS,

  34. From continuous functions to circuits • f continuous but not synchronous: • over space : trivial if infinite space • over time : expand the time • 2-adic number : < value, validity > • 0 0 1 0 1 1 0 1 1 1 0 0 ... • 0 1 1 0 0 1 1 0 0 1 1 0 ... • 0 1 1 0 1 Theorem : every continuous function can be realized by a synchronous circuit with validity G. Berry, PPS,

  35. Trace of a Synchronous Function Tr(f) 2f0f1f00f01 f10f11f000f001... f02f14(Tr(f0) ʘ Tr(f1 )) Application of a trace Tr(f) to an argument x is continuous  calculus ? Power series over Z/2Z : S(f) = nTr(f)nzn Theorem :f:2Z 2Zsynchronous has finite memory iff S(f) is algebraic over Z/2Z G. Berry, PPS,

  36. From Synchronous Traces to Transcendental Numbers Theorem (Van der Porten) : if f has finite memory, them the real number 0, f0f1f00f01 f10f11f000f001... is either rational or transcendantal Almost any finite automaton generates a transcendental number! Automatic Sequences: Theory, Applications, Generalizations Jean-Paul Allouche et Jeffrey Shallit Cambridge University Press (21 juillet 2003) G. Berry, PPS,

  37. Conclusion Thanks to Jean Vuillemin • 2-adic numbers are the good model of arithmetic synchronous circuits (only?) • the 2-adic metric, continuity, and synchronism are fundamental notions to explore further • The structure of the predictor space is largely unknown • The relation between continuous functions and validity-circuits remains to be studied (calculus?) G. Berry, PPS,

  38. Agenda • 2-adic numbers and space / time exchange in synchronous circuits • Never determinize non-deterministic automata ! • Use hierarchical automata for another exponential gain in space and timing optimization G. Berry, PPS,

  39. From Deterministic Automata to Circuits b b e0 e2 a a 1-hot encoding (only one ri to 1) size explosion! b b (ab+b)*ba e1 e3 r0 r2 b b b b r1 ok a a r3 G. Berry, PPS,

  40. The Non-Deterministic Case b s0 s1 s2 s3 • no size explosion • much better! b (ab+b)*ba a a b b b b ok a a G. Berry, PPS,

  41. Electrical Subset Construction b s0 s3 s2 s1 b (ab+b)*ba a a b a b b b ok a a G. Berry, PPS,

  42. Electrical Subset Construction b s0 s1 s2 s3 tick! b (ab+b)*ba a a b a b b b ok a a G. Berry, PPS,

  43. Electrical Subset Construction b s0 s1 s2 s3 b (ab+b)*ba a a b ab b b b ok a a G. Berry, PPS,

  44. Electrical Subset Construction b s0 s1 s2 s3 tick! b (ab+b)*ba a a b ab b b b ok a a G. Berry, PPS,

  45. Electrical Subset Construction b s0 s1 s2 s3 b (ab+b)*ba a a b abb b b b ok a a G. Berry, PPS,

  46. Electrical Subset Construction b s0 s1 s2 s3 tick! b a a b abb b b b ok a a G. Berry, PPS,

  47. Electrical Subset Construction b s0 s1 s2 s3 b (ab+b)*ba a a b abba b b b ok a a G. Berry, PPS,

  48. Electrical Subset Construction b s0 s1 s2 s3 tick! b (ab+b)*ba a a b abba b b b ok a a G. Berry, PPS,

  49. Esterel v7 implementation b module Autom : input a, b; output ok; local{r0, r1, r2, r3} : reg; refine r0 : init true; sustain { next r0 <= (r0 or r1) and b, next r1 <= r0 and a, next r2 <= r0 and b, next r3 <= r2 and a, ok<= next r3 } end module s0 s1 s2 s3 b a a b Compiled into C, C++, VHDL, Verilog, etc. G. Berry, PPS,

  50. Agenda • 2-adic numbers and space / time exchange in synchronous circuits • Never determinize non-deterministic automata ! • Use hierarchical automata for another exponential gain in space and timing optimization G. Berry, PPS,