https://open-source-silicon.dev logo
Title
s

Stefan Schippers

10/20/2020, 6:55 PM
@User an interesting alternative way of backannotating ngspice operating point data into Xschem is to place
ngspice_get_expr.sym
or
ngspice_probe.sym
objects. the first one in particular allows to write an expression using tcl syntax. This makes it easy to show power, current gain, voltage diferences etc. For more advanced parameters the
ngspice_get_value.sym
allows to retrieve any item saved in a raw file, however device parameters (gm, rds etc) must be explicitly saved. For currents a
.option savecurrents
works perfecly (for not too large circuits!) so everything you need is available. These ngspice_* components use a pull method to get the simulation data, so after loading the raw file the whole hierarchy blocks shows the correct values when descended into. Xschem takes care of adding the correct path so a block with these objects shows correctly if simulated alone or if within a parent hierarchy. The bottom line is that i do not want to add simulator specific stuff into the component library as i know by experience that parameter names saved by simulators change frequently and anything that works today will fail in the near future. Funny case: ngspice raw files used different names for branch currents if generated from interactive or background runs. PS. The syntax used by ngspice for saving currents is horrible and there is a super complex algorithm for generating the full path of a hierarchical parameter given the leaf name. In addition ngspice uses all sorts of weird characters ([ ..], @) that need to be taken care of to prevent interpretation from tcl and xschem itself (the tcl quoting hell 🙂 ) . In my ideal world a current in a diode
d2
placed in a subcircuit
x1
would be
i(x1.d2)
, ngspice uses
i(@d.x1.d2[id])