diff options
author | Alan Mishchenko <alanmi@berkeley.edu> | 2010-11-01 01:35:04 -0700 |
---|---|---|
committer | Alan Mishchenko <alanmi@berkeley.edu> | 2010-11-01 01:35:04 -0700 |
commit | 6130e39b18b5f53902e4eab14f6d5cdde5219563 (patch) | |
tree | 0db0628479a1b750e9af1f66cb8379ebd0913d31 /src/base/abci/abcQuant.c | |
parent | f0e77f6797c0504b0da25a56152b707d3357f386 (diff) | |
download | abc-6130e39b18b5f53902e4eab14f6d5cdde5219563.tar.gz abc-6130e39b18b5f53902e4eab14f6d5cdde5219563.tar.bz2 abc-6130e39b18b5f53902e4eab14f6d5cdde5219563.zip |
initial commit of public abc
Diffstat (limited to 'src/base/abci/abcQuant.c')
-rw-r--r-- | src/base/abci/abcQuant.c | 41 |
1 files changed, 26 insertions, 15 deletions
diff --git a/src/base/abci/abcQuant.c b/src/base/abci/abcQuant.c index 6d973a85..957d99b5 100644 --- a/src/base/abci/abcQuant.c +++ b/src/base/abci/abcQuant.c @@ -20,6 +20,9 @@ #include "abc.h" +ABC_NAMESPACE_IMPL_START + + //////////////////////////////////////////////////////////////////////// /// DECLARATIONS /// //////////////////////////////////////////////////////////////////////// @@ -94,18 +97,24 @@ int Abc_NtkQuantify( Abc_Ntk_t * pNtk, int fUniv, int iVar, int fVerbose ) pObj->pData = Abc_AigConst1(pNtk); // quantify the nodes - Vec_PtrForEachEntry( vNodes, pObj, i ) + Vec_PtrForEachEntry( Abc_Obj_t *, vNodes, pObj, i ) { for ( pNext = pObj? pObj->pCopy : pObj; pObj; pObj = pNext, pNext = pObj? pObj->pCopy : pObj ) { pFanin = Abc_ObjFanin0(pObj); if ( !Abc_NodeIsTravIdCurrent(pFanin) ) - pFanin->pCopy = pFanin->pData = pFanin; + { + pFanin->pCopy = pFanin; + pFanin->pData = pFanin; + } pFanin = Abc_ObjFanin1(pObj); if ( !Abc_NodeIsTravIdCurrent(pFanin) ) - pFanin->pCopy = pFanin->pData = pFanin; - pObj->pCopy = Abc_AigAnd( pNtk->pManFunc, Abc_ObjChild0Copy(pObj), Abc_ObjChild1Copy(pObj) ); - pObj->pData = Abc_AigAnd( pNtk->pManFunc, Abc_ObjChild0Data(pObj), Abc_ObjChild1Data(pObj) ); + { + pFanin->pCopy = pFanin; + pFanin->pData = pFanin; + } + pObj->pCopy = Abc_AigAnd( (Abc_Aig_t *)pNtk->pManFunc, Abc_ObjChild0Copy(pObj), Abc_ObjChild1Copy(pObj) ); + pObj->pData = Abc_AigAnd( (Abc_Aig_t *)pNtk->pManFunc, Abc_ObjChild0Data(pObj), Abc_ObjChild1Data(pObj) ); } } Vec_PtrFree( vNodes ); @@ -118,9 +127,9 @@ int Abc_NtkQuantify( Abc_Ntk_t * pNtk, int fUniv, int iVar, int fVerbose ) pFanin = Abc_ObjFanin0(pObj); // get the result of quantification if ( fUniv ) - pNext = Abc_AigAnd( pNtk->pManFunc, Abc_ObjChild0Copy(pObj), Abc_ObjChild0Data(pObj) ); + pNext = Abc_AigAnd( (Abc_Aig_t *)pNtk->pManFunc, Abc_ObjChild0Copy(pObj), Abc_ObjChild0Data(pObj) ); else - pNext = Abc_AigOr( pNtk->pManFunc, Abc_ObjChild0Copy(pObj), Abc_ObjChild0Data(pObj) ); + pNext = Abc_AigOr( (Abc_Aig_t *)pNtk->pManFunc, Abc_ObjChild0Copy(pObj), Abc_ObjChild0Data(pObj) ); pNext = Abc_ObjNotCond( pNext, Abc_ObjFaninC0(pObj) ); if ( Abc_ObjRegular(pNext) == pFanin ) continue; @@ -183,7 +192,7 @@ Abc_Ntk_t * Abc_NtkTransRel( Abc_Ntk_t * pNtk, int fInputs, int fVerbose ) // restrash the nodes (assuming a topological order of the old network) Abc_AigConst1(pNtk)->pCopy = Abc_AigConst1(pNtkNew); Abc_NtkForEachNode( pNtk, pObj, i ) - pObj->pCopy = Abc_AigAnd( pNtkNew->pManFunc, Abc_ObjChild0Copy(pObj), Abc_ObjChild1Copy(pObj) ); + pObj->pCopy = Abc_AigAnd( (Abc_Aig_t *)pNtkNew->pManFunc, Abc_ObjChild0Copy(pObj), Abc_ObjChild1Copy(pObj) ); // create the function of the primary output assert( Abc_NtkBoxNum(pNtk) == Abc_NtkLatchNum(pNtk) ); vPairs = Vec_PtrAlloc( 2*nLatches ); @@ -192,7 +201,7 @@ Abc_Ntk_t * Abc_NtkTransRel( Abc_Ntk_t * pNtk, int fInputs, int fVerbose ) Vec_PtrPush( vPairs, Abc_ObjChild0Copy(pObj) ); Vec_PtrPush( vPairs, Abc_NtkPi(pNtkNew, i+nLatches) ); } - pMiter = Abc_AigMiter( pNtkNew->pManFunc, vPairs, 0 ); + pMiter = Abc_AigMiter( (Abc_Aig_t *)pNtkNew->pManFunc, vPairs, 0 ); Vec_PtrFree( vPairs ); // add the primary output Abc_ObjAddFanin( Abc_NtkPo(pNtkNew,0), Abc_ObjNot(pMiter) ); @@ -210,7 +219,7 @@ Abc_Ntk_t * Abc_NtkTransRel( Abc_Ntk_t * pNtk, int fInputs, int fVerbose ) if ( fSynthesis ) { Abc_NtkCleanData( pNtkNew ); - Abc_AigCleanup( pNtkNew->pManFunc ); + Abc_AigCleanup( (Abc_Aig_t *)pNtkNew->pManFunc ); Abc_NtkSynthesize( &pNtkNew, 1 ); } // printf( "Var = %3d. Nodes = %6d. ", Abc_NtkPiNum(pNtkNew) - 1 - i, Abc_NtkNodeNum(pNtkNew) ); @@ -218,7 +227,7 @@ Abc_Ntk_t * Abc_NtkTransRel( Abc_Ntk_t * pNtk, int fInputs, int fVerbose ) } // printf( "\n" ); Abc_NtkCleanData( pNtkNew ); - Abc_AigCleanup( pNtkNew->pManFunc ); + Abc_AigCleanup( (Abc_Aig_t *)pNtkNew->pManFunc ); for ( i = Abc_NtkPiNum(pNtkNew) - 1; i >= 2*nLatches; i-- ) { pObj = Abc_NtkPi( pNtkNew, i ); @@ -260,7 +269,7 @@ Abc_Ntk_t * Abc_NtkInitialState( Abc_Ntk_t * pNtk ) // compute the all-zero state in terms of the CS variables pMiter = Abc_AigConst1(pNtkNew); for ( i = 0; i < nVars; i++ ) - pMiter = Abc_AigAnd( pNtkNew->pManFunc, pMiter, Abc_ObjNot( Abc_NtkPi(pNtkNew, i) ) ); + pMiter = Abc_AigAnd( (Abc_Aig_t *)pNtkNew->pManFunc, pMiter, Abc_ObjNot( Abc_NtkPi(pNtkNew, i) ) ); // add the PO Abc_ObjAddFanin( Abc_NtkPo(pNtkNew,0), pMiter ); return pNtkNew; @@ -296,7 +305,7 @@ Abc_Ntk_t * Abc_NtkSwapVariables( Abc_Ntk_t * pNtk ) } // restrash Abc_NtkForEachNode( pNtk, pObj, i ) - pObj->pCopy = Abc_AigAnd( pNtkNew->pManFunc, Abc_ObjChild0Copy(pObj), Abc_ObjChild1Copy(pObj) ); + pObj->pCopy = Abc_AigAnd( (Abc_Aig_t *)pNtkNew->pManFunc, Abc_ObjChild0Copy(pObj), Abc_ObjChild1Copy(pObj) ); // add the PO pMiter = Abc_ObjChild0Copy( Abc_NtkPo(pNtk,0) ); Abc_ObjAddFanin( Abc_NtkPo(pNtkNew,0), pMiter ); @@ -351,12 +360,12 @@ Abc_Ntk_t * Abc_NtkReachability( Abc_Ntk_t * pNtkRel, int nIters, int fVerbose ) if ( fSynthesis && (v % 3 == 2) ) { Abc_NtkCleanData( pNtkNext ); - Abc_AigCleanup( pNtkNext->pManFunc ); + Abc_AigCleanup( (Abc_Aig_t *)pNtkNext->pManFunc ); Abc_NtkSynthesize( &pNtkNext, fMoreEffort ); } } Abc_NtkCleanData( pNtkNext ); - Abc_AigCleanup( pNtkNext->pManFunc ); + Abc_AigCleanup( (Abc_Aig_t *)pNtkNext->pManFunc ); if ( fSynthesis ) Abc_NtkSynthesize( &pNtkNext, 1 ); // map the next states into the current states @@ -422,3 +431,5 @@ Abc_Ntk_t * Abc_NtkReachability( Abc_Ntk_t * pNtkRel, int nIters, int fVerbose ) //////////////////////////////////////////////////////////////////////// +ABC_NAMESPACE_IMPL_END + |