diff options
author | Alan Mishchenko <alanmi@berkeley.edu> | 2014-04-06 12:26:25 -0700 |
---|---|---|
committer | Alan Mishchenko <alanmi@berkeley.edu> | 2014-04-06 12:26:25 -0700 |
commit | 2a399042baf62f67699350c96b8d30c374373c38 (patch) | |
tree | 6d23d57733921a7a58fb301722edbe3b46a5f164 /src/base/abci/abcIf.c | |
parent | faf3bf34af25297baeb454597c7d92aa75778961 (diff) | |
download | abc-2a399042baf62f67699350c96b8d30c374373c38.tar.gz abc-2a399042baf62f67699350c96b8d30c374373c38.tar.bz2 abc-2a399042baf62f67699350c96b8d30c374373c38.zip |
Improvement in SOP balancing.
Diffstat (limited to 'src/base/abci/abcIf.c')
-rw-r--r-- | src/base/abci/abcIf.c | 119 |
1 files changed, 4 insertions, 115 deletions
diff --git a/src/base/abci/abcIf.c b/src/base/abci/abcIf.c index cec487f5..80412c9a 100644 --- a/src/base/abci/abcIf.c +++ b/src/base/abci/abcIf.c @@ -344,111 +344,6 @@ Abc_Ntk_t * Abc_NtkFromIf( If_Man_t * pIfMan, Abc_Ntk_t * pNtk ) return pNtkNew; } - -/**Function************************************************************* - - Synopsis [Inserts the entry while sorting them by delay.] - - Description [] - - SideEffects [] - - SeeAlso [] - -***********************************************************************/ -Hop_Obj_t * Abc_NodeFromSopBalanceInt( Hop_Man_t * pMan, Vec_Wrd_t * vAnds, int nVars ) -{ - Vec_Ptr_t * vResults; - Hop_Obj_t * pRes0, * pRes1, * pRes = NULL; - If_And_t This; - word Entry; - int i; - if ( Vec_WrdSize(vAnds) == 0 ) - return Hop_ManConst0(pMan); - if ( Vec_WrdSize(vAnds) == 1 && Vec_WrdEntry(vAnds,0) == 0 ) - return Hop_ManConst1(pMan); - vResults = Vec_PtrAlloc( Vec_WrdSize(vAnds) ); - for ( i = 0; i < nVars; i++ ) - Vec_PtrPush( vResults, Hop_IthVar(pMan, i) ); - Vec_WrdForEachEntryStart( vAnds, Entry, i, nVars ) - { - This = If_WrdToAnd( Entry ); - pRes0 = Hop_NotCond( (Hop_Obj_t *)Vec_PtrEntry(vResults, This.iFan0), This.fCompl0 ); - pRes1 = Hop_NotCond( (Hop_Obj_t *)Vec_PtrEntry(vResults, This.iFan1), This.fCompl1 ); - pRes = Hop_And( pMan, pRes0, pRes1 ); - Vec_PtrPush( vResults, pRes ); -/* - printf( "fan0 = %c%d fan1 = %c%d Del = %d\n", - This.fCompl0? '-':'+', This.iFan0, - This.fCompl1? '-':'+', This.iFan1, - This.Delay ); -*/ - } - Vec_PtrFree( vResults ); - return Hop_NotCond( pRes, This.fCompl ); -} -Hop_Obj_t * Abc_NodeFromSopBalance( Hop_Man_t * pMan, If_Man_t * p, If_Cut_t * pCut ) -{ - Hop_Obj_t * pResult; - Vec_Wrd_t * vArray; - vArray = If_CutDelaySopArray( p, pCut ); - pResult = Abc_NodeFromSopBalanceInt( pMan, vArray, If_CutLeaveNum(pCut) ); -// Vec_WrdFree( vArray ); - return pResult; -} - -/**Function************************************************************* - - Synopsis [Inserts the entry while sorting them by delay.] - - Description [] - - SideEffects [] - - SeeAlso [] - -***********************************************************************/ -Hop_Obj_t * Abc_NodeFromDsdBalanceInt( Hop_Man_t * pMan, Vec_Wrd_t * vAnds, int nVars ) -{ - Vec_Ptr_t * vResults; - Hop_Obj_t * pRes0, * pRes1, * pRes = NULL; - If_And_t This; - word Entry; - int i; - if ( Vec_WrdSize(vAnds) == 0 ) - return Hop_ManConst0(pMan); - if ( Vec_WrdSize(vAnds) == 1 && Vec_WrdEntry(vAnds,0) == 0 ) - return Hop_ManConst1(pMan); - vResults = Vec_PtrAlloc( Vec_WrdSize(vAnds) ); - for ( i = 0; i < nVars; i++ ) - Vec_PtrPush( vResults, Hop_IthVar(pMan, i) ); - Vec_WrdForEachEntryStart( vAnds, Entry, i, nVars ) - { - This = If_WrdToAnd( Entry ); - pRes0 = Hop_NotCond( (Hop_Obj_t *)Vec_PtrEntry(vResults, This.iFan0), This.fCompl0 ); - pRes1 = Hop_NotCond( (Hop_Obj_t *)Vec_PtrEntry(vResults, This.iFan1), This.fCompl1 ); - pRes = Hop_And( pMan, pRes0, pRes1 ); - Vec_PtrPush( vResults, pRes ); -/* - printf( "fan0 = %c%d fan1 = %c%d Del = %d\n", - This.fCompl0? '-':'+', This.iFan0, - This.fCompl1? '-':'+', This.iFan1, - This.Delay ); -*/ - } - Vec_PtrFree( vResults ); - return Hop_NotCond( pRes, This.fCompl ); -} -Hop_Obj_t * Abc_NodeFromDsdBalance( Hop_Man_t * pMan, If_Man_t * p, If_Cut_t * pCut ) -{ - Hop_Obj_t * pResult; - Vec_Wrd_t * vArray; - vArray = If_CutDelaySopArray( p, pCut ); - pResult = Abc_NodeFromDsdBalanceInt( pMan, vArray, If_CutLeaveNum(pCut) ); -// Vec_WrdFree( vArray ); - return pResult; -} - /**Function************************************************************* Synopsis [Rebuilds GIA from mini AIG.] @@ -467,7 +362,7 @@ Hop_Obj_t * Abc_NodeBuildFromMiniInt( Hop_Man_t * pMan, Vec_Int_t * vAig, int nL if ( Vec_IntSize(vAig) == 1 ) // const { assert( nLeaves == 0 ); - return Hop_NotCond( Hop_ManConst1(pMan), Vec_IntEntry(vAig, 0) ); + return Hop_NotCond( Hop_ManConst0(pMan), Vec_IntEntry(vAig, 0) ); } if ( Vec_IntSize(vAig) == 2 ) // variable { @@ -500,7 +395,7 @@ Hop_Obj_t * Abc_NodeBuildFromMini( Hop_Man_t * pMan, If_Man_t * p, If_Cut_t * pC { Hop_Obj_t * pResult; if ( p->vArray == NULL ) - p->vArray = Vec_IntAlloc(100); + p->vArray = Vec_IntAlloc(1000); If_CutDelaySopArray3( p, pCut, p->vArray ); pResult = Abc_NodeBuildFromMiniInt( pMan, p->vArray, If_CutLeaveNum(pCut) ); return pResult; @@ -582,15 +477,9 @@ Abc_Obj_t * Abc_NodeFromIf_rec( Abc_Ntk_t * pNtkNew, If_Man_t * pIfMan, If_Obj_t } } else if ( pIfMan->pPars->fDelayOpt ) - { - extern Hop_Obj_t * Abc_NodeFromSopBalance( Hop_Man_t * pMan, If_Man_t * pIfMan, If_Cut_t * pCut ); - pNodeNew->pData = Abc_NodeFromSopBalance( (Hop_Man_t *)pNtkNew->pManFunc, pIfMan, pCutBest ); - } + pNodeNew->pData = Abc_NodeBuildFromMini( (Hop_Man_t *)pNtkNew->pManFunc, pIfMan, pCutBest ); else if ( pIfMan->pPars->fDsdBalance ) - { - extern Hop_Obj_t * Abc_NodeFromDsdBalance( Hop_Man_t * pMan, If_Man_t * pIfMan, If_Cut_t * pCut ); - pNodeNew->pData = Abc_NodeFromDsdBalance( (Hop_Man_t *)pNtkNew->pManFunc, pIfMan, pCutBest ); - } + pNodeNew->pData = Abc_NodeBuildFromMini( (Hop_Man_t *)pNtkNew->pManFunc, pIfMan, pCutBest ); else if ( pIfMan->pPars->fUserRecLib ) { extern Hop_Obj_t * Abc_RecToHop3( Hop_Man_t * pMan, If_Man_t * pIfMan, If_Cut_t * pCut, If_Obj_t * pIfObj ); |