As soon as there are fields like the follows then the simulation in ngspice will not produce the configured square wave but converge to 0.
[GND_clamp]
| voltage I(typ) I(min) I(max)
|
…
-2.0000E-02 -3.9750E-10 -6.4377E-09 -4.8780E-12
0.0000E+00 0.0000E+00 0.0000E+00 0.0000E+00
3.8333E-01 0.0000E+00 0.0000E+00 0.0000E+00
7.6667E-01 0.0000E+00 0.0000E+00 0.0000E+00
1.1500E+00 0.0000E+00 0.0000E+00 0.0000E+00
1.5333E+00 0.0000E+00 0.0000E+00 0.0000E+00
1.9167E+00 0.0000E+00 0.0000E+00 0.0000E+00
2.3000E+00 0.0000E+00 0.0000E+00 0.0000E+00
2.6833E+00 0.0000E+00 0.0000E+00 0.0000E+00
3.0667E+00 0.0000E+00 0.0000E+00 0.0000E+00
3.4500E+00 0.0000E+00 0.0000E+00 0.0000E+00
3.8333E+00 0.0000E+00 0.0000E+00 0.0000E+00
4.2167E+00 0.0000E+00 0.0000E+00 0.0000E+00
4.6000E+00 0.0000E+00 0.0000E+00 0.0000E+00
I made two projects showing the effects as an example. The failing one will not be able to produce the configured square wave and the working one does… doing a diff of the two files avc1t45.ibs reveals the problem.
Failing:
IBIS is handled by Eeschema. ngspice should receive a ready-to-simulate input.
Eeschema generates two files for this purpose, U1.cache and U2.cache, both stored in C:\Users\"YourName"\AppData\Local\kicad\8.0\ibis (if you are on MS Windows, for Linux I don’t know the location). These will be used by ngspice.
In the given examples, both U1.cache are vastly different (e.g. file size working 270kB, non-working 10kB).
So this is either an IBIS model problem, a user bug or a bug in Eeschema, in its IBIS code.
I hit the same problem, but with some IBIS models that required considerable enhancements to the KiCad IBIS parser, so I couldn’t create a simple reproducer.
The problem occurs when KiCad runs a preliminary simulation to generate the Vku and Vkd pwl values used in the U1.cache file. That simulation is done on the fly in memory, so I patched KiCad to write the input deck out to a temporary file. For the models I was using, changing all the 0.0 values to a very small value (1.0e-15) didn’t always fix the problem, but changing every other 0.0 value did. Again I patched KiCad to do this for me.
The attached zip file contains those two patches, plus the temporary files created before and after applying the second patch for the test case provided here by gmarinkovic. ibis-simulation-bug.zip (27.2 KB)
The problem is apparent when you run these simulations using ngspice on the command line.
% ngspice original_input.spice
******
** ngspice-42 : Circuit level simulation program
** Compiled with KLU Direct Linear Solver
...
Warning: singular matrix: check node x2.gc_gnd0
Warning: singular matrix: check node x2.gc_gnd0
Warning: singular matrix: check node x2.gc_gnd0
doAnalyses: TRAN: Timestep too small; time = 1.6e-11, timestep = 1.25e-22: trouble with node "x1.gc_gnd0"
run simulation(s) aborted
ASCII raw file "original_output.spice"
ngspice-42 done
compared with
% ngspice modified_input.spice
******
** ngspice-42 : Circuit level simulation program
** Compiled with KLU Direct Linear Solver
...
No. of Data Rows : 5104
ASCII raw file "modified_output.spice"
ngspice-42 done
(both trimmed to just show the interesting parts).
I’m not a SPICE expert, so can’t say if the problem lies in the model KiCad generates or in ngspice.