Discovered a subtle error caused by running a setup script that

calls "equate pins".  This could fail because the routine that forces
uniqueness of pins was being called by the "compare" command but
outside of PinMatch.  Fixed by duplicating the call to force uniqueness
of pins inside the "equate" function.  Redundant calls should not
matter as uniqueness is resolved on the first call and subsequent calls
will need no further action.
This commit is contained in:
Tim Edwards 2018-04-05 10:06:32 -04:00
parent 2b15b731bb
commit 4166408576
2 changed files with 20 additions and 5 deletions

View File

@ -6393,9 +6393,13 @@ struct nlist *addproxies(struct hashlist *p, void *clientdata)
/* circuit pair has been matched with automorphisms, */
/* then some pins may be matched arbitrarily. */
/* */
/* Return 1 on success, 0 on failure. */
/* If "dolist" is 1, append the list representing the */
/* output (if any) to variable tcl_out, if it exists. */
/* */
/* Return codes: */
/* 2: Neither cell had pins, so matching is unnecessary */
/* 1: Exact match */
/* 0: Inexact match resolved by proxy pin insertion */
/*------------------------------------------------------*/
int MatchPins(struct nlist *tc1, struct nlist *tc2, int dolist)
@ -6432,7 +6436,7 @@ int MatchPins(struct nlist *tc1, struct nlist *tc2, int dolist)
if (haspins == 0) {
// Neither cell has any ports, so this is probably a top-level
// cell and there is nothing to do.
return 1;
return 2;
}
cover = (char *)CALLOC(numnodes, sizeof(char));

View File

@ -2910,15 +2910,26 @@ _netcmp_equate(ClientData clientData,
Circuit1 = tp1;
Circuit2 = tp2;
}
if (MatchPins(tp1, tp2, dolist)) {
// Check for and remove duplicate pins. Normally this is called
// from "compare", but since "equate pins" may be called outside
// of and before "compare", pin uniqueness needs to be ensured.
UniquePins(tp1->name, tp1->file);
UniquePins(tp2->name, tp2->file);
result = MatchPins(tp1, tp2, dolist);
if (result == 2) {
Fprintf(stdout, "Cells have no pins; pin matching not needed.\n");
}
else if (result > 0) {
Fprintf(stdout, "Cell pin lists are equivalent.\n");
Tcl_SetObjResult(interp, Tcl_NewBooleanObj(1));
}
else {
Fprintf(stdout, "Cell pin lists for %s and %s altered to match.\n",
name1, name2);
Tcl_SetObjResult(interp, Tcl_NewBooleanObj(0));
}
Tcl_SetObjResult(interp, Tcl_NewIntObj(result));
if (ElementClasses == NULL) {
/* Recover temporarily set global variables (see above) */
Circuit1 = SaveC1;