URL
https://opencores.org/ocsvn/dblclockfft/dblclockfft/trunk
Subversion Repositories dblclockfft
Compare Revisions
- This comparison shows the changes necessary to convert path
/
- from Rev 23 to Rev 24
- ↔ Reverse comparison
Rev 23 → Rev 24
/dblclockfft/trunk/sw/fftgen.cpp
1,6 → 1,6
///////////////////////////////////////////////////////////////////////////// |
// |
// Filename: fftgen.v |
// Filename: fftgen.cpp |
// |
// Project: A Doubletime Pipelined FFT |
// |
359,7 → 359,6
} |
|
void build_convround(const char *fname) { |
printf("CONVERGENT--ROUNDING!\n"); |
FILE *fp = fopen(fname, "w"); |
if (NULL == fp) { |
fprintf(stderr, "Could not open \'%s\' for writing\n", fname); |
1326,9 → 1325,19
"\t\t\tb_right_i <= rnd_right_i;\n" |
"\t\t\tb_left_r <= rnd_left_r;\n" |
"\t\t\tb_left_i <= rnd_left_i;\n" |
"\t\tend\n" |
"\n"); |
fprintf(fp, |
"\talways @(posedge i_clk)\n" |
"\t\tif (i_rst)\n" |
"\t\t\to_aux <= 1\'b0;\n" |
"\t\telse if (i_ce)\n" |
"\t\tbegin\n" |
"\t\t\t// Second clock, latch for final clock\n" |
"\t\t\to_aux <= aux & ovalid;\n" |
"\t\tend\n" |
"\n"); |
|
fprintf(fp, |
"\t// As a final step, we pack our outputs into two packed two\'s\n" |
"\t// complement numbers per output word, so that each output word\n" |
1484,7 → 1493,7
"\t// therefore, the left_x values need to be right shifted by\n" |
"\t// CWIDTH-2 as well. The additional bits come from a sign\n" |
"\t// extension.\n" |
"\twire\taux_s, aux_ss;\n" |
"\twire\taux_s;\n" |
"\twire\tsigned\t[(IWIDTH+CWIDTH):0] left_si, left_sr;\n" |
"\treg\t\t[(2*IWIDTH+2):0] left_saved;\n" |
"\tassign\tleft_sr = { {2{left_saved[2*(IWIDTH+1)-1]}}, left_saved[(2*(IWIDTH+1)-1):(IWIDTH+1)], {(CWIDTH-2){1'b0}} };\n" |
1611,14 → 1620,13
"\t// where the top CWIDTH bits are the real value and the bottom\n" |
"\t// CWIDTH bits are the imaginary value.\n" |
"\t//\n" |
"\t// cmem[i] = { (2^(CWIDTH-2)) * cos(2*pi*i/(2^LGWIDTH)),\n" |
"\t// %scmem[i] = { (2^(CWIDTH-2)) * cos(2*pi*i/(2^LGWIDTH)),\n" |
"\t// (2^(CWIDTH-2)) * sin(2*pi*i/(2^LGWIDTH)) };\n" |
"\t//\n" |
"\treg [(2*CWIDTH-1):0] %scmem [0:((1<<LGSPAN)-1)];\n" |
"\tinitial\t$readmemh(\"%scmem_%c%d.hex\",%scmem);\n\n", |
(inv)?"i":"", (inv)?"i":"", |
(inv)?"i":"", (odd)?'o':'e',stage<<1, |
(inv)?"i":""); |
(inv)?"i":"", (inv)?"i":"", (inv)?"i":"", |
(inv)?"i":"", (odd)?'o':'e',stage<<1, (inv)?"i":""); |
{ |
FILE *cmem; |
|
1697,6 → 1705,16
"\t// Now, we have all the inputs, so let\'s feed the butterfly\n" |
"\t//\n" |
"\talways\t@(posedge i_clk)\n" |
"\tif (i_rst)\n" |
"\t\tib_sync <= 1\'b0;\n" |
"\telse if ((i_ce)&&(iaddr[LGSPAN]))\n" |
"\t\tbegin\n" |
"\t\t\t// Set the sync to true on the very first\n" |
"\t\t\t// valid input in, and hence on the very\n" |
"\t\t\t// first valid data out per FFT.\n" |
"\t\t\tib_sync <= (iaddr==(1<<(LGSPAN)));\n" |
"\t\tend\n" |
"\talways\t@(posedge i_clk)\n" |
"\tif ((i_ce)&&(iaddr[LGSPAN]))\n" |
"\t\tbegin\n" |
"\t\t\t// One input from memory, ...\n" |
1703,10 → 1721,6
"\t\t\tib_a <= imem[iaddr[(LGSPAN-1):0]];\n" |
"\t\t\t// One input clocked in from the top\n" |
"\t\t\tib_b <= i_data;\n" |
"\t\t\t// Set the sync to true on the very first\n" |
"\t\t\t// valid input in, and hence on the very\n" |
"\t\t\t// first valid data out per FFT.\n" |
"\t\t\tib_sync <= (iaddr==(1<<(LGSPAN)));\n" |
"\t\t\tib_c <= %scmem[iaddr[(LGSPAN-1):0]];\n" |
"\t\tend\n\n", (inv)?"i":""); |
|
1767,8 → 1781,6
"\t-d <dir>\tPlaces all of the generated verilog files into <dir>.\n" |
"\t-f <size>\tSets the size of the FFT as the number of complex\n" |
"\t\tsamples input to the transform.\n" |
"\t-n <nbits>\tSets the number of bits in the twos complement input\n" |
"\t\tto the FFT routine.\n" |
"\t-m <mxbits>\tSets the maximum bit width that the FFT should ever\n" |
"\t\tproduce. Internal values greater than this value will be\n" |
"\t\ttruncated to this value.\n" |
1793,10 → 1805,6
|
// Features still needed: |
// Interactivity. |
// Some number of maximum bits, beyond which we won't accumulate any more. |
// Obviously, the build_stage above. |
// Copying the files of interest into the fft-core directory, from |
// whatever directory this file is run out of. |
int main(int argc, char **argv) { |
int fftsize = -1, lgsize = -1; |
int nbitsin = 16, xtracbits = 4, nummpy=0, nonmpy=2; |