46 if ( p->nTravIds >= (1<<30)-1 )
64 static char Buffer[100];
69 TimeStamp = asctime( localtime( <ime ) );
70 TimeStamp[
strlen(TimeStamp) - 1 ] = 0;
71 strcpy( Buffer, TimeStamp );
530 fprintf( pFile,
"%d", !fCompl );
536 fprintf( pFile,
"%s%s", fCompl?
"!" :
"", (
char*)pObj->
pData );
543 fprintf( pFile,
"%s", (Level==0?
"" :
"(") );
548 fprintf( pFile,
" %s ", fCompl?
"+" :
"*" );
550 fprintf( pFile,
"%s", (Level==0?
"" :
")") );
569 Aig_Obj_t * pFanin, * pFanin0, * pFanin1, * pFaninC;
577 fprintf( pFile,
"1\'b%d", !fCompl );
583 fprintf( pFile,
"%s%s", fCompl?
"~" :
"", (
char*)pObj->
pData );
592 fprintf( pFile,
"%s", (Level==0?
"" :
"(") );
597 fprintf( pFile,
" ^ " );
599 fprintf( pFile,
"%s", (Level==0?
"" :
")") );
607 fprintf( pFile,
"%s", (Level==0?
"" :
"(") );
609 fprintf( pFile,
" ^ " );
611 fprintf( pFile,
"%s", (Level==0?
"" :
")") );
616 fprintf( pFile,
"%s", (Level==0?
"" :
"(") );
618 fprintf( pFile,
" ? " );
620 fprintf( pFile,
" : " );
622 fprintf( pFile,
"%s", (Level==0?
"" :
")") );
630 fprintf( pFile,
"%s", (Level==0?
"" :
"(") );
635 fprintf( pFile,
" %s ", fCompl?
"|" :
"&" );
637 fprintf( pFile,
"%s", (Level==0?
"" :
")") );
656 printf(
"Node %p : ", pObj );
658 printf(
"constant 1" );
668 printf(
"AND( %p%s, %p%s )",
692 printf(
" %p", pObj );
717 sprintf( FileName,
"aigbug\\%03d.blif", ++Counter );
719 printf(
"Intermediate AIG with %d nodes was written into file \"%s\".\n",
Aig_ManNodeNum(p), FileName );
737 Aig_Obj_t * pObj, * pObjLi, * pObjLo, * pConst1 = NULL;
741 printf(
"Aig_ManDumpBlif(): AIG manager does not have POs.\n" );
753 pObj->
iData = Counter++;
755 pObj->
iData = Counter++;
757 pObj->
iData = Counter++;
760 pFile = fopen( pFileName,
"w" );
761 fprintf( pFile,
"# BLIF file written by procedure Aig_ManDumpBlif()\n" );
763 fprintf( pFile,
".model %s\n", p->pName );
765 fprintf( pFile,
".inputs" );
768 fprintf( pFile,
" %s", (
char*)
Vec_PtrEntry(vPiNames, i) );
770 fprintf( pFile,
" n%0*d", nDigits, pObj->
iData );
771 fprintf( pFile,
"\n" );
773 fprintf( pFile,
".outputs" );
776 fprintf( pFile,
" %s", (
char*)
Vec_PtrEntry(vPoNames, i) );
778 fprintf( pFile,
" n%0*d", nDigits, pObj->
iData );
779 fprintf( pFile,
"\n" );
783 fprintf( pFile,
"\n" );
786 fprintf( pFile,
".latch" );
790 fprintf( pFile,
" n%0*d", nDigits, pObjLi->
iData );
794 fprintf( pFile,
" n%0*d", nDigits, pObjLo->
iData );
795 fprintf( pFile,
" 0\n" );
797 fprintf( pFile,
"\n" );
801 fprintf( pFile,
".names n%0*d\n 1\n", nDigits, pConst1->
iData );
805 fprintf( pFile,
".names" );
809 fprintf( pFile,
" n%0*d", nDigits,
Aig_ObjFanin0(pObj)->iData );
813 fprintf( pFile,
" n%0*d", nDigits,
Aig_ObjFanin1(pObj)->iData );
814 fprintf( pFile,
" n%0*d\n", nDigits, pObj->
iData );
820 fprintf( pFile,
".names" );
824 fprintf( pFile,
" n%0*d", nDigits,
Aig_ObjFanin0(pObj)->iData );
828 fprintf( pFile,
" n%0*d\n", nDigits, pObj->
iData );
832 fprintf( pFile,
".end\n\n" );
852 Aig_Obj_t * pObj, * pObjLi, * pObjLo, * pConst1 = NULL;
856 printf(
"Aig_ManDumpBlif(): AIG manager does not have POs.\n" );
868 pObj->
iData = Counter++;
870 pObj->
iData = Counter++;
872 pObj->
iData = Counter++;
875 pFile = fopen( pFileName,
"w" );
876 fprintf( pFile,
"// Verilog file written by procedure Aig_ManDumpVerilog()\n" );
879 fprintf( pFile,
"module %s ( clock", p->pName? p->pName:
"test" );
881 fprintf( pFile,
"module %s (", p->pName? p->pName:
"test" );
883 fprintf( pFile,
"%s n%0*d", ((
Aig_ManRegNum(p) || i)?
",":
""), nDigits, pObj->
iData );
885 fprintf( pFile,
", n%0*d", nDigits, pObj->
iData );
886 fprintf( pFile,
" );\n" );
890 fprintf( pFile,
"input clock;\n" );
892 fprintf( pFile,
"input n%0*d;\n", nDigits, pObj->
iData );
895 fprintf( pFile,
"output n%0*d;\n", nDigits, pObj->
iData );
900 fprintf( pFile,
"reg n%0*d;\n", nDigits, pObjLo->
iData );
902 fprintf( pFile,
"wire n%0*d;\n", nDigits, pObjLi->
iData );
906 fprintf( pFile,
"wire n%0*d;\n", nDigits, pObj->
iData );
908 fprintf( pFile,
"wire n%0*d;\n", nDigits, pConst1->
iData );
911 fprintf( pFile,
"assign n%0*d = 1\'b1;\n", nDigits, pConst1->
iData );
914 fprintf( pFile,
"assign n%0*d = %sn%0*d & %sn%0*d;\n",
915 nDigits, pObj->
iData,
923 fprintf( pFile,
"assign n%0*d = %sn%0*d;\n",
924 nDigits, pObj->
iData,
931 fprintf( pFile,
"assign n%0*d = %sn%0*d;\n",
932 nDigits, pObjLi->
iData,
941 fprintf( pFile,
"always @ (posedge clock) begin n%0*d <= n%0*d; end\n",
942 nDigits, pObjLo->
iData,
943 nDigits, pObjLi->
iData );
945 fprintf( pFile,
"initial begin n%0*d <= 1\'b0; end\n",
946 nDigits, pObjLo->
iData );
949 fprintf( pFile,
"endmodule\n\n" );
1029 Aig_Obj_t * pObj, * pFanin0, * pFanin1, * pCtrl;
1034 printf(
"Control signal:\n" );
1072 static char Buffer[1000];
1075 if ( (pDot =
strrchr( Buffer,
'.' )) )
1077 strcat( Buffer, pSuffix );
1078 if ( (pDot =
strrchr( Buffer,
'\\' )) || (pDot =
strrchr( Buffer,
'/' )) )
1097 unsigned int lfsr = 1;
1098 unsigned int period = 0;
1099 pFile = fopen(
"rand.txt",
"w" );
1104 fprintf( pFile,
"%10d : %10d ", period, lfsr );
1106 fprintf( pFile,
"\n" );
1107 if ( period == 20000 )
1109 }
while(lfsr != 1u);
1128 unsigned int period = 0;
1129 pFile = fopen(
"rand.txt",
"w" );
1133 fprintf( pFile,
"%10d : %10d ", period, lfsr );
1135 fprintf( pFile,
"\n" );
1136 if ( period == 20000 )
1138 }
while(lfsr != 1u);
1143 #define NUMBER1 3716960521u
1144 #define NUMBER2 2174103536u
1159 static unsigned int m_z =
NUMBER1;
1160 static unsigned int m_w =
NUMBER2;
1166 m_z = 36969 * (m_z & 65535) + (m_z >> 16);
1167 m_w = 18000 * (m_w & 65535) + (m_w >> 16);
1168 return (m_z << 16) + m_w;
1205 for ( w = iWordStart; w < iWordStop; w++ )
1229 while ( pBeg1 < pEnd1 && pBeg2 < pEnd2 )
1231 if ( (*pBeg1)->Id == (*pBeg2)->Id )
1232 *pBeg++ = *pBeg1++, pBeg2++;
1233 else if ( (*pBeg1)->Id < (*pBeg2)->Id )
1238 while ( pBeg1 < pEnd1 )
1240 while ( pBeg2 < pEnd2 )
1242 vArr->nSize = pBeg - (
Aig_Obj_t **)vArr->pArray;
1243 assert( vArr->nSize <= vArr->nCap );
1244 assert( vArr->nSize >= vArr1->nSize );
1245 assert( vArr->nSize >= vArr2->nSize );
1268 while ( pBeg1 < pEnd1 && pBeg2 < pEnd2 )
1270 if ( (*pBeg1)->Id == (*pBeg2)->Id )
1271 *pBeg++ = *pBeg1++, pBeg2++;
1272 else if ( (*pBeg1)->Id < (*pBeg2)->Id )
1283 vArr->nSize = pBeg - (
Aig_Obj_t **)vArr->pArray;
1284 assert( vArr->nSize <= vArr->nCap );
1285 assert( vArr->nSize <= vArr1->nSize );
1286 assert( vArr->nSize <= vArr2->nSize );
1316 int Val0, Val1, nObjs, i, k, iBit = 0;
1318 assert( pAig->pData2 == NULL );
1326 for ( i = 0; i <= pCex->iFrame; i++ )
1349 if ( i == pCex->iFrame )
1356 assert( iBit == pCex->nBits );
1374 assert( pAig->pData2 != NULL );
1375 free( pAig->pData2 );
1376 pAig->pData2 = NULL;
1412 int iFrame =
Abc_MaxInt( 0, pCex->iFrame - 1 );
1413 printf(
"\nUsing counter-example, which asserts output %d in frame %d.\n", pCex->iPo, pCex->iFrame );
1415 printf(
"Value of object %d in frame %d is %d.\n",
Aig_ObjId(pObj), iFrame,
1485 Aig_Obj_t * pObj, * pNodeT, * pNodeE, * pNodeC;
1515 Aig_Obj_t * pObj, * pNodeT, * pNodeE, * pNodeC;
ABC_NAMESPACE_IMPL_END ABC_NAMESPACE_IMPL_START void Aig_ManCounterExampleValueStart(Aig_Man_t *pAig, Abc_Cex_t *pCex)
void Aig_ManCounterExampleValueTest(Aig_Man_t *pAig, Abc_Cex_t *pCex)
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
void Aig_ManCleanMarkB(Aig_Man_t *p)
void Aig_ManCleanMarkA(Aig_Man_t *p)
static Aig_Type_t Aig_ObjType(Aig_Obj_t *pObj)
static int Aig_ObjFaninId0(Aig_Obj_t *pObj)
char * Aig_FileNameGenericAppend(char *pBase, char *pSuffix)
#define Vec_PtrForEachEntryStart(Type, vVec, pEntry, i, Start)
static int Aig_ManConstrNum(Aig_Man_t *p)
typedefABC_NAMESPACE_HEADER_START struct Vec_Vec_t_ Vec_Vec_t
INCLUDES ///.
static int Saig_ManPoNum(Aig_Man_t *p)
typedefABC_NAMESPACE_HEADER_START struct Aig_Man_t_ Aig_Man_t
INCLUDES ///.
void Aig_ManResetRefs(Aig_Man_t *p)
static Aig_Obj_t * Aig_ObjChild0(Aig_Obj_t *pObj)
static int Vec_PtrPushUnique(Vec_Ptr_t *p, void *Entry)
void Aig_ManDumpBlif(Aig_Man_t *p, char *pFileName, Vec_Ptr_t *vPiNames, Vec_Ptr_t *vPoNames)
static int Abc_InfoHasBit(unsigned *p, int i)
static int Aig_ManObjNum(Aig_Man_t *p)
#define Saig_ManForEachLiLo(p, pObjLi, pObjLo, i)
static void Vec_PtrGrow(Vec_Ptr_t *p, int nCapMin)
int Aig_ObjRecognizeExor(Aig_Obj_t *pObj, Aig_Obj_t **ppFan0, Aig_Obj_t **ppFan1)
void Aig_ManSetCioIds(Aig_Man_t *p)
static Aig_Obj_t * Aig_ObjFanin0(Aig_Obj_t *pObj)
void Aig_ManCleanData(Aig_Man_t *p)
static int Aig_IsComplement(Aig_Obj_t *p)
void Aig_ManPrintVerbose(Aig_Man_t *p, int fHaig)
#define Aig_ManForEachCi(p, pObj, i)
ITERATORS ///.
static Aig_Obj_t * Aig_Regular(Aig_Obj_t *p)
static void Vec_PtrPush(Vec_Ptr_t *p, void *Entry)
#define Aig_ManForEachCo(p, pObj, i)
static Aig_Obj_t * Aig_ManObj(Aig_Man_t *p, int i)
static Aig_Obj_t * Aig_Not(Aig_Obj_t *p)
int Aig_ManChoiceNum(Aig_Man_t *p)
static int Aig_ObjFaninId1(Aig_Obj_t *pObj)
static int Abc_MaxInt(int a, int b)
static Aig_Obj_t * Aig_ObjFanin1(Aig_Obj_t *pObj)
Vec_Ptr_t * Aig_ManMuxesCollect(Aig_Man_t *pAig)
static int Vec_PtrSize(Vec_Ptr_t *p)
void Aig_NodeUnionLists(Vec_Ptr_t *vArr1, Vec_Ptr_t *vArr2, Vec_Ptr_t *vArr)
void Aig_ObjCleanData_rec(Aig_Obj_t *pObj)
static int Aig_ManNodeNum(Aig_Man_t *p)
void Aig_ObjPrint(Aig_Man_t *p, Aig_Obj_t *pObj)
void Aig_ManPrintControlFanouts(Aig_Man_t *p)
static int Aig_ObjIsNode(Aig_Obj_t *pObj)
int Aig_ManHasNoGaps(Aig_Man_t *p)
static int Aig_ManCoNum(Aig_Man_t *p)
void Aig_ManRandomTest1()
static int Aig_ObjIsBuf(Aig_Obj_t *pObj)
void Aig_ObjPrintVerbose(Aig_Obj_t *pObj, int fHaig)
#define Aig_ManForEachNode(p, pObj, i)
word Aig_ManRandom64(int fReset)
static Aig_Obj_t * Aig_ManCi(Aig_Man_t *p, int i)
#define Aig_ManForEachLiLoSeq(p, pObjLi, pObjLo, k)
void Aig_ManSetPhase(Aig_Man_t *pAig)
int Aig_ObjCompareIdIncrease(Aig_Obj_t **pp1, Aig_Obj_t **pp2)
unsigned __int64 word
DECLARATIONS ///.
static int Aig_ManCiNum(Aig_Man_t *p)
static int Abc_Base10Log(unsigned n)
void Aig_ManCounterExampleValueStop(Aig_Man_t *pAig)
#define ABC_NAMESPACE_IMPL_END
static Aig_Obj_t * Aig_ObjChild1(Aig_Obj_t *pObj)
static int Aig_ObjIsConst1(Aig_Obj_t *pObj)
Aig_Obj_t * Aig_ObjReal_rec(Aig_Obj_t *pObj)
void Aig_ManDumpVerilog(Aig_Man_t *p, char *pFileName)
Vec_Ptr_t * Aig_ManDfs(Aig_Man_t *p, int fNodesOnly)
#define Saig_ManForEachLo(p, pObj, i)
void Aig_ManRandomTest2()
void Aig_ManCleanNext(Aig_Man_t *p)
static void Aig_ObjChild0Flip(Aig_Obj_t *pObj)
static int Aig_ObjFaninC0(Aig_Obj_t *pObj)
int Aig_ObjIsMuxType(Aig_Obj_t *pNode)
static int Aig_ManObjNumMax(Aig_Man_t *p)
void Aig_ManMuxesRef(Aig_Man_t *pAig, Vec_Ptr_t *vMuxes)
static Aig_Obj_t * Aig_ManConst1(Aig_Man_t *p)
static int Aig_ObjIsExor(Aig_Obj_t *pObj)
#define ABC_NAMESPACE_IMPL_START
void Aig_ManRandomInfo(Vec_Ptr_t *vInfo, int iInputStart, int iWordStart, int iWordStop)
void Aig_ObjCollectMulti_rec(Aig_Obj_t *pRoot, Aig_Obj_t *pObj, Vec_Ptr_t *vSuper)
static void * Vec_PtrEntry(Vec_Ptr_t *p, int i)
static void Abc_InfoSetBit(unsigned *p, int i)
static Aig_Obj_t * Aig_ManCo(Aig_Man_t *p, int i)
Aig_Obj_t * Aig_ObjRecognizeMux(Aig_Obj_t *pNode, Aig_Obj_t **ppNodeT, Aig_Obj_t **ppNodeE)
int Aig_ManLevels(Aig_Man_t *p)
static int Aig_ManRegNum(Aig_Man_t *p)
#define Aig_ManForEachObj(p, pObj, i)
static Vec_Ptr_t * Vec_PtrAlloc(int nCap)
FUNCTION DEFINITIONS ///.
void Aig_ManMuxesDeref(Aig_Man_t *pAig, Vec_Ptr_t *vMuxes)
static void Vec_VecExpand(Vec_Vec_t *p, int Level)
void Aig_ManDump(Aig_Man_t *p)
unsigned Aig_ManRandom(int fReset)
GLOBAL VARIABLES ///.
#define ABC_CALLOC(type, num)
static int Aig_ObjFaninC1(Aig_Obj_t *pObj)
static int Abc_BitWordNum(int nBits)
#define Saig_ManForEachPo(p, pObj, i)
static int Aig_ObjId(Aig_Obj_t *pObj)
static void Vec_PtrClear(Vec_Ptr_t *p)
ABC_NAMESPACE_IMPL_START void Aig_ManIncrementTravId(Aig_Man_t *p)
DECLARATIONS ///.
typedefABC_NAMESPACE_HEADER_START struct Abc_Cex_t_ Abc_Cex_t
INCLUDES ///.
void Aig_ManCleanMarkAB(Aig_Man_t *p)
static Vec_Ptr_t * Vec_VecEntry(Vec_Vec_t *p, int i)
static int Aig_ObjRefs(Aig_Obj_t *pObj)
void Aig_ObjCollectMulti(Aig_Obj_t *pRoot, Vec_Ptr_t *vSuper)
static Aig_Obj_t * Aig_NotCond(Aig_Obj_t *p, int c)
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.
#define Aig_ManForEachPoSeq(p, pObj, i)
static int Aig_ObjIsCi(Aig_Obj_t *pObj)
void Aig_ManInvertConstraints(Aig_Man_t *pAig)
void Aig_NodeIntersectLists(Vec_Ptr_t *vArr1, Vec_Ptr_t *vArr2, Vec_Ptr_t *vArr)
static int Aig_ObjIsCo(Aig_Obj_t *pObj)
static int Aig_ObjIsChoice(Aig_Man_t *p, Aig_Obj_t *pObj)
void Aig_ObjPrintEqn(FILE *pFile, Aig_Obj_t *pObj, Vec_Vec_t *vLevels, int Level)
#define Aig_ManForEachPiSeq(p, pObj, i)
SEQUENTIAL ITERATORS ///.
void Aig_ObjPrintVerilog(FILE *pFile, Aig_Obj_t *pObj, Vec_Vec_t *vLevels, int Level)
static int Aig_ObjIsAnd(Aig_Obj_t *pObj)
void Aig_ManCleanCioIds(Aig_Man_t *p)
static int Aig_ObjCioId(Aig_Obj_t *pObj)
int Aig_ManCounterExampleValueLookup(Aig_Man_t *pAig, int Id, int iFrame)
static void Vec_PtrFree(Vec_Ptr_t *p)
#define Saig_ManForEachPi(p, pObj, i)