From f5754446c03114456c0774ed4563799b4cb332f3 Mon Sep 17 00:00:00 2001 From: Holger Vogt Date: Fri, 31 Jul 2026 14:12:08 +0200 Subject: [PATCH] Revert "no removal of dangling capacitors/resistors when rshunt is set" This reverts commit b020c83b860288bb95c820eb5c491568f20c29e0. --- src/spicelib/analysis/cktsetup.c | 46 ++++++++------------------------ 1 file changed, 11 insertions(+), 35 deletions(-) diff --git a/src/spicelib/analysis/cktsetup.c b/src/spicelib/analysis/cktsetup.c index b3829ab79..ccdb3f9b5 100644 --- a/src/spicelib/analysis/cktsetup.c +++ b/src/spicelib/analysis/cktsetup.c @@ -50,8 +50,7 @@ Author: 1985 Thomas L. Quarles * Node degree is counted GENERICALLY over every device type through the * GENnode() terminal array, so no device family can be missed (which would * wrongly prune a live node). Only capacitors and resistors are ever removed. - * Disable with `set no_topo_reduce` in .spiceinit. It is disabled as well if - * option rshunt=xx is selected.*/ + * Disable with `set no_topo_reduce` in .spiceinit. */ static void CKTtopologyReduce(CKTcircuit *ckt) { @@ -64,11 +63,6 @@ CKTtopologyReduce(CKTcircuit *ckt) if (cp_getvar("no_topo_reduce", CP_BOOL, NULL, 0)) return; -#ifdef XSPICE - if (ckt->enh->rshunt_data.enabled) - return; -#endif - maxnode = ckt->CKTmaxEqNum; if (maxnode < 1) return; @@ -85,10 +79,8 @@ CKTtopologyReduce(CKTcircuit *ckt) continue; nterm = *(DEVices[i]->DEVpublic.terms); if (DEVices[i]->DEVpublic.name) { - if (!strcmp(DEVices[i]->DEVpublic.name, "Capacitor")) - captype = i; - else if (!strcmp(DEVices[i]->DEVpublic.name, "Resistor")) - restype = i; + if (!strcmp(DEVices[i]->DEVpublic.name, "Capacitor")) captype = i; + else if (!strcmp(DEVices[i]->DEVpublic.name, "Resistor")) restype = i; } for (gmod = ckt->CKThead[i]; gmod; gmod = gmod->GENnextModel) for (ginst = gmod->GENinstances; ginst; ginst = ginst->GENnextInstance) { @@ -118,21 +110,13 @@ CKTtopologyReduce(CKTcircuit *ckt) int pn = ci->CAPposNode, nn = ci->CAPnegNode, mode = 0; if (ci->CAPdangling) continue; - if (pn > 0 && degree[pn] == 1) - mode |= 1; - if (nn > 0 && degree[nn] == 1) - mode |= 2; + if (pn > 0 && degree[pn] == 1) mode |= 1; + if (nn > 0 && degree[nn] == 1) mode |= 2; if (!mode) continue; ci->CAPdangling = mode; - if (mode & 1) - degree[pn] = 0; - else if (pn > 0) - degree[pn]--; - if (mode & 2) - degree[nn] = 0; - else if (nn > 0) - degree[nn]--; + if (mode & 1) degree[pn] = 0; else if (pn > 0) degree[pn]--; + if (mode & 2) degree[nn] = 0; else if (nn > 0) degree[nn]--; removed_this_pass++; if (reported++ < 40) fprintf(stdout, @@ -149,21 +133,13 @@ CKTtopologyReduce(CKTcircuit *ckt) int pn = ri->RESposNode, nn = ri->RESnegNode, mode = 0; if (ri->RESdangling) continue; - if (pn > 0 && degree[pn] == 1) - mode |= 1; - if (nn > 0 && degree[nn] == 1) - mode |= 2; + if (pn > 0 && degree[pn] == 1) mode |= 1; + if (nn > 0 && degree[nn] == 1) mode |= 2; if (!mode) continue; ri->RESdangling = mode; - if (mode & 1) - degree[pn] = 0; - else if (pn > 0) - degree[pn]--; - if (mode & 2) - degree[nn] = 0; - else if (nn > 0) - degree[nn]--; + if (mode & 1) degree[pn] = 0; else if (pn > 0) degree[pn]--; + if (mode & 2) degree[nn] = 0; else if (nn > 0) degree[nn]--; removed_this_pass++; if (reported++ < 40) fprintf(stdout,