diff options
author | Alan Mishchenko <alanmi@berkeley.edu> | 2013-04-28 15:02:03 -0700 |
---|---|---|
committer | Alan Mishchenko <alanmi@berkeley.edu> | 2013-04-28 15:02:03 -0700 |
commit | 48d867f77db72b70371a08f99e2e8771bbf007ff (patch) | |
tree | bf0c72f934b6755d05260c7f68d3f77897947ffb /src/aig/hop/hopDfs.c | |
parent | 8db0b9c0c6520071e51cc660ac0436ec9ee79571 (diff) | |
download | abc-48d867f77db72b70371a08f99e2e8771bbf007ff.tar.gz abc-48d867f77db72b70371a08f99e2e8771bbf007ff.tar.bz2 abc-48d867f77db72b70371a08f99e2e8771bbf007ff.zip |
Modified command 'eliminate' to perform traditional 'eliminate -1'.
Diffstat (limited to 'src/aig/hop/hopDfs.c')
-rw-r--r-- | src/aig/hop/hopDfs.c | 65 |
1 files changed, 65 insertions, 0 deletions
diff --git a/src/aig/hop/hopDfs.c b/src/aig/hop/hopDfs.c index e8ca970f..0706382f 100644 --- a/src/aig/hop/hopDfs.c +++ b/src/aig/hop/hopDfs.c @@ -286,6 +286,38 @@ int Hop_DagSize( Hop_Obj_t * pObj ) /**Function************************************************************* + Synopsis [Counts how many fanout the given node has.] + + Description [] + + SideEffects [] + + SeeAlso [] + +***********************************************************************/ +int Hop_ObjFanoutCount_rec( Hop_Obj_t * pObj, Hop_Obj_t * pPivot ) +{ + int Counter; + assert( !Hop_IsComplement(pObj) ); + if ( !Hop_ObjIsNode(pObj) || Hop_ObjIsMarkA(pObj) ) + return (int)(pObj == pPivot); + Counter = Hop_ObjFanoutCount_rec( Hop_ObjFanin0(pObj), pPivot ) + + Hop_ObjFanoutCount_rec( Hop_ObjFanin1(pObj), pPivot ); + assert( !Hop_ObjIsMarkA(pObj) ); // loop detection + Hop_ObjSetMarkA( pObj ); + return Counter; +} +int Hop_ObjFanoutCount( Hop_Obj_t * pObj, Hop_Obj_t * pPivot ) +{ + int Counter; + assert( !Hop_IsComplement(pPivot) ); + Counter = Hop_ObjFanoutCount_rec( Hop_Regular(pObj), pPivot ); + Hop_ConeUnmark_rec( Hop_Regular(pObj) ); + return Counter; +} + +/**Function************************************************************* + Synopsis [Transfers the AIG from one manager into another.] Description [] @@ -517,6 +549,39 @@ Hop_Obj_t * Hop_Remap( Hop_Man_t * p, Hop_Obj_t * pRoot, unsigned uSupp, int nVa return Hop_NotCond( (Hop_Obj_t *)Hop_Regular(pRoot)->pData, Hop_IsComplement(pRoot) ); } +/**Function************************************************************* + + Synopsis [Permute the AIG according to the given permutation.] + + Description [] + + SideEffects [] + + SeeAlso [] + +***********************************************************************/ +Hop_Obj_t * Hop_Permute( Hop_Man_t * p, Hop_Obj_t * pRoot, int nRootVars, int * pPermute ) +{ + Hop_Obj_t * pObj; + int i; + // return if constant + if ( Hop_ObjIsConst1( Hop_Regular(pRoot) ) ) + return pRoot; + // create mapping + Hop_ManForEachPi( p, pObj, i ) + { + if ( i == nRootVars ) + break; + assert( pPermute[i] >= 0 && pPermute[i] < Hop_ManPiNum(p) ); + pObj->pData = Hop_IthVar( p, pPermute[i] ); + } + // recursively perform composition + Hop_Remap_rec( p, Hop_Regular(pRoot) ); + // clear the markings + Hop_ConeUnmark_rec( Hop_Regular(pRoot) ); + return Hop_NotCond( (Hop_Obj_t *)Hop_Regular(pRoot)->pData, Hop_IsComplement(pRoot) ); +} + //////////////////////////////////////////////////////////////////////// /// END OF FILE /// //////////////////////////////////////////////////////////////////////// |