51 Gia_Obj_t * pObj, * pCtrl, * pData0, * pData1;
52 int i, k, Entry, MaxEntry = 0;
62 pData0 = Gia_Regular(pData0);
63 pData1 = Gia_Regular(pData1);
64 p->pRefs[Gia_ObjId(
p, pCtrl)]--;
65 if ( pData0 == pData1 )
66 p->pRefs[Gia_ObjId(
p, pData0)]--;
70 vCosts = Vec_IntAlloc( Gia_ManRegNum(
p) );
73 Vec_IntPush( vCosts, Gia_ObjRefNum(
p, pObj) );
74 MaxEntry = Abc_MaxInt( MaxEntry, Gia_ObjRefNum(
p, pObj) );
83 Vec_Bit_t * vCtrls = Vec_BitStart( Gia_ManObjNum(
p) );
84 Vec_Bit_t * vDatas = Vec_BitStart( Gia_ManObjNum(
p) );
86 int nCtrls = 0, nDatas = 0, nBoth = 0;
92 pCtrl = Gia_Regular(pCtrl);
93 pData1 = Gia_Regular(pData1);
94 pData0 = Gia_Regular(pData0);
95 Vec_BitWriteEntry( vCtrls, Gia_ObjId(
p, pCtrl), 1 );
96 Vec_BitWriteEntry( vDatas, Gia_ObjId(
p, pData1), 1 );
97 Vec_BitWriteEntry( vDatas, Gia_ObjId(
p, pData0), 1 );
100 if ( Vec_BitEntry(vCtrls, Gia_ObjId(
p, pObj)) )
101 Vec_IntAddToEntry( vCosts, i, MaxEntry );
104 MaxEntry = 2*MaxEntry + 1;
110 if ( Vec_BitEntry(vCtrls, Gia_ObjId(
p, pObj)) )
112 if ( Vec_BitEntry(vDatas, Gia_ObjId(
p, pObj)) )
114 if ( Vec_BitEntry(vCtrls, Gia_ObjId(
p, pObj)) && Vec_BitEntry(vDatas, Gia_ObjId(
p, pObj)) )
117 printf(
"%10s : Flops = %5d. Ctrls = %5d. Datas = %5d. Both = %5d.\n", Gia_ManName(
p), Gia_ManRegNum(
p), nCtrls, nDatas, nBoth );
119 Vec_BitFree( vCtrls );
120 Vec_BitFree( vDatas );
123 vLevels = Vec_WecStart( MaxEntry );
125 Vec_WecPush( vLevels, Entry, i );
128 vRes = Vec_IntStart( Gia_ManRegNum(
p) );
131 Vec_IntWriteEntry( vRes, Entry, MaxEntry++ );
134 assert( MaxEntry == Gia_ManRegNum(
p) );
135 Vec_WecFree( vLevels );
136 Vec_IntFree( vCosts );
157 Gia_Obj_t * pObj, * pCtrl, * pData0, * pData1;
161 Vec_Int_t * vCosts = Vec_IntStart( Gia_ManRegNum(
p) );
171 pData0 = Gia_Regular(pData0);
172 pData1 = Gia_Regular(pData1);
173 p->pRefs[Gia_ObjId(
p, pCtrl)]--;
174 if ( pData0 == pData1 )
175 p->pRefs[Gia_ObjId(
p, pData0)]--;
180 Vec_IntWriteEntry( vCosts, i, Gia_ObjRefNum(
p, pObj) );
181 MaxEntry = Abc_MaxInt( MaxEntry, Gia_ObjRefNum(
p, pObj) );
189 Vec_Bit_t * vCtrls = Vec_BitStart( Gia_ManObjNum(
p) );
190 Vec_Bit_t * vDatas = Vec_BitStart( Gia_ManObjNum(
p) );
192 int nCtrls = 0, nDatas = 0, nBoth = 0;
198 pCtrl = Gia_Regular(pCtrl);
199 pData1 = Gia_Regular(pData1);
200 pData0 = Gia_Regular(pData0);
201 Vec_BitWriteEntry( vCtrls, Gia_ObjId(
p, pCtrl), 1 );
202 Vec_BitWriteEntry( vDatas, Gia_ObjId(
p, pData1), 1 );
203 Vec_BitWriteEntry( vDatas, Gia_ObjId(
p, pData0), 1 );
206 if ( Vec_BitEntry(vCtrls, Gia_ObjId(
p, pObj)) )
207 Vec_IntAddToEntry( vCosts, i, MaxEntry );
215 if ( Vec_BitEntry(vCtrls, Gia_ObjId(
p, pObj)) )
217 if ( Vec_BitEntry(vDatas, Gia_ObjId(
p, pObj)) )
219 if ( Vec_BitEntry(vCtrls, Gia_ObjId(
p, pObj)) && Vec_BitEntry(vDatas, Gia_ObjId(
p, pObj)) )
222 printf(
"%10s : Flops = %5d. Ctrls = %5d. Datas = %5d. Both = %5d.\n", Gia_ManName(
p), Gia_ManRegNum(
p), nCtrls, nDatas, nBoth );
224 Vec_BitFree( vCtrls );
225 Vec_BitFree( vDatas );
229 vRes = Vec_IntAllocArray( pPerm, Vec_IntSize(vCosts) );
230 Vec_IntFree( vCosts );
231 vCosts = Vec_IntInvert( vRes, -1 );
255 p->vSolvers = Vec_PtrAlloc( 0 );
256 p->vClauses = Vec_VecAlloc( 0 );
258 p->pOrder =
ABC_ALLOC(
int, Aig_ManRegNum(pAig) );
259 p->vActVars = Vec_IntAlloc( 256 );
260 if ( !
p->pPars->fMonoCnf )
263 p->nPrioShift = Abc_Base2Log(Aig_ManRegNum(pAig));
265 p->vPrio = vPrioInit;
266 else if ( pPars->fFlopPrio )
271 p->vPrio = Vec_IntStart( Aig_ManRegNum(pAig) );
272 p->vLits = Vec_IntAlloc( 100 );
273 p->vCiObjs = Vec_IntAlloc( 100 );
274 p->vCoObjs = Vec_IntAlloc( 100 );
275 p->vCiVals = Vec_IntAlloc( 100 );
276 p->vCoVals = Vec_IntAlloc( 100 );
277 p->vNodes = Vec_IntAlloc( 100 );
278 p->vUndo = Vec_IntAlloc( 100 );
279 p->vVisits = Vec_IntAlloc( 100 );
280 p->vCi2Rem = Vec_IntAlloc( 100 );
281 p->vRes = Vec_IntAlloc( 100 );
286 if ( pAig->pFanData == NULL )
288 if ( pAig->pTerSimData == NULL )
289 pAig->pTerSimData =
ABC_CALLOC(
unsigned, 1 + (Aig_ManObjNumMax(pAig) / 16) );
291 if ( pPars->nTimeOutOne )
295 for ( i = 0; i < Saig_ManPoNum(pAig); i++ )
296 p->pTime4Outs[i] = pPars->nTimeOutOne * CLOCKS_PER_SEC / 1000 + 1;
298 if ( pPars->fSolveAll )
300 p->vCexes = Vec_PtrStart( Saig_ManPoNum(
p->pAig) );
301 p->pPars->vOutMap = Vec_IntAlloc( Saig_ManPoNum(pAig) );
302 Vec_IntFill(
p->pPars->vOutMap, Saig_ManPoNum(pAig), -2 );
325 if (
p->pPars->fVerbose )
327 Abc_Print( 1,
"Block =%5d Oblig =%6d Clause =%6d Call =%6d (sat=%.1f%%) Cex =%4d Start =%4d\n",
328 p->nBlocks,
p->nObligs,
p->nCubes,
p->nCalls, 100.0 *
p->nCallsS /
p->nCalls,
p->nCexesTotal,
p->nStarts );
329 ABC_PRTP(
"SAT solving",
p->tSat,
p->tTotal );
330 ABC_PRTP(
" unsat ",
p->tSatUnsat,
p->tTotal );
332 ABC_PRTP(
"Generalize ",
p->tGeneral,
p->tTotal );
333 ABC_PRTP(
"Push clause",
p->tPush,
p->tTotal );
334 ABC_PRTP(
"Ternary sim",
p->tTsim,
p->tTotal );
335 ABC_PRTP(
"Containment",
p->tContain,
p->tTotal );
336 ABC_PRTP(
"CNF compute",
p->tCnf,
p->tTotal );
337 ABC_PRTP(
"Refinement ",
p->tAbs,
p->tTotal );
344 Vec_PtrFree(
p->vSolvers );
347 Vec_VecFree(
p->vClauses );
350 Vec_IntFree(
p->vActVars );
353 Vec_IntFreeP( &
p->vVar2Reg );
357 for ( i = 0; i < Aig_ManObjNumMax(
p->pAig); i++ )
361 for ( i = 0; i < Vec_PtrSize(&
p->vVar2Ids); i++ )
362 Vec_IntFree( (
Vec_Int_t *)Vec_PtrEntry(&
p->vVar2Ids, i) );
364 Vec_WecFreeP( &
p->vVLits );
367 Vec_IntFreeP( &
p->vAbsFlops );
368 Vec_IntFreeP( &
p->vMapFf2Ppi );
369 Vec_IntFreeP( &
p->vMapPpi2Ff );
371 if (
p->pPars->fNewXSim )
374 Vec_IntFreeP( &
p->vPrio );
375 Vec_IntFree(
p->vLits );
376 Vec_IntFree(
p->vCiObjs );
377 Vec_IntFree(
p->vCoObjs );
378 Vec_IntFree(
p->vCiVals );
379 Vec_IntFree(
p->vCoVals );
380 Vec_IntFree(
p->vNodes );
381 Vec_IntFree(
p->vUndo );
382 Vec_IntFree(
p->vVisits );
383 Vec_IntFree(
p->vCi2Rem );
384 Vec_IntFree(
p->vRes );
385 Vec_PtrFreeP( &
p->vInfCubes );
388 Vec_PtrFreeFree(
p->vCexes );
390 if (
p->pAig->pFanData != NULL )
392 if (
p->pAig->pTerSimData != NULL )
412 int i, f, Lit, nFrames = 0;
414 for ( pObl =
p->pQueue; pObl; pObl = pObl->
pNext )
417 pCex =
Abc_CexAlloc( Aig_ManRegNum(
p->pAig), Saig_ManPiNum(
p->pAig), nFrames );
418 pCex->iPo =
p->iOutCur;
419 pCex->iFrame = nFrames-1;
420 for ( pObl =
p->pQueue, f = 0; pObl; pObl = pObl->
pNext, f++ )
421 for ( i = pObl->
pState->
nLits; i < pObl->pState->nTotal; i++ )
424 if ( Abc_LitIsCompl(Lit) )
426 if ( Abc_Lit2Var(Lit) >= pCex->nPis )
428 assert( Abc_Lit2Var(Lit) < pCex->nPis );
429 Abc_InfoSetBit( pCex->pData, pCex->nRegs + f * pCex->nPis + Abc_Lit2Var(Lit) );
433 printf(
"CEX for output %d is not valid.\n",
p->iOutCur );
455 int i, f, Lit, Flop, nFrames = 0;
456 int nPis = Saig_ManPiNum(
p->pAig);
458 if ( !
p->pPars->fUseAbs || !
p->vMapPpi2Ff )
463 assert( Vec_IntEntry(
p->vMapFf2Ppi, Flop ) == i );
464 Vec_IntWriteEntry(
p->vMapFf2Ppi, Flop, -1 );
466 Vec_IntClear(
p->vMapPpi2Ff );
468 for ( pObl =
p->pQueue; pObl; pObl = pObl->
pNext )
470 for ( i = pObl->
pState->
nLits; i < pObl->pState->nTotal; i++ )
473 if ( Abc_Lit2Var(Lit) < nPis )
475 Flop = Abc_Lit2Var(Lit) - nPis;
476 if ( Vec_IntEntry(
p->vMapFf2Ppi, Flop) >= 0 )
478 Vec_IntWriteEntry(
p->vMapFf2Ppi, Flop, Vec_IntSize(
p->vMapPpi2Ff) );
479 Vec_IntPush(
p->vMapPpi2Ff, Flop );
483 if ( Vec_IntSize(
p->vMapPpi2Ff) == 0 )
485 if (
p->pPars->fUseSimpleRef )
490 assert( Vec_IntEntry(
p->vAbsFlops, Flop) == 0 );
491 Vec_IntWriteEntry(
p->vAbsFlops, Flop, 1 );
498 pCex =
Abc_CexAlloc( Aig_ManRegNum(
p->pAig) - Vec_IntSize(
p->vMapPpi2Ff), Saig_ManPiNum(
p->pAig) + Vec_IntSize(
p->vMapPpi2Ff), nFrames );
499 pCex->iPo =
p->iOutCur;
500 pCex->iFrame = nFrames-1;
501 for ( pObl =
p->pQueue, f = 0; pObl; pObl = pObl->
pNext, f++ )
502 for ( i = pObl->
pState->
nLits; i < pObl->pState->nTotal; i++ )
505 if ( Abc_LitIsCompl(Lit) )
507 if ( Abc_Lit2Var(Lit) < nPis )
508 Abc_InfoSetBit( pCex->pData, pCex->nRegs + f * pCex->nPis + Abc_Lit2Var(Lit) );
511 int iPPI = nPis + Vec_IntEntry(
p->vMapFf2Ppi, Abc_Lit2Var(Lit) - nPis);
512 assert( iPPI < pCex->nPis );
513 Abc_InfoSetBit( pCex->pData, pCex->nRegs + f * pCex->nPis + iPPI );
521 assert( pCexCare->nPis == pCex->nPis );
524 for ( f = 0; f < nFrames; f++ )
526 for ( i = nPis; i < pCexCare->nPis; i++ )
527 if ( Abc_InfoHasBit(pCexCare->pData, pCexCare->nRegs + pCexCare->nPis * f + i) )
529 if ( Vec_IntEntry(
p->vAbsFlops, Vec_IntEntry(
p->vMapPpi2Ff, i-nPis)) == 0 )
530 Vec_IntWriteEntry(
p->vAbsFlops, Vec_IntEntry(
p->vMapPpi2Ff, i-nPis), 1 ), nFfRefined++;
534 if ( nFfRefined == 0 )
int * Abc_MergeSortCost(int *pCosts, int nSize)
#define ABC_ALLOC(type, num)
#define ABC_PRTP(a, t, T)
#define ABC_CALLOC(type, num)
#define ABC_NAMESPACE_IMPL_START
#define ABC_NAMESPACE_IMPL_END
void Aig_ManFanoutStart(Aig_Man_t *p)
FUNCTION DEFINITIONS ///.
void Aig_ManFanoutStop(Aig_Man_t *p)
int Aig_ManLevels(Aig_Man_t *p)
typedefABC_NAMESPACE_HEADER_START struct Aig_Man_t_ Aig_Man_t
INCLUDES ///.
void Aig_ManCleanMarkAB(Aig_Man_t *p)
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Abc_Cex_t * Bmc_CexCareMinimizeAig(Gia_Man_t *p, int nRealPis, Abc_Cex_t *pCex, int nTryCexes, int fCheck, int fVerbose)
Cnf_Man_t * Cnf_ManStart()
FUNCTION DEFINITIONS ///.
void Cnf_DataFree(Cnf_Dat_t *p)
void Cnf_ManStop(Cnf_Man_t *p)
Gia_Man_t * Gia_ManFromAigSimple(Aig_Man_t *p)
Gia_Man_t * Gia_ManDupAbs(Gia_Man_t *p, Vec_Int_t *vMapPpi2Ff, Vec_Int_t *vMapFf2Ppi)
void Gia_ManStop(Gia_Man_t *p)
#define Gia_ManForEachRo(p, pObj, i)
Gia_Obj_t * Gia_ObjRecognizeMux(Gia_Obj_t *pNode, Gia_Obj_t **ppNodeT, Gia_Obj_t **ppNodeE)
#define Gia_ManForEachAnd(p, pObj, i)
void Gia_ManStopP(Gia_Man_t **p)
struct Gia_Obj_t_ Gia_Obj_t
int Gia_ObjIsMuxType(Gia_Obj_t *pNode)
struct Gia_Man_t_ Gia_Man_t
void Gia_ManCreateRefs(Gia_Man_t *p)
void Pdr_QueueStop(Pdr_Man_t *p)
struct Pdr_Set_t_ Pdr_Set_t
void Pdr_SetDeref(Pdr_Set_t *p)
Txs3_Man_t * Txs3_ManStart(Pdr_Man_t *pMan, Aig_Man_t *pAig, Vec_Int_t *vPrio)
FUNCTION DEFINITIONS ///.
void Txs3_ManStop(Txs3_Man_t *)
struct Pdr_Obl_t_ Pdr_Obl_t
struct Pdr_Man_t_ Pdr_Man_t
Vec_Int_t * Pdr_ManDeriveFlopPriorities2(Gia_Man_t *p, int fMuxCtrls)
Pdr_Man_t * Pdr_ManStart(Aig_Man_t *pAig, Pdr_Par_t *pPars, Vec_Int_t *vPrioInit)
Abc_Cex_t * Pdr_ManDeriveCexAbs(Pdr_Man_t *p)
void Pdr_ManStop(Pdr_Man_t *p)
ABC_NAMESPACE_IMPL_START Vec_Int_t * Pdr_ManDeriveFlopPriorities3(Gia_Man_t *p, int fMuxCtrls)
DECLARATIONS ///.
Abc_Cex_t * Pdr_ManDeriveCex(Pdr_Man_t *p)
typedefABC_NAMESPACE_HEADER_START struct Pdr_Par_t_ Pdr_Par_t
INCLUDES ///.
int Saig_ManVerifyCex(Aig_Man_t *pAig, Abc_Cex_t *p)
void sat_solver_delete(sat_solver *s)
void Abc_CexFree(Abc_Cex_t *p)
ABC_NAMESPACE_IMPL_START Abc_Cex_t * Abc_CexAlloc(int nRegs, int nRealPis, int nFrames)
DECLARATIONS ///.
typedefABC_NAMESPACE_HEADER_START struct Abc_Cex_t_ Abc_Cex_t
INCLUDES ///.
typedefABC_NAMESPACE_HEADER_START struct Vec_Bit_t_ Vec_Bit_t
INCLUDES ///.
#define Vec_IntForEachEntry(vVec, Entry, i)
MACRO DEFINITIONS ///.
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.
#define Vec_VecForEachEntry(Type, vGlob, pEntry, i, k)
#define Vec_WecForEachLevel(vGlob, vVec, i)
MACRO DEFINITIONS ///.
typedefABC_NAMESPACE_HEADER_START struct Vec_Wec_t_ Vec_Wec_t
INCLUDES ///.