Line 3... |
Line 3... |
//
|
//
|
// Project: A Doubletime Pipelined FFT
|
// Project: A Doubletime Pipelined FFT
|
//
|
//
|
// Purpose: A test-bench for the main program, fftmain.v, of the double
|
// Purpose: A test-bench for the main program, fftmain.v, of the double
|
// clocked FFT. This file may be run autonomously (when
|
// clocked FFT. This file may be run autonomously (when
|
// fully functional). If so, the last line output will either
|
// fully functional). If so, the last line output will either read
|
// read "SUCCESS" on success, or some other failure message
|
// "SUCCESS" on success, or some other failure message otherwise.
|
// otherwise.
|
|
//
|
//
|
// This file depends upon verilator to both compile, run, and
|
// This file depends upon verilator to both compile, run, and therefore
|
// therefore test fftmain.v
|
// test fftmain.v
|
//
|
//
|
// Creator: Dan Gisselquist, Ph.D.
|
// Creator: Dan Gisselquist, Ph.D.
|
// Gisselquist Technology, LLC
|
// Gisselquist Technology, LLC
|
//
|
//
|
///////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////
|
//
|
//
|
// Copyright (C) 2015, Gisselquist Technology, LLC
|
// Copyright (C) 2015,2018, Gisselquist Technology, LLC
|
//
|
//
|
// This program is free software (firmware): you can redistribute it and/or
|
// 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
|
// 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
|
// by the Free Software Foundation, either version 3 of the License, or (at
|
// your option) any later version.
|
// your option) any later version.
|
Line 38... |
Line 37... |
// http://www.gnu.org/licenses/gpl.html
|
// http://www.gnu.org/licenses/gpl.html
|
//
|
//
|
//
|
//
|
///////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////
|
#include <stdio.h>
|
#include <stdio.h>
|
|
#include <stdlib.h>
|
#include <math.h>
|
#include <math.h>
|
#include <fftw3.h>
|
#include <fftw3.h>
|
|
|
#include "verilated.h"
|
#include "verilated.h"
|
|
#include "verilated_vcd_c.h"
|
#include "Vfftmain.h"
|
#include "Vfftmain.h"
|
#include "twoc.h"
|
#include "twoc.h"
|
|
|
#include "fftsize.h"
|
#include "fftsize.h"
|
|
|
Line 54... |
Line 55... |
#define VVAR(A) fftmain__DOT_ ## A
|
#define VVAR(A) fftmain__DOT_ ## A
|
#else
|
#else
|
#define VVAR(A) v__DOT_ ## A
|
#define VVAR(A) v__DOT_ ## A
|
#endif
|
#endif
|
|
|
|
#ifdef DBLCLKFFT
|
#define revstage_iaddr VVAR(_revstage__DOT__iaddr)
|
#define revstage_iaddr VVAR(_revstage__DOT__iaddr)
|
|
#else
|
|
#define revstage_iaddr VVAR(_revstage__DOT__wraddr)
|
|
#endif
|
#define br_sync VVAR(_br_sync)
|
#define br_sync VVAR(_br_sync)
|
#define br_started VVAR(_r_br_started)
|
#define br_started VVAR(_r_br_started)
|
#define w_s2048 VVAR(_w_s2048)
|
#define w_s2048 VVAR(_w_s2048)
|
#define w_s1024 VVAR(_w_s1024)
|
#define w_s1024 VVAR(_w_s1024)
|
#define w_s512 VVAR(_w_s512)
|
#define w_s512 VVAR(_w_s512)
|
Line 117... |
Line 121... |
FILE *m_dumpfp;
|
FILE *m_dumpfp;
|
fftw_plan m_plan;
|
fftw_plan m_plan;
|
double *m_fft_buf;
|
double *m_fft_buf;
|
bool m_syncd;
|
bool m_syncd;
|
unsigned long m_tickcount;
|
unsigned long m_tickcount;
|
|
VerilatedVcdC* m_trace;
|
|
|
FFT_TB(void) {
|
FFT_TB(void) {
|
m_fft = new Vfftmain;
|
m_fft = new Vfftmain;
|
|
Verilated::traceEverOn(true);
|
m_iaddr = m_oaddr = 0;
|
m_iaddr = m_oaddr = 0;
|
m_dumpfp = NULL;
|
m_dumpfp = NULL;
|
|
|
m_fft_buf = (double *)fftw_malloc(sizeof(fftw_complex)*(FFTLEN));
|
m_fft_buf = (double *)fftw_malloc(sizeof(fftw_complex)*(FFTLEN));
|
m_plan = fftw_plan_dft_1d(FFTLEN, (fftw_complex *)m_fft_buf,
|
m_plan = fftw_plan_dft_1d(FFTLEN, (fftw_complex *)m_fft_buf,
|
(fftw_complex *)m_fft_buf,
|
(fftw_complex *)m_fft_buf,
|
FFTW_FORWARD, FFTW_MEASURE);
|
FFTW_FORWARD, FFTW_MEASURE);
|
m_syncd = false;
|
m_syncd = false;
|
m_ntest = 0;
|
m_ntest = 0;
|
|
}
|
|
|
m_tickcount = 0l;
|
~FFT_TB(void) {
|
|
closetrace();
|
|
delete m_fft;
|
|
m_fft = NULL;
|
|
}
|
|
|
|
virtual void opentrace(const char *vcdname) {
|
|
if (!m_trace) {
|
|
m_trace = new VerilatedVcdC;
|
|
m_fft->trace(m_trace, 99);
|
|
m_trace->open(vcdname);
|
|
}
|
|
}
|
|
|
|
virtual void closetrace(void) {
|
|
if (m_trace) {
|
|
m_trace->close();
|
|
delete m_trace;
|
|
m_trace = NULL;
|
|
}
|
}
|
}
|
|
|
void tick(void) {
|
void tick(void) {
|
if ((!m_fft->i_ce)||(m_fft->i_rst))
|
m_tickcount++;
|
|
if (m_fft->i_reset)
|
printf("TICK(%s,%s)\n",
|
printf("TICK(%s,%s)\n",
|
(m_fft->i_rst)?"RST":" ",
|
(m_fft->i_reset)?"RST":" ",
|
(m_fft->i_ce)?"CE":" ");
|
(m_fft->i_ce)?"CE":" ");
|
|
|
m_fft->i_clk = 0;
|
m_fft->i_clk = 0;
|
m_fft->eval();
|
m_fft->eval();
|
|
if (m_trace)
|
|
m_trace->dump((vluint64_t)(10*m_tickcount-2));
|
m_fft->i_clk = 1;
|
m_fft->i_clk = 1;
|
m_fft->eval();
|
m_fft->eval();
|
|
if (m_trace)
|
|
m_trace->dump((vluint64_t)(10*m_tickcount));
|
|
m_fft->i_clk = 0;
|
|
m_fft->eval();
|
|
if (m_trace) {
|
|
m_trace->dump((vluint64_t)(10*m_tickcount+5));
|
|
m_trace->flush();
|
|
}
|
|
}
|
|
|
m_tickcount++;
|
void cetick(void) {
|
|
int ce = m_fft->i_ce, nkce;
|
|
tick();
|
|
|
/*
|
nkce = (rand()&1);
|
int nrpt = (rand()&0x01f) + 1;
|
#ifdef FFT_CKPCE
|
m_fft->i_ce = 0;
|
nkce += FFT_CKPCE;
|
for(int i=0; i<nrpt; i++) {
|
#endif
|
m_fft->i_clk = 0;
|
if ((ce)&&(nkce>0)) {
|
m_fft->eval();
|
m_fft->i_ce = 0;
|
m_fft->i_clk = 1;
|
for(int kce=1; kce < nkce; kce++)
|
m_fft->eval();
|
tick();
|
}
|
}
|
*/
|
|
|
m_fft->i_ce = ce;
|
}
|
}
|
|
|
void reset(void) {
|
void reset(void) {
|
m_fft->i_ce = 0;
|
m_fft->i_ce = 0;
|
m_fft->i_rst = 1;
|
m_fft->i_reset = 1;
|
tick();
|
tick();
|
m_fft->i_rst = 0;
|
m_fft->i_reset = 0;
|
tick();
|
tick();
|
|
|
m_iaddr = m_oaddr = m_logbase = 0;
|
m_iaddr = m_oaddr = m_logbase = 0;
|
m_syncd = false;
|
m_syncd = false;
|
m_tickcount = 0l;
|
m_tickcount = 0l;
|
Line 252... |
Line 294... |
}
|
}
|
|
|
printf("%3d : SCALE = %12.6f, WT = %18.1f, ISQ = %15.1f, ",
|
printf("%3d : SCALE = %12.6f, WT = %18.1f, ISQ = %15.1f, ",
|
m_ntest, scale, wt, isq);
|
m_ntest, scale, wt, isq);
|
printf("OSQ = %18.1f, ", osq);
|
printf("OSQ = %18.1f, ", osq);
|
printf("XISQ = %18.1f\n", xisq);
|
printf("XISQ = %18.1f, sqrt = %9.2f\n", xisq, sqrt(xisq));
|
if (xisq > 1.4 * FFTLEN/2) {
|
if (xisq > 1.4 * FFTLEN/2) {
|
printf("TEST FAIL!! Result is out of bounds from ");
|
printf("TEST FAIL!! Result is out of bounds from ");
|
printf("expected result with FFTW3.\n");
|
printf("expected result with FFTW3.\n");
|
// exit(-2);
|
// exit(EXIT_FAILURE);
|
}
|
}
|
m_ntest++;
|
m_ntest++;
|
}
|
}
|
|
|
|
#ifdef DBLCLKFFT
|
bool test(ITYP lft, ITYP rht) {
|
bool test(ITYP lft, ITYP rht) {
|
m_fft->i_ce = 1;
|
m_fft->i_ce = 1;
|
m_fft->i_rst = 0;
|
m_fft->i_reset = 0;
|
m_fft->i_left = lft;
|
m_fft->i_left = lft;
|
m_fft->i_right = rht;
|
m_fft->i_right = rht;
|
|
|
m_log[(m_iaddr++)&(NFTLOG*FFTLEN-1)] = lft;
|
m_log[(m_iaddr++)&(NFTLOG*FFTLEN-1)] = lft;
|
m_log[(m_iaddr++)&(NFTLOG*FFTLEN-1)] = rht;
|
m_log[(m_iaddr++)&(NFTLOG*FFTLEN-1)] = rht;
|
|
|
tick();
|
cetick();
|
|
|
if (m_fft->o_sync) {
|
if (m_fft->o_sync) {
|
if (!m_syncd) {
|
if (!m_syncd) {
|
m_syncd = true;
|
m_syncd = true;
|
printf("ORIGINAL SYNC AT 0x%lx, m_oaddr set to 0x%x\n", m_tickcount, m_oaddr);
|
printf("ORIGINAL SYNC AT 0x%lx, m_oaddr set to 0x%x\n", m_tickcount, m_oaddr);
|
Line 337... |
Line 380... |
checkresults();
|
checkresults();
|
}
|
}
|
|
|
return (m_fft->o_sync);
|
return (m_fft->o_sync);
|
}
|
}
|
|
#else
|
|
bool test(ITYP data) {
|
|
m_fft->i_ce = 1;
|
|
m_fft->i_reset = 0;
|
|
m_fft->i_sample = data;
|
|
|
|
m_log[(m_iaddr++)&(NFTLOG*FFTLEN-1)] = data;
|
|
|
|
cetick();
|
|
|
|
if (m_fft->o_sync) {
|
|
if (!m_syncd) {
|
|
m_syncd = true;
|
|
printf("ORIGINAL SYNC AT 0x%lx, m_oaddr set to 0x%x\n", m_tickcount, m_oaddr);
|
|
m_logbase = m_iaddr;
|
|
} else printf("RESYNC AT %lx\n", m_tickcount);
|
|
m_oaddr &= (-1<<LGWIDTH);
|
|
} else m_oaddr += 1;
|
|
|
|
printf("%8x,%5d: %08x -> %011lx\t",
|
|
m_iaddr, m_oaddr, data, m_fft->o_result);
|
|
|
|
#ifndef APPLY_BITREVERSE_LOCALLY
|
|
printf(" [%3x]%s", m_fft->revstage_iaddr,
|
|
(m_fft->br_sync)?"S"
|
|
:((m_fft->br_started)?".":"x"));
|
|
#endif
|
|
|
|
printf(" ");
|
|
#if (FFT_SIZE>=2048)
|
|
printf("%s", (m_fft->w_s2048)?"S":"-");
|
|
#endif
|
|
#if (FFT_SIZE>1024)
|
|
printf("%s", (m_fft->w_s1024)?"S":"-");
|
|
#endif
|
|
#if (FFT_SIZE>512)
|
|
printf("%s", (m_fft->w_s512)?"S":"-");
|
|
#endif
|
|
#if (FFT_SIZE>256)
|
|
printf("%s", (m_fft->w_s256)?"S":"-");
|
|
#endif
|
|
#if (FFT_SIZE>128)
|
|
printf("%s", (m_fft->w_s128)?"S":"-");
|
|
#endif
|
|
#if (FFT_SIZE>64)
|
|
printf("%s", (m_fft->w_s64)?"S":"-");
|
|
#endif
|
|
#if (FFT_SIZE>32)
|
|
printf("%s", (m_fft->w_s32)?"S":"-");
|
|
#endif
|
|
#if (FFT_SIZE>16)
|
|
printf("%s", (m_fft->w_s16)?"S":"-");
|
|
#endif
|
|
#if (FFT_SIZE>8)
|
|
printf("%s", (m_fft->w_s8)?"S":"-");
|
|
#endif
|
|
#if (FFT_SIZE>4)
|
|
printf("%s", (m_fft->w_s4)?"S":"-");
|
|
#endif
|
|
|
|
printf(" %s%s\n",
|
|
(m_fft->o_sync)?"\t(SYNC!)":"",
|
|
(m_fft->o_result)?" (NZ)":"");
|
|
|
|
m_data[(m_oaddr )&(FFTLEN-1)] = m_fft->o_result;
|
|
|
|
if ((m_syncd)&&((m_oaddr&(FFTLEN-1)) == FFTLEN-1)) {
|
|
dumpwrite();
|
|
checkresults();
|
|
}
|
|
|
|
return (m_fft->o_sync);
|
|
}
|
|
#endif
|
|
|
bool test(double lft_r, double lft_i, double rht_r, double rht_i) {
|
bool test(double lft_r, double lft_i, double rht_r, double rht_i) {
|
ITYP ilft, irht, ilft_r, ilft_i, irht_r, irht_i;
|
ITYP ilft, irht, ilft_r, ilft_i, irht_r, irht_i;
|
|
|
ilft_r = (ITYP)(lft_r) & ((1<<IWIDTH)-1);
|
ilft_r = (ITYP)(lft_r) & ((1<<IWIDTH)-1);
|
Line 349... |
Line 466... |
irht_i = (ITYP)(rht_i) & ((1<<IWIDTH)-1);
|
irht_i = (ITYP)(rht_i) & ((1<<IWIDTH)-1);
|
|
|
ilft = (ilft_r << IWIDTH) | ilft_i;
|
ilft = (ilft_r << IWIDTH) | ilft_i;
|
irht = (irht_r << IWIDTH) | irht_i;
|
irht = (irht_r << IWIDTH) | irht_i;
|
|
|
|
#ifdef DBLCLKFFT
|
return test(ilft, irht);
|
return test(ilft, irht);
|
|
#else
|
|
test(ilft);
|
|
return test(irht);
|
|
#endif
|
}
|
}
|
|
|
double rdata(int addr) {
|
double rdata(int addr) {
|
int index = addr & (FFTLEN-1);
|
int index = addr & (FFTLEN-1);
|
|
|
Line 403... |
Line 525... |
if (NULL == fpout) {
|
if (NULL == fpout) {
|
fprintf(stderr, "Cannot write output file, fft_tb.dbl\n");
|
fprintf(stderr, "Cannot write output file, fft_tb.dbl\n");
|
exit(-1);
|
exit(-1);
|
}
|
}
|
|
|
|
fft->opentrace("fft.vcd");
|
fft->reset();
|
fft->reset();
|
|
|
{
|
{
|
int ftlen = FFTLEN;
|
int ftlen = FFTLEN;
|
fwrite(&ftlen, 1, sizeof(int), fpout);
|
fwrite(&ftlen, 1, sizeof(int), fpout);
|
}
|
}
|
fft->dump(fpout);
|
fft->dump(fpout);
|
|
|
// 1.
|
// 1.
|
fft->test(0.0, 0.0, 32767.0, 0.0);
|
double maxv = ((1l<<(IWIDTH-1))-1l);
|
|
fft->test(0.0, 0.0, maxv, 0.0);
|
for(int k=0; k<FFTLEN/2-1; k++)
|
for(int k=0; k<FFTLEN/2-1; k++)
|
fft->test(0.0,0.0,0.0,0.0);
|
fft->test(0.0,0.0,0.0,0.0);
|
|
|
// 2. Try placing a pulse at the very end location
|
// 2. Try placing a pulse at the very end location
|
for(int k=0; k<FFTLEN/2; k++) {
|
for(int k=0; k<FFTLEN/2; k++) {
|
double cl, cr, sl, sr, W;
|
double cl, cr, sl, sr, W;
|
W = - 2.0 * M_PI / FFTLEN * (1);
|
W = - 2.0 * M_PI / FFTLEN * (1);
|
cl = cos(W * (2*k )) * 16383.0;
|
cl = cos(W * (2*k )) * (double)((1l<<(IWIDTH-2))-1l);
|
sl = sin(W * (2*k )) * 16383.0;
|
sl = sin(W * (2*k )) * (double)((1l<<(IWIDTH-2))-1l);
|
cr = cos(W * (2*k+1)) * 16383.0;
|
cr = cos(W * (2*k+1)) * (double)((1l<<(IWIDTH-2))-1l);
|
sr = sin(W * (2*k+1)) * 16383.0;
|
sr = sin(W * (2*k+1)) * (double)((1l<<(IWIDTH-2))-1l);
|
fft->test(cl, sl, cr, sr);
|
fft->test(cl, sl, cr, sr);
|
}
|
}
|
|
|
// 2.
|
// 2.
|
fft->test(32767.0, 0.0, 32767.0, 0.0);
|
fft->test(maxv, 0.0, maxv, 0.0);
|
for(int k=0; k<FFTLEN/2-1; k++)
|
for(int k=0; k<FFTLEN/2-1; k++)
|
fft->test(0.0,0.0,0.0,0.0);
|
fft->test(0.0,0.0,0.0,0.0);
|
|
|
// 3.
|
// 3.
|
fft->test(0.0,0.0,0.0,0.0);
|
fft->test(0.0,0.0,0.0,0.0);
|
fft->test(32767.0, 0.0, 0.0, 0.0);
|
fft->test(maxv, 0.0, 0.0, 0.0);
|
for(int k=0; k<FFTLEN/2-1; k++)
|
for(int k=0; k<FFTLEN/2-1; k++)
|
fft->test(0.0,0.0,0.0,0.0);
|
fft->test(0.0,0.0,0.0,0.0);
|
|
|
// 4.
|
// 4.
|
for(int k=0; k<8; k++)
|
for(int k=0; k<8; k++)
|
fft->test(32767.0, 0.0, 32767.0, 0.0);
|
fft->test(maxv, 0.0, maxv, 0.0);
|
for(int k=8; k<FFTLEN/2; k++)
|
for(int k=8; k<FFTLEN/2; k++)
|
fft->test(0.0,0.0,0.0,0.0);
|
fft->test(0.0,0.0,0.0,0.0);
|
|
|
// 5.
|
// 5.
|
if (FFTLEN/2 >= 16) {
|
if (FFTLEN/2 >= 16) {
|
for(int k=0; k<16; k++)
|
for(int k=0; k<16; k++)
|
fft->test(32767.0, 0.0, 32767.0, 0.0);
|
fft->test(maxv, 0.0, maxv, 0.0);
|
for(int k=16; k<FFTLEN/2; k++)
|
for(int k=16; k<FFTLEN/2; k++)
|
fft->test(0.0,0.0,0.0,0.0);
|
fft->test(0.0,0.0,0.0,0.0);
|
}
|
}
|
|
|
// 6.
|
// 6.
|
if (FFTLEN/2 >= 32) {
|
if (FFTLEN/2 >= 32) {
|
for(int k=0; k<32; k++)
|
for(int k=0; k<32; k++)
|
fft->test(32767.0, 0.0, 32767.0, 0.0);
|
fft->test(maxv, 0.0, maxv, 0.0);
|
for(int k=32; k<FFTLEN/2; k++)
|
for(int k=32; k<FFTLEN/2; k++)
|
fft->test(0.0,0.0,0.0,0.0);
|
fft->test(0.0,0.0,0.0,0.0);
|
}
|
}
|
|
|
// 7.
|
// 7.
|
if (FFTLEN/2 >= 64) {
|
if (FFTLEN/2 >= 64) {
|
for(int k=0; k<64; k++)
|
for(int k=0; k<64; k++)
|
fft->test(32767.0, 0.0, 32767.0, 0.0);
|
fft->test(maxv, 0.0, maxv, 0.0);
|
for(int k=64; k<FFTLEN/2; k++)
|
for(int k=64; k<FFTLEN/2; k++)
|
fft->test(0.0,0.0,0.0,0.0);
|
fft->test(0.0,0.0,0.0,0.0);
|
}
|
}
|
|
|
if (FFTLEN/2 >= 128) {
|
if (FFTLEN/2 >= 128) {
|
for(int k=0; k<128; k++)
|
for(int k=0; k<128; k++)
|
fft->test(32767.0, 0.0, 32767.0, 0.0);
|
fft->test(maxv, 0.0, maxv, 0.0);
|
for(int k=128; k<FFTLEN/2; k++)
|
for(int k=128; k<FFTLEN/2; k++)
|
fft->test(0.0,0.0,0.0,0.0);
|
fft->test(0.0,0.0,0.0,0.0);
|
}
|
}
|
|
|
if (FFTLEN/2 >= 256) {
|
if (FFTLEN/2 >= 256) {
|
for(int k=0; k<256; k++)
|
for(int k=0; k<256; k++)
|
fft->test(32767.0, 0.0, 32767.0, 0.0);
|
fft->test(maxv, 0.0, maxv, 0.0);
|
for(int k=256; k<FFTLEN/2; k++)
|
for(int k=256; k<FFTLEN/2; k++)
|
fft->test(0.0,0.0,0.0,0.0);
|
fft->test(0.0,0.0,0.0,0.0);
|
}
|
}
|
|
|
if (FFTLEN/2 >= 512) {
|
if (FFTLEN/2 >= 512) {
|
for(int k=0; k<256+128; k++)
|
for(int k=0; k<256+128; k++)
|
fft->test(32767.0, 0.0, 32767.0, 0.0);
|
fft->test(maxv, 0.0, maxv, 0.0);
|
for(int k=256+128; k<FFTLEN/2; k++)
|
for(int k=256+128; k<FFTLEN/2; k++)
|
fft->test(0.0,0.0,0.0,0.0);
|
fft->test(0.0,0.0,0.0,0.0);
|
}
|
}
|
|
|
/*
|
/*
|
Line 601... |
Line 725... |
for(int k=0; k<FFTLEN/2; k++)
|
for(int k=0; k<FFTLEN/2; k++)
|
fft->test(0.0,0.0,0.0,2.0); // Don't forget to expect a bias!
|
fft->test(0.0,0.0,0.0,2.0); // Don't forget to expect a bias!
|
|
|
// 65.
|
// 65.
|
for(int k=0; k<FFTLEN/2; k++)
|
for(int k=0; k<FFTLEN/2; k++)
|
fft->test(32767.0,0.0,-32767.0,0.0);
|
fft->test(maxv,0.0,-maxv,0.0);
|
// 66.
|
// 66.
|
for(int k=0; k<FFTLEN/2; k++)
|
for(int k=0; k<FFTLEN/2; k++)
|
fft->test(0.0,-32767.0,0.0,32767.0);
|
fft->test(0.0,-maxv,0.0,maxv);
|
// 67.
|
// 67.
|
for(int k=0; k<FFTLEN/2; k++)
|
for(int k=0; k<FFTLEN/2; k++)
|
fft->test(-32768.0,-32768.0,-32768.0,-32768.0);
|
fft->test(-maxv,-maxv,-maxv,-maxv);
|
// 68.
|
// 68.
|
for(int k=0; k<FFTLEN/2; k++)
|
for(int k=0; k<FFTLEN/2; k++)
|
fft->test(0.0,-32767.0,0.0,32767.0);
|
fft->test(0.0,-maxv,0.0,maxv);
|
// 69.
|
// 69.
|
for(int k=0; k<FFTLEN/2; k++)
|
for(int k=0; k<FFTLEN/2; k++)
|
fft->test(0.0,32767.0,0.0,-32767.0);
|
fft->test(0.0,maxv,0.0,-maxv);
|
// 70.
|
// 70.
|
for(int k=0; k<FFTLEN/2; k++)
|
for(int k=0; k<FFTLEN/2; k++)
|
fft->test(-32768.0,-32768.0,-32768.0,-32768.0);
|
fft->test(-maxv,-maxv,-maxv,-maxv);
|
|
|
// 71. Now let's go for an impulse (SUCCESS)
|
// 71. Now let's go for an impulse (SUCCESS)
|
fft->test(16384.0, 0.0, 0.0, 0.0);
|
fft->test(16384.0, 0.0, 0.0, 0.0);
|
for(int k=0; k<FFTLEN/2-1; k++)
|
for(int k=0; k<FFTLEN/2-1; k++)
|
fft->test(0.0,0.0,0.0,0.0);
|
fft->test(0.0,0.0,0.0,0.0);
|
Line 720... |
Line 844... |
|
|
|
|
|
|
fclose(fpout);
|
fclose(fpout);
|
|
|
|
if (!fft->m_syncd) {
|
|
printf("FAIL -- NO SYNC\n");
|
|
goto test_failure;
|
|
}
|
|
|
printf("SUCCESS!!\n");
|
printf("SUCCESS!!\n");
|
exit(0);
|
exit(0);
|
|
test_failure:
|
|
printf("TEST FAILED!!\n");
|
|
exit(0);
|
}
|
}
|
|
|
|
|
|
|
No newline at end of file
|
No newline at end of file
|