diff --git a/base/netcmp.c b/base/netcmp.c index 81b85c6..49cdabc 100644 --- a/base/netcmp.c +++ b/base/netcmp.c @@ -618,7 +618,10 @@ struct FormattedList *FormatBadElementFragment(struct Element *E) count++; elemlist->flist[k].count = count; - elemlist->flist[k].name = ob->name + strlen(ob->instance.name) + 1; + 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++; } @@ -632,7 +635,10 @@ struct FormattedList *FormatBadElementFragment(struct Element *E) m = k; for (j = i; j < fanout; j++) { if (nodes[j] != NULL && nodes[i]->pin_magic == nodes[j]->pin_magic) { - elemlist->flist[k].name = ob2->name + strlen(ob2->instance.name) + 1; + if (*ob2->name != *ob2->instance.name) // e.g., "port_match_error" + elemlist->flist[k].name = ob2->name; + else + elemlist->flist[k].name = ob2->name + strlen(ob2->instance.name) + 1; elemlist->flist[k].permute = (char)0; elemlist->flist[k].count = -1; // Put total count at end k++; @@ -4798,7 +4804,7 @@ struct nlist *addproxies(struct hashlist *p, void *clientdata) tob = tc->cell; i = FIRSTPIN; firstpin = ob; - while (ob && (tob->type == PORT || tob->type == UNKNOWN)) { + while (tob && (tob->type == PORT || tob->type == UNKNOWN)) { if (tob->type == UNKNOWN) { obn = (struct objlist *)CALLOC(1, sizeof(struct objlist)); obn->name = (char *)MALLOC(strlen(firstpin->instance.name) @@ -4820,6 +4826,12 @@ struct nlist *addproxies(struct hashlist *p, void *clientdata) HashPtrInstall(firstpin->instance.name, firstpin, &(ptr->instdict)); } } + else if (ob == NULL) { + // This should not happen. . . + Fprintf(stdout, "Error: Premature end of pin list on instance %s.\n", + firstpin->instance.name); + break; + } else { lob = ob; ob->type = i++; diff --git a/base/query.c b/base/query.c index 0fdfa58..e0baba0 100644 --- a/base/query.c +++ b/base/query.c @@ -345,7 +345,7 @@ void ElementNodes(char *cell, char *element, int fnum) struct nlist *np; struct objlist *ob, *nob, *nob2; int ckto; - char *elementname; + char *elementname, *obname; if ((fnum == -1) && (Circuit1 != NULL) && (Circuit2 != NULL)) { ElementNodes(cell, element, Circuit1->file); @@ -368,8 +368,10 @@ void ElementNodes(char *cell, char *element, int fnum) ckto = strlen(elementname); for (ob = np->cell; ob != NULL; ob = ob->next) { - if (!strncmp(elementname, ob->name, ckto)) - if (*(ob->name + ckto) == '/' || *(ob->name + ckto) == '\0') + obname = ob->name; + if (*obname == '/') obname++; + if (!strncmp(elementname, obname, ckto)) + if (*(obname + ckto) == '/' || *(obname + ckto) == '\0') break; } if (ob == NULL) { @@ -379,13 +381,15 @@ void ElementNodes(char *cell, char *element, int fnum) Printf("Device '%s' Pins:\n", elementname); for (; ob != NULL; ob = ob->next) { - if (!strncmp(elementname, ob->name, ckto)) { - if (*(ob->name + ckto) != '/' && *(ob->name + ckto) != '\0') + obname = ob->name; + if (*obname == '/') obname++; + if (!strncmp(elementname, obname, ckto)) { + if (*(obname + ckto) != '/' && *(obname + ckto) != '\0') continue; Printf(" "); PrintObjectType(ob->type); - Printf(" (%s)", ob->name + ckto + 1); + Printf(" (%s)", obname + ckto + 1); for (nob = np->cell; nob != NULL; nob = nob->next) { if (nob->node == ob->node) { if (nob->type == NODE) { diff --git a/tcltk/netgen.tcl.in b/tcltk/netgen.tcl.in index 18bab90..fff6644 100644 --- a/tcltk/netgen.tcl.in +++ b/tcltk/netgen.tcl.in @@ -20,7 +20,11 @@ foreach i $nlist { } } -load TCL_DIR/tclnetgenSHDLIB_EXT +if {${tcl_version} >= 8.6} { + load -lazy TCL_DIR/tclnetgenSHDLIB_EXT +} else { + load TCL_DIR/tclnetgenSHDLIB_EXT +} #---------------------------------------------------------------- # Define the "lvs" command as a way of calling the netgen options