From 99dcc20c0ad6782301918abf1593c68e6d2e5d35 Mon Sep 17 00:00:00 2001 From: Tim Edwards Date: Fri, 25 Jun 2021 10:27:24 -0400 Subject: [PATCH 1/3] Corrected MatchPins so that it returns an error code of 0 when pins are swapped, so that if pin names are swapped on the top level, netgen will report this as a final error message. Otherwise, the mismatch is only reported back in the pin list where it is not obvious. --- VERSION | 2 +- base/netcmp.c | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/VERSION b/VERSION index 66dd59a..af0cfc2 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.5.190 +1.5.191 diff --git a/base/netcmp.c b/base/netcmp.c index 5c0b75f..6bdd803 100644 --- a/base/netcmp.c +++ b/base/netcmp.c @@ -7225,8 +7225,13 @@ int MatchPins(struct nlist *tc1, struct nlist *tc2, int dolist) snprintf(ostr, left_col_end, "%s", obn->name); if ((*matchfunc)(obn->name, obp->name)) snprintf(ostr + left_col_end + 1, left_col_end, "%s", obp->name); - else + else { snprintf(ostr + left_col_end + 1, left_col_end, "%s **Mismatch**", obp->name); + /* Pins with different names are on different nets, + * so this should trigger an error return code. + */ + result = 0; + } for (m = 0; m < right_col_end + 1; m++) if (*(ostr + m) == '\0') *(ostr + m) = ' '; Fprintf(stdout, ostr); From c3cf6c37654e076ffd7dac77e2488ca13fc03164 Mon Sep 17 00:00:00 2001 From: Tim Edwards Date: Fri, 25 Jun 2021 12:35:11 -0400 Subject: [PATCH 2/3] Made another correction that prevents netgen from truncating the pin list that it prints in the side-by-side element mismatch comparison for an element, when there is no node record associated with the pin connection. This makes the output clearer. --- base/netcmp.c | 32 ++++++++++++++++++-------------- 1 file changed, 18 insertions(+), 14 deletions(-) diff --git a/base/netcmp.c b/base/netcmp.c index 6bdd803..ed989bc 100644 --- a/base/netcmp.c +++ b/base/netcmp.c @@ -620,15 +620,16 @@ struct FormattedList *FormatBadElementFragment(struct Element *E) for (elems = nodes[i]->node->elementlist; elems != NULL; elems = elems->next) count++; - - elemlist->flist[k].count = count; - if (*ob->name != *ob->instance.name) // e.g., "port_match_error" - elemlist->flist[k].name = ob->name; - else - elemlist->flist[k].name = ob->name + strlen(ob->instance.name) + 1; - elemlist->flist[k].permute = (char)1; - k++; } + else count = 1; + + elemlist->flist[k].count = count; + if (*ob->name != *ob->instance.name) // e.g., "port_match_error" + elemlist->flist[k].name = ob->name; + else + elemlist->flist[k].name = ob->name + strlen(ob->instance.name) + 1; + elemlist->flist[k].permute = (char)1; + k++; } else { /* handle multiple permutable pins */ struct objlist *ob2; @@ -665,13 +666,16 @@ struct FormattedList *FormatBadElementFragment(struct Element *E) struct ElementList *elems; count = 0; - if (nodes[j]->node == NULL) continue; // ? - for (elems = nodes[j]->node->elementlist; elems != NULL; - elems = elems->next) - count++; + if (nodes[j]->node == NULL) /* Under what condition is the node NULL? */ + count++; + else { + for (elems = nodes[j]->node->elementlist; elems != NULL; + elems = elems->next) + count++; + } if (count >= maxcount) { - maxcount = count; - maxindex = j; + maxcount = count; + maxindex = j; } } } From 738c1f7b3705bca2f1cc66fbc1cfb20f12d49a06 Mon Sep 17 00:00:00 2001 From: Tim Edwards Date: Fri, 25 Jun 2021 13:16:42 -0400 Subject: [PATCH 3/3] Corrected an error probably introduced into the code with the handling of multiple devices during flattening, that will skip over a node record at the end of a subcircuit call being flattened and therefore remove it from the netlist. --- base/flatten.c | 5 ++++- base/netcmp.c | 1 - 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/base/flatten.c b/base/flatten.c index 4bf3fb6..f21c807 100644 --- a/base/flatten.c +++ b/base/flatten.c @@ -344,7 +344,10 @@ int flattenInstancesOf(char *name, int fnum, char *instance) /* Find the end record of the parent cell and save it */ for (ParentEnd = (ParentProps) ? ParentProps : ParentParams; - ParentEnd && ParentEnd->next && ParentEnd->next->type != FIRSTPIN; + ParentEnd && ParentEnd->next && + /* Stop on a node or the next instance */ + ((ParentEnd->next->type > FIRSTPIN) || + (ParentEnd->next->type == PROPERTY)); ParentEnd = ParentEnd->next); /* Not primitive, so need to flatten this instance */ diff --git a/base/netcmp.c b/base/netcmp.c index ed989bc..4ea9003 100644 --- a/base/netcmp.c +++ b/base/netcmp.c @@ -621,7 +621,6 @@ struct FormattedList *FormatBadElementFragment(struct Element *E) elems = elems->next) count++; } - else count = 1; elemlist->flist[k].count = count; if (*ob->name != *ob->instance.name) // e.g., "port_match_error"