00001
00021 #include "abc.h"
00022 #include "resInt.h"
00023
00027
00028 extern Abc_Obj_t * Abc_ConvertAigToAig( Abc_Ntk_t * pAig, Abc_Obj_t * pObjOld );
00029
00033
00046 Abc_Ntk_t * Res_WndStrash( Res_Win_t * p )
00047 {
00048 Vec_Ptr_t * vPairs;
00049 Abc_Ntk_t * pAig;
00050 Abc_Obj_t * pObj, * pMiter;
00051 int i;
00052 assert( Abc_NtkHasAig(p->pNode->pNtk) );
00053
00054
00055 pAig = Abc_NtkAlloc( ABC_NTK_STRASH, ABC_FUNC_AIG, 1 );
00056 pAig->pName = Extra_UtilStrsav( "window" );
00057
00058 Vec_PtrForEachEntry( p->vLeaves, pObj, i )
00059 pObj->pCopy = Abc_NtkCreatePi( pAig );
00060 Vec_PtrForEachEntry( p->vBranches, pObj, i )
00061 pObj->pCopy = Abc_NtkCreatePi( pAig );
00062
00063 Vec_PtrForEachEntry( p->vNodes, pObj, i )
00064 {
00065 pObj->pCopy = Abc_ConvertAigToAig( pAig, pObj );
00066 if ( pObj == p->pNode )
00067 pObj->pCopy = Abc_ObjNot( pObj->pCopy );
00068 }
00069
00070 vPairs = Vec_PtrAlloc( 2 * Vec_PtrSize(p->vRoots) );
00071 Vec_PtrForEachEntry( p->vRoots, pObj, i )
00072 {
00073 Vec_PtrPush( vPairs, pObj->pCopy );
00074 Vec_PtrPush( vPairs, NULL );
00075 }
00076
00077 Abc_NtkIncrementTravId( p->pNode->pNtk );
00078 Res_WinSweepLeafTfo_rec( p->pNode, (int)p->pNode->Level + p->nWinTfoMax );
00079
00080 p->pNode->pCopy = Abc_ObjNot( p->pNode->pCopy );
00081 Abc_NodeSetTravIdPrevious( p->pNode );
00082
00083 Vec_PtrForEachEntry( p->vNodes, pObj, i )
00084 {
00085 if ( Abc_NodeIsTravIdCurrent(pObj) )
00086 pObj->pCopy = Abc_ConvertAigToAig( pAig, pObj );
00087 }
00088
00089 Vec_PtrForEachEntry( p->vRoots, pObj, i )
00090 Vec_PtrWriteEntry( vPairs, 2 * i + 1, pObj->pCopy );
00091
00092 pMiter = Abc_AigMiter( pAig->pManFunc, vPairs );
00093 Abc_ObjAddFanin( Abc_NtkCreatePo(pAig), pMiter );
00094 Vec_PtrFree( vPairs );
00095
00096 Abc_ObjAddFanin( Abc_NtkCreatePo(pAig), p->pNode->pCopy );
00097
00098 Abc_ObjForEachFanin( p->pNode, pObj, i )
00099 Abc_ObjAddFanin( Abc_NtkCreatePo(pAig), pObj->pCopy );
00100
00101 Vec_PtrForEachEntry( p->vDivs, pObj, i )
00102 Abc_ObjAddFanin( Abc_NtkCreatePo(pAig), pObj->pCopy );
00103
00104 Abc_NtkAddDummyPiNames( pAig );
00105 Abc_NtkAddDummyPoNames( pAig );
00106
00107 if ( !Abc_NtkCheck( pAig ) )
00108 fprintf( stdout, "Res_WndStrash(): Network check has failed.\n" );
00109 return pAig;
00110 }
00111
00112
00116
00117