gnetlist: spice-sdb: Add "write-prefix" to all "write-" functions.
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
gEDA |
Confirmed
|
High
|
Unassigned |
Bug Description
The functions like write-npn-
But the simple SPICE devices like resistor, capacitor, and inductor do not.
This is inconsequential when spice-sdb is used as intended, to generate hierarchical netlists using the HOWTO that Stuart Brorson wrote. But while this HOWTO shows how to create a really nice subcircuited netlist for spice, it does not allow one to use the nice hierarchical *schematic* features of gschem (where one associates a source schematic in a symbol with "source=foo.sch" instead of a source subcircuit file with "file=foo.cir").
I tried creating a hierarchical schematic and netlisting with spice-sdb and it mostly worked, but passives like resistors and capacitors were written with device names like "S1/R1" or "S1/C1".
It was really simple to fix this by adding
immediately before the lines:
;; first write out refdes and attached nets
(spice-
This prepends an R to the refdes if the refdes doesn't already have one, which will be the case for a hierarchical netlist. Once this is done, sub-schematics containing resistors, capacitors and inductors will properly be netlisted when not using the spice-subcircuit-LL and spice-subcircuit-IO technique.
I will attach a patch that fixes these three devices, and a tar file of a project that demonstrates the use of hierarchical schematics. It is improperly netlisted by gnet-spice-sdb.scm before this patch, and netlisted in a manner that works in SPICE after applying the patch.
The patch does NOT fix other simple SPICE devices such as voltage sources (including dependent sources), switches, etc. Those will also need fixing and probably require only the addition of a single line per write-function, as with the three I've patched here.
tags: | added: gnetlist |
Changed in geda: | |
status: | New → Confirmed |
importance: | Undecided → High |
milestone: | none → 1.9.2 |
tags: | added: spice-sdb |
Changed in geda: | |
milestone: | 1.9.2 → 1.9.3 |
This file is a tar file containing a simple hierarchical schematic (a common emitter amplifier and a driver circuit for it). When netlisted with :
gnetlist -g spice-sdb CE_Amplifier.sch
the resulting netlist incorrectly has the lower-level resistors and capacitors named "S1/R1", "S1/C1", etc. SPICE will not simulate that netlist correctly, as it will treat all of those devices as switches instead.
With the attached patch, these devices are output as "RS1/R1", "CS1/C1" etc. The resulting netlist simulates properly in SPICE.
Again, my patch only fixes the three simple passives, not all of the devices that are missing "write-prefix" calls.