119 #define Fx_ManForEachCubeVec( vVec, vCubes, vCube, i ) \
120 for ( i = 0; (i < Vec_IntSize(vVec)) && ((vCube) = Vec_WecEntry(vCubes, Vec_IntEntry(vVec, i))); i++ )
142 char * pCube, * pSop;
143 int nVars, i, v, Lit;
148 pSop = (
char *)pNode->
pData;
160 else if ( Lit ==
'1' )
182 Vec_Int_t * vCube, * vPres, * vFirst, * vCount;
184 char * pCube, * pSop;
185 int i, k, v, Lit, iFanin, iNodeMax = 0;
201 printf(
"The network is unchanged by fast extract.\n" );
305 extern int Fx_FastExtract(
Vec_Wec_t * vCubes,
int ObjIdMax,
int nNewNodesMax,
int LitCountMax,
int fVerbose,
int fVeryVerbose );
311 printf(
"Abc_NtkFastExtract: Nodes have duplicated fanins. FX is not performed.\n" );
328 printf(
"Abc_NtkFxPerform: The network check has failed.\n" );
332 printf(
"Warning: The network has not been changed by \"fx\".\n" );
395 int i, Lit, Level = 0;
402 int k, Lit, Level = 0;
410 int i, iVar, iFirst = 0;
474 printf(
"%4d : ", p->nDivs );
475 printf(
"Div %7d : ", iDiv );
476 printf(
"Weight %12.5f ",
Vec_FltEntry(p->vWeights, iDiv) );
481 printf(
"Lits =%7d ", p->nLits );
488 for ( iDiv = 0; iDiv <
Vec_FltSize(p->vWeights); iDiv++ )
504 int i, v, Lit, nObjs;
511 printf(
"%c",
'a' + i );
518 memset( pLine,
'-', nObjs );
524 printf(
"%6d : %s %4d\n", i, pLine,
Vec_IntEntry(vCube, 0) );
536 printf(
"Compl =%8d ", p->nDivMux[1] );
537 printf(
"Extr =%7d ", p->nDivs );
561 int RetValue = 0, LitA0 = -1, LitB0 = -1, LitA1 = -1, LitB1 = -1;
640 int * pBeg1 = vArr1->pArray + 1;
641 int * pBeg2 = vArr2->pArray + 1;
642 int * pEnd1 = vArr1->pArray + vArr1->nSize;
643 int * pEnd2 = vArr2->pArray + vArr2->nSize;
644 int Counter = 0, fAttr0 = 0, fAttr1 = 1;
646 while ( pBeg1 < pEnd1 && pBeg2 < pEnd2 )
648 if ( *pBeg1 == *pBeg2 )
649 pBeg1++, pBeg2++, Counter++;
650 else if ( *pBeg1 < *pBeg2 )
655 fAttr0 = 1, fAttr1 = 0;
659 while ( pBeg1 < pEnd1 )
661 while ( pBeg2 < pEnd2 )
664 printf(
"The SOP has duplicated cubes.\n" );
666 printf(
"The SOP has contained cubes.\n" );
668 printf(
"The SOP has distance-1 cubes or it is not a prime cover. Please make sure the result verifies.\n" );
701 if ( *pLit0 >= 0 && *pLit1 >= 0 )
707 int i, Lit, Count = 0;
715 int i, Lit, * pArray;
727 if ( pArray[1] > pArray[2] )
728 ABC_SWAP(
int, pArray[1], pArray[2] );
730 if ( pArray[1] > pArray[2] )
731 ABC_SWAP(
int, pArray[1], pArray[2] );
749 int i, k, Lit, Count;
751 p->nVars = p->nLits = 0;
761 assert( p->nVars < nVars );
784 int k, n, Lit, Lit2, iDiv;
840 else if ( Value == 1 )
845 if ( p->LitCountMax && p->LitCountMax <
Vec_IntSize(p->vCubeFree) )
877 assert( p->pHash == NULL );
909 int i, CubeId, k = 0;
931 int * pBeg1 = vPart0->pArray;
932 int * pBeg2 = vPart1->pArray;
933 int * pEnd1 = vPart0->pArray + vPart0->nSize;
934 int * pEnd2 = vPart1->pArray + vPart1->nSize;
935 int i, k, i_, k_, fCompl, CubeId1, CubeId2;
938 while ( pBeg1 < pEnd1 && pBeg2 < pEnd2 )
942 if ( CubeId1 == CubeId2 )
944 for ( i = 1; pBeg1+i < pEnd1; i++ )
947 for ( k = 1; pBeg2+k < pEnd2; k++ )
950 for ( i_ = 0; i_ < i; i_++ )
951 for ( k_ = 0; k_ < k; k_++ )
953 if ( pBeg1[i_] == pBeg2[k_] )
966 else if ( CubeId1 < CubeId2 )
986 Vec_Int_t * vCube, * vCube2, * vLitP, * vLitN;
988 int nLitsNew = p->nLits - (int)
Vec_FltEntry(p->vWeights, iDiv);
989 int i, k, Lit0, Lit1, iVarNew, RetValue, Level;
991 assert( Diff > 0.0 && Diff < 1.0 );
998 assert( Lit0 >= 0 && Lit1 >= 0 );
1082 for ( i = 0; i <
Vec_IntSize(p->vCubesD); i += 2 )
1085 p->nCompls += fCompl;
1147 if ( p->nCompls && i > 1 )
1152 assert( p->nLits == nLitsNew );
1170 int fVeryVeryVerbose = 0;
1176 p->LitCountMax = LitCountMax;
1192 if ( fVeryVeryVerbose )
static int Hsh_VecManAdd(Hsh_VecMan_t *p, Vec_Int_t *vVec)
static void Fx_PrintDivOneReal(Vec_Int_t *vDiv)
static int * Vec_IntArray(Vec_Int_t *p)
static unsigned Abc_ObjId(Abc_Obj_t *pObj)
static void Vec_WecRemoveEmpty(Vec_Wec_t *vCubes)
ABC_DLL int Abc_NtkMakeLegit(Abc_Ntk_t *pNtk)
ABC_DLL char * Abc_SopStart(Mem_Flex_t *pMan, int nCubes, int nVars)
void Abc_NtkFxInsert(Abc_Ntk_t *pNtk, Vec_Wec_t *vCubes)
#define Vec_FltForEachEntry(vVec, Entry, i)
MACRO DEFINITIONS ///.
static Vec_Wec_t * Vec_WecAlloc(int nCap)
FUNCTION DEFINITIONS ///.
static void Fx_ManCompressCubes(Vec_Wec_t *vCubes, Vec_Int_t *vLit2Cube)
typedefABC_NAMESPACE_HEADER_START struct Vec_Wec_t_ Vec_Wec_t
INCLUDES ///.
static int Vec_IntCheckUniqueSmall(Vec_Int_t *p)
Fx_Man_t * Fx_ManStart(Vec_Wec_t *vCubes)
static int Abc_NtkObjNumMax(Abc_Ntk_t *pNtk)
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
static void Fx_ManDivFindPivots(Vec_Int_t *vDiv, int *pLit0, int *pLit1)
#define Abc_SopForEachCube(pSop, nFanins, pCube)
static void Vec_WecFree(Vec_Wec_t *p)
static void Vec_WecMarkLevels(Vec_Wec_t *vCubes, Vec_Int_t *vLevels)
static int Fx_ManGetCubeVar(Vec_Wec_t *vCubes, int iCube)
static float Vec_QueTopPriority(Vec_Que_t *p)
static void Vec_FltFree(Vec_Flt_t *p)
int Fx_ManCubeSingleCubeDivisors(Fx_Man_t *p, Vec_Int_t *vPivot, int fRemove, int fUpdate)
static Vec_Wec_t * Vec_WecStart(int nSize)
static Vec_Int_t * Vec_WecPushLevel(Vec_Wec_t *p)
static int Abc_Var2Lit(int Var, int fCompl)
static int Abc_ObjFaninNum(Abc_Obj_t *pObj)
static char Fx_PrintDivLit(int Lit)
typedefABC_NAMESPACE_IMPL_START struct Fx_Man_t_ Fx_Man_t
DECLARATIONS ///.
static void Vec_WecUnmarkLevels(Vec_Wec_t *vCubes, Vec_Int_t *vLevels)
typedefABC_NAMESPACE_HEADER_START struct Vec_Que_t_ Vec_Que_t
INCLUDES ///.
static Vec_Flt_t * Vec_FltAlloc(int nCap)
FUNCTION DEFINITIONS ///.
static int Fx_ManComputeLevelDiv(Fx_Man_t *p, Vec_Int_t *vCubeFree)
void Fx_ManStop(Fx_Man_t *p)
static int Vec_WecSizeUsed(Vec_Wec_t *p)
ABC_DLL int Abc_NtkCheck(Abc_Ntk_t *pNtk)
FUNCTION DEFINITIONS ///.
static int Abc_NtkIsSopLogic(Abc_Ntk_t *pNtk)
static void Fx_PrintDivArray(Vec_Int_t *vDiv)
static int Vec_QuePop(Vec_Que_t *p)
static int Fx_ManDivNormalize(Vec_Int_t *vCubeFree)
#define Abc_CubeForEachVar(pCube, Value, i)
ABC_DLL int Abc_NtkCleanup(Abc_Ntk_t *pNtk, int fVerbose)
static abctime Abc_Clock()
static int Abc_MaxInt(int a, int b)
static Abc_Obj_t * Abc_NtkObj(Abc_Ntk_t *pNtk, int i)
void Fx_ManCreateDivisors(Fx_Man_t *p)
static void Vec_IntSort(Vec_Int_t *p, int fReverse)
static Vec_Int_t * Vec_IntStartFull(int nSize)
void Fx_ManCubeDoubleCubeDivisors(Fx_Man_t *p, int iFirst, Vec_Int_t *vPivot, int fRemove, int fUpdate)
static void Vec_FltPush(Vec_Flt_t *p, float Entry)
static int Vec_WecSize(Vec_Wec_t *p)
#define ABC_SWAP(Type, a, b)
static void Hsh_VecManStop(Hsh_VecMan_t *p)
ABC_DLL void Abc_ObjAddFanin(Abc_Obj_t *pObj, Abc_Obj_t *pFanin)
static int Fx_ManDivRemoveLits(Vec_Int_t *vCube, Vec_Int_t *vDiv, int fCompl)
static void Vec_IntGrow(Vec_Int_t *p, int nCapMin)
static void Abc_PrintTime(int level, const char *pStr, abctime time)
static int Vec_QueSize(Vec_Que_t *p)
static void Vec_IntWriteEntry(Vec_Int_t *p, int i, int Entry)
static void Vec_IntSelectSort(int *pArray, int nSize)
static int Abc_MinInt(int a, int b)
static Vec_Int_t * Vec_IntStart(int nSize)
static int Abc_LitIsCompl(int Lit)
#define Vec_WecForEachLevel(vGlob, vVec, i)
MACRO DEFINITIONS ///.
static Vec_Int_t * Vec_IntAlloc(int nCap)
FUNCTION DEFINITIONS ///.
static void Vec_IntAddToEntry(Vec_Int_t *p, int i, int Addition)
static int Vec_IntTwoRemove(Vec_Int_t *vArr1, Vec_Int_t *vArr2)
static int Vec_IntEntry(Vec_Int_t *p, int i)
#define ABC_NAMESPACE_IMPL_END
static void Vec_IntUpdateEntry(Vec_Int_t *p, int i, int Value)
static void Fx_PrintLiterals(Fx_Man_t *p)
int Abc_NtkFxPerform(Abc_Ntk_t *pNtk, int nNewNodesMax, int LitCountMax, int fVerbose, int fVeryVerbose)
static void Vec_IntPush(Vec_Int_t *p, int Entry)
static int Vec_IntTwoRemoveCommon(Vec_Int_t *vArr1, Vec_Int_t *vArr2, Vec_Int_t *vArr)
#define Vec_IntForEachEntryStart(vVec, Entry, i, Start)
void Fx_ManUpdate(Fx_Man_t *p, int iDiv)
void Fx_ManCreateLiterals(Fx_Man_t *p, int nVars)
static Hsh_VecMan_t * Hsh_VecManStart(int nEntries)
static void Fx_PrintStats(Fx_Man_t *p, abctime clk)
ABC_DLL void Abc_ObjRemoveFanins(Abc_Obj_t *pObj)
#define Abc_NtkForEachNode(pNtk, pNode, i)
static void Fx_PrintDiv(Fx_Man_t *p, int iDiv)
#define ABC_NAMESPACE_IMPL_START
static Vec_Int_t * Vec_WecEntry(Vec_Wec_t *p, int i)
#define Fx_ManForEachCubeVec(vVec, vCubes, vCube, i)
int Fx_ManDivFindCubeFree(Vec_Int_t *vArr1, Vec_Int_t *vArr2, Vec_Int_t *vCubeFree)
static void Fx_ManDivAddLits(Vec_Int_t *vCube, Vec_Int_t *vCube2, Vec_Int_t *vDiv)
static int Abc_LitNot(int Lit)
static int Hsh_VecSize(Hsh_VecMan_t *p)
static void Vec_FltAddToEntry(Vec_Flt_t *p, int i, float Addition)
static int Vec_IntSize(Vec_Int_t *p)
#define Vec_WecForEachLevelStart(vGlob, vVec, i, LevelStart)
ABC_DLL void Abc_SopComplement(char *pSop)
static int Vec_IntEqual(Vec_Int_t *p1, Vec_Int_t *p2)
int Fx_FastExtract(Vec_Wec_t *vCubes, int ObjIdMax, int nNewNodesMax, int LitCountMax, int fVerbose, int fVeryVerbose)
static float ** Vec_FltArrayP(Vec_Flt_t *p)
#define Abc_ObjForEachFanin(pObj, pFanin, i)
static void Vec_IntShrink(Vec_Int_t *p, int nSizeNew)
void Fx_ManFindCommonPairs(Vec_Wec_t *vCubes, Vec_Int_t *vPart0, Vec_Int_t *vPart1, Vec_Int_t *vPairs, Vec_Int_t *vCompls, Vec_Int_t *vDiv, Vec_Int_t *vCubeFree)
static int Vec_WecLevelId(Vec_Wec_t *p, Vec_Int_t *vLevel)
static int Vec_WecIntHasMark(Vec_Int_t *vVec)
static void Vec_QueUpdate(Vec_Que_t *p, int v)
static Abc_Obj_t * Abc_NtkCreateNode(Abc_Ntk_t *pNtk)
#define ABC_CALLOC(type, num)
static int Abc_Lit2Var(int Lit)
static int Fx_ManComputeLevelCube(Fx_Man_t *p, Vec_Int_t *vCube)
typedefABC_NAMESPACE_HEADER_START struct Vec_Flt_t_ Vec_Flt_t
INCLUDES ///.
void Fx_ManComputeLevel(Fx_Man_t *p)
ABC_DLL int Abc_SopGetVarNum(char *pSop)
static int Vec_QueIsMember(Vec_Que_t *p, int v)
static void Vec_QueFree(Vec_Que_t *p)
static void Fx_PrintDivisors(Fx_Man_t *p)
static Vec_Int_t * Hsh_VecReadEntry(Hsh_VecMan_t *p, int i)
static float Vec_FltEntry(Vec_Flt_t *p, int i)
static void Vec_IntPrint(Vec_Int_t *vVec)
static int Abc_ObjFaninId(Abc_Obj_t *pObj, int i)
static void Fx_PrintDivOne(Vec_Int_t *vDiv)
static void Vec_IntFree(Vec_Int_t *p)
static void Vec_IntClear(Vec_Int_t *p)
static int Vec_FltSize(Vec_Flt_t *p)
#define Vec_IntForEachEntry(vVec, Entry, i)
MACRO DEFINITIONS ///.
static Vec_Que_t * Vec_QueAlloc(int nCap)
MACRO DEFINITIONS ///.
int Abc_NtkFxCheck(Abc_Ntk_t *pNtk)
ABC_DLL int Abc_SopIsComplement(char *pSop)
static int Vec_IntRemove1(Vec_Int_t *p, int Entry)
Vec_Wec_t * Abc_NtkFxRetrieve(Abc_Ntk_t *pNtk)
FUNCTION DEFINITIONS ///.
static void Vec_QuePush(Vec_Que_t *p, int v)
static int Fx_ManGetFirstVarCube(Fx_Man_t *p, Vec_Int_t *vCube)
static void Vec_QueSetPriority(Vec_Que_t *p, float **pCosts)
static void Fx_PrintMatrix(Fx_Man_t *p)
static void Vec_WecPush(Vec_Wec_t *p, int Level, int Entry)