Examples' Makefiles are completed and tested.
[Faustine.git] / interpretor / preprocessor / faust-0.9.47mr3 / examples / rewriting / mesh.dsp
1
2 /* Layout of a systolic array:
3
4 x1 xm
5 ↓ ↓
6 y1 → □ → ... → □ → y1'
7 ↓ ↓
8 ... ...
9 ↓ ↓
10 yn → □ → ... → □ → yn'
11 ↓ ↓
12 x1' xm'
13
14 g(m,f) : y,x1,...,xm -> x1',...,xm',y'
15 constructs a single row of size m.
16
17 h(n,m,f) : y1,...,yn,x1,...,xm -> x1',...,xm',yn',...,y1'
18 constructs an array of size nxm.
19
20 f is the function computed by each cell, which must take
21 exactly two inputs and yield exactly two outputs. */
22
23 g(1,f) = f;
24 g(m,f) = (f, r(m-1)) : (_, g(m-1,f));
25
26 h(1,m,f) = g(m,f);
27 h(n,m,f) = (r(n+m) <:
28 (!,r(n-1),s(m), (_,s(n-1),r(m) : g(m,f)))) :
29 (h(n-1,m,f), _);
30
31 // route n inputs
32 r(1) = _;
33 r(n) = _,r(n-1);
34
35 // skip n inputs
36 s(1) = !;
37 s(n) = !,s(n-1);
38
39 // sample cell function
40 f = + <: _,_;
41
42 //process = g(3,f);
43 process = h(2,3,f);