From 72ef2f2637414221361d2a5c87d9b6e66ab6b6a2 Mon Sep 17 00:00:00 2001 From: Tim Edwards Date: Sat, 10 Jul 2021 11:25:07 -0400 Subject: [PATCH 1/2] Corrected the pin matching so that it runs the same loop on unmatched pins on non-black-boxed circuits as it does not black-boxed circuits, but specifically looking for pins that are disconnected on both sides, since those do not appear in the node list and are not otherwise handled. Otherwise, disconnected pins will appear to have disappeared from the first netlist. --- VERSION | 2 +- base/netcmp.c | 63 ++++++++++++++++++++++++++++++--------------------- 2 files changed, 38 insertions(+), 27 deletions(-) diff --git a/VERSION b/VERSION index ed4d51c..b6834e4 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.5.193 +1.5.194 diff --git a/base/netcmp.c b/base/netcmp.c index 1508353..e58401d 100644 --- a/base/netcmp.c +++ b/base/netcmp.c @@ -7343,35 +7343,44 @@ int MatchPins(struct nlist *tc1, struct nlist *tc2, int dolist) /* so apply only to black-box (CELL_PLACEHOLDER) entries. */ /* (Semi-hack: Allow "!" global flag) */ - if (((tc1->flags & CELL_PLACEHOLDER) && (tc2->flags & CELL_PLACEHOLDER)) || - (NodeClasses == NULL)) { - ob1 = tc1->cell; - bangptr1 = strrchr(ob1->name, '!'); - if (bangptr1 && (*(bangptr1 + 1) == '\0')) - *bangptr1 = '\0'; - else bangptr1 = NULL; + ob1 = tc1->cell; + bangptr1 = strrchr(ob1->name, '!'); + if (bangptr1 && (*(bangptr1 + 1) == '\0')) + *bangptr1 = '\0'; + else bangptr1 = NULL; - for (i = 0; i < numorig; i++) { - if (*(cover + i) == (char)0) { - j = 0; - for (ob2 = tc2->cell; ob2 != NULL; ob2 = ob2->next) { - char *name1, *name2; + for (i = 0; i < numorig; i++) { + if (*(cover + i) == (char)0) { + j = 0; + for (ob2 = tc2->cell; ob2 != NULL; ob2 = ob2->next) { + char *name1, *name2; - if (!IsPort(ob2)) break; + if (!IsPort(ob2)) break; - bangptr2 = strrchr(ob2->name, '!'); - if (bangptr2 && (*(bangptr2 + 1) == '\0')) - *bangptr2 = '\0'; - else bangptr2 = NULL; + bangptr2 = strrchr(ob2->name, '!'); + if (bangptr2 && (*(bangptr2 + 1) == '\0')) + *bangptr2 = '\0'; + else bangptr2 = NULL; - name1 = ob1->name; - name2 = ob2->name; + name1 = ob1->name; + name2 = ob2->name; - /* Recognize proxy pins as matching */ - if (!strncmp(name1, "proxy", 5)) name1 +=5; - if (!strncmp(name2, "proxy", 5)) name2 +=5; + /* Recognize proxy pins as matching unconnected pins */ + if (!strncmp(name1, "proxy", 5) && (ob2->node == -1)) name1 +=5; + if (!strncmp(name2, "proxy", 5) && (ob1->node == -1)) name2 +=5; + + if ((*matchfunc)(name1, name2)) { + + /* If both sides have unconnected nodes, then pins with */ + /* matching names are an automatic match. Otherwise, if */ + /* matching black-box entries, then pins are always */ + /* matched by name. */ + + if (((ob1->node == -1) && (ob2->node == -1)) || + (((tc1->flags & CELL_PLACEHOLDER) && + (tc2->flags & CELL_PLACEHOLDER)) || + (NodeClasses == NULL))) { - if ((*matchfunc)(name1, name2)) { ob2->model.port = i; /* save order */ *(cover + i) = (char)1; @@ -7398,13 +7407,15 @@ int MatchPins(struct nlist *tc1, struct nlist *tc2, int dolist) Tcl_NewStringObj(ob2->name, -1)); } #endif + if (bangptr2) *bangptr2 = '!'; + break; } - if (bangptr2) *bangptr2 = '!'; - j++; } + if (bangptr2) *bangptr2 = '!'; + j++; } - ob1 = ob1->next; } + ob1 = ob1->next; if (bangptr1) *bangptr1 = '!'; } From 0a0a6bcf630ea943c540de505a9d3fbe5ea661f4 Mon Sep 17 00:00:00 2001 From: Tim Edwards Date: Sat, 10 Jul 2021 13:54:14 -0400 Subject: [PATCH 2/2] Modified the handling of missing pins (again) such that netgen continues to allow missing pins to match unconnected pins, but *only* on subcircuits below the top level. This essentially forces layouts to separate merged pins with metal resistors, although there should be an option in magic's ext2spice routine that allows "equiv" statements, when declaring equivalence of two ports, to be replaced by a zero volt source or zero ohm ideal resistor. --- base/netcmp.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/base/netcmp.c b/base/netcmp.c index e58401d..c04765b 100644 --- a/base/netcmp.c +++ b/base/netcmp.c @@ -7467,6 +7467,12 @@ int MatchPins(struct nlist *tc1, struct nlist *tc2, int dolist) if ((obt == NULL) && (notempty == 1)) { ob2->node = -2; // Will run this through cleanuppins needclean2 = 1; + + /* On the top level, missing pins are an error, even if */ + /* they appear to match unconnected pins on the other side. */ + if (CompareQueue == NULL) + result = 0; + #ifdef TCL_NETGEN if (dolist) { Tcl_ListObjAppendElement(netgeninterp, plist1,