Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@tskaar
Copy link
Contributor

@tskaar tskaar commented Jul 22, 2025

This does the same string replacement that can be seen in Component::GetSpiceNetlist, where the ground node "gnd" gets replaced by "0". This isn't an issue in NGSpice since it handles gnd as a global 0 anyways, however Xyce (by default) doesn't, so currently one can get a mix of "0" and "gnd", which then fails on Xyce.

Testbench:

Simple test schematic using IHP's PDK:

Test Schematic

On current-branch:

This gets netlisted as:
Xsg13_lv_nmos1 0 0 gnd 0 gnd IHP_PDK_nonlinear_components_sg13_lv_nmos ...

This passes simulation because we currently have two ground nodes, (hence they are connected to something), however this will not simulate as if you had these grounded.

Another possibility would be to use the option: .PREPROCESS REPLACEGROUND TRUE, which would then according to the reference manual:

The purpose of ground synonym replacement is to treat nodes with the names GND, GND!, GROUND or any
capital/lowercase variant thereof as synonyms for node 0.

With this PR:

This gets netlisted as:
Xsg13_lv_nmos1 0 0 0 0 0 IHP_PDK_nonlinear_components_sg13_lv_nmos ...

Additionally I removed the double trailing whitespace, but that's more of a cosmetic fix rather than a functional one

@ra3xdh
Copy link
Owner

ra3xdh commented Jul 23, 2025

Thanks for finding this. But please rewrite the patch using spicecompat::normalize_node_name. This function performs node rename. Use it instead of replace.

tskaar added 2 commits July 23, 2025 12:32
This change does the same string replacement as seen
in Component::getSpiceNetlist.
Additionally it fixes issues seen when using the 'gnd' component
with Xyce (which doesn't _natively_ use the gnd node as a global)
@tskaar tskaar force-pushed the dev/ts/libcomp-xyce-ground-netlist branch from 2001b66 to 889bfba Compare July 23, 2025 10:33
@tskaar
Copy link
Contributor Author

tskaar commented Jul 23, 2025

Didn't realize there was a function for that.
Pushed the change now, thanks!

@ra3xdh ra3xdh merged commit 538fb51 into ra3xdh:current Jul 23, 2025
8 checks passed
@ra3xdh ra3xdh added the xyce label Jul 23, 2025
@ra3xdh ra3xdh added this to the 25.2.0 milestone Jul 23, 2025
@ra3xdh
Copy link
Owner

ra3xdh commented Jul 23, 2025

Merged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants