Line 23... |
Line 23... |
// 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
|
Line 48... |
Line 48... |
unsigned long m_tickcount;
|
unsigned long m_tickcount;
|
|
|
TESTB(void) : m_trace(NULL), m_tickcount(0l) {
|
TESTB(void) : m_trace(NULL), m_tickcount(0l) {
|
m_core = new VA;
|
m_core = new VA;
|
Verilated::traceEverOn(true);
|
Verilated::traceEverOn(true);
|
|
m_core->i_clk = 0;
|
|
eval(); // Get our initial values set properly.
|
}
|
}
|
virtual ~TESTB(void) {
|
virtual ~TESTB(void) {
|
if (m_trace) m_trace->close();
|
if (m_trace) m_trace->close();
|
delete m_core;
|
delete m_core;
|
m_core = NULL;
|
m_core = NULL;
|
}
|
}
|
|
|
virtual void opentrace(const char *vcdname) {
|
virtual void opentrace(const char *vcdname) {
|
|
if (!m_trace) {
|
m_trace = new VerilatedVcdC;
|
m_trace = new VerilatedVcdC;
|
m_core->trace(m_trace, 99);
|
m_core->trace(m_trace, 99);
|
m_trace->open(vcdname);
|
m_trace->open(vcdname);
|
}
|
}
|
|
}
|
|
|
virtual void closetrace(void) {
|
virtual void closetrace(void) {
|
if (m_trace) {
|
if (m_trace) {
|
m_trace->close();
|
m_trace->close();
|
m_trace = NULL;
|
m_trace = NULL;
|
Line 75... |
Line 79... |
}
|
}
|
|
|
virtual void tick(void) {
|
virtual void tick(void) {
|
m_tickcount++;
|
m_tickcount++;
|
|
|
//if((m_trace)&&(m_tickcount)) m_trace->dump(10*m_tickcount-4);
|
// Make sure we have our evaluations straight before the top
|
|
// of the clock. This is necessary since some of the
|
|
// connection modules may have made changes, for which some
|
|
// logic depends. This forces that logic to be recalculated
|
|
// before the top of the clock.
|
eval();
|
eval();
|
if ((m_trace)&&(m_tickcount)) m_trace->dump(10*m_tickcount-2);
|
if (m_trace) m_trace->dump(10*m_tickcount-2);
|
m_core->i_clk = 1;
|
m_core->i_clk = 1;
|
eval();
|
eval();
|
if (m_trace) m_trace->dump(10*m_tickcount);
|
if (m_trace) m_trace->dump(10*m_tickcount);
|
m_core->i_clk = 0;
|
m_core->i_clk = 0;
|
eval();
|
eval();
|