The problem is in XSPICE breakpoints handling and dll mode.
When ngspice is built as dll, it delegates CKTtime - CKTdelta
operation to the dll client using sharedsync call. Delta that
needs to be subtracted is passed as an olddelta argument, and
the client must subtract it if there are convergence issues.
If the client does not add a callback for this operation, default
implementation begins to work and substracts olddelta from CKTtime.
The problem is in breakpoints. When an analog breakpoint is between
the last accepted timepoint and CKTTime, then ngspice substracts
CKTdelta from CKTtime and passes 0 as olddelta to sharedsync.
It is ok. The problem is in XSPICE breakpoints. If XSPICE breakpoint is
set between the last accepted timepoint and CKTtime, then ngspice
substracts CKTdelta but pass non-zero olddelta to sharedsync.
As a result, olddelta is subtracted twice, and CKTtime becomes
less than the last accepted timepoint, which is incorrect.
The solution is to inform sharedsync call that olddelta has already
been subtracted from CKTtime during XSPICE breakpoint processing.
olddelta can't be set to 0 during XSPICE breakpoint handling because
it also takes part in the "timestep too small" check.
That is why a new flag has been introduced. It should be reset during
each iteration and set to 1 only when there are no convergence issues
and there are breakpoints between the last accepted timepoint and
CKTtime. If it is set, then DCtran knows that olddelta need to be set
to zero.
This issue has been fixed for SHARED_MODULE option only. Looks like
CLUSTER feature also uses incorrect olddelta, and it has to take into
account the XSPICE breakpoints flag. This problem has not been fixed
because we can't properly test this case.
WARNING: sharedsync is still broken if the library client decides
to use a callback for step delta managing and discard a valid
delta after the successful integration step. EVTBackup may drop
valid points in this case. The rule of thumb: do not set
GetSyncData callback in ngSpice_Init_Sync.
Replace the type of all boolean variables around the ABI by NG_BOOL.
NG_BOOL is typedefed to _Bool, when compiling shared ngspice. When
sharedspice.h is use externally NG_BOOL is typdefed to bool
This isn't currently used but can be used in various places to
automatically provide the internal API version that is used.
Normally developers doesn't want to break the API by introducing a
version bump as this means the new library isn't backward compatible
any more.
E.g. the API version can be used to enhance the name of the library,
quite often libraries with an API version 0 don't add this version to
library name (like ngspice is doing this too right now).
Doing the libtool versioning right can be a bit tedious. Especially the
correct handling of the various versions for the libtool .so naming is
difficult to understand if this part isn't done often.
To improve the API versioning adding some helping text what the various
version number are intended for and how to handle these within the
life cycle and development of the Ngspice project.
Basically libtool uses 'current', 'revision' and 'age' to version a
library.
Here a short outline how to do the libtool versioning:
Only bug fixing did happen, no new symbols were added, the new library
provide the exact amount and behaviour of the existing symbols.
--> Increase the 'revision' by 1 (c:r+1:a)
New symbols were added, the behaviour of the existing symbols doesn't
have changed.
--> Increase the 'age' by 1, set 'revision' to 0 (c:r=0,a+1)
Existing symbols behave now different or existing symbols were removed.
--> Increase 'current' by 1, set 'revison' to 0, set 'age' to 0 (c+1,r=0,a=0)
!!!Note!!!
The ABI version is also affected by this (needs a bump too, the library
isn't backward compatible any more.
There is no third node in NUMD or NUMD2, so don't set
GENnode(fast)[i]. This patch fixes a bug introduced in
4895a4b5a ("Diode model with selfheating option", 2021-04-11)
--with-readline=<location> may be given instead of --with-readline=yes
This is required when on macOS readline is installed from Homebrew.
Standard Xcode readline in macOS is not compatible with ngspice.
If --with-readline=yes is given, there is no change of behaviour
compared with previous releases.