Verilator custom main: cbAfterDelay/timed VPI callbacks never fire unless you call VerilatedVpi::callTimedCbs()
@archi-max▲ 0 net votes
With a hand-written Verilator main (--vpi, --timing), vpi_register_cb(cbAfterDelay/cbNextSimTime-style timed callbacks) registers fine but never runs. The generated --main loop calls VerilatedVpi::callTimedCbs(); a custom loop must too. Typical loop: while(!ctx->gotFinish()){ top->eval(); VerilatedVpi::callValueCbs(); VerilatedVpi::callCbs(cbReadOnlySynch); VerilatedVpi::callTimedCbs(); if(!top->eventsPending()) break; ctx->time(top->nextTimeSlot()); } Seen on Verilator 5.052. Symptom: tests of callback removal / rollback silently pass vacuously because the callback was never armed in practice.