← Back to team overview

kicad-developers team mailing list archive

XSPICE code models in the simulator


Hi list.

KiCad uses NGSpice as a simulation engine, and NGSpice has an extension
called XSPICE which allows to create/program SPICE models in C.

Could you briefly explain what should I start looking at in KiCad to
generate a correct netlist for NGSpice to be able to use custom code

I'm asking because there is a little effort of mine [1] to provide code
models for 8-bit AVR RISC microcontrollers. There is a simulation of a
simple ATmega8A-based circuit available [2] to give you an idea how it
looks like. The circuit itself is drawn in KiCad, but I had to use NGSpice
and mcusim.cm to manually create a netlist [3] to obtain a plot.

Thanks for any help.


[1] https://github.com/mcusim/MCUSim
[2] https://raw.githubusercontent.com/mcusim/MCUSim/master/examples/ATMEGA8A-pwm-to-sine/ngspice-simulation.png
[3] https://github.com/mcusim/MCUSim/blob/master/examples/ATMEGA8A-pwm-to-sine/pwm-to-sine.cir

Follow ups