From 6d2ef396efcb573bedf26c38f85dd952f3f549e0 Mon Sep 17 00:00:00 2001 From: Tim Edwards Date: Fri, 27 Dec 2024 16:20:00 -0500 Subject: [PATCH] After giving the previous code change some more thought, I decided that it is beneficial to break symmetries by net name; it's just that net names should not be used before all symmetries related to pins have been broken. So I rewrote the compare routine to take an argument allowing or disallowing net name matches, and make one call to break symmetries by pin name followed by another call to break symmetries by net name. This still solves the original problem, but does not allow symmetries to be broken randomly on internal nets if names have been matched in both netlists. Otherwise the output may report nets that appear to be swapped, making the output confusing. --- VERSION | 2 +- base/netcmp.c | 7 ++++++- base/netcmp.h | 2 +- tcltk/tclnetgen.c | 8 +++++++- 4 files changed, 15 insertions(+), 4 deletions(-) diff --git a/VERSION b/VERSION index 74884a5..338640b 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.5.288 +1.5.289 diff --git a/base/netcmp.c b/base/netcmp.c index 35b0bf9..0fa925a 100644 --- a/base/netcmp.c +++ b/base/netcmp.c @@ -6567,11 +6567,16 @@ void PrintAutomorphisms(void) * separating out those devices that are connected to matching pins * in each circuit. * + * If match_nets == TRUE, then also match internal nets by name. Pins + * should always be matched by name without considering nets first; + * once all symmetries related to pins have been broken, then matching + * symmetries by net can keep the output from looking confusing. + * * Return value is the same as VerifyMatching() *------------------------------------------------------------------------- */ -int ResolveAutomorphsByPin() +int ResolveAutomorphsByPin(int match_nets) { struct NodeClass *NC; struct Node *N; diff --git a/base/netcmp.h b/base/netcmp.h index 3aa7a82..6d90178 100644 --- a/base/netcmp.h +++ b/base/netcmp.h @@ -62,7 +62,7 @@ extern void RegroupDataStructures(); extern void FormatIllegalElementClasses(); extern void FormatIllegalNodeClasses(); extern int ResolveAutomorphsByProperty(); -extern int ResolveAutomorphsByPin(); +extern int ResolveAutomorphsByPin(int match_nets); extern void SummarizeElementClasses(struct ElementClass *EC); extern int remove_group_tags(struct objlist *ob); diff --git a/tcltk/tclnetgen.c b/tcltk/tclnetgen.c index da011f2..5071a02 100644 --- a/tcltk/tclnetgen.c +++ b/tcltk/tclnetgen.c @@ -2512,7 +2512,13 @@ _netcmp_run(ClientData clientData, if (automorphisms > 0) { // Next, attempt to resolve automorphisms uniquely by // using the pin names - automorphisms = ResolveAutomorphsByPin(); + automorphisms = ResolveAutomorphsByPin(FALSE); + } + if (automorphisms > 0) { + // Next, attempt to resolve automorphisms uniquely by + // using the net names (should only be done after + // resolving by pin). + automorphisms = ResolveAutomorphsByPin(TRUE); } if (automorphisms > 0) { // Anything left is truly indistinguishable