Currently ngspice contains 68 code models, ranging from simple elements like analog gain cells or digital inverters up to complex ones like a digital state machine , SRAMs, 3D table models or interfaces to digital Verilog building blocks compiled with Verilator.
I have created a symbol library for KiCad 8, containing digital and hybrid symbols. It is accompanied by the associated simulation model library. Enhancement by analog symbols and models will follow.
Both symbols and models are made to be integrated into the KiCad symbol library. Therefore the installation even now requires to copy both files (Simulation_XSPICE.kicad_sym and Simulation_XSPICE.sp) into the location where the standard symbol library resides (e.g. C:\Program Files\KiCad\8.0\share\kicad\symbols on MS Windows). Then they have to be added to the available libraries by Eeschema → Preferences → Manage Symbol libraries → + → Select the library path and add a nickname (Simulation_XSPICE for example).
Yes, it may happen that these files are deleted when updating KiCad. Then just copy them and attch them again into this directory. However,. after updating and installing KiCad 8.0.7 (MS Windows), the Simulation_XSPICE files are still present.
Below you will find some projects using the new symbols and models, tested with KiCad 8.06 on MS Windows 10.
Plotting is sometimes done using a ngspice script writing a VCD file and then starting GTKWAVE to plot it. The Eeschema plotter currently does not support plotting digital data (except for you will change them to analog by adding a resistor to the specific node).
Thank you Holger for this fantastic contribution.
A couple of questions and comments (feel free to delete this post when read):
I copied your files to the global symbol libraries and added it to the links.
This last release is missing A_int for me.
Also, the reference in the symbol to the spice model is a KiCad 8 library. Perhaps KiCad 9 is more suitable now?
Will this be part of a future release of KiCad?
Nice @holder. I miss the “Laplace primitive” (as I remember being called in some other EDAs) in the library, which allowed me to simulate control logic with some circuits.
Advancing the discussion, “U*” cold not be the most appropriated reference name since it is not direct related to a chip but a logic of simulation or be assembled (maybe a better could be X or M, but it is necessary to check the standard for this).
I propose a simple “difference symbol” for the operator (with gain=1). The idea could be also used to the “sum symbol operator”
About the integrator, I propose a more “formal symbol” or even a version with single input (since the integrative effect of a difference could be created by a concatenation of a difference and integrator).
The last, the AD and DA, I like use the symbology that the manufactures use into the datasheets (also some books of the area). If it is need a analog + and - (not just the signal reference to 0V of the simulation), follow the propose.
What is the “Laplace primitive”? As this symbol library is meant to provides symbols for code models available and integrated into ngspice, what code model may be referenced with such a symbol (see chapter 8.2 of the ngspice manual for available analog models)?
From the simulator standpoint, letters X or M are dedicated to subcircuit calls or MOS devices, so should not be used for this library. If U is not acceptable, it may become A (as code models are referenced by letter A anyway). What “standard” are you referencing here?
For the integrator symbol U2 is fine. U7 (and U12) may be acceptable as well. I would keep the differential input however. Of course you may compose it from different symbols, but this is not efficient from a simulating standpoint, as the code models offer differential input (and even differential output, not used here) in a single model.
U11 and U12 may be o.k.
I do not like U14, would prefer U13, maybe with the larger cross from U14 inside.