From ab614b63f750fc5d84079dca71708cbca046f7a0 Mon Sep 17 00:00:00 2001 From: Tim Edwards Date: Sun, 19 Dec 2021 16:25:32 -0500 Subject: [PATCH] Corrected the last commit (again) because FlattenUnmatched() should not be called after CreateTwoLists(). CreateTwoLists() was being called in one case only to print the contents of the cells, so that part was pulled out into a separate routine. --- VERSION | 2 +- base/netcmp.c | 27 ++++++++++++++++++--------- base/netcmp.h | 1 + base/query.c | 2 +- tcltk/tclnetgen.c | 14 +++++++------- 5 files changed, 28 insertions(+), 18 deletions(-) diff --git a/VERSION b/VERSION index 7e161b8..37c8b13 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.5.212 +1.5.213 diff --git a/base/netcmp.c b/base/netcmp.c index e95f3ef..9b7456d 100644 --- a/base/netcmp.c +++ b/base/netcmp.c @@ -3758,8 +3758,23 @@ void RemoveCompareQueue() 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) @@ -3771,14 +3786,6 @@ void CreateTwoLists(char *name1, int file1, char *name2, int file2, int dolist) 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) tc1 = LookupCell(name1); else @@ -7938,6 +7945,7 @@ int Compare(char *cell1, char *cell2) { int automorphisms; + DescribeContents(cell1, -1, cell2, -1); CreateTwoLists(cell1, -1, cell2, -1, 0); Permute(); while (!Iterate()); @@ -7998,6 +8006,7 @@ void NETCOMP(void) case 'c': promptstring("Enter cell 1: ",name); promptstring("Enter cell 2: ",name2); + DescribeContents(name, -1, name2, -1); CreateTwoLists(name, -1, name2, -1, 0); #ifdef DEBUG_ALLOC PrintCoreStats(); diff --git a/base/netcmp.h b/base/netcmp.h index df77fdd..35ff986 100644 --- a/base/netcmp.h +++ b/base/netcmp.h @@ -26,6 +26,7 @@ extern void PrintCoreStats(void); extern void ResetState(void); extern void CreateTwoLists(char *name1, int file1, char *name2, int file2, int dolist); +extern void DescribeContents(char *name1, int file1, char *name2, int file2); extern int Iterate(void); extern int VerifyMatching(void); extern void PrintAutomorphisms(void); diff --git a/base/query.c b/base/query.c index 55147cd..1ab7979 100644 --- a/base/query.c +++ b/base/query.c @@ -805,7 +805,7 @@ void DescribeInstance(char *name, int file) /* All black-box modules and placeholders by definition have all */ /* 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"); disconnectednodes++; diff --git a/tcltk/tclnetgen.c b/tcltk/tclnetgen.c index a75fa14..f6c573c 100644 --- a/tcltk/tclnetgen.c +++ b/tcltk/tclnetgen.c @@ -2196,10 +2196,8 @@ _netcmp_compare(ClientData clientData, ConvertGlobals(name2, fnum2); } - if (tp1 == NULL) tp1 = LookupCellFile(name1, fnum1); - if (tp2 == NULL) tp2 = LookupCellFile(name2, fnum2); - - CreateTwoLists(name1, fnum1, name2, fnum2, dolist); + tp1 = LookupCellFile(name1, fnum1); + tp2 = LookupCellFile(name2, fnum2); hascontents1 = HasContents(tp1); hascontents2 = HasContents(tp2); @@ -2215,15 +2213,17 @@ _netcmp_compare(ClientData clientData, 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"); - CreateTwoLists(name1, fnum1, name2, fnum2, dolist); - FlattenUnmatched(tp1, name1, 0, 0); - FlattenUnmatched(tp2, name2, 0, 0); + 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 // hierarchical". If "-list" was specified, then append the output