00001
00021 #include "cswInt.h"
00022
00026
00030
00042 Aig_Man_t * Csw_Sweep( Aig_Man_t * pAig, int nCutsMax, int nLeafMax, int fVerbose )
00043 {
00044 Csw_Man_t * p;
00045 Aig_Man_t * pRes;
00046 Aig_Obj_t * pObj, * pObjNew, * pObjRes;
00047 int i, clk;
00048 clk = clock();
00049
00050 p = Csw_ManStart( pAig, nCutsMax, nLeafMax, fVerbose );
00051
00052 Aig_ManForEachPi( p->pManRes, pObj, i )
00053 {
00054 Csw_ObjPrepareCuts( p, pObj, 1 );
00055 Csw_ObjAddRefs( p, pObj, Aig_ManPi(p->pManAig,i)->nRefs );
00056 }
00057
00058 Aig_ManForEachNode( pAig, pObj, i )
00059 {
00060
00061 pObjNew = Aig_And( p->pManRes, Csw_ObjChild0Equiv(p, pObj), Csw_ObjChild1Equiv(p, pObj) );
00062
00063
00064
00065
00066 do {
00067 pObjRes = Csw_ObjSweep( p, Aig_Regular(pObjNew), pObj->nRefs > 1 );
00068 pObjRes = Aig_NotCond( pObjRes, Aig_IsComplement(pObjNew) );
00069 pObjNew = pObjRes;
00070 } while ( Csw_ObjCuts(p, Aig_Regular(pObjNew)) == NULL && !Aig_ObjIsConst1(Aig_Regular(pObjNew)) );
00071
00072 Csw_ObjSetEquiv( p, pObj, pObjRes );
00073
00074 Csw_ObjAddRefs( p, Aig_Regular(pObjRes), pObj->nRefs );
00075 }
00076
00077 Aig_ManForEachPo( pAig, pObj, i )
00078 Aig_ObjCreatePo( p->pManRes, Csw_ObjChild0Equiv(p, pObj) );
00079
00080 Aig_ManCleanup( p->pManRes );
00081
00082 p->timeTotal = clock() - clk;
00083 p->timeOther = p->timeTotal - p->timeCuts - p->timeHash;
00084 pRes = p->pManRes;
00085 Csw_ManStop( p );
00086 return pRes;
00087 }
00088
00089
00093
00094