summaryrefslogtreecommitdiffstats
path: root/src/aig/gia/giaIf.c
diff options
context:
space:
mode:
authorAlan Mishchenko <alanmi@berkeley.edu>2020-10-29 17:21:37 -0700
committerAlan Mishchenko <alanmi@berkeley.edu>2020-10-29 17:21:37 -0700
commit73f8b598ac0809f646007c84504ac6afb2a922e8 (patch)
tree870b335d7179a50df725c1fc64bfa8c417c9e9a0 /src/aig/gia/giaIf.c
parentb2aa245eaacb47837d9a9d63b231903888adfe13 (diff)
downloadabc-73f8b598ac0809f646007c84504ac6afb2a922e8.tar.gz
abc-73f8b598ac0809f646007c84504ac6afb2a922e8.tar.bz2
abc-73f8b598ac0809f646007c84504ac6afb2a922e8.zip
Rare bug fix in mapping with choices.
Diffstat (limited to 'src/aig/gia/giaIf.c')
-rw-r--r--src/aig/gia/giaIf.c38
1 files changed, 38 insertions, 0 deletions
diff --git a/src/aig/gia/giaIf.c b/src/aig/gia/giaIf.c
index 2c206292..614f7b47 100644
--- a/src/aig/gia/giaIf.c
+++ b/src/aig/gia/giaIf.c
@@ -756,6 +756,43 @@ int Gia_ManChoiceLevel( Gia_Man_t * p )
}
+/**Function*************************************************************
+
+ Synopsis [Checks integrity of choice nodes.]
+
+ Description []
+
+ SideEffects []
+
+ SeeAlso []
+
+***********************************************************************/
+void If_ManCheckChoices_rec( If_Man_t * pIfMan, If_Obj_t * pIfObj )
+{
+ if ( !pIfObj || pIfObj->Type != IF_AND || pIfObj->fDriver )
+ return;
+ pIfObj->fDriver = 1;
+ If_ManCheckChoices_rec( pIfMan, If_ObjFanin0(pIfObj) );
+ If_ManCheckChoices_rec( pIfMan, If_ObjFanin1(pIfObj) );
+ If_ManCheckChoices_rec( pIfMan, pIfObj->pEquiv );
+}
+void If_ManCheckChoices( If_Man_t * pIfMan )
+{
+ If_Obj_t * pIfObj;
+ int i, fFound = 0;
+ If_ManForEachObj( pIfMan, pIfObj, i )
+ pIfObj->fDriver = 0;
+ If_ManForEachCo( pIfMan, pIfObj, i )
+ If_ManCheckChoices_rec( pIfMan, If_ObjFanin0(pIfObj) );
+ If_ManForEachNode( pIfMan, pIfObj, i )
+ if ( !pIfObj->fDriver )
+ printf( "Object %d is dangling.\n", i ), fFound = 1;
+ if ( !fFound )
+ printf( "There are no dangling objects.\n" );
+ If_ManForEachObj( pIfMan, pIfObj, i )
+ pIfObj->fDriver = 0;
+}
+
/**Function*************************************************************
@@ -824,6 +861,7 @@ If_Man_t * Gia_ManToIf( Gia_Man_t * p, If_Par_t * pPars )
}
if ( Gia_ManHasChoices(p) )
Gia_ManCleanMark0( p );
+ //If_ManCheckChoices( pIfMan );
return pIfMan;
}