62 memset( p->pSimsReal, 0,
sizeof(
unsigned) * p->nWordsDyna );
91 assert( p->iWordStart + nWords <= p->nWordsDyna );
94 for ( i = 1; i < p->vNodes->nSize; i++ )
105 if ( p->iWordStart + nWords == p->nWordsDyna )
128 int i, nVars, nVarsPis, * pVars;
131 for ( i = 0; i < p->vInputs->nSize; i++ )
133 pNode = p->vInputs->pArray[i];
143 for ( i = 0; i < nVars; i++ )
145 pNode = p->vNodes->pArray[ pVars[i] ];
170 int nWords, iPatFlip, nPatFlipLimit, i, w;
177 else if ( fUseNoPats )
182 if ( nWords > p->nWordsDyna - p->iWordStart )
183 nWords = p->nWordsDyna - p->iWordStart;
185 nPatFlipLimit = nWords * 32 - 2;
194 for ( i = 0; i < p->vInputs->nSize; i++ )
196 pNode = p->vInputs->pArray[i];
197 for ( w = p->iWordStart; w < p->iWordStart + nWords; w++ )
208 if ( pNode->
fFeedUse && 2 * iPatFlip < nPatFlipLimit )
216 else if ( fUseNoPats )
222 if ( pNode->
fFeedUse && iPatFlip < nPatFlipLimit )
233 for ( w = p->iWordStart; w < p->iWordStart + nWords; w++ )
254 int fValue1, fValue2, iPat;
282 int i, w, t, nPats, * pPats;
283 int fPerformChecks = (p->nBTLimit == -1);
286 if ( fPerformChecks )
304 for ( i = 0; i < p->vInputs->nSize; i++ )
307 pSims = p->vInputs->pArray[i]->puSimD;
309 for ( w = p->iWordPerm; w < p->iWordStart; w++ )
312 for ( t = 0; t < nPats; t++ )
316 if ( p->iPatsPerm + t < p->iWordPerm * 32 )
322 for ( w = p->iWordPerm; w < p->iWordStart; w++ )
323 pSims[w] = p->pSimsTemp[w];
326 for ( w = 0; w < p->iWordStart; w++ )
328 p->vInputs->pArray[i]->uHashD = uHash;
332 p->iWordPerm = p->iWordStart;
333 p->iPatsPerm += nPats;
337 for ( i = 1; i < p->vNodes->nSize; i++ )
340 p->vNodes->pArray[i]->uHashD = 0;
345 if ( fPerformChecks )
352 if ( fPerformChecks )
363 memset( p->pSimsReal, 0,
sizeof(
unsigned)*p->nWordsDyna );
364 for ( w = 0; w < p->iWordPerm; w++ )
366 if ( p->iPatsPerm % 32 > 0 )
367 p->pSimsReal[p->iWordPerm-1] =
FRAIG_MASK( p->iPatsPerm % 32 );
369 return p->iWordStart;
390 int * pHits, iPat, iCol, i;
391 int nOnesTotal, nSolStarting;
392 int fVeryVerbose = 0;
399 for ( i = 0; i < vColumns->
nSize; i++ )
401 pSims = (
unsigned *)vColumns->
pArray[i];
403 nOnesTotal += pHits[i];
420 for ( i = 0; i < vColumns->
nSize; i++ )
424 if ( p->fVerbose && fVeryVerbose )
426 printf(
"%3d\\%3d\\%3d ", p->nWordsRand, p->nWordsDyna, p->iWordPerm );
427 printf(
"Col (pairs) = %5d. ", vColumns->
nSize );
428 printf(
"Row (pats) = %5d. ", p->iWordStart * 32 );
429 printf(
"Dns = %6.2f %%. ", vColumns->
nSize==0? 0.0 : 100.0 * nOnesTotal / vColumns->
nSize / p->iWordStart / 32 );
455 unsigned * pUnsigned1, * pUnsigned2;
462 for ( i = 0; i < pT->
nBins; i++ )
465 p->vCones->nSize = 0;
468 if ( p->vCones->nSize == 1 )
471 if ( p->vCones->nSize > 20 )
475 for ( k = 0; k < p->vCones->nSize; k++ )
476 for ( m = k+1; m < p->vCones->nSize; m++ )
485 pUnsigned1 = p->vCones->pArray[k]->puSimD;
486 pUnsigned2 = p->vCones->pArray[m]->puSimD;
487 for ( w = 0; w < p->iWordStart; w++ )
488 pSims[w] = (pUnsigned1[w] ^ pUnsigned2[w]) & ~p->pSimsReal[w];
502 for ( i = 0; i < pT->
nBins; i++ )
507 for ( w = 0; w < p->iWordStart; w++ )
515 for ( i = 0; i < pT->
nBins; i++ )
518 p->vCones->nSize = 0;
521 if ( p->vCones->nSize == 1 )
525 for ( k = 0; k < p->vCones->nSize; k++ )
526 for ( m = k+1; m < p->vCones->nSize; m++ )
531 pUnsigned1 = p->vCones->pArray[k]->puSimD;
532 pUnsigned2 = p->vCones->pArray[m]->puSimD;
533 for ( w = 0; w < p->iWordStart; w++ )
534 pSims[w] = (pUnsigned1[w] ^ pUnsigned2[w]) & ~p->pSimsReal[w];
557 int i, iColMin = -1, nHitsMin = 1000000;
558 for ( i = 0; i < nHits; i++ )
567 if ( nHitsMin > pHits[i] )
590 for ( i = 0; i <
nWords; i++ )
594 for ( b = 0; b < 32; b++ )
595 if ( pSims[i] & (1 << b) )
616 for ( i = 0; i < vColumns->
nSize; i++ )
618 pSims = (
unsigned *)vColumns->
pArray[i];
643 for ( i = 0; i < pT->
nBins; i++ )
646 p->vCones->nSize = 0;
649 if ( p->vCones->nSize == 1 )
651 for ( k = 0; k < p->vCones->nSize; k++ )
652 for ( m = k+1; m < p->vCones->nSize; m++ )
655 printf(
"Nodes %d and %d have the same D simulation info.\n",
656 p->vCones->pArray[k]->Num, p->vCones->pArray[m]->Num );
681 for ( i = 0; i < pT->
nBins; i++ )
683 p->vCones->nSize = 0;
686 if ( p->vCones->nSize == 1 )
688 for ( k = 0; k < p->vCones->nSize; k++ )
689 for ( m = k+1; m < p->vCones->nSize; m++ )
692 printf(
"Nodes %d and %d have the same D simulation info.\n",
693 p->vCones->pArray[k]->Num, p->vCones->pArray[m]->Num );
727 memset( pNode->
puSimR, 0,
sizeof(
unsigned) * p->nWordsRand );
728 memset( pNode->
puSimD, 0,
sizeof(
unsigned) * p->nWordsDyna );
731 for ( i = 0; i < p->vInputs->nSize; i++ )
733 pNode = p->vInputs->pArray[i];
736 memmove( pSimsNew, pNode->
puSimR,
sizeof(
unsigned) * (p->nWordsRand + p->iWordStart) );
745 p->mmSims = mmSimsNew;
748 for ( i = 1; i < p->vNodes->nSize; i++ )
750 pNode = p->vNodes->pArray[i];
770 memset( p->pSimsReal, 0,
sizeof(
unsigned) * p->nWordsDyna );
790 pModel =
ABC_ALLOC(
int, p->vInputs->nSize );
791 memset( pModel, 0,
sizeof(
int) * p->vInputs->nSize );
817 pNode->
fMark3 = Value0 & Value1;
834 int fCompl, RetValue, i;
837 for ( i = 0; i < p->vInputs->nSize; i++ )
840 p->vInputs->pArray[i]->fMark3 = pModel[i];
845 return fCompl ^ RetValue;
876 for ( i = 0; i < p->vInputs->nSize; i++ )
891 for ( i = 0; i < p->vInputs->nSize; i++ )
int * Fraig_ManAllocCounterExample(Fraig_Man_t *p)
int Fraig_FeedBackCompress(Fraig_Man_t *p)
#define FRAIG_WORDS_STORE
#define Fraig_BitStringHasBit(p, i)
void Fraig_NodeSetTravIdCurrent(Fraig_Man_t *pMan, Fraig_Node_t *pNode)
void Fraig_NodeVecPush(Fraig_NodeVec_t *p, Fraig_Node_t *Entry)
void Fraig_NodeSimulate(Fraig_Node_t *pNode, int iWordStart, int iWordStop, int fUseRand)
typedefABC_NAMESPACE_HEADER_START struct Fraig_ManStruct_t_ Fraig_Man_t
INCLUDES ///.
int Fraig_ManSimulateBitNode(Fraig_Man_t *p, Fraig_Node_t *pNode, int *pModel)
static void Fraig_FeedBackVerify(Fraig_Man_t *p, Fraig_Node_t *pOld, Fraig_Node_t *pNew)
void Fraig_MemFixedEntryRecycle(Fraig_MemFixed_t *p, char *pEntry)
void Fraig_ManIncrementTravId(Fraig_Man_t *pMan)
int Fraig_CompareSimInfo(Fraig_Node_t *pNode1, Fraig_Node_t *pNode2, int iWordLast, int fUseRand)
static void Fraig_ReallocateSimulationInfo(Fraig_Man_t *p)
void Msat_IntVecClear(Msat_IntVec_t *p)
static int Fraig_FeedBackInsert(Fraig_Man_t *p, int nVarsPi)
static void Fraig_FeedBackCheckTable(Fraig_Man_t *p)
#define ABC_ALLOC(type, num)
int Fraig_ManSimulateBitNode_rec(Fraig_Man_t *p, Fraig_Node_t *pNode)
static abctime Abc_Clock()
#define Fraig_TableBinForEachEntryD(pBin, pEnt)
static int Fraig_GetSmallestColumn(int *pHits, int nHits)
int Fraig_FindFirstDiff(Fraig_Node_t *pNode1, Fraig_Node_t *pNode2, int fCompl, int iWordLast, int fUseRand)
int Msat_IntVecReadSize(Msat_IntVec_t *p)
void Msat_IntVecPush(Msat_IntVec_t *p, int Entry)
#define Fraig_TableBinForEachEntryF(pBin, pEnt)
void Fraig_FeedBackInit(Fraig_Man_t *p)
FUNCTION DEFINITIONS ///.
#define FRAIG_RANDOM_UNSIGNED
#define Fraig_BitStringSetBit(p, i)
void Fraig_NodeVecFree(Fraig_NodeVec_t *p)
Fraig_NodeVec_t * Fraig_NodeVecAlloc(int nCap)
DECLARATIONS ///.
int Fraig_CompareSimInfoUnderMask(Fraig_Node_t *pNode1, Fraig_Node_t *pNode2, int iWordLast, int fUseRand, unsigned *puMask)
static void Fraig_FeedBackCheckTableF0(Fraig_Man_t *p)
static void Fraig_FeedBackCovering(Fraig_Man_t *p, Msat_IntVec_t *vPats)
#define ABC_NAMESPACE_IMPL_END
static ABC_NAMESPACE_IMPL_START int Fraig_FeedBackPrepare(Fraig_Man_t *p, int *pModel, Msat_IntVec_t *vVars)
DECLARATIONS ///.
int Msat_IntVecReadEntry(Msat_IntVec_t *p, int i)
int Fraig_NodeIsAnd(Fraig_Node_t *p)
int Fraig_NodeIsTravIdCurrent(Fraig_Man_t *pMan, Fraig_Node_t *pNode)
#define FRAIG_NUM_WORDS(n)
static Fraig_NodeVec_t * Fraig_FeedBackCoveringStart(Fraig_Man_t *pMan)
int * Fraig_ManSaveCounterExample(Fraig_Man_t *p, Fraig_Node_t *pNode)
Msat_IntVec_t * Msat_IntVecAlloc(int nCap)
FUNCTION DEFINITIONS ///.
static void Fraig_CancelCoveredColumns(Fraig_NodeVec_t *vColumns, int *pHits, int iPat)
#define Fraig_BitStringXorBit(p, i)
#define Fraig_IsComplement(p)
GLOBAL VARIABLES ///.
#define ABC_NAMESPACE_IMPL_START
int Fraig_BitStringCountOnes(unsigned *pString, int nWords)
char * Fraig_MemFixedEntryFetch(Fraig_MemFixed_t *p)
int * Msat_IntVecReadArray(Msat_IntVec_t *p)
void Fraig_MemFixedStop(Fraig_MemFixed_t *p, int fVerbose)
int Fraig_TableRehashF0(Fraig_Man_t *pMan, int fLinkEquiv)
int Fraig_NodeIsVar(Fraig_Node_t *p)
void Fraig_FeedBack(Fraig_Man_t *p, int *pModel, Msat_IntVec_t *vVars, Fraig_Node_t *pOld, Fraig_Node_t *pNew)
Fraig_MemFixed_t * Fraig_MemFixedStart(int nEntrySize)
FUNCTION DEFINITIONS ///.
int s_FraigPrimes[FRAIG_MAX_PRIMES]
DECLARATIONS ///.
static int Fraig_GetHittingPattern(unsigned *pSims, int nWords)