| 1 |
17 |
dgisselq |
////////////////////////////////////////////////////////////////////////////
|
| 2 |
|
|
//
|
| 3 |
|
|
// Filename: ifft_tb.v
|
| 4 |
|
|
//
|
| 5 |
|
|
// Project: A Doubletime Pipelined FFT
|
| 6 |
|
|
//
|
| 7 |
|
|
// Purpose: This file is used to test whether an FFT followed by an
|
| 8 |
|
|
// immediate IFFT produces the input again. It is a test
|
| 9 |
|
|
// bench for the composition of the two programs, and specifically
|
| 10 |
|
|
// for the IFFT. As designed and built, this test bench would
|
| 11 |
|
|
// be difficult to implement in an FPGA (although I wouldn't
|
| 12 |
|
|
// put it past a smart individual), it was designed to be
|
| 13 |
|
|
// used within Verilator as part of a C++ simulation. The
|
| 14 |
|
|
// simulation source may be found in this project inside
|
| 15 |
|
|
// ifft_tb.cpp.
|
| 16 |
|
|
//
|
| 17 |
|
|
// Creator: Dan Gisselquist, Ph.D.
|
| 18 |
30 |
dgisselq |
// Gisselquist Technology, LLC
|
| 19 |
17 |
dgisselq |
//
|
| 20 |
|
|
///////////////////////////////////////////////////////////////////////////
|
| 21 |
|
|
//
|
| 22 |
|
|
// Copyright (C) 2015, Gisselquist Technology, LLC
|
| 23 |
|
|
//
|
| 24 |
|
|
// This program is free software (firmware): you can redistribute it and/or
|
| 25 |
|
|
// modify it under the terms of the GNU General Public License as published
|
| 26 |
|
|
// by the Free Software Foundation, either version 3 of the License, or (at
|
| 27 |
|
|
// your option) any later version.
|
| 28 |
|
|
//
|
| 29 |
|
|
// This program is distributed in the hope that it will be useful, but WITHOUT
|
| 30 |
|
|
// ANY WARRANTY; without even the implied warranty of MERCHANTIBILITY or
|
| 31 |
|
|
// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
| 32 |
|
|
// for more details.
|
| 33 |
|
|
//
|
| 34 |
|
|
// You should have received a copy of the GNU General Public License along
|
| 35 |
|
|
// with this program. (It's in the $(ROOT)/doc directory, run make with no
|
| 36 |
|
|
// target there if the PDF file isn't present.) If not, see
|
| 37 |
|
|
// <http://www.gnu.org/licenses/> for a copy.
|
| 38 |
|
|
//
|
| 39 |
|
|
// License: GPL, v3, as defined and found on www.gnu.org,
|
| 40 |
|
|
// http://www.gnu.org/licenses/gpl.html
|
| 41 |
|
|
//
|
| 42 |
|
|
//
|
| 43 |
|
|
///////////////////////////////////////////////////////////////////////////
|
| 44 |
|
|
module ifft_tb(i_clk, i_rst, i_ce, i_left, i_right, o_left, o_right, o_sync);
|
| 45 |
|
|
parameter IWIDTH=16, MIDWIDTH=22, OWIDTH=28;
|
| 46 |
|
|
input i_clk, i_rst, i_ce;
|
| 47 |
|
|
input [(2*IWIDTH-1):0] i_left, i_right;
|
| 48 |
|
|
output wire [(2*OWIDTH-1):0] o_left, o_right;
|
| 49 |
|
|
output wire o_sync;
|
| 50 |
|
|
|
| 51 |
|
|
wire m_sync;
|
| 52 |
|
|
wire [(2*MIDWIDTH-1):0] m_left, m_right;
|
| 53 |
|
|
fftmain fft(i_clk, i_rst, i_ce, i_left, i_right,
|
| 54 |
|
|
m_left, m_right, m_sync);
|
| 55 |
|
|
|
| 56 |
|
|
wire w_syncd;
|
| 57 |
|
|
reg r_syncd;
|
| 58 |
|
|
always @(posedge i_clk)
|
| 59 |
|
|
if (i_rst)
|
| 60 |
|
|
r_syncd <= 1'b0;
|
| 61 |
|
|
else
|
| 62 |
|
|
r_syncd <= r_syncd || m_sync;
|
| 63 |
|
|
assign w_syncd = r_syncd || m_sync;
|
| 64 |
|
|
|
| 65 |
|
|
ifftmain ifft(i_clk, i_rst, (i_ce)&&(w_syncd), m_left, m_right,
|
| 66 |
|
|
o_left, o_right, o_sync);
|
| 67 |
|
|
|
| 68 |
|
|
|
| 69 |
|
|
endmodule
|