Loopcounter in bit_reverse opcode eingefügt

This commit is contained in:
Jörg Thalheim 2015-03-05 16:24:22 +01:00
parent a0939290bb
commit 5b5ee5fdf0
2 changed files with 18 additions and 14 deletions

12
fft.c
View File

@ -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;

View File

@ -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} {}