From: unknown Date: Thu, 27 Mar 2008 16:38:31 +0000 (+0100) Subject: * Keep track of the current stage number (not montiumcc compatible) so we X-Git-Url: https://git.stderr.nl/gitweb?p=matthijs%2Fprojects%2Fmontium-fft.git;a=commitdiff_plain;h=a980bbf75167001020f0d2ddb4a4563bd71a2e3d * Keep track of the current stage number (not montiumcc compatible) so we know which twiddle factors we need. This needs checking and improving. --- diff --git a/FFT.mc b/FFT.mc index 3ad0816..626b0dc 100644 --- a/FFT.mc +++ b/FFT.mc @@ -6,6 +6,7 @@ #include "FFT.h" +int stage = 1; /** * Executes a single butterfly on ALU 0-3. The inputs are the words taken from * in, which will be read on various inputs of ALU 0-3. Outputs will be @@ -98,7 +99,13 @@ INLINE struct bf_in read_input_regular(struct mems m, bool cycle_odd, bool stage add_offset(m.input_a_im, 1); add_offset(m.input_b_re, 1); add_offset(m.input_b_im, 1); - /* TODO: Update twiddle offsets */ + + /* TODO: Is this true? */ + add_offset(m.twiddle_re, (PARAM_N_t>>stage)); + add_offset(m.twiddle_im, (PARAM_N_t>>stage)); + use_mask(m.twiddle_re, (PARAM_N_t/2)-1); + use_mask(m.twiddle_im, (PARAM_N_t/2)-1); + return in; } @@ -256,11 +263,13 @@ void run() { next_cycle(); do_half_regular_stage(m, EVEN_STAGE, FIRST_HALF); do_half_regular_stage(m, EVEN_STAGE, SECOND_HALF); + stage++; next_cycle(); init_input_addresses_regular(m, ODD_STAGE); m = init_mem_mapping(ODD_STAGE); next_cycle(); do_half_regular_stage(m, ODD_STAGE, FIRST_HALF); do_half_regular_stage(m, ODD_STAGE, SECOND_HALF); + stage++; } while (loop_next(LC1)); }