Initial import.
[Faustine.git] / dsp_files / fft_test.0.tmp.dsp
1 import ( "fft.lib.dsp" ) ;
2 import ( "complex.lib" ) ;
3
4 evens = case {
5 (2) => _ , ! ;
6 (n) => _ , ! , evens(n - 2);
7 };
8 odds = case {
9 (2) => ! , _ ;
10 (n) => ! , _ , odds(n - 2);
11 };
12
13 eo(n) = evens(n), odds(n);
14
15 shuffling = case {
16 (2) => eo(2);
17 (n) => (evens(n) <: shuffling(n/2)), (odds(n) <: shuffling(n/2));
18 };
19
20 shuffle(n) = bus(n) <: shuffling(n);
21
22 input2complex(n) = par(i, n, (sca2pcplx));
23
24 fft(n) = input2complex(n) : shuffle(n) : xbutterflies(n);
25
26 picks(n) = par(i, n, [i]);
27
28 concats = case {
29 (1) => vectorize(1);
30 (n) => concats(n-1) # vectorize(1);
31 };
32
33 modules_vector(n) = concats(n);
34
35 fft_test(n) = _ : vectorize(n) <: picks(n) : fft(n) : pcplx_moduls(n) : modules_vector(n) : serialize;
36
37 //process = +, _ : + : fft_test(128);
38 process = fft_test(128);
39 //process = (0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7) <: shuffle(8);
40
41
42
43
44
45