diff options
Diffstat (limited to 'src/opt/res/resFilter.c')
-rw-r--r-- | src/opt/res/resFilter.c | 76 |
1 files changed, 65 insertions, 11 deletions
diff --git a/src/opt/res/resFilter.c b/src/opt/res/resFilter.c index 65e9953f..4f1be833 100644 --- a/src/opt/res/resFilter.c +++ b/src/opt/res/resFilter.c @@ -19,19 +19,21 @@ ***********************************************************************/ #include "abc.h" -#include "res.h" +#include "resInt.h" //////////////////////////////////////////////////////////////////////// /// DECLARATIONS /// //////////////////////////////////////////////////////////////////////// +static unsigned * Res_FilterCollectFaninInfo( Res_Win_t * pWin, Res_Sim_t * pSim, unsigned uMask ); + //////////////////////////////////////////////////////////////////////// /// FUNCTION DEFINITIONS /// //////////////////////////////////////////////////////////////////////// /**Function************************************************************* - Synopsis [] + Synopsis [Finds sets of feasible candidates.] Description [] @@ -40,26 +42,78 @@ SeeAlso [] ***********************************************************************/ -Vec_Vec_t * Res_FilterCandidates( Res_Win_t * pWin, Res_Sim_t * pSim ) +int Res_FilterCandidates( Res_Win_t * pWin, Abc_Ntk_t * pAig, Res_Sim_t * pSim, Vec_Vec_t * vResubs ) { + Abc_Obj_t * pFanin, * pFanin2; unsigned * pInfo; - Abc_Obj_t * pFanin; - int i, RetValue; + int Counter, RetValue, i, k; + // check that the info the node is one pInfo = Vec_PtrEntry( pSim->vOuts, 1 ); RetValue = Abc_InfoIsOne( pInfo, pSim->nWordsOut ); if ( RetValue == 0 ) printf( "Failed 1!" ); + // collect the fanin info - pInfo = Vec_PtrEntry( pSim->vOuts, 0 ); - Abc_InfoClear( pInfo, pSim->nWordsOut ); - Abc_ObjForEachFanin( pWin->pNode, pFanin, i ) - Abc_InfoOr( pInfo, Vec_PtrEntry( pSim->vOuts, 2+i ), pSim->nWordsOut ); - // check that the simulation info is constant 1 + pInfo = Res_FilterCollectFaninInfo( pWin, pSim, ~0 ); RetValue = Abc_InfoIsOne( pInfo, pSim->nWordsOut ); if ( RetValue == 0 ) printf( "Failed 2!" ); - return NULL; + + // try removing fanins +// printf( "Fanins: " ); + Counter = 0; + Vec_VecClear( vResubs ); + Abc_ObjForEachFanin( pWin->pNode, pFanin, i ) + { + pInfo = Res_FilterCollectFaninInfo( pWin, pSim, ~(1 << i) ); + RetValue = Abc_InfoIsOne( pInfo, pSim->nWordsOut ); + if ( RetValue ) + { +// printf( "Node %4d. Removing fanin %4d.\n", pWin->pNode->Id, Abc_ObjFaninId(pWin->pNode, i) ); + + // collect the nodes + Vec_VecPush( vResubs, Counter, Abc_NtkPo(pAig,0) ); + Vec_VecPush( vResubs, Counter, Abc_NtkPo(pAig,1) ); + Abc_ObjForEachFanin( pWin->pNode, pFanin2, k ) + { + if ( k != i ) + Vec_VecPush( vResubs, Counter, Abc_NtkPo(pAig,2+k) ); + } + Counter++; + } + if ( Counter == Vec_VecSize(vResubs) ) + break; +// printf( "%d", RetValue ); + } +// printf( "\n\n" ); + return Counter; +} + +/**Function************************************************************* + + Synopsis [Finds sets of feasible candidates.] + + Description [] + + SideEffects [] + + SeeAlso [] + +***********************************************************************/ +unsigned * Res_FilterCollectFaninInfo( Res_Win_t * pWin, Res_Sim_t * pSim, unsigned uMask ) +{ + Abc_Obj_t * pFanin; + unsigned * pInfo; + int i; + pInfo = Vec_PtrEntry( pSim->vOuts, 0 ); + Abc_InfoClear( pInfo, pSim->nWordsOut ); + Abc_ObjForEachFanin( pWin->pNode, pFanin, i ) + { + if ( uMask & (1 << i) ) + Abc_InfoOr( pInfo, Vec_PtrEntry(pSim->vOuts, 2+i), pSim->nWordsOut ); + } + return pInfo; } |