27 #define VTA_LARGE 0xFFFFFFF
107 #define Vta_ManForEachObj( p, pObj, i ) \
108 for ( i = 1; (i < p->nObjs) && ((pObj) = Vta_ManObj(p, i)); i++ )
109 #define Vta_ManForEachObjObj( p, pObjVta, pObjGia, i ) \
110 for ( i = 1; (i < p->nObjs) && ((pObjVta) = Vta_ManObj(p, i)) && ((pObjGia) = Gia_ManObj(p->pGia, pObjVta->iObj)); i++ )
111 #define Vta_ManForEachObjObjReverse( p, pObjVta, pObjGia, i ) \
112 for ( i = Vec_IntSize(vVec) - 1; (i >= 1) && ((pObjVta) = Vta_ManObj(p, i)) && ((pObjGia) = Gia_ManObj(p->pGia, pObjVta->iObj)); i++ )
114 #define Vta_ManForEachObjVec( vVec, p, pObj, i ) \
115 for ( i = 0; (i < Vec_IntSize(vVec)) && ((pObj) = Vta_ManObj(p, Vec_IntEntry(vVec,i))); i++ )
116 #define Vta_ManForEachObjVecReverse( vVec, p, pObj, i ) \
117 for ( i = Vec_IntSize(vVec) - 1; (i >= 0) && ((pObj) = Vta_ManObj(p, Vec_IntEntry(vVec,i))); i-- )
119 #define Vta_ManForEachObjObjVec( vVec, p, pObj, pObjG, i ) \
120 for ( i = 0; (i < Vec_IntSize(vVec)) && ((pObj) = Vta_ManObj(p, Vec_IntEntry(vVec,i))) && ((pObjG) = Gia_ManObj(p->pGia, pObj->iObj)); i++ )
121 #define Vta_ManForEachObjObjVecReverse( vVec, p, pObj, pObjG, i ) \
122 for ( i = Vec_IntSize(vVec) - 1; (i >= 0) && ((pObj) = Vta_ManObj(p, Vec_IntEntry(vVec,i))) && ((pObjG) = Gia_ManObj(p->pGia, pObj->iObj)); i-- )
152 int i, k, Entry, iStart, iStop = -1;
156 for ( i = 0; i < nFrames; i++ )
183 int i, k, Entry, nSize;
219 for ( i = 0; i < nObjs; i++ )
222 for ( w = 0; w <
nWords; w++ )
246 for ( i = 0; i < nObjs; i++ )
247 for ( w = 0; w <
nWords; w++ )
248 pArray[2 * nWords * i + w] = p->pArray[nWords * i + w];
271 return ((
unsigned)((iObj + iFrame)*(iObj + iFrame + 1))) % nBins;
278 pThis; pPlace = &pThis->
iNext,
280 if ( pThis->
iObj == iObj && pThis->
iFrame == iFrame )
293 assert( iObj >= 0 && iFrame >= -1 );
315 *pPlace = p->
nObjs++;
326 *pPlace = pThis->
iNext;
350 pCex->iFrame = p->
pPars->iFrame;
393 int Diff = (*pp1)->Prio - (*pp2)->Prio;
398 Diff = (*pp1) - (*pp2);
421 for ( i = 0; i < p->
nWords; i++ )
564 pCounters[pThis->
iFrame]++;
565 for ( i = 0; i <= p->
pPars->iFrame; i++ )
587 Vta_Obj_t * pThis, * pThis0, * pThis1, * pTop;
709 Vec_PtrSort( vTermsUnused, (
int (*)(
void))Vta_ManComputeDepthIncrease );
719 pThis->
Prio = Counter++;
721 pThis->
Prio = Counter++;
740 assert( pThis0 && pThis1 );
800 assert( pThis0 && pThis1 );
816 else if ( pThis1->
fVisit )
819 else if ( pThis0->
Prio <= pThis1->
Prio )
859 if ( p->
pPars->fAddLayer )
911 assert( pThis0 && pThis1 );
949 Abc_Print( 1,
"Vta_ManRefineAbstraction(): Terminary simulation verification failed!\n" );
956 if ( pTop->
Prio == 0 )
1035 if ( p->
pPars->fVerbose )
1036 Abc_Print( 1,
"SAT solver: Var = %d Cla = %d Conf = %d Lrn = %d Reduce = %d Cex = %d Objs+ = %d\n",
1099 RetValue =
sat_solver2_solve( pSat, &iLit, &iLit+1, (ABC_INT64_T)nConfMax, (ABC_INT64_T)0, (ABC_INT64_T)0, (ABC_INT64_T)0 );
1108 if ( RetValue ==
l_True )
1146 int * pCountAll = NULL, * pCountUni = NULL;
1147 int i, iFrame, iObj, Entry, fChanges = 0;
1157 assert( iFrame < nFrames );
1162 pCountUni[iFrame+1]++;
1166 pCountAll[iFrame+1]++;
1200 if ( vCore == NULL )
1205 Abc_Print( 1,
"%9.2f sec", 1.0*Time/CLOCKS_PER_SEC );
1229 Abc_Print( 1,
"%9.2f sec", 1.0*Time/CLOCKS_PER_SEC );
1259 int iThis0, iMainVar =
Vta_ObjId(p, pThis);
1277 if ( p->
pPars->fUseTermVars )
1334 int i, Entry, iObj, iFrame;
1339 Abc_Print( 1,
"%d*%d ", iObj, iFrame+Lift );
1360 for ( ; pThis < pLimit; pThis++ )
1365 if ( Entry < p->nObjs )
1426 char * pFileNameDef =
"vabs.aig";
1427 char * pFileName = p->
pPars->pFileVabs ? p->
pPars->pFileVabs : pFileNameDef;
1430 Abc_Print( 1,
"Dumping abstracted model into file \"%s\"...\n", pFileName );
1471 memTot = memAig + memSat + memPro + memMap + memOth;
1472 ABC_PRMP(
"Memory: AIG ", memAig, memTot );
1473 ABC_PRMP(
"Memory: SAT ", memSat, memTot );
1474 ABC_PRMP(
"Memory: Proof ", memPro, memTot );
1475 ABC_PRMP(
"Memory: Map ", memMap, memTot );
1476 ABC_PRMP(
"Memory: Other ", memOth, memTot );
1477 ABC_PRMP(
"Memory: TOTAL ", memTot, memTot );
1497 int i, f, nConfls, Status, nObjOld, RetValue = -1, nCountNoChange = 0, fOneIsSent = 0;
1501 assert( pPars->nFramesMax == 0 || pPars->nFramesStart <= pPars->nFramesMax );
1506 printf(
"Sequential miter is trivially UNSAT.\n" );
1511 printf(
"Sequential miter is trivially SAT.\n" );
1527 if ( p->
pPars->nTimeOut )
1530 if ( p->
pPars->fVerbose )
1532 Abc_Print( 1,
"Running variable-timeframe abstraction (VTA) with the following parameters:\n" );
1533 Abc_Print( 1,
"FramePast = %d FrameMax = %d ConfMax = %d Timeout = %d RatioMin = %d %%\n",
1534 pPars->nFramesPast, pPars->nFramesMax, pPars->nConfLimit, pPars->nTimeOut, pPars->nRatioMin );
1535 Abc_Print( 1,
"LearnStart = %d LearnDelta = %d LearnRatio = %d %%.\n",
1536 pPars->nLearnedStart, pPars->nLearnedDelta, pPars->nLearnedPerce );
1538 Abc_Print( 1,
" Frame %% Abs %% Confl Cex Vars Clas Lrns Core Time Mem\n" );
1541 for ( f = i = 0; !p->
pPars->nFramesMax || f < p->
pPars->nFramesMax; f++ )
1544 p->
pPars->iFrame = f;
1546 if ( f == p->
nWords * 32 )
1565 for ( i = 0; ; i++ )
1569 assert( (vCore != NULL) == (Status == 1) );
1581 if ( vCore != NULL )
1614 assert( (vCore != NULL) == (Status == 1) );
1635 p->
pPars->nFramesNoChange = 0;
1637 else if ( ++nCountNoChange == 2 )
1639 p->
pPars->nFramesNoChange++;
1651 if ( p->
pPars->fDumpVabs && (f & 1) )
1672 if ( p->
pPars->fVerbose && Status == -1 )
1675 Abc_Print( 1,
"Abstraction is not produced because first frame is not solved. " );
1686 Abc_Print( 1,
"Timeout %d sec in frame %d with a %d-stable abstraction. ", p->
pPars->nTimeOut, f, p->
pPars->nFramesNoChange );
1688 Abc_Print( 1,
"Exceeded %d conflicts in frame %d with a %d-stable abstraction. ", pPars->nConfLimit, f, p->
pPars->nFramesNoChange );
1690 Abc_Print( 1,
"The ratio of abstracted objects is less than %d %% in frame %d. ", pPars->nRatioMin, f );
1692 Abc_Print( 1,
"Abstraction stopped for unknown reason in frame %d. ", f );
1697 Abc_Print( 1,
"VTA completed %d frames with a %d-stable abstraction. ", f, p->
pPars->nFramesNoChange );
1703 if ( p->
pPars->fVerbose )
1708 Abc_Print( 1,
" Gia_VtaPerform(): CEX verification has failed!\n" );
1709 Abc_Print( 1,
"Counter-example detected in frame %d. ", f );
1710 p->
pPars->iFrame = pCex->iFrame - 1;
1716 if ( p->
pPars->fVerbose )
1746 if ( pAig->
vObjClasses == NULL && pPars->fUseRollback )
1748 int nFramesMaxOld = pPars->nFramesMax;
1749 pPars->nFramesMax = pPars->nFramesStart;
1751 pPars->nFramesMax = nFramesMaxOld;
1753 if ( RetValue == 0 )
void Vga_ManStop(Vta_Man_t *p)
static int sat_solver2_nlearnts(sat_solver2 *s)
static void Vga_ManDelete(Vta_Man_t *p, int iObj, int iFrame)
static int Vta_ObjId(Vta_Man_t *p, Vta_Obj_t *pObj)
ABC_DLL int Abc_FrameIsBridgeMode()
void Vga_ManLoadSlice(Vta_Man_t *p, Vec_Int_t *vOne, int Lift)
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
struct Vta_Man_t_ Vta_Man_t
static int Abc_PrimeCudd(unsigned int p)
static int Vga_ManGetOutLit(Vta_Man_t *p, int f)
Vec_Int_t * Vta_ManCollectNodes(Vta_Man_t *p, int f)
void Gia_ManStop(Gia_Man_t *p)
static int sat_solver2_nclauses(sat_solver2 *s)
int Gia_ManVerifyCex(Gia_Man_t *pAig, Abc_Cex_t *p, int fDualOut)
DECLARATIONS ///.
void Gia_VtaSendCancel(Vta_Man_t *p, int fVerbose)
typedefABC_NAMESPACE_HEADER_START struct Vec_Vec_t_ Vec_Vec_t
INCLUDES ///.
void * Sat_ProofCore(sat_solver2 *s)
static int Gia_ManPoNum(Gia_Man_t *p)
static int Gia_ObjFaninC1(Gia_Obj_t *pObj)
void Gia_VtaDumpAbsracted(Vta_Man_t *p, int fVerbose)
static double Vec_VecMemoryInt(Vec_Vec_t *p)
int Vec_IntDoubleWidth(Vec_Int_t *p, int nWords)
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
static Vta_Obj_t * Vga_ManFindOrAdd(Vta_Man_t *p, int iObj, int iFrame)
int Cmd_CommandExecute(void *pAbc, char *pCommandLine)
static int Abc_InfoHasBit(unsigned *p, int i)
ABC_NAMESPACE_IMPL_START Abc_Cex_t * Abc_CexAlloc(int nRegs, int nRealPis, int nFrames)
DECLARATIONS ///.
double sat_solver2_memory_proof(sat_solver2 *s)
static Gia_Obj_t * Gia_ManPo(Gia_Man_t *p, int v)
#define ABC_REALLOC(type, obj, num)
static int Vga_ManHash(int iObj, int iFrame, int nBins)
static int Vta_ValIs0(Vta_Obj_t *pThis, int fCompl)
#define Vta_ManForEachObjObjVecReverse(vVec, p, pObj, pObjG, i)
ABC_DLL int Abc_FrameIsBatchMode()
#define Vec_VecForEachLevelInt(vGlob, vVec, i)
void sat_solver2_delete(sat_solver2 *s)
Gia_Man_t * Gia_ManDupAbsGates(Gia_Man_t *p, Vec_Int_t *vGateClasses)
static int Gia_ObjIsConst0(Gia_Obj_t *pObj)
static int Abc_Var2Lit(int Var, int fCompl)
static Vec_Set_t * Vec_SetAlloc(int nPageSize)
Abc_Cex_t * Vga_ManDeriveCex(Vta_Man_t *p)
static void Vec_PtrSort(Vec_Ptr_t *p, int(*Vec_PtrSortCompare)()) ___unused
static int Gia_ObjFaninId1p(Gia_Man_t *p, Gia_Obj_t *pObj)
int Gia_ManToBridgeBadAbs(FILE *pFile)
static void Vec_PtrPush(Vec_Ptr_t *p, void *Entry)
static Vec_Int_t * Vta_ManDeriveAbsAll(Vec_Int_t *p, int nWords)
Vec_Int_t * Gia_VtaFramesToAbs(Vec_Vec_t *vFrames)
sat_solver2 * sat_solver2_new(void)
static Vta_Obj_t * Vta_ManObj(Vta_Man_t *p, int i)
void Vta_ManSatVerify(Vta_Man_t *p)
Vec_Int_t * Gia_VtaConvertToGla(Gia_Man_t *p, Vec_Int_t *vVta)
Abc_Cex_t * Vta_ManRefineAbstraction(Vta_Man_t *p, int f)
Vec_Ptr_t * Gia_VtaAbsToFrames(Vec_Int_t *vAbs)
FUNCTION DEFINITIONS ///.
ABC_DLL void Abc_FrameSetStatus(int Status)
static void Vec_BitFreeP(Vec_Bit_t **p)
static void Vec_BitWriteEntry(Vec_Bit_t *p, int i, int Entry)
static abctime Abc_Clock()
static int Abc_MaxInt(int a, int b)
#define Vta_ManForEachObjVec(vVec, p, pObj, i)
static int Vec_PtrSize(Vec_Ptr_t *p)
static int Vta_ValIs1(Vta_Obj_t *pThis, int fCompl)
static void Vec_IntSort(Vec_Int_t *p, int fReverse)
static Gia_Obj_t * Gia_ManObj(Gia_Man_t *p, int v)
static int sat_solver2_var_value(sat_solver2 *s, int v)
typedefABC_NAMESPACE_HEADER_START struct Vec_Bit_t_ Vec_Bit_t
INCLUDES ///.
Abc_Cex_t * Abc_CexMakeTriv(int nRegs, int nTruePis, int nTruePos, int iFrameOut)
int Vta_ManComputeDepthIncrease(Vta_Obj_t **pp1, Vta_Obj_t **pp2)
#define ABC_PRTP(a, t, T)
double sat_solver2_memory(sat_solver2 *s, int fAll)
int Gia_VtaPerformInt(Gia_Man_t *pAig, Abs_Par_t *pPars)
static void Abc_PrintTime(int level, const char *pStr, abctime time)
struct Gia_Obj_t_ Gia_Obj_t
static void Vec_IntWriteEntry(Vec_Int_t *p, int i, int Entry)
static int Gia_ManAndNum(Gia_Man_t *p)
static int Abc_MinInt(int a, int b)
static Vec_Int_t * Vec_IntStart(int nSize)
static Vec_Bit_t * Vec_BitStart(int nSize)
static Gia_Obj_t * Gia_ObjFanin0(Gia_Obj_t *pObj)
void Vta_ManCollectNodes_rec(Vta_Man_t *p, Vta_Obj_t *pThis, Vec_Int_t *vOrder)
static Vec_Int_t * Vec_IntAlloc(int nCap)
FUNCTION DEFINITIONS ///.
void Vta_ManProfileAddition(Vta_Man_t *p, Vec_Int_t *vTermsToAdd)
static void * Vec_PtrEntryLast(Vec_Ptr_t *p)
int sat_solver2_simplify(sat_solver2 *s)
void sat_solver2_rollback(sat_solver2 *s)
static int Gia_ObjIsRo(Gia_Man_t *p, Gia_Obj_t *pObj)
static int sat_solver2_add_constraint(sat_solver2 *pSat, int iVar, int iVar2, int fCompl, int fMark, int Id)
ABC_DLL void Abc_FrameSetCex(Abc_Cex_t *pCex)
static Gia_Obj_t * Gia_ObjRoToRi(Gia_Man_t *p, Gia_Obj_t *pObj)
static int Vec_IntEntry(Vec_Int_t *p, int i)
#define Vta_ManForEachObj(p, pObj, i)
#define ABC_NAMESPACE_IMPL_END
void * Abc_FrameGetGlobalFrame()
static void Vec_IntPush(Vec_Int_t *p, int Entry)
static void Vta_ObjPreds(Vta_Man_t *p, Vta_Obj_t *pThis, Gia_Obj_t *pObj, Vta_Obj_t **ppThis0, Vta_Obj_t **ppThis1)
static int Gia_ManCandNum(Gia_Man_t *p)
static void Vec_IntFreeP(Vec_Int_t **p)
static void sat_solver2_bookmark(sat_solver2 *s)
static int Vec_IntCap(Vec_Int_t *p)
void Gia_VtaSendAbsracted(Vta_Man_t *p, int fVerbose)
static void Abc_Print(int level, const char *format,...)
#define Vta_ManForEachObjObj(p, pObjVta, pObjGia, i)
int Gia_VtaPerform(Gia_Man_t *pAig, Abs_Par_t *pPars)
void Gia_AigerWrite(Gia_Man_t *p, char *pFileName, int fWriteSymbols, int fCompact)
static int Vec_BitCap(Vec_Bit_t *p)
#define Vta_ManForEachObjObjVec(vVec, p, pObj, pObjG, i)
static int * Vga_ManLookup(Vta_Man_t *p, int iObj, int iFrame)
Vta_Man_t * Vga_ManStart(Gia_Man_t *pGia, Abs_Par_t *pPars)
struct Vta_Obj_t_ Vta_Obj_t
DECLARATIONS ///.
#define ABC_NAMESPACE_IMPL_START
static void * Vec_PtrEntry(Vec_Ptr_t *p, int i)
static void Abc_InfoSetBit(unsigned *p, int i)
static int sat_solver2_add_buffer(sat_solver2 *pSat, int iVarA, int iVarB, int fCompl, int fMark, int Id)
static int Vec_IntEntryLast(Vec_Int_t *p)
static int Vec_IntSize(Vec_Int_t *p)
ABC_DLL void Abc_FrameSetNFrames(int nFrames)
static Vec_Ptr_t * Vec_PtrAlloc(int nCap)
FUNCTION DEFINITIONS ///.
static int sat_solver2_add_and(sat_solver2 *pSat, int iVar, int iVar0, int iVar1, int fCompl0, int fCompl1, int fMark, int Id)
#define ABC_PRMP(a, f, F)
static int Abc_Base2Log(unsigned n)
static int sat_solver2_nvars(sat_solver2 *s)
static int Vec_VecSizeSize(Vec_Vec_t *p)
static int Gia_ObjIsAnd(Gia_Obj_t *pObj)
static int Vec_BitEntry(Vec_Bit_t *p, int i)
int Gia_ManToBridgeAbsNetlist(FILE *pFile, void *p, int pkg_type)
static int sat_solver2_add_const(sat_solver2 *pSat, int iVar, int fCompl, int fMark, int Id)
void Vga_ManRollBack(Vta_Man_t *p, int nObjOld)
#define ABC_CALLOC(type, num)
static int Vec_VecSize(Vec_Vec_t *p)
static int Gia_ObjFaninId0p(Gia_Man_t *p, Gia_Obj_t *pObj)
int sat_solver2_solve(sat_solver2 *s, lit *begin, lit *end, ABC_INT64_T nConfLimit, ABC_INT64_T nInsLimit, ABC_INT64_T nConfLimitGlobal, ABC_INT64_T nInsLimitGlobal)
Vec_Int_t * Vta_ManUnsatCore(int iLit, sat_solver2 *pSat, int nConfMax, int fVerbose, int *piRetValue, int *pnConfls)
static void Vec_VecFreeP(Vec_Vec_t **p)
static int * Vec_IntEntryP(Vec_Int_t *p, int i)
#define Vec_IntForEachEntryStartStop(vVec, Entry, i, Start, Stop)
#define BRIDGE_ABS_NETLIST
typedefABC_NAMESPACE_HEADER_START struct Abc_Cex_t_ Abc_Cex_t
INCLUDES ///.
int Vta_ManObjIsUsed(Vta_Man_t *p, int iObj)
static int Gia_ObjFaninC0(Gia_Obj_t *pObj)
static void Vec_IntFree(Vec_Int_t *p)
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.
static int Gia_ManPiNum(Gia_Man_t *p)
void Gia_VtaPrintMemory(Vta_Man_t *p)
static void Vec_IntClear(Vec_Int_t *p)
static int Gia_ObjIsCi(Gia_Obj_t *pObj)
#define Vec_IntForEachEntry(vVec, Entry, i)
MACRO DEFINITIONS ///.
static void Abc_PrintInt(int i)
static Vta_Obj_t * Vga_ManFind(Vta_Man_t *p, int iObj, int iFrame)
static int sat_solver2_nconflicts(sat_solver2 *s)
void Vga_ManPrintCore(Vta_Man_t *p, Vec_Int_t *vCore, int Lift)
static int Gia_ObjCioId(Gia_Obj_t *pObj)
static int Gia_ManObjNum(Gia_Man_t *p)
typedefABC_NAMESPACE_HEADER_START struct Abs_Par_t_ Abs_Par_t
INCLUDES ///.
static abctime sat_solver2_set_runtime_limit(sat_solver2 *s, abctime Limit)
static void Vec_PtrFree(Vec_Ptr_t *p)
void Vta_ManUnsatCoreRemap(Vta_Man_t *p, Vec_Int_t *vCore)
static int Gia_ObjIsPi(Gia_Man_t *p, Gia_Obj_t *pObj)
int Vta_ManAbsPrintFrame(Vta_Man_t *p, Vec_Int_t *vCore, int nFrames, int nConfls, int nCexes, abctime Time, int fVerbose)
void Vga_ManAddClausesOne(Vta_Man_t *p, int iObj, int iFrame)
static int Gia_ManRegNum(Gia_Man_t *p)