XSPICE Port Type Modifiers and Netlist Generation

Hello,

In ngSPICE available are extra options for port type modifications and it would be great to define it for particular schematic symbol in KiCad. Also, if brackets ([ ]) could be used too, seamless generation of netlist from schematic with XSPICE models could be performed (like Multiplication block).

I found a tricky way to workaround it - I added pins with number [ and ], and I connects it to global nets [ and ], but it looks not as good as it could:

image

Better option would be different handling of Spice_Node_Sequence field:
Copy one-to-one non-number chars, and replace numbers with proper Node Names:
e.g. Spice_Node_Sequence = [1 2] 3 → A1 [ _Net… _Net…] _Net… mult

I even dig in code and changed code files to handle it in that way (KiCad 6.04):
https://drive.google.com/drive/folders/1PlMmFUO4uDNSkK1rdELKjuCVaVuW2ZfQ?usp=sharing

But after compilation using MSYS2 (no errors shown, compilation completed), launching kicad.exe gives error of missing entry point of DllMain in libidn2-0.dll. And due to this, I don’t have possibility to check if this code is even working well.

Is easier way to achieve my goal ? Or someone know how to fix error with dll ?
Is there any hope to get handling of this modifiers in next KiCad versions ?

Best Regards,
Radek

This forum forum.kicad.info is run by and dedicated to KiCad users. So I guess you will not get detailed answers here on coding KiCad.

XSPICE A device are not supported currently. Typically I would put the A devices into a subcircuit and attach this to the symbol as usual.

If you want to discuss an improvement, including code changes to KiCad, you’d better use the bug and feature request tracker at Issues · KiCad / KiCad Source Code / kicad · GitLab.

2 Likes

Thank you for answer.
Method with subckt is really more convinient but also demanding more work too.
I generate netlist from KiCad and run in at self-compiled ngSPICE with XSPICE enabled, and this improvement would be very “elegant” in this case. May it would be also more useful for others in future, when built-in ngspice.dll will have XSPICE enabled (maybe ?)
I made Issue in link given by You.
Thank you again.

Radek

Maybe I did formulate this not correctly:
ngspice.dll indeed does support XSPICE analog and digital devices.
However, the A devices are not easily enabled when attaching them as a spice model to a symbol in Eeschema.
So for now you may use the subcircuit approach.

1 Like