101 assert( pPars->nWindow > 0 && pPars->nWindow < 100 );
102 assert( pPars->nCands > 0 && pPars->nCands < 100 );
107 p->vMem = Vec_IntAlloc( 0 );
108 p->vResubs = Vec_VecStart( pPars->nCands );
109 p->vResubsW = Vec_VecStart( pPars->nCands );
110 p->vLevels = Vec_VecStart( 32 );
127 if (
p->pPars->fVerbose )
129 printf(
"Reduction in nodes = %5d. (%.2f %%) ",
130 p->nTotalNodes-
p->nTotalNodes2,
131 100.0*(
p->nTotalNodes-
p->nTotalNodes2)/
p->nTotalNodes );
132 printf(
"Reduction in edges = %5d. (%.2f %%) ",
133 p->nTotalNets-
p->nTotalNets2,
134 100.0*(
p->nTotalNets-
p->nTotalNets2)/
p->nTotalNets );
137 printf(
"Winds = %d. ",
p->nWins );
138 printf(
"Nodes = %d. (Ave = %5.1f) ",
p->nWinNodes, 1.0*
p->nWinNodes/
p->nWins );
139 printf(
"Divs = %d. (Ave = %5.1f) ",
p->nDivNodes, 1.0*
p->nDivNodes/
p->nWins );
141 printf(
"WinsTriv = %d. ",
p->nWinsTriv );
142 printf(
"SimsEmpt = %d. ",
p->nSimEmpty );
143 printf(
"Const = %d. ",
p->nConstsUsed );
144 printf(
"WindUsed = %d. ",
p->nWinsUsed );
145 printf(
"Cands = %d. ",
p->nCandSets );
146 printf(
"Proved = %d.",
p->nProvedSets );
149 ABC_PRTP(
"Windowing ",
p->timeWin,
p->timeTotal );
150 ABC_PRTP(
"Divisors ",
p->timeDiv,
p->timeTotal );
151 ABC_PRTP(
"Strashing ",
p->timeAig,
p->timeTotal );
152 ABC_PRTP(
"Simulation ",
p->timeSim,
p->timeTotal );
153 ABC_PRTP(
"Candidates ",
p->timeCand,
p->timeTotal );
154 ABC_PRTP(
"SAT solver ",
p->timeSatTotal,
p->timeTotal );
155 ABC_PRTP(
" sat ",
p->timeSatSat,
p->timeTotal );
156 ABC_PRTP(
" unsat ",
p->timeSatUnsat,
p->timeTotal );
157 ABC_PRTP(
" simul ",
p->timeSatSim,
p->timeTotal );
158 ABC_PRTP(
"Interpol ",
p->timeInt,
p->timeTotal );
159 ABC_PRTP(
"Undating ",
p->timeUpd,
p->timeTotal );
160 ABC_PRTP(
"TOTAL ",
p->timeTotal,
p->timeTotal );
167 Vec_IntFree(
p->vMem );
168 Vec_VecFree(
p->vResubs );
169 Vec_VecFree(
p->vResubsW );
170 Vec_VecFree(
p->vLevels );
191 pObjNew = Abc_NtkCreateNode( pObj->
pNtk );
192 pObjNew->
pData = pFunc;
222 int i, k, RetValue, nNodesOld, nFanins, nFaninsMax;
223 abctime clk, clkTotal = Abc_Clock();
228 p->nTotalNodes = Abc_NtkNodeNum(pNtk);
230 if ( nFaninsMax > 8 )
239 fprintf( stdout,
"Converting to BDD has failed.\n" );
243 assert( Abc_NtkHasAig(pNtk) );
250 nNodesOld = Abc_NtkObjNumMax(pNtk);
254 Extra_ProgressBarUpdate( pProgress, i, NULL );
255 if ( !Abc_ObjIsNode(pObj) )
257 if ( Abc_ObjFaninNum(pObj) > 8 )
259 if ( pObj->
Id > nNodesOld )
264 RetValue =
Res_WinCompute( pObj,
p->pPars->nWindow/10,
p->pPars->nWindow%10,
p->pWin );
265p->timeWin += Abc_Clock() - clk;
270 if (
p->pPars->fVeryVerbose )
272 printf(
"%5d (lev=%2d) : ", pObj->
Id, pObj->
Level );
273 printf(
"Win = %3d/%3d/%4d/%3d ",
274 Vec_PtrSize(
p->pWin->vLeaves),
275 Vec_PtrSize(
p->pWin->vBranches),
276 Vec_PtrSize(
p->pWin->vNodes),
277 Vec_PtrSize(
p->pWin->vRoots) );
283p->timeDiv += Abc_Clock() - clk;
286 p->nWinNodes += Vec_PtrSize(
p->pWin->vNodes);
287 p->nDivNodes += Vec_PtrSize(
p->pWin->vDivs);
289 if (
p->pPars->fVeryVerbose )
291 printf(
"D = %3d ", Vec_PtrSize(
p->pWin->vDivs) );
292 printf(
"D+ = %3d ",
p->pWin->nDivsPlus );
299p->timeAig += Abc_Clock() - clk;
301 if (
p->pPars->fVeryVerbose )
303 printf(
"AIG = %4d ", Abc_NtkNodeNum(
p->pAig) );
310p->timeSim += Abc_Clock() - clk;
318 if (
p->pSim->fConst0 ||
p->pSim->fConst1 )
323 vFanins = Vec_VecEntry(
p->vResubsW, 0 );
324 Vec_PtrClear( vFanins );
333 if (
p->pPars->fArea )
337p->timeCand += Abc_Clock() - clk;
338 p->nCandSets += RetValue;
349 if ( Vec_PtrSize(vFanins) == 0 )
356 if (
p->pCnf == NULL )
358p->timeSatSat += Abc_Clock() - clk;
363p->timeSatUnsat += Abc_Clock() - clk;
377p->timeInt += Abc_Clock() - clk;
378 if ( nFanins != Vec_PtrSize(vFanins) - 2 )
393p->timeUpd += Abc_Clock() - clk;
401p->timeSatSim +=
p->pSim->timeSat;
402p->timeSatTotal =
p->timeSatSat +
p->timeSatUnsat +
p->timeSatSim;
405 p->nTotalNodes2 = Abc_NtkNodeNum(pNtk);
408p->timeTotal = Abc_Clock() - clkTotal;
415 fprintf( stdout,
"Abc_NtkResynthesize(): Network check has failed.\n" );
ABC_DLL int Abc_NtkSweep(Abc_Ntk_t *pNtk, int fVerbose)
struct Abc_Obj_t_ Abc_Obj_t
ABC_DLL int Abc_NtkGetFaninMax(Abc_Ntk_t *pNtk)
ABC_DLL void Abc_ObjAddFanin(Abc_Obj_t *pObj, Abc_Obj_t *pFanin)
ABC_DLL int Abc_ObjRequiredLevel(Abc_Obj_t *pObj)
ABC_DLL int Abc_NtkCheck(Abc_Ntk_t *pNtk)
FUNCTION DEFINITIONS ///.
#define Abc_NtkForEachObj(pNtk, pObj, i)
ITERATORS ///.
ABC_DLL void Abc_NtkUpdate(Abc_Obj_t *pObj, Abc_Obj_t *pObjNew, Vec_Vec_t *vLevels)
struct Abc_Ntk_t_ Abc_Ntk_t
ABC_DLL void Abc_NtkStopReverseLevels(Abc_Ntk_t *pNtk)
ABC_DLL int Abc_NtkLevel(Abc_Ntk_t *pNtk)
ABC_DLL void Abc_NtkStartReverseLevels(Abc_Ntk_t *pNtk, int nMaxLevelIncrease)
ABC_DLL int Abc_NtkToAig(Abc_Ntk_t *pNtk)
ABC_DLL void Abc_NtkDelete(Abc_Ntk_t *pNtk)
ABC_DLL int Abc_NtkGetTotalFanins(Abc_Ntk_t *pNtk)
#define ABC_ALLOC(type, num)
#define ABC_PRTP(a, t, T)
#define ABC_NAMESPACE_IMPL_START
#define ABC_NAMESPACE_IMPL_END
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
ABC_NAMESPACE_IMPL_START typedef char ProgressBar
typedefABC_NAMESPACE_HEADER_START struct Hop_Man_t_ Hop_Man_t
INCLUDES ///.
struct Hop_Obj_t_ Hop_Obj_t
struct Kit_Graph_t_ Kit_Graph_t
void Kit_GraphFree(Kit_Graph_t *pGraph)
Kit_Graph_t * Kit_TruthToGraph(unsigned *pTruth, int nVars, Vec_Int_t *vMemory)
typedefABC_NAMESPACE_IMPL_START struct Res_Man_t_ Res_Man_t
DECLARATIONS ///.
void Res_ManFree(Res_Man_t *p)
int Abc_NtkResynthesize(Abc_Ntk_t *pNtk, Res_Par_t *pPars)
MACRO DEFINITIONS ///.
Hop_Obj_t * Kit_GraphToHop(Hop_Man_t *pMan, Kit_Graph_t *pGraph)
Res_Man_t * Res_ManAlloc(Res_Par_t *pPars)
FUNCTION DEFINITIONS ///.
void Res_UpdateNetwork(Abc_Obj_t *pObj, Vec_Ptr_t *vFanins, Hop_Obj_t *pFunc, Vec_Vec_t *vLevels)
void Res_WinDivisors(Res_Win_t *p, int nLevDivMax)
FUNCTION DEFINITIONS ///.
int Res_FilterCandidates(Res_Win_t *pWin, Abc_Ntk_t *pAig, Res_Sim_t *pSim, Vec_Vec_t *vResubs, Vec_Vec_t *vResubsW, int nFaninsMax, int fArea)
FUNCTION DEFINITIONS ///.
void Res_SimFree(Res_Sim_t *p)
struct Res_Sim_t_ Res_Sim_t
int Res_SimPrepare(Res_Sim_t *p, Abc_Ntk_t *pAig, int nTruePis, int fVerbose)
typedefABC_NAMESPACE_HEADER_START struct Res_Win_t_ Res_Win_t
INCLUDES ///.
void * Res_SatProveUnsat(Abc_Ntk_t *pAig, Vec_Ptr_t *vFanins)
FUNCTION DEFINITIONS ///.
int Res_WinIsTrivial(Res_Win_t *p)
Abc_Ntk_t * Res_WndStrash(Res_Win_t *p)
FUNCTION DEFINITIONS ///.
int Res_WinCompute(Abc_Obj_t *pNode, int nWinTfiMax, int nWinTfoMax, Res_Win_t *p)
void Res_WinFree(Res_Win_t *p)
Res_Win_t * Res_WinAlloc()
DECLARATIONS ///.
Res_Sim_t * Res_SimAlloc(int nWords)
DECLARATIONS ///.
typedefABC_NAMESPACE_HEADER_START struct Res_Par_t_ Res_Par_t
INCLUDES ///.
void Int_ManFree(Int_Man_t *p)
Int_Man_t * Int_ManAlloc()
FUNCTION DEFINITIONS ///.
int Int_ManInterpolate(Int_Man_t *p, Sto_Man_t *pCnf, int fVerbose, unsigned **ppResult)
void Sto_ManFree(Sto_Man_t *p)
struct Sto_Man_t_ Sto_Man_t
struct Int_Man_t_ Int_Man_t
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.
#define Vec_VecForEachLevel(vGlob, vVec, i)
MACRO DEFINITIONS ///.
typedefABC_NAMESPACE_HEADER_START struct Vec_Vec_t_ Vec_Vec_t
INCLUDES ///.