58 #define kCS_WITH_SAFETY_INVARIANTS 1
59 #define kCS_WITH_DISCOVER_MONOTONE_SIGNALS 2
60 #define kCS_WITH_SAFETY_AND_DCS_INVARIANTS 3
61 #define kCS_WITH_SAFETY_AND_USER_GIVEN_DCS_INVARIANTS 4
106 if( nonFirstIteration == 0 )
178 Aig_Obj_t *pObj, *pObjAbsorberLo, *pPInNewArg, *pPOutNewArg;
179 Aig_Obj_t *pPIn = NULL, *pPOut = NULL, *pPOutCo = NULL;
180 Aig_Obj_t *pFirstAbsorberOr, *pSecondAbsorberOr;
182 int piCopied = 0, loCreated = 0, loCopied = 0, liCreated = 0, liCopied = 0;
185 assert(*pLiveIndex_0 != -1);
186 if(nonFirstIteration == 0)
187 assert( *pLiveIndex_k == -1 );
189 assert( *pLiveIndex_k != -1 );
198 sprintf(pNewAig->pName,
"%s_%s", pAig->pName,
"kCS");
199 pNewAig->pSpec = NULL;
206 if( *pLiveIndex_k == -1 )
241 nRegCount = loCreated + loCopied;
254 if( nonFirstIteration == 0 )
262 pFirstAbsorberOr =
Aig_Or( pNewAig,
Aig_Not(pPInNewArg), pObjAbsorberLo );
263 pSecondAbsorberOr =
Aig_Or( pNewAig, pPInNewArg,
Aig_Not(pObjAbsorberLo) );
276 pFirstAbsorberOr =
Aig_Or( pNewAig,
Aig_Not(pPOutNewArg), pObjAbsorberLo );
277 pSecondAbsorberOr =
Aig_Or( pNewAig, pPInNewArg,
Aig_Not(pObjAbsorberLo) );
286 if( i == *pLiveIndex_k )
291 if( nonFirstIteration == 0 )
300 assert( pPOutCo != NULL );
322 assert( *pLiveIndex_k != - 1);
328 Aig_Obj_t *pObjPOSafetyInvar, *pObjSafetyInvar;
329 Aig_Obj_t *pObjPOCSTarget, *pObjCSTarget;
332 pObjPOSafetyInvar =
Aig_ManCo( pAig, safetyInvarPO );
334 pObjPOCSTarget =
Aig_ManCo( pAig, csTarget );
337 pObjCSTargetNew =
Aig_And( pAig, pObjSafetyInvar, pObjCSTarget );
341 int flipConePdr(
Aig_Man_t *pAig,
int directive,
int targetCSPropertyIndex,
int safetyInvariantPOIndex,
int absorberCount )
351 fileName = (
char *)
malloc(
sizeof(
char) * 50);
352 sprintf(fileName,
"%s_%d.%s",
"kLive", absorberCount,
"blif" );
356 assert( safetyInvariantPOIndex != -1 );
371 pPars->fNotVerbose = 1;
372 pPars->fSolveAll = 1;
373 pAig->vSeqModelVec = NULL;
380 if( pAig->vSeqModelVec )
457 return monotoneVector;
468 if(vMasterBarrierDisjunctsArg)
484 if(vMasterBarrierDisjunctsArg)
493 printf(
"%d - ", iElem);
506 char stringBuffer[100];
509 while(fgets(stringBuffer, 50, fp))
511 if(
strstr(stringBuffer,
":"))
530 int absorberLimit = 500;
532 int liveIndex_0 = -1, liveIndex_k = -1;
536 int safetyInvariantPO = -1;
539 Vec_Ptr_t *vMasterBarrierDisjuncts = NULL;
555 assert( directive == -1 );
591 printf(
"The input network was not strashed, strashing....\n");
604 assert( safetyInvariantPO != -1 );
612 time_spent = (double)(endTime - beginTime)/CLOCKS_PER_SEC;
613 printf(
"pre-processing time = %f\n",time_spent);
620 assert( safetyInvariantPO != -1 );
625 time_spent = (double)(endTime - beginTime)/CLOCKS_PER_SEC;
626 printf(
"pre-processing time = %f\n",time_spent);
628 assert( vMasterBarrierDisjuncts != NULL );
635 assert( safetyInvariantPO != -1 );
640 time_spent = (double)(endTime - beginTime)/CLOCKS_PER_SEC;
641 printf(
"pre-processing time = %f\n",time_spent);
643 assert( vMasterBarrierDisjuncts != NULL );
649 assert( vMasterBarrierDisjuncts != NULL );
661 for( absorberCount=1; absorberCount<absorberLimit; absorberCount++ )
664 RetValue =
flipConePdr( pAigCS, directive, liveIndex_k, safetyInvariantPO, absorberCount );
668 Abc_Print( 1,
"k = %d, Property proved\n", absorberCount );
671 else if ( RetValue == 0 )
675 Abc_Print( 1,
"k = %d, Property DISPROVED\n", absorberCount );
678 else if ( RetValue == -1 )
680 Abc_Print( 1,
"Property UNDECIDED with k = %d.\n", absorberCount );
707 fprintf( stdout,
"usage: kcs [-cmgCh]\n" );
708 fprintf( stdout,
"\timplements Claessen-Sorensson's k-Liveness algorithm\n" );
709 fprintf( stdout,
"\t-c : verification with constraints, looks for POs prefixed with csSafetyInvar_\n");
710 fprintf( stdout,
"\t-m : discovers monotone signals\n");
711 fprintf( stdout,
"\t-g : verification with user-supplied barriers, looks for POs prefixed with csLevel1Stabil_\n");
712 fprintf( stdout,
"\t-C : verification with discovered monotone signals\n");
713 fprintf( stdout,
"\t-h : print usage\n");
720 Abc_Ntk_t * pNtk, * pNtkTemp, *pNtkCombStabil;
724 int parameterizedCombK;
734 assert( directive == -1 );
770 printf(
"The input network was not strashed, strashing....\n");
783 printf(
"Enter parameterizedCombK = " );
784 if( scanf(
"%d", ¶meterizedCombK) != 1 )
786 printf(
"\nFailed to read integer!\n");
796 fprintf( stdout,
"Abc_NtkCreateCone(): Network check has failed.\n" );
808 fprintf( stdout,
"usage: nck [-cmgCh]\n" );
809 fprintf( stdout,
"\tgenerates combinatorial signals for stabilization\n" );
810 fprintf( stdout,
"\t-h : print usage\n");
Aig_Obj_t * Aig_ObjCreateCo(Aig_Man_t *p, Aig_Obj_t *pDriver)
ABC_NAMESPACE_IMPL_START Aig_Man_t * Abc_NtkToDar(Abc_Ntk_t *pNtk, int fExors, int fRegisters)
DECLARATIONS ///.
static int Abc_NtkIsStrash(Abc_Ntk_t *pNtk)
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
ABC_DLL int Aig_ManCheck(Aig_Man_t *p)
FUNCTION DECLARATIONS ///.
static Aig_Type_t Aig_ObjType(Aig_Obj_t *pObj)
Vec_Int_t * createSingletonIntVector(int i)
static int Saig_ManPoNum(Aig_Man_t *p)
typedefABC_NAMESPACE_HEADER_START struct Aig_Man_t_ Aig_Man_t
INCLUDES ///.
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
void Aig_ManStop(Aig_Man_t *p)
void Pdr_ManSetDefaultParams(Pdr_Par_t *pPars)
MACRO DEFINITIONS ///.
typedefABC_NAMESPACE_HEADER_START struct Pdr_Par_t_ Pdr_Par_t
INCLUDES ///.
#define kCS_WITH_SAFETY_AND_USER_GIVEN_DCS_INVARIANTS
ABC_DLL void Abc_FrameSetCurrentNetwork(Abc_Frame_t *p, Abc_Ntk_t *pNet)
Abc_Ntk_t * Abc_NtkFromAigPhase(Aig_Man_t *pMan)
ABC_DLL Abc_Ntk_t * Abc_NtkStrash(Abc_Ntk_t *pNtk, int fAllNodes, int fCleanup, int fRecord)
static Aig_Obj_t * Aig_ObjFanin0(Aig_Obj_t *pObj)
Aig_Man_t * Aig_ManStart(int nNodesMax)
DECLARATIONS ///.
void Aig_ManPrintStats(Aig_Man_t *p)
static int Aig_IsComplement(Aig_Obj_t *p)
static Aig_Obj_t * Aig_Regular(Aig_Obj_t *p)
Aig_Obj_t * Aig_ObjCreateCi(Aig_Man_t *p)
DECLARATIONS ///.
static void Vec_PtrPush(Vec_Ptr_t *p, void *Entry)
static int Abc_NtkCiNum(Abc_Ntk_t *pNtk)
Aig_Obj_t * readLiveSignal_0(Aig_Man_t *pAig, int liveIndex_0)
static Abc_Obj_t * Abc_NtkCi(Abc_Ntk_t *pNtk, int i)
static Aig_Obj_t * Aig_Not(Aig_Obj_t *p)
ABC_DLL int Abc_NtkCheck(Abc_Ntk_t *pNtk)
FUNCTION DEFINITIONS ///.
ABC_DLL char * Abc_ObjAssignName(Abc_Obj_t *pObj, char *pName, char *pSuffix)
static abctime Abc_Clock()
#define kCS_WITH_SAFETY_AND_DCS_INVARIANTS
static int Vec_PtrSize(Vec_Ptr_t *p)
static Abc_Obj_t * Abc_ObjFanin0(Abc_Obj_t *pObj)
Aig_Obj_t * Aig_And(Aig_Man_t *p, Aig_Obj_t *p0, Aig_Obj_t *p1)
static Abc_Obj_t * Abc_NtkCo(Abc_Ntk_t *pNtk, int i)
char * Nm_ManStoreIdName(Nm_Man_t *p, int ObjId, int Type, char *pName, char *pSuffix)
Aig_Man_t * generateGeneralDisjunctiveTester(Abc_Ntk_t *pNtk, Aig_Man_t *pAig, int combK)
typedefABC_NAMESPACE_HEADER_START struct Abc_Frame_t_ Abc_Frame_t
INCLUDES ///.
#define Aig_ManForEachNode(p, pObj, i)
#define kCS_WITH_DISCOVER_MONOTONE_SIGNALS
Vec_Ptr_t * collectUserGivenDisjunctiveMonotoneSignals(Abc_Ntk_t *pNtk)
void Aig_ObjPatchFanin0(Aig_Man_t *p, Aig_Obj_t *pObj, Aig_Obj_t *pFaninNew)
Aig_Man_t * generateDisjunctiveTester(Abc_Ntk_t *pNtk, Aig_Man_t *pAig, int combN, int combK)
void Aig_ManSetRegNum(Aig_Man_t *p, int nRegs)
#define Saig_ManForEachLi(p, pObj, i)
Abc_Ntk_t * Abc_NtkMakeOnePo(Abc_Ntk_t *pNtk, int Output, int nRange)
#define ABC_NAMESPACE_IMPL_END
char * Nm_ManFindNameById(Nm_Man_t *p, int ObjId)
static Aig_Obj_t * Aig_ObjChild1Copy(Aig_Obj_t *pObj)
Aig_Obj_t * Aig_Or(Aig_Man_t *p, Aig_Obj_t *p0, Aig_Obj_t *p1)
#define Saig_ManForEachLo(p, pObj, i)
Aig_Man_t * generateWorkingAig(Aig_Man_t *pAig, Abc_Ntk_t *pNtk, int *pIndex0Live)
static Aig_Obj_t * Aig_ObjChild0Copy(Aig_Obj_t *pObj)
void deallocateMasterBarrierDisjunctVecPtrVecInt(Vec_Ptr_t *vMasterBarrierDisjunctsArg)
#define Abc_NtkForEachLatch(pNtk, pObj, i)
int flipConePdr(Aig_Man_t *pAig, int directive, int targetCSPropertyIndex, int safetyInvariantPOIndex, int absorberCount)
static void Aig_ObjChild0Flip(Aig_Obj_t *pObj)
static void Abc_Print(int level, const char *format,...)
void Aig_ManDumpBlif(Aig_Man_t *p, char *pFileName, Vec_Ptr_t *vPiNames, Vec_Ptr_t *vPoNames)
static int Aig_ObjFaninC0(Aig_Obj_t *pObj)
static int Aig_ManObjNumMax(Aig_Man_t *p)
#define kCS_WITH_SAFETY_INVARIANTS
static Aig_Obj_t * Aig_ManConst1(Aig_Man_t *p)
#define ABC_NAMESPACE_IMPL_START
static void * Vec_PtrEntry(Vec_Ptr_t *p, int i)
static Aig_Obj_t * Aig_ManCo(Aig_Man_t *p, int i)
ABC_DLL Abc_Ntk_t * Abc_FrameReadNtk(Abc_Frame_t *p)
int Pdr_ManSolve(Aig_Man_t *p, Pdr_Par_t *pPars)
Vec_Ptr_t * getVecOfVecFairness(FILE *fp)
Aig_Obj_t * readLiveSignal_k(Aig_Man_t *pAig, int liveIndex_k)
static Abc_Obj_t * Abc_NtkPo(Abc_Ntk_t *pNtk, int i)
static Vec_Ptr_t * Vec_PtrAlloc(int nCap)
FUNCTION DEFINITIONS ///.
static int Saig_ManPiNum(Aig_Man_t *p)
MACRO DEFINITIONS ///.
ABC_DLL char * Abc_ObjName(Abc_Obj_t *pNode)
DECLARATIONS ///.
int Abc_CommandNChooseK(Abc_Frame_t *pAbc, int argc, char **argv)
Aig_Man_t * generateWorkingAigWithDSC(Aig_Man_t *pAig, Abc_Ntk_t *pNtk, int *pIndex0Live, Vec_Ptr_t *vMasterBarriers)
Aig_Man_t * introduceAbsorberLogic(Aig_Man_t *pAig, int *pLiveIndex_0, int *pLiveIndex_k, int nonFirstIteration)
Nm_Man_t * Nm_ManCreate(int nSize)
MACRO DEFINITIONS ///.
#define Saig_ManForEachPo(p, pObj, i)
int collectSafetyInvariantPOIndex(Abc_Ntk_t *pNtk)
typedefABC_NAMESPACE_HEADER_START struct Abc_Cex_t_ Abc_Cex_t
INCLUDES ///.
#define Abc_NtkForEachPo(pNtk, pPo, i)
static Aig_Obj_t * Aig_NotCond(Aig_Obj_t *p, int c)
static void Vec_IntFree(Vec_Int_t *p)
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.
Vec_Ptr_t * findDisjunctiveMonotoneSignals(Abc_Ntk_t *pNtk)
void deallocateMasterBarrierDisjunctInt(Vec_Ptr_t *vMasterBarrierDisjunctsArg)
char * Abc_UtilStrsav(char *s)
#define Vec_IntForEachEntry(vVec, Entry, i)
MACRO DEFINITIONS ///.
int Abc_CommandCS_kLiveness(Abc_Frame_t *pAbc, int argc, char **argv)
int Aig_ManCleanup(Aig_Man_t *p)
Aig_Man_t * Aig_ManDupSimple(Aig_Man_t *p)
DECLARATIONS ///.
void modifyAigToApplySafetyInvar(Aig_Man_t *pAig, int csTarget, int safetyInvarPO)
static void Vec_PtrFree(Vec_Ptr_t *p)
#define Saig_ManForEachPi(p, pObj, i)