Merge branch 'master' into netgen-1.5
This commit is contained in:
commit
8ed4e3cf38
|
|
@ -1421,11 +1421,27 @@ typedef struct ecomplist {
|
||||||
ECompListPtr next;
|
ECompListPtr next;
|
||||||
} ECompList;
|
} ECompList;
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------*/
|
||||||
|
/* Determine if a cell contains at least one device or subcircuit */
|
||||||
|
/*----------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
int
|
||||||
|
HasContents(struct nlist *tc)
|
||||||
|
{
|
||||||
|
struct objlist *ob;
|
||||||
|
|
||||||
|
for (ob = tc->cell; ob; ob = ob->next)
|
||||||
|
if (ob->type == FIRSTPIN)
|
||||||
|
return TRUE;
|
||||||
|
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
/*------------------------------------------------------*/
|
/*------------------------------------------------------*/
|
||||||
/* Survey the contents of a cell and sort into a hash */
|
/* Survey the contents of a cell and sort into a hash */
|
||||||
/*------------------------------------------------------*/
|
/*------------------------------------------------------*/
|
||||||
|
|
||||||
int
|
void
|
||||||
SurveyCell(struct nlist *tc, struct hashdict *compdict, int file1, int file2, int which)
|
SurveyCell(struct nlist *tc, struct hashdict *compdict, int file1, int file2, int which)
|
||||||
{
|
{
|
||||||
struct objlist *ob;
|
struct objlist *ob;
|
||||||
|
|
@ -1433,12 +1449,10 @@ SurveyCell(struct nlist *tc, struct hashdict *compdict, int file1, int file2, in
|
||||||
ECompare *ecomp, *qcomp, *ncomp;
|
ECompare *ecomp, *qcomp, *ncomp;
|
||||||
int file = (which == 0) ? file1 : file2;
|
int file = (which == 0) ? file1 : file2;
|
||||||
int ofile = (which == 0) ? file2 : file1;
|
int ofile = (which == 0) ? file2 : file1;
|
||||||
int retval = FALSE;
|
|
||||||
char *dstr;
|
char *dstr;
|
||||||
|
|
||||||
for (ob = tc->cell; ob; ob = ob->next) {
|
for (ob = tc->cell; ob; ob = ob->next) {
|
||||||
if (ob->type == FIRSTPIN) {
|
if (ob->type == FIRSTPIN) {
|
||||||
retval = TRUE; /* Cell has at least one device or subcircuit */
|
|
||||||
tsub = LookupCellFile(ob->model.class, file);
|
tsub = LookupCellFile(ob->model.class, file);
|
||||||
if (tsub->flags & CELL_DUPLICATE) {
|
if (tsub->flags & CELL_DUPLICATE) {
|
||||||
// Always register a duplicate under the original name
|
// Always register a duplicate under the original name
|
||||||
|
|
@ -1492,7 +1506,6 @@ SurveyCell(struct nlist *tc, struct hashdict *compdict, int file1, int file2, in
|
||||||
if (dstr) *dstr = '[';
|
if (dstr) *dstr = '[';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return retval;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*------------------------------------------------------*/
|
/*------------------------------------------------------*/
|
||||||
|
|
@ -1540,28 +1553,10 @@ PrematchLists(char *name1, int file1, char *name2, int file2)
|
||||||
listX0 = list0X = NULL;
|
listX0 = list0X = NULL;
|
||||||
|
|
||||||
// Gather information about instances of cell "name1"
|
// Gather information about instances of cell "name1"
|
||||||
hascontents1 = SurveyCell(tc1, &compdict, file1, file2, 0);
|
SurveyCell(tc1, &compdict, file1, file2, 0);
|
||||||
|
|
||||||
// Gather information about instances of cell "name2"
|
// Gather information about instances of cell "name2"
|
||||||
hascontents2 = SurveyCell(tc2, &compdict, file1, file2, 1);
|
SurveyCell(tc2, &compdict, file1, file2, 1);
|
||||||
|
|
||||||
// If one cell has no contents, then flattening the other
|
|
||||||
// isn't going to improve anything, so stop here.
|
|
||||||
|
|
||||||
if (!hascontents1 && !hascontents2 && (tc1->flags & CELL_PLACEHOLDER)
|
|
||||||
&& (tc2->flags & CELL_PLACEHOLDER)) {
|
|
||||||
goto done;
|
|
||||||
}
|
|
||||||
else if (hascontents1 && !hascontents2 && (tc2->flags & CELL_PLACEHOLDER)) {
|
|
||||||
Fprintf(stdout, "Circuit 2 cell %s is a black box; will not flatten "
|
|
||||||
"Circuit 1\n", name2);
|
|
||||||
goto done;
|
|
||||||
}
|
|
||||||
else if (hascontents2 && !hascontents1 && (tc1->flags & CELL_PLACEHOLDER)) {
|
|
||||||
Fprintf(stdout, "Circuit 1 cell %s is a black box; will not flatten "
|
|
||||||
"Circuit 2\n", name1);
|
|
||||||
goto done;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Find all instances of one cell that have fewer in
|
// Find all instances of one cell that have fewer in
|
||||||
// the compared circuit. Check whether subcircuits
|
// the compared circuit. Check whether subcircuits
|
||||||
|
|
|
||||||
|
|
@ -3,5 +3,6 @@
|
||||||
|
|
||||||
extern int UniquePins(char *name, int filenum);
|
extern int UniquePins(char *name, int filenum);
|
||||||
extern void flattenCell(char *name, int file);
|
extern void flattenCell(char *name, int file);
|
||||||
|
extern int HasContents(struct nlist *);
|
||||||
|
|
||||||
#endif /* _FLATTEN_H */
|
#endif /* _FLATTEN_H */
|
||||||
|
|
|
||||||
|
|
@ -3758,8 +3758,23 @@ void RemoveCompareQueue()
|
||||||
CompareQueue = NULL;
|
CompareQueue = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------*/
|
||||||
|
/* Output a summary of the contents of the two circuits being compared */
|
||||||
|
/*----------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
void DescribeContents(char *name1, int file1, char *name2, int file2)
|
||||||
|
{
|
||||||
|
Fprintf(stdout, "\n"); // blank line before new circuit diagnostics in log file
|
||||||
|
/* print preliminary statistics */
|
||||||
|
Printf("\nContents of circuit 1: ");
|
||||||
|
DescribeInstance(name1, file1);
|
||||||
|
Printf("Contents of circuit 2: ");
|
||||||
|
DescribeInstance(name2, file2);
|
||||||
|
Printf("\n");
|
||||||
|
}
|
||||||
|
|
||||||
/*----------------------------------*/
|
/*----------------------------------*/
|
||||||
/* create an initial data structure */
|
/* Create an initial data structure */
|
||||||
/*----------------------------------*/
|
/*----------------------------------*/
|
||||||
|
|
||||||
void CreateTwoLists(char *name1, int file1, char *name2, int file2, int dolist)
|
void CreateTwoLists(char *name1, int file1, char *name2, int file2, int dolist)
|
||||||
|
|
@ -3771,14 +3786,6 @@ void CreateTwoLists(char *name1, int file1, char *name2, int file2, int dolist)
|
||||||
|
|
||||||
ResetState();
|
ResetState();
|
||||||
|
|
||||||
Fprintf(stdout, "\n"); // blank line before new circuit diagnostics in log file
|
|
||||||
/* print preliminary statistics */
|
|
||||||
Printf("\nContents of circuit 1: ");
|
|
||||||
DescribeInstance(name1, file1);
|
|
||||||
Printf("Contents of circuit 2: ");
|
|
||||||
DescribeInstance(name2, file2);
|
|
||||||
Printf("\n");
|
|
||||||
|
|
||||||
if (file1 == -1)
|
if (file1 == -1)
|
||||||
tc1 = LookupCell(name1);
|
tc1 = LookupCell(name1);
|
||||||
else
|
else
|
||||||
|
|
@ -7938,6 +7945,7 @@ int Compare(char *cell1, char *cell2)
|
||||||
{
|
{
|
||||||
int automorphisms;
|
int automorphisms;
|
||||||
|
|
||||||
|
DescribeContents(cell1, -1, cell2, -1);
|
||||||
CreateTwoLists(cell1, -1, cell2, -1, 0);
|
CreateTwoLists(cell1, -1, cell2, -1, 0);
|
||||||
Permute();
|
Permute();
|
||||||
while (!Iterate());
|
while (!Iterate());
|
||||||
|
|
@ -7998,6 +8006,7 @@ void NETCOMP(void)
|
||||||
case 'c':
|
case 'c':
|
||||||
promptstring("Enter cell 1: ",name);
|
promptstring("Enter cell 1: ",name);
|
||||||
promptstring("Enter cell 2: ",name2);
|
promptstring("Enter cell 2: ",name2);
|
||||||
|
DescribeContents(name, -1, name2, -1);
|
||||||
CreateTwoLists(name, -1, name2, -1, 0);
|
CreateTwoLists(name, -1, name2, -1, 0);
|
||||||
#ifdef DEBUG_ALLOC
|
#ifdef DEBUG_ALLOC
|
||||||
PrintCoreStats();
|
PrintCoreStats();
|
||||||
|
|
|
||||||
|
|
@ -26,6 +26,7 @@ extern void PrintCoreStats(void);
|
||||||
extern void ResetState(void);
|
extern void ResetState(void);
|
||||||
extern void CreateTwoLists(char *name1, int file1, char *name2, int file2,
|
extern void CreateTwoLists(char *name1, int file1, char *name2, int file2,
|
||||||
int dolist);
|
int dolist);
|
||||||
|
extern void DescribeContents(char *name1, int file1, char *name2, int file2);
|
||||||
extern int Iterate(void);
|
extern int Iterate(void);
|
||||||
extern int VerifyMatching(void);
|
extern int VerifyMatching(void);
|
||||||
extern void PrintAutomorphisms(void);
|
extern void PrintAutomorphisms(void);
|
||||||
|
|
@ -46,6 +47,7 @@ extern int CreateCompareQueue(char *, int, char *, int);
|
||||||
extern int GetCompareQueueTop(char **, int *, char **, int *);
|
extern int GetCompareQueueTop(char **, int *, char **, int *);
|
||||||
extern int PeekCompareQueueTop(char **, int *, char **, int *);
|
extern int PeekCompareQueueTop(char **, int *, char **, int *);
|
||||||
extern void RemoveCompareQueue();
|
extern void RemoveCompareQueue();
|
||||||
|
extern int FlattenUnmatched(struct nlist *, char *, int, int);
|
||||||
|
|
||||||
extern void PrintIllegalClasses();
|
extern void PrintIllegalClasses();
|
||||||
extern void PrintIllegalNodeClasses();
|
extern void PrintIllegalNodeClasses();
|
||||||
|
|
|
||||||
|
|
@ -805,7 +805,7 @@ void DescribeInstance(char *name, int file)
|
||||||
/* All black-box modules and placeholders by definition have all */
|
/* All black-box modules and placeholders by definition have all */
|
||||||
/* disconnected pins, so don't report those. */
|
/* disconnected pins, so don't report those. */
|
||||||
|
|
||||||
if (!(tp->flags & CELL_PLACEHOLDER) && (tp->class != CLASS_MODULE))
|
if ((!(tp->flags & CELL_PLACEHOLDER)) && (tp->class != CLASS_MODULE))
|
||||||
{
|
{
|
||||||
//if (disconnectednodes == 0) Fprintf(stderr, "\n");
|
//if (disconnectednodes == 0) Fprintf(stderr, "\n");
|
||||||
disconnectednodes++;
|
disconnectednodes++;
|
||||||
|
|
|
||||||
|
|
@ -2095,8 +2095,9 @@ _netcmp_compare(ClientData clientData,
|
||||||
int dohierarchy = FALSE;
|
int dohierarchy = FALSE;
|
||||||
int assignonly = FALSE;
|
int assignonly = FALSE;
|
||||||
int argstart = 1, qresult, llen, result;
|
int argstart = 1, qresult, llen, result;
|
||||||
|
int hascontents1, hascontents2;
|
||||||
struct Correspond *nextcomp;
|
struct Correspond *nextcomp;
|
||||||
struct nlist *tp;
|
struct nlist *tp1 = NULL, *tp2 = NULL;
|
||||||
Tcl_Obj *flist = NULL;
|
Tcl_Obj *flist = NULL;
|
||||||
|
|
||||||
if (objc > 1) {
|
if (objc > 1) {
|
||||||
|
|
@ -2139,24 +2140,24 @@ _netcmp_compare(ClientData clientData,
|
||||||
}
|
}
|
||||||
else if ((objc - argstart) == 2) {
|
else if ((objc - argstart) == 2) {
|
||||||
|
|
||||||
result = CommonParseCell(interp, objv[argstart], &tp, &fnum1);
|
result = CommonParseCell(interp, objv[argstart], &tp1, &fnum1);
|
||||||
if (result != TCL_OK) return TCL_ERROR;
|
if (result != TCL_OK) return TCL_ERROR;
|
||||||
else if (fnum1 == -1) {
|
else if (fnum1 == -1) {
|
||||||
Tcl_SetResult(interp, "Cannot use wildcard with compare command.\n",
|
Tcl_SetResult(interp, "Cannot use wildcard with compare command.\n",
|
||||||
NULL);
|
NULL);
|
||||||
return TCL_ERROR;
|
return TCL_ERROR;
|
||||||
}
|
}
|
||||||
name1 = tp->name;
|
name1 = tp1->name;
|
||||||
argstart++;
|
argstart++;
|
||||||
|
|
||||||
result = CommonParseCell(interp, objv[argstart], &tp, &fnum2);
|
result = CommonParseCell(interp, objv[argstart], &tp2, &fnum2);
|
||||||
if (result != TCL_OK) return TCL_ERROR;
|
if (result != TCL_OK) return TCL_ERROR;
|
||||||
else if (fnum2 == -1) {
|
else if (fnum2 == -1) {
|
||||||
Tcl_SetResult(interp, "Cannot use wildcard with compare command.\n",
|
Tcl_SetResult(interp, "Cannot use wildcard with compare command.\n",
|
||||||
NULL);
|
NULL);
|
||||||
return TCL_ERROR;
|
return TCL_ERROR;
|
||||||
}
|
}
|
||||||
name2 = tp->name;
|
name2 = tp2->name;
|
||||||
|
|
||||||
if (dohierarchy) {
|
if (dohierarchy) {
|
||||||
RemoveCompareQueue();
|
RemoveCompareQueue();
|
||||||
|
|
@ -2195,12 +2196,34 @@ _netcmp_compare(ClientData clientData,
|
||||||
ConvertGlobals(name2, fnum2);
|
ConvertGlobals(name2, fnum2);
|
||||||
}
|
}
|
||||||
|
|
||||||
CreateTwoLists(name1, fnum1, name2, fnum2, dolist);
|
tp1 = LookupCellFile(name1, fnum1);
|
||||||
while (PrematchLists(name1, fnum1, name2, fnum2) > 0) {
|
tp2 = LookupCellFile(name2, fnum2);
|
||||||
Fprintf(stdout, "Making another compare attempt.\n");
|
|
||||||
Printf("Flattened mismatched instances and attempting compare again.\n");
|
hascontents1 = HasContents(tp1);
|
||||||
CreateTwoLists(name1, fnum1, name2, fnum2, dolist);
|
hascontents2 = HasContents(tp2);
|
||||||
|
|
||||||
|
if (hascontents1 && !hascontents2 && (tp2->flags & CELL_PLACEHOLDER)) {
|
||||||
|
Fprintf(stdout, "Circuit 2 cell %s is a black box; will not flatten "
|
||||||
|
"Circuit 1\n", name2);
|
||||||
}
|
}
|
||||||
|
else if (hascontents2 && !hascontents1 && (tp1->flags & CELL_PLACEHOLDER)) {
|
||||||
|
Fprintf(stdout, "Circuit 1 cell %s is a black box; will not flatten "
|
||||||
|
"Circuit 2\n", name1);
|
||||||
|
}
|
||||||
|
else if (hascontents1 || hascontents2) {
|
||||||
|
FlattenUnmatched(tp1, name1, 1, 0);
|
||||||
|
FlattenUnmatched(tp2, name2, 1, 0);
|
||||||
|
DescribeContents(name1, fnum1, name2, fnum2);
|
||||||
|
|
||||||
|
while (PrematchLists(name1, fnum1, name2, fnum2) > 0) {
|
||||||
|
Fprintf(stdout, "Making another compare attempt.\n");
|
||||||
|
Printf("Flattened mismatched instances and attempting compare again.\n");
|
||||||
|
FlattenUnmatched(tp1, name1, 1, 0);
|
||||||
|
FlattenUnmatched(tp2, name2, 1, 0);
|
||||||
|
DescribeContents(name1, fnum1, name2, fnum2);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
CreateTwoLists(name1, fnum1, name2, fnum2, dolist);
|
||||||
|
|
||||||
// Return the names of the two cells being compared, if doing "compare
|
// Return the names of the two cells being compared, if doing "compare
|
||||||
// hierarchical". If "-list" was specified, then append the output
|
// hierarchical". If "-list" was specified, then append the output
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue