When tran analysis comes close to tran stop time, i.e. CKTfinalTime, a corner case could cause CKTdelta to be set to 0 and then leads simulation abort. Let me explain:
The CKTclrBreak func makes sure CKTbreaks will have a minial size of 2, with both value to be CKTfinalTime:
if(ckt->CKTbreakSize >2) {
...
} else {
ckt->CKTbreaks[0] = ckt->CKTbreaks[1];
ckt->CKTbreaks[1] = ckt->CKTfinalTime;
}
In this case, ckt->CKTbreaks[1] - ckt->CKTbreaks[0] = 0 and below codes in Dctran could set the CKTdelta to 0, if the second condition ckt->CKTbreaks[0] - ckt->CKTtime <= ckt->CKTdelmin is meet (if the first condition is meet, we hit the CKTfinalTime and will exit before).
/* are we at a breakpoint, or indistinguishably close? */
/* if ((ckt->CKTtime == ckt->CKTbreaks[0]) || (ckt->CKTbreaks[0] - */
if ( AlmostEqualUlps( ckt->CKTtime, ckt->CKTbreaks[0], 100 ) ||
ckt->CKTbreaks[0] - ckt->CKTtime <= ckt->CKTdelmin) {
ckt->CKTorder = 1;
ckt->CKTdelta = MIN(ckt->CKTdelta, .1 * MIN(ckt->CKTsaveDelta,
ckt->CKTbreaks[1] - ckt->CKTbreaks[0]));
A simple fix is to add a check to see if ckt->CKTbreaks[1] - ckt->CKTbreaks[0] is 0. Please have a check on the patch.