X-Git-Url: https://git.stderr.nl/gitweb?p=matthijs%2Fprojects%2Fmontium-fft.git;a=blobdiff_plain;f=FFT.mc;fp=FFT.mc;h=5969315c8a174d1cadc4b8e49e60bee63f813f1c;hp=6688275a9f32d7a7341ead36d3859efe18578e57;hb=7a5f3f2a9974d0fa0f3c888944d9120b22f254eb;hpb=81823b7486c210898290292ed87142a89c496946 diff --git a/FFT.mc b/FFT.mc index 6688275..5969315 100644 --- a/FFT.mc +++ b/FFT.mc @@ -188,8 +188,8 @@ INLINE void do_half_regular_stage(struct mems m, bool stage_odd, bool second_hal /* Now, do half a single stage. That means N_t / 4 cycles. Since we do 2 * cycles on every iteration, plus one before and after the loop, * we will loop N_t / 8 - 1 times. We add an extra - 1 because this is a do while loop... */ - init_loop(LC2, (PARAM_N_t / 8) - 1); - while (loop_next(LC2)) { + init_loop(LC2, (PARAM_N_t / 8) - 1 - 1); + do { /* Write outputs of previous cycle */ write_output_regular(m, out, second_half); @@ -204,7 +204,7 @@ INLINE void do_half_regular_stage(struct mems m, bool stage_odd, bool second_hal /* Even cycle */ in = read_input_regular(m, EVEN_CYCLE, second_half); out = butterfly(in); - } + } while (loop_next(LC2)); /* Write outputs of previous cycle */ write_output_regular(m, out, second_half); @@ -254,9 +254,9 @@ void run() { struct mems m; /* We need to do n_t regular stages. Since we do two stages each - * iteration, we'll do n_t / 2 iterations. */ - init_loop(LC1, (PARAM_n_t / 2)); - while (loop_next(LC1)) { + * iteration, we'll do n_t / 2 iterations (and a -1 because we check after looping) */ + init_loop(LC1, (PARAM_n_t / 2) - 1); + do { m = init_mem_mapping(EVEN_STAGE); init_input_addresses_regular(m, EVEN_STAGE); /* do_half_regular_stage will init output addresses */ @@ -271,5 +271,5 @@ void run() { do_half_regular_stage(m, ODD_STAGE, FIRST_HALF); do_half_regular_stage(m, ODD_STAGE, SECOND_HALF); stage++; - } + } while (loop_next(LC1)); }