* Let the libmontiumc write the contents of the input memories to file before
authorunknown <s0042331@.dynamic.ewi.utwente.nl>
Tue, 1 Apr 2008 13:56:01 +0000 (15:56 +0200)
committerunknown <s0042331@.dynamic.ewi.utwente.nl>
Tue, 1 Apr 2008 13:56:01 +0000 (15:56 +0200)
   starting, so we can use them in the python simulator.
 * Output the results in hex as well as fixed point format.
 * Fix some comments.

FFT_support.cpp

index e482b2d2dd0e44cd17f94e9c6671c34a9ec31620..7fc2484be97043c091505e99354a165015e2e2a1 100644 (file)
@@ -2,8 +2,7 @@
 #include <cstdio>\r
 #include <cmath>\r
 \r
-\r
-/* Didn't the Montium use Q15 instead of Q14? */\r
+/* Use Q15 fixed point format (1 sign bit plus 15 fractional bits) */\r
 #define FIXED_POINT 15\r
 #define WORD_SIZE   16\r
 \r
@@ -102,12 +101,20 @@ void pre_run()
        print_mem(input_a_re, 0, PARAM_N_t/2, true);\r
        printf("re(in_b)\n");\r
        print_mem(input_b_re, 0, PARAM_N_t/2, true);\r
+       \r
+/* Write out memory contents for use by the python simulator */\r
+       save_mem_range_to_file(input_a_re->id, 0, PARAM_N_t/2, "Memory/sin_a_re.mm");\r
+       save_mem_range_to_file(input_a_im->id, 0, PARAM_N_t/2, "Memory/sin_a_im.mm");\r
+       save_mem_range_to_file(input_b_re->id, 0, PARAM_N_t/2, "Memory/sin_b_re.mm");\r
+       save_mem_range_to_file(input_b_im->id, 0, PARAM_N_t/2, "Memory/sin_b_im.mm");\r
+       save_mem_range_to_file(twiddle_re->id, 0, PARAM_N_t/2, "Memory/twiddle_re.mm");\r
+       save_mem_range_to_file(twiddle_im->id, 0, PARAM_N_t/2, "Memory/twiddle_im.mm");\r
 }\r
 \r
 void post_run()\r
 {\r
        if (PARAM_n_t % 2 == 0) {\r
-               /* When the number of stages is odd, the \r
+               /* When the number of stages is even, the \r
                 * outputs end up at the left memories again */\r
                output_a_re  = alloc_mem(P0M0);\r
                output_a_im  = alloc_mem(P1M0);\r
@@ -125,5 +132,12 @@ void post_run()
        printf("im(out)\n");\r
        print_mem(output_a_im, 0, PARAM_N_t/2, true);\r
        print_mem(output_b_im, 0, PARAM_N_t/2, true);\r
+       \r
+       printf("re(out)\n");\r
+       print_mem(output_a_re, 0, PARAM_N_t/2, false);\r
+       print_mem(output_b_re, 0, PARAM_N_t/2, false);\r
+       printf("im(out)\n");\r
+       print_mem(output_a_im, 0, PARAM_N_t/2, false);\r
+       print_mem(output_b_im, 0, PARAM_N_t/2, false);\r
 \r
 }\r