From 6c420525d0e37811f23985d4b8d6dcac37f53e4e Mon Sep 17 00:00:00 2001 From: Giles Atkinson <“gatk555@gmail.com”> Date: Sun, 7 May 2023 18:27:32 +0100 Subject: [PATCH] Apply a patch from Aleksey Morozov to fix a bug that he identified and reproduced. It is the same as Bug #331 - "XSpice skips digital output point" except that it applies to the instance queue, not the event queue. --- src/xspice/evt/evtbackup.c | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/src/xspice/evt/evtbackup.c b/src/xspice/evt/evtbackup.c index f857c6816..52ce11b97 100644 --- a/src/xspice/evt/evtbackup.c +++ b/src/xspice/evt/evtbackup.c @@ -479,17 +479,26 @@ static void EVTbackup_inst_queue( } inst_queue->next_time = next_time; - /* Update the modified list by looking for any queued events */ - /* with posted time > last_time */ + /* Update the modified list by looking for events that were processed + * or queued in the current timestep. + */ + for(i = 0, j = 0; i < num_modified; i++) { inst_index = inst_queue->modified_index[i]; inst = *(inst_queue->last_step[inst_index]); - while(inst) { - if(inst->posted_time > inst_queue->last_time) - break; - inst = inst->next; + if (inst_queue->current[inst_index] == + inst_queue->last_step[inst_index]) { + /* Nothing now removed from the queue, + * but it may have been modified by an addition. + */ + + while (inst) { + if (inst->posted_time > inst_queue->last_time) + break; + inst = inst->next; + } } if(! inst) {