M wird durch Buildtarget definiert

This commit is contained in:
Jörg Thalheim 2015-03-09 17:29:31 +01:00
parent a260fd56bf
commit 207f1c46be
3 changed files with 8 additions and 13 deletions

1
fft.c
View File

@ -80,7 +80,6 @@ int fix_fft(fixed fr[], fixed fi[], int m, int inverse)
fi[mr] = ti; fi[mr] = ti;
} }
l = 1; l = 1;
k = LOG2_N_WAVE-1; k = LOG2_N_WAVE-1;
while(l < n) while(l < n)

View File

@ -200,6 +200,9 @@ operation FFT_calc {inout FFT_reg data, in AR wr, in AR wi, in AR shift} {}
wire [15:0] fii = data[31:16]; wire [15:0] fii = data[31:16];
wire [15:0] fij = data[15:0]; wire [15:0] fij = data[15:0];
// TODO semantic for hardware implementation
// TODO shared functions
// TODO ersetzen durch TIEmac
wire [31:0] tr1 = TIEmul(wr, frj, 1'b1); wire [31:0] tr1 = TIEmul(wr, frj, 1'b1);
wire [15:0] tr1s = tr1[30:15]; wire [15:0] tr1s = tr1[30:15];
wire [31:0] tr2 = TIEmul(wi, fij, 1'b1); wire [31:0] tr2 = TIEmul(wi, fij, 1'b1);
@ -215,6 +218,7 @@ operation FFT_calc {inout FFT_reg data, in AR wr, in AR wi, in AR shift} {}
wire [15:0] qr = TIEmux(shift[0], fri, {fri[15], fri[15:1]}); wire [15:0] qr = TIEmux(shift[0], fri, {fri[15], fri[15:1]});
wire [15:0] qi = TIEmux(shift[0], fii, {fii[15], fii[15:1]}); wire [15:0] qi = TIEmux(shift[0], fii, {fii[15], fii[15:1]});
// TODO multiple add
wire [15:0] frio = TIEadd(qr, tr, 1'b0); wire [15:0] frio = TIEadd(qr, tr, 1'b0);
wire [15:0] frjo = TIEadd(qr, ~tr, 1'b1); wire [15:0] frjo = TIEadd(qr, ~tr, 1'b1);
wire [15:0] fiio = TIEadd(qi, ti, 1'b0); wire [15:0] fiio = TIEadd(qi, ti, 1'b0);
@ -300,7 +304,6 @@ immediate_range ld.FFT_reg_immed2 -32 24 8
// //
//-------------------------------------------------------------------------- //--------------------------------------------------------------------------
format flix64_0 64 { flix64_0_slot0, flix64_0_slot1, flix64_0_slot2 } format flix64_0 64 { flix64_0_slot0, flix64_0_slot1, flix64_0_slot2 }
slot_opcodes Inst { slot_opcodes Inst {

15
main.c
View File

@ -1,20 +1,17 @@
//main.c //main.c
#include "fft.h" #include "fft.h"
#include "fft-org.h" #include "fft-org.h"
#include <stdio.h> #include <stdio.h>
#include <math.h> #include <math.h>
#define M 8 //defined by Compile Target
#define M 3
//number of points //number of points
#define N (1<<M) #define N (1<<M)
#define M2 100
#define N2 (3<<M)
fixed real[N], imag[N]; fixed real[N], imag[N];
fixed real_org[N], imag_org[N]; fixed real_org[N], imag_org[N];
@ -34,7 +31,6 @@ void show_result(fixed* real, fixed* real_org, fixed* imag, fixed* imag_org, int
int main() int main()
{ {
int i; int i;
for(i=0; i<N; i++) for(i=0; i<N; i++)
{ {
real[i] = 1000*cos(i*2*3.1415926535/N); real[i] = 1000*cos(i*2*3.1415926535/N);
@ -50,7 +46,6 @@ int main()
printf("%d: %d, %d\n", i, real[i], imag[i]); printf("%d: %d, %d\n", i, real[i], imag[i]);
} }
//FFT //FFT
fix_fft(real, imag, M, 0); fix_fft(real, imag, M, 0);
fix_fft_org(real_org, imag_org, M, 0); fix_fft_org(real_org, imag_org, M, 0);
@ -65,7 +60,7 @@ int main()
printf("\nIFFT\n"); printf("\nIFFT\n");
show_result(real, real_org, imag, imag_org, N); show_result(real, real_org, imag, imag_org, N);
for(i=0; i<N; i++) /*for(i=0; i<N; i++)
{ {
real[i] = 1000*(cos(i*2*3.1415926535/N) + sin(i*2*3.1415926535/N)); real[i] = 1000*(cos(i*2*3.1415926535/N) + sin(i*2*3.1415926535/N));
real_org[i] = real[i]; real_org[i] = real[i];
@ -73,7 +68,6 @@ int main()
imag_org[i] = 0; imag_org[i] = 0;
} }
/*
//FFT //FFT
fix_fft(real, imag, M, 0); fix_fft(real, imag, M, 0);
fix_fft_org(real_org, imag_org, M, 0); fix_fft_org(real_org, imag_org, M, 0);
@ -86,8 +80,7 @@ int main()
fix_fft_org(real_org, imag_org, M, 1); fix_fft_org(real_org, imag_org, M, 1);
printf("\nIFFT2\n"); printf("\nIFFT2\n");
show_result(real, real_org, imag, imag_org, N); show_result(real, real_org, imag, imag_org, N);*/
*/
return 0; return 0;
} }