19 #ifndef ABC__sat__fraig__fraigInt_h
20 #define ABC__sat__fraig__fraigInt_h
57 #define FRAIG_ENABLE_FANOUTS
58 #define FRAIG_PATTERNS_RANDOM 2048 // should not be less than 128 and more than 32768 (2^15)
59 #define FRAIG_PATTERNS_DYNAMIC 2048 // should not be less than 256 and more than 32768 (2^15)
60 #define FRAIG_MAX_PRIMES 1024 // the maximum number of primes used for hashing
67 #define FRAIG_WORDS_STORE 5
70 #define FRAIG_MASK(n) ((~((unsigned)0)) >> (32-(n)))
71 #define FRAIG_FULL (~((unsigned)0))
72 #define FRAIG_NUM_WORDS(n) (((n)>>5) + (((n)&31) > 0))
76 #define FRAIG_RANDOM_UNSIGNED Aig_ManRandom(0)
79 #define Fraig_BitStringSetBit(p,i) ((p)[(i)>>5] |= (1<<((i) & 31)))
80 #define Fraig_BitStringXorBit(p,i) ((p)[(i)>>5] ^= (1<<((i) & 31)))
81 #define Fraig_BitStringHasBit(p,i) (((p)[(i)>>5] & (1<<((i) & 31))) > 0)
86 #define Fraig_NodeSetVarStr(p,i) Fraig_BitStringSetBit(Fraig_Regular(p)->pSuppStr,i)
87 #define Fraig_NodeHasVarStr(p,i) Fraig_BitStringHasBit(Fraig_Regular(p)->pSuppStr,i)
90 #define Fraig_PrintTime(a,t) printf( "%s = ", (a) ); printf( "%6.2f sec\n", (float)(t)/(float)(CLOCKS_PER_SEC) )
92 #define Fraig_HashKey2(a,b,TSIZE) (((ABC_PTRUINT_T)(a) + (ABC_PTRUINT_T)(b) * 12582917) % TSIZE)
254 #ifdef FRAIG_ENABLE_FANOUTS
279 #define Fraig_NodeReadNextFanout( pNode, pFanout ) \
280 ( ( pFanout == NULL )? NULL : \
281 ((Fraig_Regular((pFanout)->p1) == (pNode))? \
282 (pFanout)->pFanFanin1 : (pFanout)->pFanFanin2) )
284 #define Fraig_NodeReadNextFanoutPlace( pNode, pFanout ) \
285 ( (Fraig_Regular((pFanout)->p1) == (pNode))? \
286 &(pFanout)->pFanFanin1 : &(pFanout)->pFanFanin2 )
288 #define Fraig_NodeForEachFanout( pNode, pFanout ) \
289 for ( pFanout = (pNode)->pFanPivot; pFanout; \
290 pFanout = Fraig_NodeReadNextFanout(pNode, pFanout) )
292 #define Fraig_NodeForEachFanoutSafe( pNode, pFanout, pFanout2 ) \
293 for ( pFanout = (pNode)->pFanPivot, \
294 pFanout2 = Fraig_NodeReadNextFanout(pNode, pFanout); \
296 pFanout = pFanout2, \
297 pFanout2 = Fraig_NodeReadNextFanout(pNode, pFanout) )
301 #define Fraig_TableBinForEachEntryS( pBin, pEnt ) \
304 pEnt = pEnt->pNextS )
305 #define Fraig_TableBinForEachEntrySafeS( pBin, pEnt, pEnt2 ) \
307 pEnt2 = pEnt? pEnt->pNextS: NULL; \
310 pEnt2 = pEnt? pEnt->pNextS: NULL )
312 #define Fraig_TableBinForEachEntryF( pBin, pEnt ) \
315 pEnt = pEnt->pNextF )
316 #define Fraig_TableBinForEachEntrySafeF( pBin, pEnt, pEnt2 ) \
318 pEnt2 = pEnt? pEnt->pNextF: NULL; \
321 pEnt2 = pEnt? pEnt->pNextF: NULL )
323 #define Fraig_TableBinForEachEntryD( pBin, pEnt ) \
326 pEnt = pEnt->pNextD )
327 #define Fraig_TableBinForEachEntrySafeD( pBin, pEnt, pEnt2 ) \
329 pEnt2 = pEnt? pEnt->pNextD: NULL; \
332 pEnt2 = pEnt? pEnt->pNextD: NULL )
334 #define Fraig_TableBinForEachEntryE( pBin, pEnt ) \
337 pEnt = pEnt->pNextE )
338 #define Fraig_TableBinForEachEntrySafeE( pBin, pEnt, pEnt2 ) \
340 pEnt2 = pEnt? pEnt->pNextE: NULL; \
343 pEnt2 = pEnt? pEnt->pNextE: NULL )
Fraig_Node_t * pFanFanin1
int Fraig_FeedBackCompress(Fraig_Man_t *p)
void Fraig_NodeSetTravIdCurrent(Fraig_Man_t *pMan, Fraig_Node_t *pNode)
int Fraig_NodeIsTravIdPrevious(Fraig_Man_t *pMan, Fraig_Node_t *pNode)
Fraig_Node_t * Fraig_NodeCreateConst(Fraig_Man_t *p)
FUNCTION DEFINITIONS ///.
Fraig_HashTable_t * pTableF
void Fraig_NodeSimulate(Fraig_Node_t *pNode, int iWordStart, int iWordStop, int fUseRand)
int Fraig_NodesCompareSupps(Fraig_Man_t *p, Fraig_Node_t *pOld, Fraig_Node_t *pNew)
typedefABC_NAMESPACE_HEADER_START struct Fraig_ManStruct_t_ Fraig_Man_t
INCLUDES ///.
int * Fraig_ManSaveCounterExample(Fraig_Man_t *p, Fraig_Node_t *pNode)
Fraig_NodeVec_t * vOutputs
void Fraig_MemFixedEntryRecycle(Fraig_MemFixed_t *p, char *pEntry)
int Fraig_MemFixedReadMemUsage(Fraig_MemFixed_t *p)
void Fraig_NodeAddFaninFanout(Fraig_Node_t *pFanin, Fraig_Node_t *pFanout)
DECLARATIONS ///.
void Fraig_FeedBackTest(Fraig_Man_t *p)
void Fraig_TablePrintStatsF(Fraig_Man_t *pMan)
void Fraig_ManIncrementTravId(Fraig_Man_t *pMan)
Fraig_MemFixed_t * mmSims
void Fraig_TablePrintStatsF0(Fraig_Man_t *pMan)
Fraig_Node_t * Fraig_NodeCreate(Fraig_Man_t *p, Fraig_Node_t *p1, Fraig_Node_t *p2)
void Fraig_FeedBackInit(Fraig_Man_t *p)
FUNCTION DEFINITIONS ///.
Msat_IntVec_t * vPatsReal
int Fraig_CompareSimInfo(Fraig_Node_t *pNode1, Fraig_Node_t *pNode2, int iWordLast, int fUseRand)
Fraig_Node_t * Fraig_NodeAndCanon(Fraig_Man_t *pMan, Fraig_Node_t *p1, Fraig_Node_t *p2)
FUNCTION DEFINITIONS ///.
void Fraig_TablePrintStatsS(Fraig_Man_t *pMan)
void Fraig_HashTableFree(Fraig_HashTable_t *p)
int Fraig_HashTableLookupS(Fraig_Man_t *pMan, Fraig_Node_t *p1, Fraig_Node_t *p2, Fraig_Node_t **ppNodeRes)
int Fraig_CountPis(Fraig_Man_t *p, Msat_IntVec_t *vVarNums)
int Fraig_NodeIsInSupergate(Fraig_Node_t *pOld, Fraig_Node_t *pNew)
Fraig_Node_t * Fraig_NodeCreatePi(Fraig_Man_t *p)
Fraig_Node_t * Fraig_NodeRecognizeMux(Fraig_Node_t *pNode, Fraig_Node_t **ppNodeT, Fraig_Node_t **ppNodeE)
void Fraig_FeedBack(Fraig_Man_t *p, int *pModel, Msat_IntVec_t *vVars, Fraig_Node_t *pOld, Fraig_Node_t *pNew)
int Fraig_FindFirstDiff(Fraig_Node_t *pNode1, Fraig_Node_t *pNode2, int fCompl, int iWordLast, int fUseRand)
void Fraig_ManSelectBestChoice(Fraig_Man_t *p)
int Fraig_NodeSimsContained(Fraig_Man_t *pMan, Fraig_Node_t *pNode1, Fraig_Node_t *pNode2)
Fraig_Node_t * Fraig_HashTableLookupF0(Fraig_Man_t *pMan, Fraig_Node_t *pNode)
int * Fraig_ManAllocCounterExample(Fraig_Man_t *p)
int Fraig_ManCountMuxes(Fraig_Man_t *pMan)
Fraig_HashTable_t * pTableS
int Fraig_CompareSimInfoUnderMask(Fraig_Node_t *pNode1, Fraig_Node_t *pNode2, int iWordLast, int fUseRand, unsigned *puMask)
int Fraig_NodeIsExor(Fraig_Node_t *pNode)
void Fraig_HashTableInsertF0(Fraig_Man_t *pMan, Fraig_Node_t *pNode)
Msat_IntVec_t * vVarsUsed
int Fraig_NodeIsTravIdCurrent(Fraig_Man_t *pMan, Fraig_Node_t *pNode)
int Fraig_NodeIsImplication(Fraig_Man_t *p, Fraig_Node_t *pOld, Fraig_Node_t *pNew, int nBTLimit)
Fraig_HashTable_t * pTableF0
Fraig_Node_t * pFanFanin2
#define ABC_NAMESPACE_HEADER_START
NAMESPACES ///.
void Fraig_ManCreateSolver(Fraig_Man_t *p)
int Fraig_NodeCountPis(Msat_IntVec_t *vVars, int nVarsPi)
void Fraig_CollectXors(Fraig_Node_t *pNode1, Fraig_Node_t *pNode2, int iWordLast, int fUseRand, unsigned *puMask)
#define ABC_NAMESPACE_HEADER_END
Fraig_HashTable_t * Fraig_HashTableCreate(int nSize)
FUNCTION DEFINITIONS ///.
unsigned Aig_ManRandom(int fReset)
GLOBAL VARIABLES ///.
Fraig_NodeVec_t * Fraig_CollectSupergate(Fraig_Node_t *pNode, int fStopAtMux)
int Fraig_NodeAndSimpleCase_rec(Fraig_Node_t *pOld, Fraig_Node_t *pNew)
int Fraig_BitStringCountOnes(unsigned *pString, int nWords)
int Fraig_NodeGetFanoutNum(Fraig_Node_t *pNode)
Msat_ClauseVec_t * vAdjacents
int Fraig_NodeIsMuxType(Fraig_Node_t *pNode)
Fraig_MemFixed_t * mmNodes
int Fraig_NodeCountSuppVars(Fraig_Man_t *p, Fraig_Node_t *pNode, int fSuppStr)
Fraig_Node_t * Fraig_HashTableLookupF(Fraig_Man_t *pMan, Fraig_Node_t *pNode)
void Fraig_MemFixedRestart(Fraig_MemFixed_t *p)
char * Fraig_MemFixedEntryFetch(Fraig_MemFixed_t *p)
void Fraig_NodeVecSortByRefCount(Fraig_NodeVec_t *p)
void Fraig_MemFixedStop(Fraig_MemFixed_t *p, int fVerbose)
void Fraig_NodeRemoveFaninFanout(Fraig_Node_t *pFanin, Fraig_Node_t *pFanoutToRemove)
int Fraig_ManCountExors(Fraig_Man_t *pMan)
int Fraig_TableRehashF0(Fraig_Man_t *pMan, int fLinkEquiv)
void Fraig_PrintBinary(FILE *pFile, unsigned *pSign, int nBits)
Fraig_MemFixed_t * Fraig_MemFixedStart(int nEntrySize)
FUNCTION DEFINITIONS ///.
Fraig_NodeVec_t * vFanins
Fraig_NodeVec_t * vInputs
int Fraig_NodeIsExorType(Fraig_Node_t *pNode)
typedefABC_NAMESPACE_HEADER_START struct Msat_Solver_t_ Msat_Solver_t
INCLUDES ///.
int s_FraigPrimes[FRAIG_MAX_PRIMES]
DECLARATIONS ///.