Fix VPI timed callbacks to be one-shot, pull5.

Signed-off-by: Matthew Ballance <[email protected]>
Signed-off-by: Wilson Snyder <[email protected]>
This commit is contained in:
Matthew Ballance
2019-11-19 22:44:33 -05:00
committed by Wilson Snyder
parent 7a413a121d
commit f63dfd7028
8 changed files with 765 additions and 1 deletions
+3 -1
View File
@@ -416,7 +416,9 @@ public:
for (VpioTimedCbs::iterator it=s_s.m_timedCbs.begin(); it!=s_s.m_timedCbs.end(); ) {
if (VL_UNLIKELY(it->first <= time)) {
VerilatedVpioCb* vop = it->second;
++it; // iterator may be deleted by callback
VpioTimedCbs::iterator last_it = it;
++it; // Timed callbacks are one-shot
s_s.m_timedCbs.erase(last_it);
VL_DEBUG_IF_PLI(VL_DBG_MSGF("- vpi: timed_callback %p\n", vop););
(vop->cb_rtnp()) (vop->cb_datap());
}