Corrected the code from version 258 which was supposed to handle

the removal of zero-valued devices between ports on the top level
(from version 254 they are ignored for levels under the top to
prevent port order from getting scrambled).  An invalid check was
being made to determine if the cells being compared were the top
of the compare queue.  This has been fixed.
This commit is contained in:
Tim Edwards 2023-10-22 10:36:54 -04:00
parent f59c9ebcb7
commit ec0e097fcf
3 changed files with 37 additions and 10 deletions

View File

@ -1 +1 @@
1.5.259
1.5.260

View File

@ -1632,6 +1632,7 @@ PrematchLists(char *name1, int file1, char *name2, int file2)
ECompList *list0X, *listX0;
int hascontents1, hascontents2;
int match, modified = 0;
int not_top;
if (file1 == -1)
tc1 = LookupCell(name1);
@ -1902,6 +1903,8 @@ PrematchLists(char *name1, int file1, char *name2, int file2)
// Remove non-matching zero-value devices. This can
// be done on a per-instance basis.
not_top = (PeekCompareQueueTop(NULL, NULL, NULL, NULL) == -1) ? FALSE : TRUE;
ecomp = (ECompare *)HashFirst(&compdict);
while (ecomp != NULL) {
if ((ecomp->num1 != ecomp->num2) && (ecomp->cell1 != NULL) &&
@ -1958,7 +1961,7 @@ PrematchLists(char *name1, int file1, char *name2, int file2)
/* because it will just show up as a */
/* port mismatch error as it should. */
if (!(tc1->flags & CELL_TOP) &&
if ((not_top == TRUE) &&
(ecomp->cell1->class != CLASS_ISOURCE)) {
int found1 = FALSE;
int found2 = FALSE;
@ -2096,6 +2099,27 @@ PrematchLists(char *name1, int file1, char *name2, int file2)
break;
}
}
/* (See comments above about removing shorts */
/* between two ports.) */
if ((not_top == TRUE) &&
(ecomp->cell2->class != CLASS_ISOURCE)) {
int found1 = FALSE;
int found2 = FALSE;
for (ob1 = tc2->cell; ob1; ob1 = ob1->next) {
if (!IsPort(ob1)) break;
else if (ob1->node == node1)
found1 = TRUE;
else if (ob1->node == node2)
found2 = TRUE;
if (found1 && found2) {
found = FALSE;
break;
}
}
}
if (found) break;
}
if (found) {

View File

@ -3773,20 +3773,23 @@ int CreateCompareQueue(char *name1, int file1, char *name2, int file2)
return 0;
}
/*----------------------------------------------*/
/* Read the top of the compare queue, but do */
/* not alter the stack. */
/*----------------------------------------------*/
/*----------------------------------------------------------------*/
/* Read the top of the compare queue, but do not alter the stack. */
/* Return -1 if there is no compare queue. This is a way to */
/* check if the current cells being checked are the topmost in */
/* the queue. Call with all NULL values for a quick check for a */
/* top-level compare. */
/*----------------------------------------------------------------*/
int PeekCompareQueueTop(char **name1, int *file1, char **name2, int *file2)
{
if (CompareQueue == NULL)
return -1;
*name1 = CompareQueue->class1;
*file1 = CompareQueue->file1;
*name2 = CompareQueue->class2;
*file2 = CompareQueue->file2;
if (name1) *name1 = CompareQueue->class1;
if (file1) *file1 = CompareQueue->file1;
if (name2) *name2 = CompareQueue->class2;
if (file2) *file2 = CompareQueue->file2;
return 0;
}