Loopcounter in bit_reverse opcode eingefügt
This commit is contained in:
parent
a0939290bb
commit
5b5ee5fdf0
12
fft.c
12
fft.c
@ -61,13 +61,14 @@ int fix_fft(fixed fr[], fixed fi[], int m, int inverse)
|
|||||||
scale = 0;
|
scale = 0;
|
||||||
|
|
||||||
int mm = m;
|
int mm = m;
|
||||||
xtbool t;
|
|
||||||
|
|
||||||
/* decimation in time - re-order data */
|
/* decimation in time - re-order data */
|
||||||
for(m=1; m<=nn; ++m) {
|
for(m=0;;) {
|
||||||
mr = FFT_bit_reverse(m, mm);
|
FFT_bit_reverse(m, mr, mm);
|
||||||
|
|
||||||
|
if(m >= nn) break;
|
||||||
if(mr <= m) continue;
|
if(mr <= m) continue;
|
||||||
|
|
||||||
tr = fr[m];
|
tr = fr[m];
|
||||||
fr[m] = fr[mr];
|
fr[m] = fr[mr];
|
||||||
fr[mr] = tr;
|
fr[mr] = tr;
|
||||||
@ -97,10 +98,10 @@ int fix_fft(fixed fr[], fixed fi[], int m, int inverse)
|
|||||||
if(FFT_shift_check(j,m))
|
if(FFT_shift_check(j,m))
|
||||||
{
|
{
|
||||||
shift = 1;
|
shift = 1;
|
||||||
|
++scale;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(shift) ++scale;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -128,6 +129,7 @@ int fix_fft(fixed fr[], fixed fi[], int m, int inverse)
|
|||||||
{
|
{
|
||||||
i = RUR_FFT_loop();
|
i = RUR_FFT_loop();
|
||||||
|
|
||||||
|
xtbool t;
|
||||||
FFT_loop_check(n, istep, t, j);
|
FFT_loop_check(n, istep, t, j);
|
||||||
if(!t)
|
if(!t)
|
||||||
break;
|
break;
|
||||||
|
20
fft_inst.tie
20
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);
|
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 = {
|
wire [15:0] x = TIEadd(m, 0, 1'b1);
|
||||||
TIEmux(m[2:0], 1'b0, 1'b0, 1'b0, 1'b0, 1'b0, 1'b0, 1'b0, b[0]),
|
assign mr = {
|
||||||
TIEmux(m[2:0], 1'b0, 1'b0, 1'b0, 1'b0, 1'b0, 1'b0, b[0], b[1]),
|
TIEmux(mm[2:0], 1'b0, 1'b0, 1'b0, 1'b0, 1'b0, 1'b0, 1'b0, x[0]),
|
||||||
TIEmux(m[2:0], 1'b0, 1'b0, 1'b0, 1'b0, 1'b0, b[0], b[1], b[2]),
|
TIEmux(mm[2:0], 1'b0, 1'b0, 1'b0, 1'b0, 1'b0, 1'b0, x[0], x[1]),
|
||||||
TIEmux(m[2:0], 1'b0, 1'b0, 1'b0, 1'b0, b[0], b[1], b[2], b[3]),
|
TIEmux(mm[2:0], 1'b0, 1'b0, 1'b0, 1'b0, 1'b0, x[0], x[1], x[2]),
|
||||||
TIEmux(m[2:0], 1'b0, 1'b0, 1'b0, b[0], b[1], b[2], b[3], b[4]),
|
TIEmux(mm[2:0], 1'b0, 1'b0, 1'b0, 1'b0, x[0], x[1], x[2], x[3]),
|
||||||
TIEmux(m[2:0], 1'b0, 1'b0, b[0], b[1], b[2], b[3], b[4], b[5]),
|
TIEmux(mm[2:0], 1'b0, 1'b0, 1'b0, x[0], x[1], x[2], x[3], x[4]),
|
||||||
TIEmux(m[2:0], 1'b0, b[0], b[1], b[2], b[3], b[4], b[5], b[6])
|
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} {}
|
operation FFT_twiddle {out AR wr, out AR wi, in AR j, in BR shift, in BR inverse} {}
|
||||||
|
Loading…
Reference in New Issue
Block a user