From: unknown Date: Tue, 1 Apr 2008 13:56:01 +0000 (+0200) Subject: * Let the libmontiumc write the contents of the input memories to file before X-Git-Url: https://git.stderr.nl/gitweb?a=commitdiff_plain;h=00b2c5a7eced88e39b762255d361d61f78e2abe3;p=matthijs%2Fprojects%2Fmontium-fft.git * Let the libmontiumc write the contents of the input memories to file before starting, so we can use them in the python simulator. * Output the results in hex as well as fixed point format. * Fix some comments. --- diff --git a/FFT_support.cpp b/FFT_support.cpp index e482b2d..7fc2484 100644 --- a/FFT_support.cpp +++ b/FFT_support.cpp @@ -2,8 +2,7 @@ #include #include - -/* Didn't the Montium use Q15 instead of Q14? */ +/* Use Q15 fixed point format (1 sign bit plus 15 fractional bits) */ #define FIXED_POINT 15 #define WORD_SIZE 16 @@ -102,12 +101,20 @@ void pre_run() print_mem(input_a_re, 0, PARAM_N_t/2, true); printf("re(in_b)\n"); print_mem(input_b_re, 0, PARAM_N_t/2, true); + +/* Write out memory contents for use by the python simulator */ + save_mem_range_to_file(input_a_re->id, 0, PARAM_N_t/2, "Memory/sin_a_re.mm"); + save_mem_range_to_file(input_a_im->id, 0, PARAM_N_t/2, "Memory/sin_a_im.mm"); + save_mem_range_to_file(input_b_re->id, 0, PARAM_N_t/2, "Memory/sin_b_re.mm"); + save_mem_range_to_file(input_b_im->id, 0, PARAM_N_t/2, "Memory/sin_b_im.mm"); + save_mem_range_to_file(twiddle_re->id, 0, PARAM_N_t/2, "Memory/twiddle_re.mm"); + save_mem_range_to_file(twiddle_im->id, 0, PARAM_N_t/2, "Memory/twiddle_im.mm"); } void post_run() { if (PARAM_n_t % 2 == 0) { - /* When the number of stages is odd, the + /* When the number of stages is even, the * outputs end up at the left memories again */ output_a_re = alloc_mem(P0M0); output_a_im = alloc_mem(P1M0); @@ -125,5 +132,12 @@ void post_run() printf("im(out)\n"); print_mem(output_a_im, 0, PARAM_N_t/2, true); print_mem(output_b_im, 0, PARAM_N_t/2, true); + + printf("re(out)\n"); + print_mem(output_a_re, 0, PARAM_N_t/2, false); + print_mem(output_b_re, 0, PARAM_N_t/2, false); + printf("im(out)\n"); + print_mem(output_a_im, 0, PARAM_N_t/2, false); + print_mem(output_b_im, 0, PARAM_N_t/2, false); }