summaryrefslogtreecommitdiffstats
path: root/src/aig/gia/giaUtil.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/aig/gia/giaUtil.c')
-rw-r--r--src/aig/gia/giaUtil.c66
1 files changed, 66 insertions, 0 deletions
diff --git a/src/aig/gia/giaUtil.c b/src/aig/gia/giaUtil.c
index e56f6ea9..333fe58e 100644
--- a/src/aig/gia/giaUtil.c
+++ b/src/aig/gia/giaUtil.c
@@ -963,6 +963,41 @@ int Gia_ManHasChoices( Gia_Man_t * p )
/**Function*************************************************************
+ Synopsis []
+
+ Description []
+
+ SideEffects []
+
+ SeeAlso []
+
+***********************************************************************/
+void Gia_ManVerifyChoices( Gia_Man_t * p )
+{
+ Gia_Obj_t * pObj;
+ int i, fProb = 0;
+ assert( p->pReprs );
+ Gia_ManForEachObj( p, pObj, i )
+ {
+ if ( Gia_ObjIsAnd(pObj) )
+ {
+ if ( Gia_ObjHasRepr(p, Gia_ObjFaninId0(pObj, i)) )
+ printf( "Fanin 0 of AND node %d has a repr.\n", i ), fProb = 1;
+ if ( Gia_ObjHasRepr(p, Gia_ObjFaninId1(pObj, i)) )
+ printf( "Fanin 1 of AND node %d has a repr.\n", i ), fProb = 1;
+ }
+ else if ( Gia_ObjIsCo(pObj) )
+ {
+ if ( Gia_ObjHasRepr(p, Gia_ObjFaninId0(pObj, i)) )
+ printf( "Fanin 0 of CO node %d has a repr.\n", i ), fProb = 1;
+ }
+ }
+ if ( !fProb )
+ printf( "GIA with choices is correct.\n" );
+}
+
+/**Function*************************************************************
+
Synopsis [Returns 1 if AIG has dangling nodes.]
Description []
@@ -1004,6 +1039,37 @@ int Gia_ManHasDangling( Gia_Man_t * p )
SeeAlso []
***********************************************************************/
+int Gia_ManMarkDangling( Gia_Man_t * p )
+{
+ Gia_Obj_t * pObj;
+ int i, Counter = 0;
+ Gia_ManForEachObj( p, pObj, i )
+ {
+ pObj->fMark0 = 0;
+ if ( Gia_ObjIsAnd(pObj) )
+ {
+ Gia_ObjFanin0(pObj)->fMark0 = 1;
+ Gia_ObjFanin1(pObj)->fMark0 = 1;
+ }
+ else if ( Gia_ObjIsCo(pObj) )
+ Gia_ObjFanin0(pObj)->fMark0 = 1;
+ }
+ Gia_ManForEachAnd( p, pObj, i )
+ Counter += !pObj->fMark0;
+ return Counter;
+}
+
+/**Function*************************************************************
+
+ Synopsis [Returns 1 if AIG has dangling nodes.]
+
+ Description []
+
+ SideEffects []
+
+ SeeAlso []
+
+***********************************************************************/
Vec_Int_t * Gia_ManGetDangling( Gia_Man_t * p )
{
Vec_Int_t * vDangles;