Line 1... |
Line 1... |
////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
//
|
//
|
// Filename: mpy_tb.cpp
|
// Filename: mpy_tb.cpp
|
//
|
//
|
// Project: A General Purpose Pipelined FFT Implementation
|
// Project: A General Purpose Pipelined FFT Implementation
|
//
|
//
|
// Purpose: A test-bench for the shift and add shiftaddmpy.v subfile of
|
// Purpose: A test-bench for the shift and add shiftaddmpy.v subfile of
|
// the double clocked FFT. This file may be run autonomously.
|
// the double clocked FFT. This file may be run autonomously.
|
// If so, the last line output will either read "SUCCESS" on
|
// If so, the last line output will either read "SUCCESS" on success, or
|
// success, or some other failure message otherwise.
|
// some other failure message otherwise.
|
//
|
//
|
// This file depends upon verilator to both compile, run, and
|
// This file depends upon verilator to both compile, run, and therefore
|
// therefore test shiftaddmpy.v
|
// test shiftaddmpy.v
|
//
|
//
|
// Creator: Dan Gisselquist, Ph.D.
|
// Creator: Dan Gisselquist, Ph.D.
|
// Gisselquist Technology, LLC
|
// Gisselquist Technology, LLC
|
//
|
//
|
///////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
//
|
//
|
// Copyright (C) 2015-2018, 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
|
Line 28... |
Line 28... |
// ANY WARRANTY; without even the implied warranty of MERCHANTIBILITY or
|
// ANY WARRANTY; without even the implied warranty of MERCHANTIBILITY or
|
// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
// for more details.
|
// for more details.
|
//
|
//
|
// You should have received a copy of the GNU General Public License along
|
// 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
|
// 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
|
// target there if the PDF file isn't present.) If not, see
|
// <http://www.gnu.org/licenses/> for a copy.
|
// <http://www.gnu.org/licenses/> for a copy.
|
//
|
//
|
// License: GPL, v3, as defined and found on www.gnu.org,
|
// License: GPL, v3, as defined and found on www.gnu.org,
|
// http://www.gnu.org/licenses/gpl.html
|
// http://www.gnu.org/licenses/gpl.html
|
//
|
//
|
//
|
//
|
///////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
#include "verilated.h"
|
#include "verilated.h"
|
#include "verilated_vcd_c.h"
|
#include "verilated_vcd_c.h"
|
|
|
#include "fftsize.h"
|
#include "fftsize.h"
|
|
|
Line 101... |
Line 101... |
void tick(void) {
|
void tick(void) {
|
m_tickcount++;
|
m_tickcount++;
|
|
|
m_mpy->i_clk = 0;
|
m_mpy->i_clk = 0;
|
m_mpy->eval();
|
m_mpy->eval();
|
if (m_trace) m_trace->dump((uint64_t)(10ul*m_tickcount-2));
|
if (m_trace) m_trace->dump((vluint64_t)(10ul*m_tickcount-2));
|
m_mpy->i_clk = 1;
|
m_mpy->i_clk = 1;
|
m_mpy->eval();
|
m_mpy->eval();
|
if (m_trace) m_trace->dump((uint64_t)(10ul*m_tickcount));
|
if (m_trace) m_trace->dump((vluint64_t)(10ul*m_tickcount));
|
m_mpy->i_clk = 0;
|
m_mpy->i_clk = 0;
|
m_mpy->eval();
|
m_mpy->eval();
|
if (m_trace) {
|
if (m_trace) {
|
m_trace->dump((uint64_t)(10ul*m_tickcount+5));
|
m_trace->dump((vluint64_t)(10ul*m_tickcount+5));
|
m_trace->flush();
|
m_trace->flush();
|
}
|
}
|
}
|
}
|
|
|
void cetick(void) {
|
void cetick(void) {
|
Line 178... |
Line 178... |
|
|
int main(int argc, char **argv, char **envp) {
|
int main(int argc, char **argv, char **envp) {
|
Verilated::commandArgs(argc, argv);
|
Verilated::commandArgs(argc, argv);
|
MPYTB *tb = new MPYTB;
|
MPYTB *tb = new MPYTB;
|
|
|
tb->opentrace("mpy.vcd");
|
// tb->opentrace("mpy.vcd");
|
tb->reset();
|
tb->reset();
|
|
|
for(int k=0; k<15; k++) {
|
for(int k=0; k<15; k++) {
|
int a, b;
|
int a, b;
|
|
|