30 0,1,1,2,1,2,2,3,1,2,2,3,2,3,3,4,1,2,2,3,2,3,3,4,2,3,3,4,3,4,4,5,
31 1,2,2,3,2,3,3,4,2,3,3,4,3,4,4,5,2,3,3,4,3,4,4,5,3,4,4,5,4,5,5,6,
32 1,2,2,3,2,3,3,4,2,3,3,4,3,4,4,5,2,3,3,4,3,4,4,5,3,4,4,5,4,5,5,6,
33 2,3,3,4,3,4,4,5,3,4,4,5,4,5,5,6,3,4,4,5,4,5,5,6,4,5,5,6,5,6,6,7,
34 1,2,2,3,2,3,3,4,2,3,3,4,3,4,4,5,2,3,3,4,3,4,4,5,3,4,4,5,4,5,5,6,
35 2,3,3,4,3,4,4,5,3,4,4,5,4,5,5,6,3,4,4,5,4,5,5,6,4,5,5,6,5,6,6,7,
36 2,3,3,4,3,4,4,5,3,4,4,5,4,5,5,6,3,4,4,5,4,5,5,6,4,5,5,6,5,6,6,7,
37 3,4,4,5,4,5,5,6,4,5,5,6,5,6,6,7,4,5,5,6,5,6,6,7,5,6,6,7,6,7,7,8
64 for ( i = 0; i < pMan->vOutputs->nSize; i++ )
106 for ( i = 0; i < nNodes; i++ )
126 if ( pNode->
TravId == pMan->nTravIds )
128 pNode->
TravId = pMan->nTravIds;
135 if ( fEquiv && pNode->
pNextE )
157 RetValue = vNodes->
nSize;
197 if ( pNode->
Num < pOld->
Num && !pMan->fChoicing )
202 if ( pNode->
TravId == pMan->nTravIds )
204 pNode->
TravId = pMan->nTravIds;
231 RetValue = (pOld->
TravId == pMan->nTravIds);
259 for ( i = 0; i < vNodes->
nSize; i++ )
265 for ( i = 0; i < vNodes->
nSize; i++ )
268 if ( pNodeR && ++pNodeR->
nFanouts == 3 )
271 if ( pNodeR && ++pNodeR->
nFanouts == 3 )
290 unsigned char * pSuppBytes = (
unsigned char *)pString;
291 int i, nOnes, nBytes =
sizeof(unsigned) * nWords;
293 for ( i = nOnes = 0; i < nBytes; i++ )
318 for ( i = 0; i < pVec->
nSize; i++ )
324 printf(
"Primary input %d is a secondary node.\n", pNode->
Num );
329 printf(
"Constant 1 %d is a secondary node.\n", pNode->
Num );
334 printf(
"Internal node %d is a secondary node.\n", pNode->
Num );
336 printf(
"Internal node %d has first fanin %d that is a secondary node.\n",
339 printf(
"Internal node %d has second fanin %d that is a secondary node.\n",
362 int fCompl1, fCompl2, i;
365 for ( i = 0; i < vNodes->
nSize; i++ )
367 pTemp = vNodes->
pArray[i];
370 printf(
"%3d : PI ", pTemp->
Num );
374 printf(
" %d\n", pTemp->
fInv );
380 printf(
"%3d : %c%3d %c%3d ", pTemp->
Num,
386 printf(
" %d\n", pTemp->
fInv );
407 Remainder = (nBits%(
sizeof(unsigned)*8));
408 nWords = (nBits/(
sizeof(unsigned)*8)) + (Remainder>0);
410 for ( w = nWords-1; w >= 0; w-- )
411 for ( i = ((w == nWords-1 && Remainder)? Remainder-1: 31); i >= 0; i-- )
412 fprintf( pFile,
"%c",
'0' + (
int)((pSign[w] & (1<<i)) > 0) );
432 for ( i = 0; i < pMan->vOutputs->nSize; i++ )
433 nLevelMax = nLevelMax >
Fraig_Regular(pMan->vOutputs->pArray[i])->Level?
452 int Level1, Level2, LevelE;
457 if ( pNode->
TravId == pMan->nTravIds )
459 pNode->
TravId = pMan->nTravIds;
469 if ( pNode->
Level < LevelE )
470 pNode->
Level = LevelE;
474 if ( pNode->
Level > LevelE )
475 pNode->
Level = LevelE;
478 if ( pNode->
pRepr == NULL )
479 for ( pTemp = pNode->
pNextE; pTemp; pTemp = pTemp->
pNextE )
503 for ( i = 0; i < pMan->vOutputs->nSize; i++ )
523 int nChoiceNodes, nChoices;
524 int i, LevelMax1, LevelMax2;
532 nChoiceNodes = nChoices = 0;
533 for ( i = 0; i < pMan->vNodes->nSize; i++ )
535 pNode = pMan->vNodes->pArray[i];
536 if ( pNode->
pRepr == NULL && pNode->
pNextE != NULL )
539 for ( pTemp = pNode; pTemp; pTemp = pTemp->
pNextE )
543 printf(
"Maximum level: Original = %d. Reduced due to choices = %d.\n", LevelMax1, LevelMax2 );
544 printf(
"Choice stats: Choice nodes = %d. Total choices = %d.\n", nChoiceNodes, nChoices );
746 for ( i = 0; i < pMan->vNodes->nSize; i++ )
767 for ( i = 0; i < pMan->vNodes->nSize; i++ )
786 unsigned * pUnsigned1, * pUnsigned2;
790 pUnsigned1 = pNode1->
puSimR;
791 pUnsigned2 = pNode2->
puSimR;
792 for ( i = 0; i < pMan->nWordsRand; i++ )
793 if ( pUnsigned1[i] & ~pUnsigned2[i] )
797 pUnsigned1 = pNode1->
puSimD;
798 pUnsigned2 = pNode2->
puSimD;
799 for ( i = 0; i < pMan->iWordStart; i++ )
800 if ( pUnsigned1[i] & ~pUnsigned2[i] )
819 int * pVars, nVars, i,
Counter;
824 for ( i = 0; i < nVars; i++ )
850 for ( i = 0; i < pMan->vNodes->nSize; i++ )
852 pNode = pMan->vNodes->pArray[i];
854 if ( pNode->
nOnes == 0 || pNode->
nOnes == (
unsigned)pMan->nWordsRand * 32 )
857 if ( pNode->
nRefs > 5 )
863 printf(
"Total nodes = %d. Referenced nodes = %d.\n", pMan->vNodes->nSize, vPivots->
nSize );
867 Counter = nProved = 0;
868 for ( i = 0; i < vPivots->
nSize; i++ )
869 for ( k = i+1; k < vPivots->
nSize; k++ )
871 pNode = vPivots->
pArray[i];
872 pNode2 = vPivots->
pArray[k];
886 printf(
"Number of candidate pairs = %d. Proved = %d.\n", Counter, nProved );
907 int RetValue1, RetValue2;
909 return (pOld == pNew)? 1 : -1;
914 if ( RetValue1 == -1 || RetValue2 == -1 )
916 if ( RetValue1 == 1 || RetValue2 == 1 )
998 pNode->
TravId2 = pMan->nTravIds2;
1014 return pNode->
TravId2 == pMan->nTravIds2;
1030 return pNode->
TravId2 == pMan->nTravIds2 - 1;
void Fraig_ManReportChoices(Fraig_Man_t *pMan)
void Fraig_CollectSupergate_rec(Fraig_Node_t *pNode, Fraig_NodeVec_t *vSuper, int fFirst, int fStopAtMux)
void Fraig_NodeVecPush(Fraig_NodeVec_t *p, Fraig_Node_t *Entry)
Fraig_NodeVec_t * Fraig_DfsOne(Fraig_Man_t *pMan, Fraig_Node_t *pNode, int fEquiv)
typedefABC_NAMESPACE_HEADER_START struct Fraig_ManStruct_t_ Fraig_Man_t
INCLUDES ///.
int Fraig_ManCountMuxes(Fraig_Man_t *pMan)
int Fraig_NodeIsExor(Fraig_Node_t *pNode)
static int Fraig_CheckTfi_rec(Fraig_Man_t *pMan, Fraig_Node_t *pNode, Fraig_Node_t *pOld)
int Fraig_NodeIsExorType(Fraig_Node_t *pNode)
void Fraig_PrintNode(Fraig_Man_t *p, Fraig_Node_t *pNode)
int Fraig_NodeVecPushUnique(Fraig_NodeVec_t *p, Fraig_Node_t *Entry)
static abctime Abc_Clock()
int Fraig_CheckTfi(Fraig_Man_t *pMan, Fraig_Node_t *pOld, Fraig_Node_t *pNew)
static int Abc_MaxInt(int a, int b)
int Fraig_BitStringCountOnes(unsigned *pString, int nWords)
int Fraig_GetMaxLevel(Fraig_Man_t *pMan)
Fraig_Node_t * Fraig_NodeRecognizeMux(Fraig_Node_t *pNode, Fraig_Node_t **ppNodeT, Fraig_Node_t **ppNodeE)
int Fraig_CheckTfi2(Fraig_Man_t *pMan, Fraig_Node_t *pOld, Fraig_Node_t *pNew)
int Msat_IntVecReadSize(Msat_IntVec_t *p)
void Fraig_NodeSetTravIdCurrent(Fraig_Man_t *pMan, Fraig_Node_t *pNode)
int Fraig_NodeIsTravIdPrevious(Fraig_Man_t *pMan, Fraig_Node_t *pNode)
void Fraig_NodeVecFree(Fraig_NodeVec_t *p)
Fraig_NodeVec_t * Fraig_NodeVecAlloc(int nCap)
DECLARATIONS ///.
#define ABC_NAMESPACE_IMPL_END
int Fraig_NodeIsMuxType(Fraig_Node_t *pNode)
void Fraig_ManMarkRealFanouts(Fraig_Man_t *p)
int Fraig_NodeSimsContained(Fraig_Man_t *pMan, Fraig_Node_t *pNode1, Fraig_Node_t *pNode2)
int Fraig_NodeIsAnd(Fraig_Node_t *p)
int Fraig_NodeIsImplication(Fraig_Man_t *p, Fraig_Node_t *pOld, Fraig_Node_t *pNew, int nBTLimit)
Fraig_NodeVec_t * Fraig_Dfs(Fraig_Man_t *pMan, int fEquiv)
FUNCTION DEFINITIONS ///.
void Fraig_PrintBinary(FILE *pFile, unsigned *pSign, int nBits)
Fraig_NodeVec_t * Fraig_CollectSupergate(Fraig_Node_t *pNode, int fStopAtMux)
static ABC_NAMESPACE_IMPL_START int bit_count[256]
DECLARATIONS ///.
#define Fraig_IsComplement(p)
GLOBAL VARIABLES ///.
int Fraig_ManPrintRefs(Fraig_Man_t *pMan)
int Fraig_CountNodes(Fraig_Man_t *pMan, int fEquiv)
#define ABC_NAMESPACE_IMPL_START
Fraig_NodeVec_t * Fraig_DfsNodes(Fraig_Man_t *pMan, Fraig_Node_t **ppNodes, int nNodes, int fEquiv)
int Fraig_NodeIsConst(Fraig_Node_t *p)
int Fraig_NodeIsInSupergate(Fraig_Node_t *pOld, Fraig_Node_t *pNew)
void Fraig_MappingSetChoiceLevels(Fraig_Man_t *pMan, int fMaximum)
int * Msat_IntVecReadArray(Msat_IntVec_t *p)
int Fraig_ManCountExors(Fraig_Man_t *pMan)
int Fraig_NodeIsVar(Fraig_Node_t *p)
void Fraig_ManIncrementTravId(Fraig_Man_t *pMan)
static void Fraig_Dfs_rec(Fraig_Man_t *pMan, Fraig_Node_t *pNode, Fraig_NodeVec_t *vNodes, int fEquiv)
int Fraig_CountPis(Fraig_Man_t *p, Msat_IntVec_t *vVarNums)
int Fraig_ManCheckConsistency(Fraig_Man_t *p)
int Fraig_MappingUpdateLevel_rec(Fraig_Man_t *pMan, Fraig_Node_t *pNode, int fMaximum)
int Fraig_NodeIsTravIdCurrent(Fraig_Man_t *pMan, Fraig_Node_t *pNode)