From cc16b82a79bae41c2978902d9d526de0bab857ce Mon Sep 17 00:00:00 2001 From: Tim Edwards Date: Sun, 25 Jul 2021 13:49:13 -0400 Subject: [PATCH] Corrected a problem in ext2spice which has been in the code for a very long time but never discovered; in which any implicit port connection into a subcell (that is otherwise labeled with ports) that appears at the end of the node list (i.e., after all the declared ports), will not be output, either in the subcircuit definition or calls. --- VERSION | 2 +- ext2spice/ext2spice.c | 13 +++++++++++-- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/VERSION b/VERSION index 7eb9f00a..074b807c 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -8.3.189 +8.3.190 diff --git a/ext2spice/ext2spice.c b/ext2spice/ext2spice.c index aa0ecc29..0f1a96b2 100644 --- a/ext2spice/ext2spice.c +++ b/ext2spice/ext2spice.c @@ -1704,7 +1704,8 @@ topVisit(def, doStub) HashSearch hs; HashEntry *he, *hep; HashTable portNameTable; - int portorder, portmax, tchars; + int portorder, portmax, tchars, implicit; + bool explicit; DevParam *plist, *pptr; char *instname; char *subcktname; @@ -1731,6 +1732,7 @@ topVisit(def, doStub) HashStartSearch(&hs); portmax = -1; + implicit = 0; while (he = HashNext(&def->def_nodes, &hs)) { @@ -1738,11 +1740,14 @@ topVisit(def, doStub) if (sname == NULL) continue; snode = sname->efnn_node; if ((!snode) || (!(snode->efnode_flags & EF_PORT))) continue; + explicit = FALSE; for (nodeName = sname; nodeName != NULL; nodeName = nodeName->efnn_next) { portorder = nodeName->efnn_port; if (portorder > portmax) portmax = portorder; + if (portorder != -1) explicit = TRUE; } + if (explicit == FALSE) implicit++; } if (portmax < 0) @@ -1791,7 +1796,7 @@ topVisit(def, doStub) /* They will be printed in numerical order. */ portorder = 0; - while (portorder <= portmax) + while (portorder <= portmax + implicit) { HashStartSearch(&hs); while (he = HashNext(&def->def_nodes, &hs)) @@ -1860,7 +1865,11 @@ topVisit(def, doStub) // and "ext2spice blackbox on" is in effect. if (esDoBlackBox == FALSE || !(def->def_flags & DEF_ABSTRACT)) + { unnumbered->efnn_port = ++portmax; + implicit--; + portorder--; /* Will loop again */ + } } } portorder++;