31 #define TSI_MAX_ROUNDS 1000
32 #define TSI_ONE_SERIES 300
67 }
while ( RetValue == 0 );
86 fprintf( pFile,
"0" );
91 fprintf( pFile,
"1" );
95 fprintf( pFile,
"x" );
112 static inline unsigned *
Aig_TsiNext(
unsigned * pState,
int nWords ) {
return *((
unsigned **)(pState + nWords)); }
113 static inline void Aig_TsiSetNext(
unsigned * pState,
int nWords,
unsigned * pNext ) { *((
unsigned **)(pState + nWords)) = pNext; }
177 static int s_FPrimes[128] = {
178 1009, 1049, 1093, 1151, 1201, 1249, 1297, 1361, 1427, 1459,
179 1499, 1559, 1607, 1657, 1709, 1759, 1823, 1877, 1933, 1997,
180 2039, 2089, 2141, 2213, 2269, 2311, 2371, 2411, 2467, 2543,
181 2609, 2663, 2699, 2741, 2797, 2851, 2909, 2969, 3037, 3089,
182 3169, 3221, 3299, 3331, 3389, 3461, 3517, 3557, 3613, 3671,
183 3719, 3779, 3847, 3907, 3943, 4013, 4073, 4129, 4201, 4243,
184 4289, 4363, 4441, 4493, 4549, 4621, 4663, 4729, 4793, 4871,
185 4933, 4973, 5021, 5087, 5153, 5227, 5281, 5351, 5417, 5471,
186 5519, 5573, 5651, 5693, 5749, 5821, 5861, 5923, 6011, 6073,
187 6131, 6199, 6257, 6301, 6353, 6397, 6481, 6563, 6619, 6689,
188 6737, 6803, 6863, 6917, 6977, 7027, 7109, 7187, 7237, 7309,
189 7393, 7477, 7523, 7561, 7607, 7681, 7727, 7817, 7877, 7933,
190 8011, 8039, 8059, 8081, 8093, 8111, 8123, 8147
195 for ( i = 0; i <
nWords; i++ )
196 uHash ^= pState[i] * s_FPrimes[i & 0x7F];
197 return uHash % nTableSize;
216 for ( pEntry = p->
pBins[Hash]; pEntry; pEntry =
Aig_TsiNext(pEntry, nWords) )
217 if ( !
memcmp( pEntry, pState,
sizeof(
unsigned) * nWords ) )
238 p->
pBins[Hash] = pState;
274 int i, Value, nZeros = 0, nOnes = 0, nDcs = 0;
279 printf(
"0" ), nZeros++;
280 else if ( Value == 2 )
281 printf(
"1" ), nOnes++;
282 else if ( Value == 3 )
283 printf(
"x" ), nDcs++;
287 printf(
" (0=%5d, 1=%5d, x=%5d)\n", nZeros, nOnes, nDcs );
304 int i, Value, nCounter = 0;
308 nCounter += (Value == 1 || Value == 2);
330 for ( k = 0; k < pTsi->
nWords; k++ )
331 pState[k] |= pPrev[k];
354 int i, f, fConstants, Value, nCounter, nRetired;
380 printf(
"%3d : ", f );
427 if ( f == TSI_MAX_ROUNDS )
429 printf(
"Aig_ManTernarySimulate(): Did not reach a fixed point after %d iterations (not a bug).\n", TSI_MAX_ROUNDS );
440 for ( i = 0; i < pTsi->
nWords; i++ )
441 if ( pState[i] != ~0 )
446 for ( i = 0; i < pTsi->
nWords - 1; i++ )
447 if ( pState[i] != ~0 )
452 if ( fConstants == 0 )
455 printf(
"Detected 0 constants after %d iterations of ternary simulation.\n", f );
469 nCounter += (Value == 1 || Value == 2);
472 else if ( Value == 2 )
474 else if ( Value == 3 )
483 printf(
"Detected %d constants after %d iterations of ternary simulation.\n", nCounter, f );
void Aig_TsiStateOrAll(Aig_Tsi_t *pTsi, unsigned *pState)
Aig_Man_t * Aig_ManRemap(Aig_Man_t *p, Vec_Ptr_t *vMap)
DECLARATIONS ///.
static unsigned Abc_InfoMask(int nVar)
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
static int Abc_PrimeCudd(unsigned int p)
int Aig_TsiStateCount(Aig_Tsi_t *p, unsigned *pState)
int Aig_TsiStateHash(unsigned *pState, int nWords, int nTableSize)
Aig_Man_t * Aig_ManConstReduce(Aig_Man_t *p, int fUseMvSweep, int nFramesSymb, int nFramesSatur, int fVerbose, int fVeryVerbose)
typedefABC_NAMESPACE_HEADER_START struct Aig_Man_t_ Aig_Man_t
INCLUDES ///.
void Aig_ManStop(Aig_Man_t *p)
static int Abc_InfoHasBit(unsigned *p, int i)
int Aig_ManSeqCleanup(Aig_Man_t *p)
void Aig_MmFixedStop(Aig_MmFixed_t *p, int fVerbose)
static Aig_Obj_t * Aig_ObjFanin0(Aig_Obj_t *pObj)
static unsigned * Aig_TsiNext(unsigned *pState, int nWords)
static void Vec_PtrPush(Vec_Ptr_t *p, void *Entry)
static Aig_Obj_t * Aig_ManConst0(Aig_Man_t *p)
#define ABC_ALLOC(type, num)
unsigned Aig_ManRandom(int fReset)
static Aig_Obj_t * Aig_ObjFanin1(Aig_Obj_t *pObj)
Aig_MmFixed_t * Aig_MmFixedStart(int nEntrySize, int nEntriesMax)
FUNCTION DEFINITIONS ///.
static void Aig_ObjSetXsim(Aig_Obj_t *pObj, int Value)
void Aig_TsiStateInsert(Aig_Tsi_t *p, unsigned *pState, int nWords)
Vec_Ptr_t * Aig_ManTernarySimulate(Aig_Man_t *p, int fVerbose, int fVeryVerbose)
#define Aig_ManForEachNode(p, pObj, i)
static void Aig_TsiSetNext(unsigned *pState, int nWords, unsigned *pNext)
static int Aig_ObjGetXsim(Aig_Obj_t *pObj)
Aig_Tsi_t * Aig_TsiStart(Aig_Man_t *pAig)
FUNCTION DEFINITIONS ///.
#define TSI_MAX_ROUNDS
DECLARATIONS ///.
void Aig_ManReportImprovement(Aig_Man_t *p, Aig_Man_t *pNew)
void Aig_TsiStop(Aig_Tsi_t *p)
#define Aig_ManForEachLiLoSeq(p, pObjLi, pObjLo, k)
static int Aig_XsimRand2()
static int Aig_ManCiNum(Aig_Man_t *p)
#define ABC_NAMESPACE_IMPL_END
static int Aig_ObjGetXsimFanin1(Aig_Obj_t *pObj)
static int Aig_XsimInv(int Value)
char * Aig_MmFixedEntryFetch(Aig_MmFixed_t *p)
unsigned * Aig_TsiStateNew(Aig_Tsi_t *p)
static int Aig_ObjGetXsimFanin0(Aig_Obj_t *pObj)
static int Aig_XsimAnd(int Value0, int Value1)
static int Aig_ObjFaninC0(Aig_Obj_t *pObj)
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 void Abc_InfoSetBit(unsigned *p, int i)
static void Aig_XsimPrint(FILE *pFile, int Value)
static int Aig_ManRegNum(Aig_Man_t *p)
static int Aig_XsimRand3()
int Aig_TsiStateLookup(Aig_Tsi_t *p, unsigned *pState, int nWords)
static Vec_Ptr_t * Vec_PtrAlloc(int nCap)
FUNCTION DEFINITIONS ///.
#define Aig_ManForEachLoSeq(p, pObj, i)
static int Aig_ObjFaninC1(Aig_Obj_t *pObj)
static int Abc_BitWordNum(int nBits)
#define Aig_ManForEachLiSeq(p, pObj, i)
Vec_Ptr_t * Saig_MvManSimulate(Aig_Man_t *pAig, int nFramesSymb, int nFramesSatur, int fVerbose, int fVeryVerbose)
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.
void Aig_TsiStatePrint(Aig_Tsi_t *p, unsigned *pState)
#define Aig_ManForEachPiSeq(p, pObj, i)
SEQUENTIAL ITERATORS ///.
static void Vec_PtrFree(Vec_Ptr_t *p)