Line 1... |
Line 1... |
|
/////////////////////////////////////////////////////////////////////////////
|
|
//
|
|
// Filename: fftgen.v
|
|
//
|
|
// Project: A Doubletime Pipelined FFT
|
|
//
|
|
// Purpose: This is the core generator for the project. Every part
|
|
// and piece of this project begins and ends in this program.
|
|
// Once built, this program will build an FFT (or IFFT) core
|
|
// of arbitrary width, precision, etc., that will run at
|
|
// two samples per clock. (Incidentally, I didn't pick two
|
|
// samples per clock because it was easier, but rather because
|
|
// there weren't any two-sample per clock FFT's posted on
|
|
// opencores.com. Further, FFT's running at one sample per
|
|
// clock aren't that hard to find.)
|
|
//
|
|
// You can find the documentation for this program in two places.
|
|
// One is in the usage() function below. The second is in the
|
|
// 'doc'uments directory that comes with this package,
|
|
// specifically in the spec.pdf file. If it's not there, type
|
|
// make in the documents directory to build it.
|
|
//
|
|
// Creator: Dan Gisselquist, Ph.D.
|
|
// Gisselquist Tecnology, LLC
|
|
//
|
|
///////////////////////////////////////////////////////////////////////////
|
|
//
|
|
// Copyright (C) 2015, Gisselquist Technology, LLC
|
|
//
|
|
// This program is free software (firmware): you can redistribute it and/or
|
|
// modify it under the terms of the GNU General Public License as published
|
|
// by the Free Software Foundation, either version 3 of the License, or (at
|
|
// your option) any later version.
|
|
//
|
|
// This program is distributed in the hope that it will be useful, but WITHOUT
|
|
// ANY WARRANTY; without even the implied warranty of MERCHANTIBILITY or
|
|
// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|
// for more details.
|
|
//
|
|
// You should have received a copy of the GNU General Public License along
|
|
// with this program. (It's in the $(ROOT)/doc directory, run make with no
|
|
// target there if the PDF file isn't present.) If not, see
|
|
// <http://www.gnu.org/licenses/> for a copy.
|
|
//
|
|
// License: GPL, v3, as defined and found on www.gnu.org,
|
|
// http://www.gnu.org/licenses/gpl.html
|
|
//
|
|
//
|
|
///////////////////////////////////////////////////////////////////////////
|
|
//
|
|
//
|
#include <stdio.h>
|
#include <stdio.h>
|
#include <stdlib.h>
|
#include <stdlib.h>
|
#include <unistd.h>
|
#include <unistd.h>
|
#include <sys/stat.h>
|
#include <sys/stat.h>
|
#include <string.h>
|
#include <string.h>
|
Line 810... |
Line 861... |
"\treg\tsigned\t[(CWIDTH+IWIDTH+3-1):0] b_left_r, b_left_i,\n"
|
"\treg\tsigned\t[(CWIDTH+IWIDTH+3-1):0] b_left_r, b_left_i,\n"
|
"\t\t\t\t\t\tb_right_r, b_right_i;\n"
|
"\t\t\t\t\t\tb_right_r, b_right_i;\n"
|
"\treg\tsigned\t[(CWIDTH+IWIDTH+3-1):0] mpy_r, mpy_i;\n"
|
"\treg\tsigned\t[(CWIDTH+IWIDTH+3-1):0] mpy_r, mpy_i;\n"
|
"\treg\tsigned\t[(CWIDTH+IWIDTH+3-1):0] rnd;\n"
|
"\treg\tsigned\t[(CWIDTH+IWIDTH+3-1):0] rnd;\n"
|
"\tgenerate\n"
|
"\tgenerate\n"
|
"\tif ((ROUND==0)||(CWIDTH+IWIDTH-OWIDTH-SHIFT<1))\n"
|
"\tif ((ROUND==0)||(CWIDTH+IWIDTH-OWIDTH-SHIFT<2))\n"
|
"\t\tassign rnd = ({(CWIDTH+IWIDTH+3){1'b0}});\n"
|
"\t\tassign rnd = ({(CWIDTH+IWIDTH+3){1'b0}});\n"
|
|
"\telse if ((IWIDTH+CWIDTH)-(OWIDTH+SHIFT) == 2)\n"
|
|
"\t\tassign rnd = ({ {(OWIDTH+4+SHIFT){1'b0}},1'b1 });\n"
|
"\telse\n"
|
"\telse\n"
|
"\t\tassign rnd = ({ {(OWIDTH+4+SHIFT){1'b0}},1'b1,\n"
|
"\t\tassign rnd = ({ {(OWIDTH+4+SHIFT){1'b0}},1'b1,\n"
|
"\t\t\t\t{((IWIDTH+CWIDTH+3)-(OWIDTH+SHIFT+5)){1'b0}} });\n"
|
"\t\t\t\t{((IWIDTH+CWIDTH+3)-(OWIDTH+SHIFT+5)){1'b0}} });\n"
|
"\tendgenerate\n"
|
"\tendgenerate\n"
|
"\n");
|
"\n");
|
Line 1593... |
Line 1646... |
}
|
}
|
}
|
}
|
}
|
}
|
|
|
|
|
No newline at end of file
|
No newline at end of file
|
|
|
No newline at end of file
|
No newline at end of file
|