Skip to content

Commit

Permalink
Added a few lines to rebuild the node cache after removing devices
Browse files Browse the repository at this point in the history
such a zero-ohm resistors or zero-volt sources during the pre-match
phase, since the list of nodes gets changed by merging nets across
the removed devices.  Otherwise, the node-name cache gets
corrupted and random LVS errors occur.
  • Loading branch information
RTimothyEdwards committed Sep 27, 2024
1 parent 2b88d79 commit 8022e13
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 13 deletions.
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.5.277
1.5.278
36 changes: 24 additions & 12 deletions base/flatten.c
Original file line number Diff line number Diff line change
Expand Up @@ -1636,7 +1636,7 @@ PrematchLists(char *name1, int file1, char *name2, int file2)
ECompare *ecomp, *ncomp;
ECompList *list0X, *listX0;
int hascontents1, hascontents2;
int match, modified = 0;
int match, modified1 = 0, modified2 = 0;
int not_top;

if (file1 == -1)
Expand Down Expand Up @@ -1714,15 +1714,15 @@ PrematchLists(char *name1, int file1, char *name2, int file2)
" makes a better match\n", ecomp->cell1->name,
name1, file1);
flattenInstancesOf(name1, file1, ecomp->cell1->name);
modified++;
modified1++;
}
if (ecomp->cell2 && (ecomp->num2 > 0) &&
(!(ecomp->cell2->flags & CELL_PLACEHOLDER))) {
Fprintf(stdout, "Flattening instances of %s in cell %s (%d)"
" makes a better match\n", ecomp->cell2->name,
name2, file2);
flattenInstancesOf(name2, file2, ecomp->cell2->name);
modified++;
modified2++;
}
}

Expand Down Expand Up @@ -1812,7 +1812,7 @@ PrematchLists(char *name1, int file1, char *name2, int file2)
" makes a better match\n", ecomp->cell2->name,
name2, file2);
flattenInstancesOf(name2, file2, ecomp->cell2->name);
modified++;
modified2++;
}
}
}
Expand Down Expand Up @@ -1878,7 +1878,7 @@ PrematchLists(char *name1, int file1, char *name2, int file2)
" makes a better match\n", ecomp->cell1->name,
name1, file1);
flattenInstancesOf(name1, file1, ecomp->cell1->name);
modified++;
modified1++;
}
}
}
Expand Down Expand Up @@ -2032,7 +2032,7 @@ PrematchLists(char *name1, int file1, char *name2, int file2)

/* Remove from list */
ecomp->num1--;
modified++;
modified1++;

ob1 = lob;
}
Expand Down Expand Up @@ -2170,8 +2170,8 @@ PrematchLists(char *name1, int file1, char *name2, int file2)
}

/* Remove from list */
ecomp->num1--;
modified++;
ecomp->num2--;
modified2++;

ob2 = lob;
}
Expand Down Expand Up @@ -2205,7 +2205,7 @@ PrematchLists(char *name1, int file1, char *name2, int file2)
// are no other modifications, as this rule is relaxed compared to other
// rules, and the other rules should be exhaustively applied first.

if ((listX0 != NULL) && (list0X != NULL) && (modified == 0)) {
if ((listX0 != NULL) && (list0X != NULL) && ((modified1 + modified2) == 0)) {
ECompare *ecomp0X, *ecompX0;
ECompList *elist0X, *elistX0;
for (elistX0 = listX0; elistX0; elistX0 = elistX0->next) {
Expand Down Expand Up @@ -2237,7 +2237,7 @@ PrematchLists(char *name1, int file1, char *name2, int file2)
flattenInstancesOf(name1, file1, ecompX0->cell1->name);
ecompX0->num1 = 0;
ecomp0X->num1 += ecompX0->num1;
modified++;
modified1++;
break;
}
}
Expand All @@ -2263,7 +2263,7 @@ PrematchLists(char *name1, int file1, char *name2, int file2)
flattenInstancesOf(name2, file2, ecomp0X->cell2->name);
ecomp0X->num2 = 0;
ecompX0->num2 += ecomp0X->num2;
modified++;
modified2++;
break;
}
}
Expand Down Expand Up @@ -2294,5 +2294,17 @@ PrematchLists(char *name1, int file1, char *name2, int file2)
FREE(list0X);
list0X = nextptr;
}
return modified;

// If either netlist was modified, rebuild its node cache

if (modified1 > 0) {
FreeNodeNames(tc1);
CacheNodeNames(tc1);
}
if (modified2 > 0) {
FreeNodeNames(tc2);
CacheNodeNames(tc2);
}

return modified1 + modified2;
}

0 comments on commit 8022e13

Please sign in to comment.