Merge pull request #397 from garmin-mjames/skip_callbacks

Skip all removed VPI callbacks
This commit is contained in:
Stephen Williams 2020-11-30 15:04:04 -08:00 committed by GitHub
commit 8bb856f29d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 15 additions and 7 deletions

View File

@ -514,7 +514,9 @@ void vpiEndOfCompile(void) {
while (EndOfCompile) { while (EndOfCompile) {
cur = EndOfCompile; cur = EndOfCompile;
EndOfCompile = dynamic_cast<simulator_callback*>(cur->next); EndOfCompile = dynamic_cast<simulator_callback*>(cur->next);
(cur->cb_data.cb_rtn)(&cur->cb_data); if (cur->cb_data.cb_rtn != 0) {
(cur->cb_data.cb_rtn)(&cur->cb_data);
}
delete cur; delete cur;
} }
@ -534,7 +536,9 @@ void vpiStartOfSim(void) {
while (StartOfSimulation) { while (StartOfSimulation) {
cur = StartOfSimulation; cur = StartOfSimulation;
StartOfSimulation = dynamic_cast<simulator_callback*>(cur->next); StartOfSimulation = dynamic_cast<simulator_callback*>(cur->next);
(cur->cb_data.cb_rtn)(&cur->cb_data); if (cur->cb_data.cb_rtn != 0) {
(cur->cb_data.cb_rtn)(&cur->cb_data);
}
delete cur; delete cur;
} }
@ -553,10 +557,12 @@ void vpiPostsim(void) {
while (EndOfSimulation) { while (EndOfSimulation) {
cur = EndOfSimulation; cur = EndOfSimulation;
EndOfSimulation = dynamic_cast<simulator_callback*>(cur->next); EndOfSimulation = dynamic_cast<simulator_callback*>(cur->next);
/* Only set the time if it is not NULL. */ if (cur->cb_data.cb_rtn != 0) {
if (cur->cb_data.time) /* Only set the time if it is not NULL. */
vpip_time_to_timestruct(cur->cb_data.time, schedule_simtime()); if (cur->cb_data.time)
(cur->cb_data.cb_rtn)(&cur->cb_data); vpip_time_to_timestruct(cur->cb_data.time, schedule_simtime());
(cur->cb_data.cb_rtn)(&cur->cb_data);
}
delete cur; delete cur;
} }
@ -577,7 +583,9 @@ void vpiNextSimTime(void)
while (NextSimTime) { while (NextSimTime) {
cur = NextSimTime; cur = NextSimTime;
NextSimTime = dynamic_cast<simulator_callback*>(cur->next); NextSimTime = dynamic_cast<simulator_callback*>(cur->next);
(cur->cb_data.cb_rtn)(&cur->cb_data); if (cur->cb_data.cb_rtn != 0) {
(cur->cb_data.cb_rtn)(&cur->cb_data);
}
delete cur; delete cur;
} }