32 return 3 & (pInfo[i >> 4] >> ((i & 15) << 1));
38 pInfo[i >> 4] ^= (Value << ((i & 15) << 1));
256 static int s_FPrimes[128] = {
257 1009, 1049, 1093, 1151, 1201, 1249, 1297, 1361, 1427, 1459,
258 1499, 1559, 1607, 1657, 1709, 1759, 1823, 1877, 1933, 1997,
259 2039, 2089, 2141, 2213, 2269, 2311, 2371, 2411, 2467, 2543,
260 2609, 2663, 2699, 2741, 2797, 2851, 2909, 2969, 3037, 3089,
261 3169, 3221, 3299, 3331, 3389, 3461, 3517, 3557, 3613, 3671,
262 3719, 3779, 3847, 3907, 3943, 4013, 4073, 4129, 4201, 4243,
263 4289, 4363, 4441, 4493, 4549, 4621, 4663, 4729, 4793, 4871,
264 4933, 4973, 5021, 5087, 5153, 5227, 5281, 5351, 5417, 5471,
265 5519, 5573, 5651, 5693, 5749, 5821, 5861, 5923, 6011, 6073,
266 6131, 6199, 6257, 6301, 6353, 6397, 6481, 6563, 6619, 6689,
267 6737, 6803, 6863, 6917, 6977, 7027, 7109, 7187, 7237, 7309,
268 7393, 7477, 7523, 7561, 7607, 7681, 7727, 7817, 7877, 7933,
269 8011, 8039, 8059, 8081, 8093, 8111, 8123, 8147
274 for ( i = 0; i <
nWords; i++ )
275 uHash ^= pState[i] * s_FPrimes[i & 0x7F];
276 return uHash % nTableSize;
295 if ( !
memcmp( pEntry, pState,
sizeof(
unsigned) * nWords ) )
316 pBins[Hash] = pState;
332 return (
unsigned *)
ABC_CALLOC(
char,
sizeof(
unsigned) * nWords +
sizeof(
unsigned *) );
377 int i, iCis = 0, iCos = 0;
417 int i, Entry, iMaxTerValue = -1;
422 assert( iMaxTerValue >= 0 );
430 if ( iMaxTerValue == 0 )
478 int i, nZeros = 0, nOnes = 0, nDcs = 0;
479 printf(
" %4d : ", iNum );
480 for ( i = 0; i < nRegs; i++ )
483 printf(
"0" ), nZeros++;
485 printf(
"1" ), nOnes++;
487 printf(
"x" ), nDcs++;
491 printf(
" (0=%4d, 1=%4d, x=%4d)\n", nZeros, nOnes, nDcs );
507 unsigned * pTemp, * pStates = (
unsigned *)
Vec_PtrPop( vStates );
508 int i, w, nZeros, nConsts, nStateWords;
511 memset( pStates, 0,
sizeof(
int) * nStateWords );
513 for ( w = 0; w < nStateWords; w++ )
514 pStates[w] |= pTemp[w];
517 for ( i = 0; i < nRegs; i++ )
520 printf(
"Found %d constant registers.\n", nZeros );
522 memset( pStates, 0,
sizeof(
int) * nStateWords );
524 for ( w = 0; w < nStateWords; w++ )
525 pStates[w] |= (~(pTemp[w] ^ (pTemp[w] >> 1)) & 0x55555555);
528 for ( i = 0; i < nRegs; i++ )
531 printf(
"Found %d non-ternary registers.\n", nConsts );
549 int i, nZeros = 0, nConsts = 0;
575 unsigned * pState, * pFlop;
576 int i, k, nFlopWords;
607 unsigned * pFlop, * pTemp;
611 if ( !
memcmp( pTemp, pFlop,
sizeof(
unsigned) * nFlopWords ) )
632 int i, iRepr, nFlopWords, Counter0 = 0, CounterE = 0;
652 printf(
"Transforming %d const and %d equiv registers.\n", Counter0, CounterE );
671 unsigned * pState, * pPrev, * pLoop;
680 printf(
"Obj = %8d (%8d). F = %6d. ",
682 printf(
"AIG = %7.2f MB. F-mem = %7.2f MB. Other = %7.2f MB. ",
709 if ( i >= p->
nIters && i % 10 == 0 )
720 printf(
"Ternary simulation saturated after %d iterations. ", i+1 );
void Gia_ManTerStatesFree(Vec_Ptr_t *vStates)
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
static int Abc_PrimeCudd(unsigned int p)
void Gia_ManStop(Gia_Man_t *p)
static void Gia_ManTerSimInfoTransfer(Gia_ManTer_t *p)
static int Gia_ObjFaninC1(Gia_Obj_t *pObj)
static Gia_Obj_t * Gia_ManCi(Gia_Man_t *p, int v)
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
static int Gia_ObjDiff1(Gia_Obj_t *pObj)
static int Abc_Var2Lit(int Var, int fCompl)
static int Gia_ObjValue(Gia_Obj_t *pObj)
static void Gia_ManTerSimulateCi(Gia_ManTer_t *p, Gia_Obj_t *pObj, int iCi)
static void Vec_PtrPush(Vec_Ptr_t *p, void *Entry)
#define ABC_ALLOC(type, num)
static int Gia_XsimNotCond(int Value, int fCompl)
void Gia_ManTerDelete(Gia_ManTer_t *p)
int Gia_ManTerRetire2(Gia_ManTer_t *p, unsigned *pState)
static int Gia_XsimAndCond(int Value0, int fCompl0, int Value1, int fCompl1)
unsigned * Gia_ManTerStateCreate(Gia_ManTer_t *p)
static abctime Abc_Clock()
unsigned * Gia_ManTerStateAlloc(int nWords)
static int Vec_PtrSize(Vec_Ptr_t *p)
static void * Vec_PtrPop(Vec_Ptr_t *p)
static void Gia_ManTerStateSetNext(unsigned *pState, int nWords, unsigned *pNext)
static int Vec_PtrFind(Vec_Ptr_t *p, void *Entry)
static void Gia_ManTerSimulateRound(Gia_ManTer_t *p)
static void Gia_ManTerSimInfoInit(Gia_ManTer_t *p)
static void Gia_ManTerSimInfoSet(unsigned *pInfo, int i, int Value)
static int Gia_ManAndNum(Gia_Man_t *p)
void Gia_ManTerStateInsert(unsigned *pState, int nWords, unsigned **pBins, int nBins)
static Vec_Int_t * Vec_IntAlloc(int nCap)
FUNCTION DEFINITIONS ///.
int Gia_ManTerStateHash(unsigned *pState, int nWords, int nTableSize)
static int Vec_IntEntry(Vec_Int_t *p, int i)
Gia_Man_t * Gia_ManFront(Gia_Man_t *p)
#define ABC_NAMESPACE_IMPL_END
static int Gia_ObjIsAndOrConst0(Gia_Obj_t *pObj)
static unsigned * Gia_ManTerStateNext(unsigned *pState, int nWords)
static void Vec_IntPush(Vec_Int_t *p, int Entry)
static int Gia_ObjId(Gia_Man_t *p, Gia_Obj_t *pObj)
int Gia_ManTerRetire(Gia_ManTer_t *p, unsigned *pThis, unsigned *pPrev)
static int Gia_ObjDiff0(Gia_Obj_t *pObj)
#define ABC_NAMESPACE_IMPL_START
Gia_Man_t * Gia_ManDupDfsCiMap(Gia_Man_t *p, int *pCi2Lit, Vec_Int_t *vLits)
static void * Vec_PtrEntry(Vec_Ptr_t *p, int i)
static int Gia_ManCiNum(Gia_Man_t *p)
void Gia_ManTerAnalyze(Gia_ManTer_t *p)
static int Vec_IntSize(Vec_Int_t *p)
#define Vec_PtrForEachEntryStop(Type, vVec, pEntry, i, Stop)
static Vec_Ptr_t * Vec_PtrAlloc(int nCap)
FUNCTION DEFINITIONS ///.
int * Gia_ManTerCreateMap(Gia_ManTer_t *p, int fVerbose)
Gia_ManTer_t * Gia_ManTerCreate(Gia_Man_t *pAig)
FUNCTION DEFINITIONS ///.
static Gia_Obj_t * Gia_ManConst0(Gia_Man_t *p)
#define GIA_NONE
INCLUDES ///.
#define ABC_CALLOC(type, num)
unsigned * Gia_ManTerStateLookup(unsigned *pState, int nWords, unsigned **pBins, int nBins)
Gia_Man_t * Gia_ManReduceConst(Gia_Man_t *pAig, int fVerbose)
static int Abc_BitWordNum(int nBits)
#define Gia_ManForEachObj1(p, pObj, i)
int Gia_ManFindEqualFlop(Vec_Ptr_t *vFlops, int iFlop, int nFlopWords)
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)
static void Vec_IntClear(Vec_Int_t *p)
static int Gia_ObjIsCi(Gia_Obj_t *pObj)
Vec_Ptr_t * Gia_ManTerTranspose(Gia_ManTer_t *p)
#define Vec_IntForEachEntry(vVec, Entry, i)
MACRO DEFINITIONS ///.
static void Gia_ManTerSimulateNode(Gia_ManTer_t *p, Gia_Obj_t *pObj)
Gia_ManTer_t * Gia_ManTerSimulate(Gia_Man_t *pAig, int fVerbose)
static void Gia_ManTerSimulateCo(Gia_ManTer_t *p, int iCo, Gia_Obj_t *pObj)
void Gia_ManTerStatePrint(unsigned *pState, int nRegs, int iNum)
static int Gia_ManObjNum(Gia_Man_t *p)
#define ABC_FALLOC(type, num)
static ABC_NAMESPACE_IMPL_START int Gia_ManTerSimInfoGet(unsigned *pInfo, int i)
DECLARATIONS ///.
static void Vec_PtrFree(Vec_Ptr_t *p)
static int Gia_ManCoNum(Gia_Man_t *p)
void Gia_ManTerAnalyze2(Vec_Ptr_t *vStates, int nRegs)
static int Gia_ManRegNum(Gia_Man_t *p)