summaryrefslogtreecommitdiffstats
path: root/src/aig/gia/giaDup.c
diff options
context:
space:
mode:
authorAlan Mishchenko <alanmi@berkeley.edu>2017-06-01 15:42:50 +0200
committerAlan Mishchenko <alanmi@berkeley.edu>2017-06-01 15:42:50 +0200
commit8de04d36b395d1b12254df584566fe76ae6b4e4c (patch)
tree94721ed9d9209d684436fbe4011482f79f37c236 /src/aig/gia/giaDup.c
parente74f05d71ece1f137b159518c96bda004648a1d9 (diff)
downloadabc-8de04d36b395d1b12254df584566fe76ae6b4e4c.tar.gz
abc-8de04d36b395d1b12254df584566fe76ae6b4e4c.tar.bz2
abc-8de04d36b395d1b12254df584566fe76ae6b4e4c.zip
Several new procedures for GIA manipulation.
Diffstat (limited to 'src/aig/gia/giaDup.c')
-rw-r--r--src/aig/gia/giaDup.c51
1 files changed, 51 insertions, 0 deletions
diff --git a/src/aig/gia/giaDup.c b/src/aig/gia/giaDup.c
index ee709df4..5e7dc639 100644
--- a/src/aig/gia/giaDup.c
+++ b/src/aig/gia/giaDup.c
@@ -1638,6 +1638,57 @@ Gia_Man_t * Gia_ManDupExist( Gia_Man_t * p, int iVar )
/**Function*************************************************************
+ Synopsis [Existentially quantified given variable.]
+
+ Description []
+
+ SideEffects []
+
+ SeeAlso []
+
+***********************************************************************/
+Gia_Man_t * Gia_ManDupUniv( Gia_Man_t * p, int iVar )
+{
+ Gia_Man_t * pNew, * pTemp;
+ Gia_Obj_t * pObj;
+ int i;
+ assert( iVar >= 0 && iVar < Gia_ManPiNum(p) );
+ assert( Gia_ManRegNum(p) == 0 );
+ Gia_ManFillValue( p );
+ // find the cofactoring variable
+ pNew = Gia_ManStart( Gia_ManObjNum(p) );
+ pNew->pName = Abc_UtilStrsav( p->pName );
+ pNew->pSpec = Abc_UtilStrsav( p->pSpec );
+ Gia_ManHashAlloc( pNew );
+ // compute negative cofactor
+ Gia_ManConst0(p)->Value = 0;
+ Gia_ManForEachCi( p, pObj, i )
+ pObj->Value = Gia_ManAppendCi(pNew);
+ Gia_ManPi( p, iVar )->Value = Abc_Var2Lit( 0, 0 );
+ Gia_ManForEachAnd( p, pObj, i )
+ pObj->Value = Gia_ManHashAnd( pNew, Gia_ObjFanin0Copy(pObj), Gia_ObjFanin1Copy(pObj) );
+ Gia_ManForEachPo( p, pObj, i )
+ pObj->Value = Gia_ObjFanin0Copy(pObj);
+ // compute the positive cofactor
+ Gia_ManPi( p, iVar )->Value = Abc_Var2Lit( 0, 1 );
+ Gia_ManForEachAnd( p, pObj, i )
+ pObj->Value = Gia_ManHashAnd( pNew, Gia_ObjFanin0Copy(pObj), Gia_ObjFanin1Copy(pObj) );
+ // create OR gate
+ Gia_ManForEachPo( p, pObj, i )
+ {
+ if ( i == 0 )
+ pObj->Value = Gia_ManAppendCo( pNew, Gia_ManHashAnd(pNew, Gia_ObjFanin0Copy(pObj), pObj->Value) );
+ else
+ pObj->Value = Gia_ManAppendCo( pNew, Gia_ObjFanin0Copy(pObj) );
+ }
+ Gia_ManHashStop( pNew );
+ pNew = Gia_ManCleanup( pTemp = pNew );
+ Gia_ManStop( pTemp );
+ return pNew;
+}
+
+/**Function*************************************************************
+
Synopsis [Existentially quantifies the given variable.]
Description []