* Cleanup main.cpp a bit.
[matthijs/projects/montium-fft.git] / FFT_support.cpp
index 1876e36ce4302e6cae6511d7113c976b637bcdc6..6f21e5a24afa1e9cca6fe74a37bfa4965ff6d2ea 100644 (file)
@@ -10,9 +10,7 @@
 #define WORDS_PER_LINE 4\r
 #define WORDS_PER_GROUP 1\r
 \r
 #define WORDS_PER_LINE 4\r
 #define WORDS_PER_GROUP 1\r
 \r
-extern         mem input_a_re, input_a_im, input_b_re, input_b_im, output_a_re, output_a_im, output_b_re, output_b_im, twiddle_re, twiddle_im; \r
-\r
-\r
+mem input_a_re, input_a_im, input_b_re, input_b_im, output_a_re, output_a_im, output_b_re, output_b_im, twiddle_re, twiddle_im; \r
 \r
 int to_fixed(float n)\r
 {\r
 \r
 int to_fixed(float n)\r
 {\r
@@ -52,7 +50,16 @@ void print_mem(mem m, int offset, int size, bool fixed)
 void pre_run()\r
 {\r
        int i;\r
 void pre_run()\r
 {\r
        int i;\r
-\r
+       /* Assign memories, at least for the first stage */\r
+       input_a_re   = alloc_mem(P0M0);\r
+       input_a_im   = alloc_mem(P1M0);\r
+       input_b_re   = alloc_mem(P2M0);\r
+       input_b_im   = alloc_mem(P3M0);\r
+       output_a_re  = alloc_mem(P0M1);\r
+       output_a_im  = alloc_mem(P1M1);\r
+       output_b_re  = alloc_mem(P2M1);\r
+       output_b_im  = alloc_mem(P3M1);\r
+       \r
        /* TODO: Init memory and twiddles */\r
        for (i=0;i<SIZE/2;i++)\r
        {\r
        /* TODO: Init memory and twiddles */\r
        for (i=0;i<SIZE/2;i++)\r
        {\r