gEDA netlisting for NGspice Code Models

I came up with a little patch against the current gEDA cvs that allows for a custom format string in the spice-sdb backend for the gEDA gnetlist util. This allows you to seamlessly use code models in your spice simulations. Code models can be useful if you want to quickly cobble together a test environment for your circuit. Here are some examples:

Oneshot

  • Simple test schematic of a oneshot code model:
    oneshot.png
  • Oneshot Simulation:
    oneshot_gaw.png

V2 (red) is the clock input, when it goes high the oneshot starts a pulse the length of which is controlled by the CTL input which is from V1, the blue sloping line. As it goes higher the green output pulses get longer.

The new net-format attribute holds the custom format string. Net-format can be an unpromoted attribute in the symbol. When you make a new symbol you chose which I/O pins are single ended or differential, and set your format string appropriately. Since my version of the oneshot uses all differential IO its format string looks like this: %vd(~a ~a) %vd(~a ~a) %vd(~a ~a) %vd(~a ~a).

Integrator

  • Integrator code model test circuit:
    inttest_1.png
  • Integrator code model simulation:
    inttest_gaw.png

The blue input sine wave and it's red integral. Notice how the integrator symbol has differential input and single ended output? It's format string looks like this: %vd(~a ~a) ~a .

Differentiator

  • Differentiator test circuit:
    difftest_1.png
  • Differentiator simulation:
    difftest_gaw.png

The blue input sine wave and its green derivative.

Links:

You can find documentation on NGspice code models here: http://ngspice.sourceforge.net/docs/ngspice-manual.pdf

-- ClifCox - 2011-01-13
Topic attachments
I Attachment ActionSorted ascending Size Date Who Comment
Add-NGspice-Code-Models-netlisting-capability.txttxt Add-NGspice-Code-Models-netlisting-capability.txt manage 3.2 K 13 Jan 2011 - 19:41 ClifCox Add NGspice Device Models netlisting capability to spice-sdb
differentiator-1.symsym differentiator-1.sym manage 1.3 K 13 Jan 2011 - 20:31 ClifCox Differentiator symbol file
difftest_1.cktckt difftest_1.ckt manage 0.6 K 13 Jan 2011 - 20:32 ClifCox Differentiator spice netlist output
difftest_1.pngpng difftest_1.png manage 11.6 K 13 Jan 2011 - 20:26 ClifCox Differentiator test circuit
difftest_1.schsch difftest_1.sch manage 1.0 K 13 Jan 2011 - 20:31 ClifCox Differentiator gschem file
difftest_gaw.pngpng difftest_gaw.png manage 29.3 K 13 Jan 2011 - 20:27 ClifCox Differentiator simulation
integrator-1.symsym integrator-1.sym manage 1.4 K 13 Jan 2011 - 20:07 ClifCox Integrator symbol
inttest_1.cktckt inttest_1.ckt manage 0.6 K 13 Jan 2011 - 20:09 ClifCox Integrator ngspice netlist output
inttest_1.pngpng inttest_1.png manage 10.9 K 13 Jan 2011 - 19:52 ClifCox Integrator Code Model test circuit
inttest_1.schsch inttest_1.sch manage 1.0 K 13 Jan 2011 - 20:07 ClifCox Integrator gschem file
inttest_gaw.pngpng inttest_gaw.png manage 29.9 K 13 Jan 2011 - 20:05 ClifCox Integrator code model simulation
oneshot-1.symsym oneshot-1.sym manage 2.5 K 13 Jan 2011 - 19:31 ClifCox Oneshot Symbol
oneshot.cktckt oneshot.ckt manage 0.8 K 13 Jan 2011 - 19:34 ClifCox Oneshot NGspice netlist output
oneshot.pngpng oneshot.png manage 11.1 K 13 Jan 2011 - 18:02 ClifCox Simple schematic of a oneshot device model
oneshot.schsch oneshot.sch manage 1.7 K 13 Jan 2011 - 19:30 ClifCox Gschem oneshot schematic file
oneshot_gaw.pngpng oneshot_gaw.png manage 15.8 K 13 Jan 2011 - 18:17 ClifCox Oneshot Simulation
Topic revision: r1 - 13 Jan 2011 - 21:30:56 - ClifCox
 

This site is powered by FoswikiCopyright © by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding Eugene Maker Space Wiki? Send feedback