30 #define PROPAGATE_NAMES
61 printf(
"vec[%d] = %s\n", i, (
char *)
Vec_PtrEntry(vec, i) );
86 if( pObj == pObjPivot )
104 int index, oldIndex, originalLatchNum =
Saig_ManRegNum(pAigOld), strMatch, i;
105 char *dummyStr = (
char *)
malloc(
sizeof(
char) * 50 );
109 if( pObj == pObjPivot )
111 if( index < originalLatchNum )
114 pObjOld =
Aig_ManCi( pAigOld, oldIndex );
119 else if( index == originalLatchNum )
121 else if( index > originalLatchNum && index < 2 * originalLatchNum + 1 )
123 oldIndex =
Saig_ManPiNum( pAigOld ) + index - originalLatchNum - 1;
124 pObjOld =
Aig_ManCi( pAigOld, oldIndex );
129 else if( index >= 2 * originalLatchNum + 1 && index < 2 * originalLatchNum + 1 +
Vec_PtrSize( vLive ) )
131 oldIndex = index - 2 * originalLatchNum - 1;
138 if( strMatch == oldIndex )
150 oldIndex = index - 2 * originalLatchNum - 1 -
Vec_PtrSize( vLive );
157 if( strMatch == oldIndex )
205 Aig_Obj_t *pObjSaveOrSaved, *pObjSavedLoAndEquality;
206 Aig_Obj_t *pObjShadowLo, *pObjShadowLi, *pObjShadowLiDriver;
207 Aig_Obj_t *pObjXor, *pObjXnor, *pObjAndAcc, *pObjAndAccDummy;
208 Aig_Obj_t *pObjLive, *pObjFair, *pObjSafetyGate;
212 int piCopied = 0, liCopied = 0, loCopied = 0, liCreated = 0, loCreated = 0, liveLatch = 0, fairLatch = 0;
220 #ifdef DUPLICATE_CKT_DEBUG
221 printf(
"\nCode is compiled in DEBUG mode, the input-output behavior will be the same as the original circuit\n");
222 printf(
"Press any key to continue...");
256 #ifndef DUPLICATE_CKT_DEBUG
277 #ifndef DUPLICATE_CKT_DEBUG
288 #ifndef DUPLICATE_CKT_DEBUG
289 pObjSaveOrSaved =
Aig_Or( pNew, pObjSavePi, pObjSavedLo );
306 #ifndef DUPLICATE_CKT_DEBUG
314 #ifdef DUPLICATE_CKT_DEBUG
334 #ifndef DUPLICATE_CKT_DEBUG
346 #ifdef PROPAGATE_NAMES
356 loCreated++; liCreated++;
360 if( pObjAndAcc == NULL )
361 pObjAndAcc = pObjXnor;
364 pObjAndAccDummy = pObjAndAcc;
365 pObjAndAcc =
Aig_And( pNew, pObjXnor, pObjAndAccDummy );
370 pObjSavedLoAndEquality =
Aig_And( pNew, pObjSavedLo, pObjAndAcc );
375 printf(
"\nCircuit without any liveness property\n");
386 #ifdef PROPAGATE_NAMES
394 Aig_And( pNew, pDriverImage, pObjSaveOrSaved ) );
397 loCreated++; liCreated++;
399 if( pObjAndAcc == NULL )
400 pObjAndAcc = pObjShadowLo;
403 pObjAndAccDummy = pObjAndAcc;
404 pObjAndAcc =
Aig_And( pNew, pObjShadowLo, pObjAndAccDummy );
409 if( pObjAndAcc != NULL )
410 pObjLive = pObjAndAcc;
417 printf(
"\nCircuit without any fairness property\n");
427 #ifdef PROPAGATE_NAMES
435 Aig_And( pNew, pDriverImage, pObjSaveOrSaved ) );
438 loCreated++; liCreated++;
440 if( pObjAndAcc == NULL )
441 pObjAndAcc = pObjShadowLo;
444 pObjAndAccDummy = pObjAndAcc;
445 pObjAndAcc =
Aig_And( pNew, pObjShadowLo, pObjAndAccDummy );
450 if( pObjAndAcc != NULL )
451 pObjFair = pObjAndAcc;
456 pObjSafetyGate =
Aig_And( pNew, pObjSavedLoAndEquality,
Aig_And( pNew, pObjFair,
Aig_Not( pObjLive ) ) );
469 #ifndef DUPLICATE_CKT_DEBUG
487 Aig_Obj_t *pObjXor, *pObjXnor, *pObjAndAcc, *pObjAndAccDummy;
488 Aig_Obj_t *pObjLive, *pObjFair, *pObjSafetyGate;
495 int piCopied = 0, liCopied = 0, loCopied = 0;
534 nodeName =
"SAVE_BIERE",
557 nodeName =
"SAVED_LO";
565 pObjSaveOrSaved =
Aig_Or( pNew, pObjSavePi, pObjSavedLo );
566 pObjSaveAndNotSaved =
Aig_And( pNew, pObjSavePi,
Aig_Not(pObjSavedLo) );
618 if( pObjAndAcc == NULL )
619 pObjAndAcc = pObjXnor;
622 pObjAndAccDummy = pObjAndAcc;
623 pObjAndAcc =
Aig_And( pNew, pObjXnor, pObjAndAccDummy );
628 pObjSavedLoAndEquality =
Aig_And( pNew, pObjSavePi, pObjAndAcc );
633 printf(
"\nCircuit without any liveness property\n");
639 if( pObjAndAcc == NULL )
640 pObjAndAcc = pDriverImage;
643 pObjAndAccDummy = pObjAndAcc;
644 pObjAndAcc =
Aig_And( pNew, pDriverImage, pObjAndAccDummy );
649 if( pObjAndAcc != NULL )
650 pObjLive = pObjAndAcc;
657 printf(
"\nCircuit without any fairness property\n");
663 if( pObjAndAcc == NULL )
664 pObjAndAcc = pDriverImage;
667 pObjAndAccDummy = pObjAndAcc;
668 pObjAndAcc =
Aig_And( pNew, pDriverImage, pObjAndAccDummy );
673 if( pObjAndAcc != NULL )
674 pObjFair = pObjAndAcc;
678 pObjSafetyGate =
Aig_And( pNew, pObjSavedLoAndEquality,
Aig_And( pNew, pObjFair,
Aig_Not( pObjLive ) ) );
684 printf(
"\nSaig_ManPiNum = %d, Reg Num = %d, before everything, before Pi cleanup\n",
Vec_PtrSize( pNew->vCis ), pNew->nRegs );
701 int i, liveCounter = 0;
711 printf(
"\nNumber of liveness property found = %d\n", liveCounter);
718 int i, fairCounter = 0;
728 printf(
"\nNumber of fairness property found = %d\n", fairCounter);
757 Abc_Ntk_t * pNtk, * pNtkTemp, *pNtkNew, *pNtkOld;
768 fprintf( pErr,
"Empty network.\n" );
774 printf(
"\nThe input network was not strashed, strashing....\n");
791 printf(
"\nDetail statistics*************************************\n");
792 printf(
"Number of true primary inputs = %d\n",
Saig_ManPiNum( pAig ));
793 printf(
"Number of true primary outputs = %d\n",
Saig_ManPoNum( pAig ));
797 printf(
"\n*******************************************************\n");
808 printf(
"\nDetail statistics*************************************\n");
809 printf(
"Number of true primary inputs = %d\n",
Saig_ManPiNum( pAigNew ));
810 printf(
"Number of true primary outputs = %d\n",
Saig_ManPoNum( pAigNew ));
814 printf(
"\n*******************************************************\n");
820 fprintf( stdout,
"Abc_NtkCreateCone(): Network check has failed.\n" );
835 #ifndef DUPLICATE_CKT_DEBUG
Aig_Obj_t * Aig_ObjCreateCo(Aig_Man_t *p, Aig_Obj_t *pDriver)
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)
static char * retrieveLOName(Abc_Ntk_t *pNtkOld, Aig_Man_t *pAigOld, Aig_Man_t *pAigNew, Aig_Obj_t *pObjPivot, Vec_Ptr_t *vLive, Vec_Ptr_t *vFair)
static int Saig_ManPoNum(Aig_Man_t *p)
static int Saig_ObjIsLo(Aig_Man_t *p, Aig_Obj_t *pObj)
typedefABC_NAMESPACE_HEADER_START struct Aig_Man_t_ Aig_Man_t
INCLUDES ///.
static Aig_Obj_t * Aig_ObjChild0(Aig_Obj_t *pObj)
static Aig_Obj_t * Saig_ObjLoToLi(Aig_Man_t *p, Aig_Obj_t *pObj)
ABC_DLL void Abc_FrameSetCurrentNetwork(Abc_Frame_t *p, Abc_Ntk_t *pNet)
Aig_Obj_t * Aig_Exor(Aig_Man_t *p, Aig_Obj_t *p0, Aig_Obj_t *p1)
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)
static int getPoIndex(Aig_Man_t *pAig, Aig_Obj_t *pPivot)
Aig_Man_t * Aig_ManStart(int nNodesMax)
DECLARATIONS ///.
void Aig_ManPrintStats(Aig_Man_t *p)
static int Aig_ManCoCleanupBiere(Aig_Man_t *p)
static Aig_Man_t * LivenessToSafetyTransformationOneStepLoopSim(Abc_Ntk_t *pNtk, Aig_Man_t *p, Vec_Ptr_t *vLive, Vec_Ptr_t *vFair)
#define Aig_ManForEachCi(p, pObj, i)
ITERATORS ///.
static void updateNewNetworkNameManager(Abc_Ntk_t *pNtk, Aig_Man_t *pAig, Vec_Ptr_t *vPiNames, Vec_Ptr_t *vLoNames)
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)
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 ///.
static int Vec_PtrSize(Vec_Ptr_t *p)
static char * retrieveTruePiName(Abc_Ntk_t *pNtkOld, Aig_Man_t *pAigOld, Aig_Man_t *pAigNew, Aig_Obj_t *pObjPivot)
static int Aig_ManCiCleanupBiere(Aig_Man_t *p)
Aig_Obj_t * Aig_And(Aig_Man_t *p, Aig_Obj_t *p0, Aig_Obj_t *p1)
char * Nm_ManStoreIdName(Nm_Man_t *p, int ObjId, int Type, char *pName, char *pSuffix)
static int Aig_ManCoNum(Aig_Man_t *p)
static Vec_Ptr_t * populateFairnessVector(Abc_Ntk_t *pNtk, Aig_Man_t *pAig)
typedefABC_NAMESPACE_HEADER_START struct Abc_Frame_t_ Abc_Frame_t
INCLUDES ///.
#define Aig_ManForEachNode(p, pObj, i)
void Aig_ObjPatchFanin0(Aig_Man_t *p, Aig_Obj_t *pObj, Aig_Obj_t *pFaninNew)
void Aig_ManSetRegNum(Aig_Man_t *p, int nRegs)
static Aig_Obj_t * Aig_ManCi(Aig_Man_t *p, int i)
static int Aig_ManCiNum(Aig_Man_t *p)
#define ABC_NAMESPACE_IMPL_END
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)
static Aig_Man_t * LivenessToSafetyTransformationSim(Abc_Ntk_t *pNtk, Aig_Man_t *p, Vec_Ptr_t *vLive, Vec_Ptr_t *vFair)
Abc_Ntk_t * Abc_NtkFromAigPhase(Aig_Man_t *pMan)
#define Saig_ManForEachLo(p, pObj, i)
static Aig_Obj_t * Aig_ObjChild0Copy(Aig_Obj_t *pObj)
static int Saig_ManCiNum(Aig_Man_t *p)
int Abc_CommandAbcLivenessToSafetySim(Abc_Frame_t *pAbc, int argc, char **argv)
static int Aig_ObjFaninC0(Aig_Obj_t *pObj)
static int Saig_ManRegNum(Aig_Man_t *p)
static int Aig_ManObjNumMax(Aig_Man_t *p)
static Vec_Ptr_t * populateLivenessVector(Abc_Ntk_t *pNtk, Aig_Man_t *pAig)
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)
static int Aig_ManRegNum(Aig_Man_t *p)
Aig_Man_t * Abc_NtkToDar(Abc_Ntk_t *pNtk, int fExors, int fRegisters)
DECLARATIONS ///.
Aig_Obj_t * Aig_Mux(Aig_Man_t *p, Aig_Obj_t *pC, Aig_Obj_t *p1, Aig_Obj_t *p0)
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 ///.
static int Abc_NtkPiNum(Abc_Ntk_t *pNtk)
ABC_DLL char * Abc_ObjName(Abc_Obj_t *pNode)
DECLARATIONS ///.
Nm_Man_t * Nm_ManCreate(int nSize)
MACRO DEFINITIONS ///.
#define Saig_ManForEachPo(p, pObj, i)
ABC_DLL FILE * Abc_FrameReadErr(Abc_Frame_t *p)
static int Saig_ManCoNum(Aig_Man_t *p)
static Abc_Obj_t * Abc_NtkPi(Abc_Ntk_t *pNtk, int i)
ABC_DLL FILE * Abc_FrameReadOut(Abc_Frame_t *p)
#define Abc_NtkForEachPo(pNtk, pPo, i)
static Aig_Obj_t * Aig_NotCond(Aig_Obj_t *p, int c)
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.
char * Abc_UtilStrsav(char *s)
static int Saig_ObjIsPi(Aig_Man_t *p, Aig_Obj_t *pObj)
int Aig_ManCleanup(Aig_Man_t *p)
static void printVecPtrOfString(Vec_Ptr_t *vec)
static int Aig_ObjCioId(Aig_Obj_t *pObj)
#define Saig_ManForEachPi(p, pObj, i)