From 240a276431a4c0197186a344e139cb59c55009af Mon Sep 17 00:00:00 2001 From: Tim Edwards Date: Tue, 3 Mar 2020 10:50:45 -0500 Subject: [PATCH 1/5] Changed behavior of "equate pins" to detect placeholder cells as a different way of treating "black box" cells. Even when the "-blackbox" option is specified, any cell that has no definition will be treated as a black box. This allows comparison of a black-box netlist against a non-black-box netlist, such as a verilog netlist vs. a SPICE netlist, without forcing the black-box attribute on the SPICE netlist. Then, if the SPICE netlist contains cells without elements such as fill/decap/tap cells, they can be flattened and removed instead of forcing an error or requiring the use of "ignore". --- tcltk/tclnetgen.c | 30 +++++++++++++++++++++++------- 1 file changed, 23 insertions(+), 7 deletions(-) diff --git a/tcltk/tclnetgen.c b/tcltk/tclnetgen.c index 0062d07..96a6e03 100644 --- a/tcltk/tclnetgen.c +++ b/tcltk/tclnetgen.c @@ -2959,15 +2959,31 @@ _netcmp_equate(ClientData clientData, case PINS_IDX: if ((ElementClasses == NULL) && (auto_blackbox == FALSE)) { - if (CurrentCell == NULL) + if (CurrentCell == NULL) { Fprintf(stderr, "Equate elements: no current cell.\n"); - Fprintf(stderr, "Equate pins: cell %s and/or %s has no elements.\n", - name1, name2); - Tcl_SetObjResult(interp, Tcl_NewBooleanObj(0)); - return TCL_OK; + Tcl_SetObjResult(interp, Tcl_NewBooleanObj(0)); + return TCL_OK; + } + else if ((tp1->flags & CELL_PLACEHOLDER) || + (tp2->flags & CELL_PLACEHOLDER)) { + if (tp1->flags & CELL_PLACEHOLDER) { + Fprintf(stdout, "Warning: Equate pins: cell %s " + "has no definition, treated as a black box.\n", name1); + } + if (tp2->flags & CELL_PLACEHOLDER) { + Fprintf(stdout, "Warning: Equate pins: cell %s " + "has no definition, treated as a black box.\n", name2); + } + } + else { + Fprintf(stdout, "Equate pins: cell %s and/or %s " + "has no elements.\n", name1, name2); + Tcl_SetObjResult(interp, Tcl_NewBooleanObj(0)); + return TCL_OK; + } } - else if (ElementClasses == NULL) { - /* This has been called outside of a netlist compare, */ + if (ElementClasses == NULL) { + /* This may have been called outside of a netlist compare, */ /* probably to force name matching of pins on black-box */ /* devices. But MatchPins only works if tp1 == Circuit1 */ /* and tp2 == Circuit2, so preserve these values and */ From a34f08b20ade49eb153e5218052e1f55bf85014d Mon Sep 17 00:00:00 2001 From: Tim Edwards Date: Wed, 4 Mar 2020 15:17:42 -0500 Subject: [PATCH 2/5] Corrected problem in flattening code that would attempt to flatten a cell that mismatched by having zero instances. Which fails and repeats indefinitely. --- base/flatten.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/base/flatten.c b/base/flatten.c index 96bfdce..d873033 100644 --- a/base/flatten.c +++ b/base/flatten.c @@ -1539,7 +1539,7 @@ PrematchLists(char *name1, int file1, char *name2, int file2) /* (it without regard to cell1) improves the matching. */ else if ((ecomp->num1 != ecomp->num2) && (ecomp->cell2 != NULL) && - (ecomp->cell2->class == CLASS_SUBCKT)) { + (ecomp->num2 != 0) && (ecomp->cell2->class == CLASS_SUBCKT)) { ecomp->add2 = -ecomp->num2; match = 1; for (ob2 = ecomp->cell2->cell; ob2; ob2 = ob2->next) { @@ -1597,7 +1597,7 @@ PrematchLists(char *name1, int file1, char *name2, int file2) /* (it without regard to cell1) improves the matching. */ else if ((ecomp->num1 != ecomp->num2) && (ecomp->cell1 != NULL) && - (ecomp->cell1->class == CLASS_SUBCKT)) { + (ecomp->num1 != 0) && (ecomp->cell1->class == CLASS_SUBCKT)) { ecomp->add1 = -ecomp->num1; match = 1; for (ob2 = ecomp->cell1->cell; ob2; ob2 = ob2->next) { From 44673a04b605f4fcf62a752c39684f8cb64ef756 Mon Sep 17 00:00:00 2001 From: Tim Edwards Date: Wed, 4 Mar 2020 16:55:53 -0500 Subject: [PATCH 3/5] Corrected the verilog parser to handle backslash-escape notation in instance names, and to ignore bus delimiters inside backslash- escaped names when determining if a net is a bus or not. --- base/netfile.c | 1 + base/query.c | 9 ++++++--- base/verilog.c | 15 +++++++++++---- 3 files changed, 18 insertions(+), 7 deletions(-) diff --git a/base/netfile.c b/base/netfile.c index cf299a9..9413148 100644 --- a/base/netfile.c +++ b/base/netfile.c @@ -673,6 +673,7 @@ char *strdtok(char *pstring, char *delim1, char *delim2) /* accordingly (needs to be done). */ if (*s == '\\') { + s++; while (*s != '\0') { if ((*s == ' ') || (*s == '\\')) { s++; diff --git a/base/query.c b/base/query.c index f59b7f0..8517d80 100644 --- a/base/query.c +++ b/base/query.c @@ -801,9 +801,12 @@ void DescribeInstance(char *name, int file) { if (ob->node > nodemax) nodemax = ob->node; else if ((ob->node == -1) && (ob->model.port != PROXY)) { - if (disconnectednodes == 0) Fprintf(stderr, "\n"); - disconnectednodes++; - Fprintf(stderr, "Cell %s disconnected node: %s\n", tp->name, ob->name); + if (!(tp->flags & CELL_PLACEHOLDER)) + { + if (disconnectednodes == 0) Fprintf(stderr, "\n"); + disconnectednodes++; + Fprintf(stderr, "Cell %s disconnected node: %s\n", tp->name, ob->name); + } } } instlist = (unsigned char *) CALLOC((nodemax + 1), sizeof(unsigned char)); diff --git a/base/verilog.c b/base/verilog.c index fe4c979..ccecf45 100644 --- a/base/verilog.c +++ b/base/verilog.c @@ -283,7 +283,7 @@ int GetBusTok(struct bus *wb) int GetBus(char *astr, struct bus *wb) { - char *colonptr, *brackstart, *brackend, *sigend, sdelim; + char *colonptr, *brackstart, *brackend, *sigend, sdelim, *aastr; int result, start, end; if (wb == NULL) return 0; @@ -325,15 +325,22 @@ int GetBus(char *astr, struct bus *wb) return 0; } - brackstart = strchr(astr, '['); + // Delimiters may appear in backslash-escaped names. . . ignore these. + aastr = astr; + if (*aastr == '\\') { + aastr++; + while (*aastr != ' ' && *aastr != '\\' && *aastr != '\0') aastr++; + } + + brackstart = strchr(aastr, '['); if (brackstart != NULL) { - brackend = strchr(astr, ']'); + brackend = strchr(aastr, ']'); if (brackend == NULL) { Printf("Badly formed array notation \"%s\"\n", astr); return 1; } *brackend = '\0'; - colonptr = strchr(astr, ':'); + colonptr = strchr(aastr, ':'); if (colonptr) *colonptr = '\0'; result = sscanf(brackstart + 1, "%d", &start); if (colonptr) *colonptr = ':'; From 39b3bb4d96761a2408d79b76b7f341a6b1a22750 Mon Sep 17 00:00:00 2001 From: Tim Edwards Date: Wed, 4 Mar 2020 21:01:43 -0500 Subject: [PATCH 4/5] Changed behavior of MatchPins so that disconnected pins that are to be removed because they do not match pins on the other cell being compared, are marked with a different number (-2) than the usual (-1). CleanupPins then only removes those pins that are marked, rather than all disconnected pins. --- base/flatten.c | 6 +++--- base/netcmp.c | 7 ++++--- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/base/flatten.c b/base/flatten.c index d873033..bae43f5 100644 --- a/base/flatten.c +++ b/base/flatten.c @@ -1166,7 +1166,7 @@ struct nlist *cleanuppins(struct hashlist *p, void *clientdata) while (ob && obt && (ob->type > FIRSTPIN || ob == firstpin) && ob->model.class != NULL) { nob = ob->next; - if ((obt->type == PORT) && (obt->node == -1)) { + if ((obt->type == PORT) && (obt->node == -2)) { /* Remove this pin */ @@ -1238,7 +1238,7 @@ int CleanupPins(char *name, int filenum) for (ob = ThisCell->cell; ob != NULL; ob = ob->next) { if (ob->type != PORT) break; - if (ob->node == -1) { + if (ob->node == -2) { needscleanup = 1; break; } @@ -1265,7 +1265,7 @@ int CleanupPins(char *name, int filenum) } else if (ob->type != PORT) break; nob = ob->next; - if (ob->node == -1) { + if (ob->node == -2) { if (lob == NULL) { ThisCell->cell = ob->next; } diff --git a/base/netcmp.c b/base/netcmp.c index c2e8cfa..34c43f9 100644 --- a/base/netcmp.c +++ b/base/netcmp.c @@ -6729,7 +6729,7 @@ int MatchPins(struct nlist *tc1, struct nlist *tc2, int dolist) /* Make a pass through circuit 1 to find out if */ /* the pin really is connected to anything, or */ /* has been left orphaned after flattening. If */ - /* disconnected, set its node number to -1. */ + /* disconnected, set its node number to -2. */ for (obt = ob1->next; obt; obt = obt->next) { if (obt->type >= FIRSTPIN) @@ -6737,7 +6737,7 @@ int MatchPins(struct nlist *tc1, struct nlist *tc2, int dolist) break; } if (obt == NULL) { - ob1->node = -1; // Will run this through cleanuppins + ob1->node = -2; // Will run this through cleanuppins needclean1 = 1; } } @@ -6884,7 +6884,7 @@ int MatchPins(struct nlist *tc1, struct nlist *tc2, int dolist) break; } if (obt == NULL) { - ob2->node = -1; // Will run this through cleanuppins + ob2->node = -2; // Will run this through cleanuppins needclean2 = 1; continue; } @@ -6986,6 +6986,7 @@ int MatchPins(struct nlist *tc1, struct nlist *tc2, int dolist) else if (ob1 != NULL && ob1->type == PORT) { /* Disconnected node was not meaningful, has no pin match in */ /* the compared circuit, and so should be discarded. */ + ob1->node = -2; needclean1 = 1; /* Adjust numbering around removed node */ From 7d94a7d5f61e8f755d99d3898e4e41c3e4548fd4 Mon Sep 17 00:00:00 2001 From: Tim Edwards Date: Wed, 4 Mar 2020 21:06:21 -0500 Subject: [PATCH 5/5] Updated VERSION for new tarball. --- VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VERSION b/VERSION index e6502d6..26e650d 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.5.141 +1.5.142