OpenCores
URL https://opencores.org/ocsvn/dblclockfft/dblclockfft/trunk

Subversion Repositories dblclockfft

Compare Revisions

  • This comparison shows the changes necessary to convert path
    /dblclockfft/trunk
    from Rev 15 to Rev 16
    Reverse comparison

Rev 15 → Rev 16

/bench/cpp/fft_tb.cpp
109,7 → 109,7
long *lp;
 
// Fill up our test array from the log array
printf("%3d : CHECK: %8d %5x\n", m_ntest, m_iaddr, m_iaddr);
// printf("%3d : CHECK: %8d %5x\n", m_ntest, m_iaddr, m_iaddr);
dp = m_fft_buf; lp = &m_log[(m_iaddr-FFTLEN*3)&((4*FFTLEN-1)&(-FFTLEN))];
for(int i=0; i<FFTLEN; i++) {
long tv = *lp++;
117,10 → 117,10
dp[0] = twos_complement(tv >> IWIDTH, IWIDTH);
dp[1] = twos_complement(tv, IWIDTH);
 
printf("IN[%4d = %4x] = %9.1f %9.1f\n",
i+((m_iaddr-FFTLEN*3)&((4*FFTLEN-1)&(-FFTLEN))),
i+((m_iaddr-FFTLEN*3)&((4*FFTLEN-1)&(-FFTLEN))),
dp[0], dp[1]);
// printf("IN[%4d = %4x] = %9.1f %9.1f\n",
// i+((m_iaddr-FFTLEN*3)&((4*FFTLEN-1)&(-FFTLEN))),
// i+((m_iaddr-FFTLEN*3)&((4*FFTLEN-1)&(-FFTLEN))),
// dp[0], dp[1]);
dp += 2;
}
 
136,15 → 136,15
for(int i=0; i<FFTLEN; i++) {
long tv = m_data[i];
 
printf("OUT[%4d = %4x] = ", i, i);
printf("%12lx = ", tv);
// printf("OUT[%4d = %4x] = ", i, i);
// printf("%12lx = ", tv);
*dp = twos_complement(tv >> OWIDTH, OWIDTH);
printf("%10.1f + ", *dp);
// printf("%10.1f + ", *dp);
osq += (*dp) * (*dp); dp++;
*dp = twos_complement(tv, OWIDTH);
printf("%10.1f j", *dp);
// printf("%10.1f j", *dp);
osq += (*dp) * (*dp); dp++;
printf(" <-> %12.1f %12.1f\n", m_fft_buf[2*i], m_fft_buf[2*i+1]);
// printf(" <-> %12.1f %12.1f\n", m_fft_buf[2*i], m_fft_buf[2*i+1]);
}
 
 
169,6 → 169,11
m_ntest, scale, wt, isq);
printf("OSQ = %18.1f, ", osq);
printf("XISQ = %18.1f\n", xisq);
if (xisq > 1.2 * FFTLEN/2) {
printf("TEST FAIL!! Result is out of bounds from ");
printf("expected result with FFTW3.\n");
exit(-2);
}
m_ntest++;
}
 
188,6 → 193,7
m_syncd = true;
} else m_oaddr += 2;
 
/*
printf("%8x,%5d: %08x,%08x -> %011lx,%011lx"
// "\t%011lx,%011lx"
// "\t%011lx,%011lx"
243,6 → 249,7
// (m_fft->v__DOT__w_s2)?"S":"-", // doesn't exist
(m_fft->o_sync)?"\t(SYNC!)":"",
(m_fft->o_left | m_fft->o_right)?" (NZ)":"");
*/
 
m_data[(m_oaddr )&(FFTLEN-1)] = m_fft->o_left;
m_data[(m_oaddr+1)&(FFTLEN-1)] = m_fft->o_right;
512,6 → 519,9
 
 
fclose(fpout);
 
printf("SUCCESS!!\n");
exit(0);
}
 
 
/bench/cpp/Makefile
1,9 → 1,54
############################################################################
##
## Filename: Makefile
##
## Project: A Doubletime Pipelined FFT
##
## Purpose: This programs the build process for the test benches
## associated with the double clocked FFT project. These
## test benches are designed for the size and arguments of the
## FFT as given by the Makefile in the trunk/sw directory,
## although they shouldn't be too difficult to modify for
## other FFT parameters.
##
## Please note that running these test benches requires access
## to the *cmem_*.hex files found in trunk/sw/fft-core. I
## usually soft link them into this directory, but such linking
## is not currently part of this makefile or the build scripts.
##
## 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
##
##
##########################################################################/
all: mpy_tb dblrev_tb dblstage_tb qtrstage_tb fft_tb test
 
OBJDR:= ../../sw/fft-core/obj_dir
VSRCD:= ../../sw/fft-core
LCLDR:= obj_dir
VINC := -I/usr/share/verilator/include -I$(OBJDR)/ -I$(LCLDR)/
VSRCD = ../../sw/fft-core
TBODR:= ../rtl/obj_dir
VINC := -I/usr/share/verilator/include -I$(OBJDR)/ -I$(TBODR)/
MPYLB:= $(OBJDR)/Vshiftaddmpy__ALL.a
DBLRV:= $(OBJDR)/Vdblreverse__ALL.a
DBLSG:= $(OBJDR)/Vdblstage__ALL.a
10,7 → 55,7
QTRSG:= $(OBJDR)/Vqtrstage__ALL.a
BFLYL:= $(OBJDR)/Vbutterfly__ALL.a
FFTLB:= $(OBJDR)/Vfftmain__ALL.a
IFTLB:= $(LCLDR)/Vifft_tb__ALL.a
IFTLB:= $(TBODR)/Vifft_tb__ALL.a
STGLB:= $(OBJDR)/Vfftstage_o2048__ALL.a
VERILATOR_ROOT := /usr/share/verilator
 
35,12 → 80,19
fft_tb: fft_tb.cpp $(FFTLB)
g++ -g $(VINC) $< $(FFTLB) $(VERILATOR_ROOT)/include/verilated.cpp -lfftw3 -o $@
 
ifft_tb: ifft_tb.cpp $(IFTLB)
g++ -g $(VINC) $< $(IFTLB) $(VERILATOR_ROOT)/include/verilated.cpp -lfftw3 -o $@
$(IFTLB): $(LCLDR)/Vifft_tb.cpp
cd $(LCLDR); make -f Vifft_tb.mk
$(LCLDR)/Vifft_tb.cpp: ifft_tb.v $(VSRCD)/fftmain.v $(VSRCD)/ifftmain.v
verilator -y $(VSRCD) -cc ifft_tb.v
.PHONY: HEX
# HEX: cmem_e2048.hex cmem_e1024.hex cmem_e512.hex cmem_e256.hex
# HEX: cmem_o2048.hex cmem_o1024.hex cmem_o512.hex cmem_o256.hex
# HEX: icmem_e2048.hex icmem_e1024.hex icmem_e512.hex icmem_e256.hex
# HEX: icmem_o2048.hex icmem_o1024.hex icmem_o512.hex icmem_o256.hex
# HEX: cmem_e128.hex cmem_e64.hex cmem_e32.hex cmem_e16.hex cmem_e8.hex
# HEX: cmem_o128.hex cmem_o64.hex cmem_o32.hex cmem_o16.hex cmem_o8.hex
# HEX: icmem_e128.hex icmem_e64.hex icmem_e32.hex icmem_e16.hex icmem_e8.hex
# HEX: icmem_o128.hex icmem_o64.hex icmem_o32.hex icmem_o16.hex icmem_o8.hex
# cmem_%.hex: $(VSRCD)/cmem_%.hex
# echo ln -s $* $<
HEX:
ln -s $(VSRCD)/*.hex .
 
.PHONY: test
test: mpy_tb dblrev_tb dblstage_tb qtrstage_tb butterfly_tb fftstage_o2048_tb
58,6 → 110,7
clean:
rm mpy_tb dblrev_tb dblstage_tb qtrstage_tb butterfly_tb
rm fftstage_o2048_tb fft_tb ifft_tb
rm -rf $(LCLDR) fft_tb.dbl ifft_tb.dbl
rm -rf fft_tb.dbl ifft_tb.dbl
rm -rf *cmem_*.hex
 
include $(VERILATOR_ROOT)/include/verilated.mk
/sw/fftgen.cpp
1,3 → 1,54
/////////////////////////////////////////////////////////////////////////////
//
// 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 <stdlib.h>
#include <unistd.h>
812,8 → 863,10
"\treg\tsigned\t[(CWIDTH+IWIDTH+3-1):0] mpy_r, mpy_i;\n"
"\treg\tsigned\t[(CWIDTH+IWIDTH+3-1):0] rnd;\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"
"\telse if ((IWIDTH+CWIDTH)-(OWIDTH+SHIFT) == 2)\n"
"\t\tassign rnd = ({ {(OWIDTH+4+SHIFT){1'b0}},1'b1 });\n"
"\telse\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"
1594,3 → 1647,4
}
}
 
 
/sw/Makefile
1,3 → 1,48
############################################################################/
##
## Filename: fftgen.v
##
## Project: A Doubletime Pipelined FFT
##
## Purpose: This is the main Makefile for the FFT core generator.
## It is very simple in its construction, the most complicated
## parts being the building of the Verilator simulation--a
## step that may not be required for your project.
##
## To build the FFT generator, just type 'make' on a line
## by itself. For a quick tutorial in how to run the
## generator, just type './fftgen -h' to read the usage()
## statement.
##
## 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
##
##
##########################################################################/
##
##
# This is really simple ...
all: fftgen
CORED := fft-core
12,6 → 57,13
.PHONY: test
test: fft ifft shiftaddmpy butterfly dblreverse qtrstage dblstage fftstage_o2048
 
#
# Although these parameters, a 2048 point FFT of 16 bits input, aren't
# the only parameters the FFT can do, they are the ones that the test
# benches depend upon. If you change these, and you are welcome to do so,
# you may need to adjust the test benches if you wish to prove that your
# changes work.
#
.PHONY: fft
fft: fftgen
./fftgen -f 2048 -n 16

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.