Debug zero-time loop
Added by Guy Hutchison 9 months ago
I've been trying to debug what looks like a zero-time loop. I suspect the problem is in my testbench because the original code (xge mac from opencores) has a verilator testbench as well, but when I simulate my drivers & monitors only see a single clock event and from then on backtrace shows me a path to inside verilator or the systemC core:
#4 0x08056e9f in Vxge_mac::eval() () #0 0x080a801a in sc_core::sc_notify_time_compare(void const*, void const*) () #2 0x080aa100 in sc_core::sc_simcontext::simulate(sc_core::sc_time const&) () #0 0x080ac082 in sc_core::sc_simcontext::crunch(bool) ()
It appears that the last call (::crunch() ) never exits. Any ideas on what's going on here?
Replies (4)
RE: Debug zero-time loop - Added by Wilson Snyder 9 months ago
Verilator should report an error if the eval loop hangs. You can compile your model with "CPPFLAGS += -DVL_DEBUG=1" and then call Verilated::debug(1) and you'll get a number of printouts showing hopefully where it is looping.
RE: Debug zero-time loop - Added by Guy Hutchison 9 months ago
Resolved -- error between seat and keyboard. SC_CTHREAD() only calls method task once and not once per event. Thanks for the help!
RE: Debug zero-time loop - Added by Guy Hutchison 9 months ago
So, having resolved my previous issue, I'm unable to get tracing working. I'm using exactly the same code as from a previous working testbench:
/* start Verilator traces */
if (ec0.dumping) {
Verilated::traceEverOn(true);
tfp = new VerilatedVcdC;
mac0.trace(tfp, 99);
tfp->open(ec0.dumpfile_name);
}
/* start SC simulator */
sc_start();
// close dumpfile
if (ec0.dumping) {
printf ("Closing dumpfile\n");
tfp->close();
}
It creates the dumpfile, but the dump has signal definitions only and no toggle data. I can turn on Verilated debug mode and see that evaluations are happening, it just doesn't seem to get written out.
RE: Debug zero-time loop - Added by Wilson Snyder 9 months ago
If you use VerilatedVcd__C__ you need to call tfp->dump(time) yourself. If you use VarilatedVcd___Sc__ this is done for you.
(1-4/4)
![[logo]](/img/veripool_small.png)