Author Topic: [Solved] Generating SPICE Netlists and PCB Collateral with slotting  (Read 9319 times)

0 Members and 1 Guest are viewing this topic.

Offline jeffberhowTopic starter

  • Newbie
  • Posts: 7
Hello,

I'm having a tough time generating a SPICE netlist (gnetlist) and PCB collateral (gsch2pcb) with the same schematic (gschem).

I have a dual opamp package (lm358n) that is represented in the schematic by two separate op amp symbols that have slotting enabled.

If I give each one the same refdes=U1 and separate slots, the layout in PCB is as expected: one device. BUT I can't generate a SPICE netlist without errors because the refdes are the same and separate refdes are required for simulation.

If I set the refdes of each to separate values U1/U2, the SPICE netlist looks good and simulations work. BUT PCB now shows two devices with incorrect connections.

How can I get the best of both worlds?

It'd be nice if there was a way for gnetlist to know that the same refdes and different slots should be given different refdes in spice, say U1A and U1B. Is this a feature that I'm not aware of?

Thanks,
Jeff
« Last Edit: November 28, 2020, 07:06:57 pm by jeffberhow »
 

Offline jeffberhowTopic starter

  • Newbie
  • Posts: 7
Re: Generating SPICE Netlists and PCB Collateral with slotting
« Reply #1 on: November 27, 2020, 11:12:32 pm »
Going through the backend code for spice-sdb, it seems it should be able to handle this...

Is there some configuration I'm missing? Here is my current gnetlistrc:
Code: [Select]
(hierarchy-uref-mangle "enabled")
(hierarchy-uref-order "prepend")
(hierarchy-uref-separator ":")

The spice-sdb backend code:
Code: [Select]
;; Custom get-uref function to append ".${SLOT}" where a component
;; has a "slot=${SLOT}" attribute attached.
;;
;; NOTE: Original test for appending the ".<SLOT>" was this:
;;   (let ((numslots (gnetlist:get-package-attribute package "numslots"))
;;        (slot-count (length (gnetlist:get-unique-slots package)))
;;     (if (or (string=? numslots "unknown") (string=? numslots "0"))
;;
(define get-uref
  (lambda (object)
    (let ((real_uref (gnetlist:get-uref object)))
      (if (null? (get-attrib-value-by-attrib-name object "slot"))
        real_uref
        (string-append real_uref "."
          (car (get-attrib-value-by-attrib-name object "slot")))
      )
    )
  )
)
 

Offline jeffberhowTopic starter

  • Newbie
  • Posts: 7
Re: Generating SPICE Netlists and PCB Collateral with slotting
« Reply #2 on: November 28, 2020, 07:06:29 pm »
I came across a workaround for this in some ngspice documentation. It seems like a reasonable flow.

Basically, it said to create a subckt definition that instantiates each of the opamps individually and use that subckt definition as the one that the symbol points to with attribute file.

Care has to be taken to ensure all interfaces are synced.

ngspice documentation for reference:
http://ngspice.sourceforge.net/ngspice-eeschema.html#multi
Section 8
 
The following users thanked this post: techman-001


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf