From 081058a41bcd95067703dd850da4967f847f03ff Mon Sep 17 00:00:00 2001 From: Tim Edwards Date: Sat, 8 Jul 2023 12:14:57 -0400 Subject: [PATCH] Corrected an issue in which ports which have the same name under the assumption of case insensitivity (e.g., VSS, Vss, and vss) are kept separate even when writing SPICE netlists, which are case insensitive. The code fix both avoids flagging these ports when running ext2spice, and more importantly, allows the use of "ext2spice short" without these ports ending up separate in the output netlist. --- VERSION | 2 +- extflat/EFbuild.c | 70 +++++++++++++++++++++++++++-------------------- extflat/EFread.c | 2 +- 3 files changed, 43 insertions(+), 31 deletions(-) diff --git a/VERSION b/VERSION index a42b25a5..e7aaabca 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -8.3.411 +8.3.412 diff --git a/extflat/EFbuild.c b/extflat/EFbuild.c index 1680c468..2ea61319 100644 --- a/extflat/EFbuild.c +++ b/extflat/EFbuild.c @@ -491,13 +491,17 @@ efBuildKill(def, name) */ void -efBuildEquiv(def, nodeName1, nodeName2, resist) +efBuildEquiv(def, nodeName1, nodeName2, resist, isspice) Def *def; /* Def for which we're adding a new node name */ char *nodeName1; /* One of node names to be made equivalent */ char *nodeName2; /* Other name to be made equivalent. One of nodeName1 * or nodeName2 must already be known. */ bool resist; /* True if "extresist on" option was selected */ + bool isspice; /* Passed from "dosubckt" in EFReadFile(), is only + * TRUE when running ext2spice. Indicates that nodes + * are case-insensitive. + */ { EFNodeName *nn1, *nn2; HashEntry *he1, *he2; @@ -543,38 +547,46 @@ efBuildEquiv(def, nodeName1, nodeName2, resist) if (nn1 && nn2 && (nn1->efnn_port >= 0) && (nn2->efnn_port >= 0) && (nn1->efnn_port != nn2->efnn_port)) { - if ((EFOutputFlags & EF_SHORT_MASK) != EF_SHORT_NONE) + equalByCase = FALSE; + if (isspice) { - int i; - int sdev; - char *argv[10], zeroarg[] = "0"; + /* If ports have the same name under the assumption of + * case-insensitivity, then just quietly merge them. + */ + if (!strcasecmp(nodeName1, nodeName2)) equalByCase = TRUE; + } + if (!equalByCase) + { + if ((EFOutputFlags & EF_SHORT_MASK) != EF_SHORT_NONE) + { + int i; + int sdev; + char *argv[10], zeroarg[] = "0"; - if ((EFOutputFlags & EF_SHORT_MASK) == EF_SHORT_R) - sdev = DEV_RES; + if ((EFOutputFlags & EF_SHORT_MASK) == EF_SHORT_R) + sdev = DEV_RES; + else + sdev = DEV_VOLT; + + for (i = 0; i < 10; i++) argv[i] = zeroarg; + argv[0] = StrDup((char **)NULL, "0.0"); + argv[1] = StrDup((char **)NULL, "dummy"); + argv[4] = StrDup((char **)NULL, nodeName1); + argv[7] = StrDup((char **)NULL, nodeName2); + efBuildDevice(def, sdev, "None", &GeoNullRect, 10, argv); + freeMagic(argv[0]); + freeMagic(argv[1]); + freeMagic(argv[4]); + freeMagic(argv[7]); + return; + } + else if (!resist) + TxError("Warning: Ports \"%s\" and \"%s\" are electrically shorted.\n", + nodeName1, nodeName2); else - sdev = DEV_VOLT; - - for (i = 0; i < 10; i++) argv[i] = zeroarg; - argv[0] = StrDup((char **)NULL, "0.0"); - argv[1] = StrDup((char **)NULL, "dummy"); - argv[4] = StrDup((char **)NULL, nodeName1); - argv[7] = StrDup((char **)NULL, nodeName2); - efBuildDevice(def, sdev, "None", &GeoNullRect, 10, argv); - freeMagic(argv[0]); - freeMagic(argv[1]); - freeMagic(argv[4]); - freeMagic(argv[7]); - return; + /* Do not merge the nodes when folding in extresist parasitics */ + return; } - else if (!resist) - { - /* Flag a strong warning */ - TxError("Warning: Ports \"%s\" and \"%s\" are electrically shorted.\n", - nodeName1, nodeName2); - } - else - /* Do not merge the nodes when folding in extresist parasitics */ - return; } /* If both names exist and are for different nodes, merge them */ diff --git a/extflat/EFread.c b/extflat/EFread.c index 415757d8..2201bf32 100644 --- a/extflat/EFread.c +++ b/extflat/EFread.c @@ -325,7 +325,7 @@ readfile: /* equiv node1 node2 */ case EQUIV: - efBuildEquiv(def, argv[1], argv[2], resist); + efBuildEquiv(def, argv[1], argv[2], resist, dosubckt); break; /* replaces "fet" (below) */