From 5b5ee5fdf0297c744927b5ce4db5a50979aca752 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Thalheim?= Date: Thu, 5 Mar 2015 16:24:22 +0100 Subject: [PATCH] =?UTF-8?q?Loopcounter=20in=20bit=5Freverse=20opcode=20ein?= =?UTF-8?q?gef=C3=BCgt?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- fft.c | 12 +++++++----- fft_inst.tie | 20 +++++++++++--------- 2 files changed, 18 insertions(+), 14 deletions(-) diff --git a/fft.c b/fft.c index 81f48ca..0db9e2f 100644 --- a/fft.c +++ b/fft.c @@ -61,13 +61,14 @@ int fix_fft(fixed fr[], fixed fi[], int m, int inverse) scale = 0; int mm = m; - xtbool t; /* decimation in time - re-order data */ - for(m=1; m<=nn; ++m) { - mr = FFT_bit_reverse(m, mm); + for(m=0;;) { + FFT_bit_reverse(m, mr, mm); + if(m >= nn) break; if(mr <= m) continue; + tr = fr[m]; fr[m] = fr[mr]; fr[mr] = tr; @@ -97,10 +98,10 @@ int fix_fft(fixed fr[], fixed fi[], int m, int inverse) if(FFT_shift_check(j,m)) { shift = 1; + ++scale; break; } - } - if(shift) ++scale; + } } else { @@ -128,6 +129,7 @@ int fix_fft(fixed fr[], fixed fi[], int m, int inverse) { i = RUR_FFT_loop(); + xtbool t; FFT_loop_check(n, istep, t, j); if(!t) break; diff --git a/fft_inst.tie b/fft_inst.tie index 5c2a075..b2ea686 100644 --- a/fft_inst.tie +++ b/fft_inst.tie @@ -150,17 +150,19 @@ operation FFT_loop_check {in AR n, in AR istep, out BR t, out AR j} {inout FFT_l assign j = TIEadd(FFT_loop, {1'b0, istep[15:1]}, 1'b0); } -operation FFT_bit_reverse {in AR b, out AR o, in AR m} {} +operation FFT_bit_reverse {inout AR m, out AR mr, in AR mm} {} { - assign o = { - TIEmux(m[2:0], 1'b0, 1'b0, 1'b0, 1'b0, 1'b0, 1'b0, 1'b0, b[0]), - TIEmux(m[2:0], 1'b0, 1'b0, 1'b0, 1'b0, 1'b0, 1'b0, b[0], b[1]), - TIEmux(m[2:0], 1'b0, 1'b0, 1'b0, 1'b0, 1'b0, b[0], b[1], b[2]), - TIEmux(m[2:0], 1'b0, 1'b0, 1'b0, 1'b0, b[0], b[1], b[2], b[3]), - TIEmux(m[2:0], 1'b0, 1'b0, 1'b0, b[0], b[1], b[2], b[3], b[4]), - TIEmux(m[2:0], 1'b0, 1'b0, b[0], b[1], b[2], b[3], b[4], b[5]), - TIEmux(m[2:0], 1'b0, b[0], b[1], b[2], b[3], b[4], b[5], b[6]) + wire [15:0] x = TIEadd(m, 0, 1'b1); + assign mr = { + TIEmux(mm[2:0], 1'b0, 1'b0, 1'b0, 1'b0, 1'b0, 1'b0, 1'b0, x[0]), + TIEmux(mm[2:0], 1'b0, 1'b0, 1'b0, 1'b0, 1'b0, 1'b0, x[0], x[1]), + TIEmux(mm[2:0], 1'b0, 1'b0, 1'b0, 1'b0, 1'b0, x[0], x[1], x[2]), + TIEmux(mm[2:0], 1'b0, 1'b0, 1'b0, 1'b0, x[0], x[1], x[2], x[3]), + TIEmux(mm[2:0], 1'b0, 1'b0, 1'b0, x[0], x[1], x[2], x[3], x[4]), + TIEmux(mm[2:0], 1'b0, 1'b0, x[0], x[1], x[2], x[3], x[4], x[5]), + TIEmux(mm[2:0], 1'b0, x[0], x[1], x[2], x[3], x[4], x[5], x[6]) }; + assign m = x; } operation FFT_twiddle {out AR wr, out AR wi, in AR j, in BR shift, in BR inverse} {}