52 static inline int Supp_SizeType(
int nSize,
int nStepSize ) {
return nSize / nStepSize + ((nSize % nStepSize) > 0); }
53 static inline char *
Supp_OneNext(
char * pPart ) {
return *((
char **)pPart); }
54 static inline void Supp_OneSetNext(
char * pPart,
char * pNext ) { *((
char **)pPart) = pNext; }
76 p->nChunkSize = nChunkSize;
77 p->nStepSize = nStepSize;
123 if ( (pMemory = (
char *)
Vec_PtrEntry( p->vFree, Type )) )
128 nSizeReal = p->nStepSize * Type;
129 if ( p->nFreeSize < nSizeReal )
131 p->pFreeBuf =
ABC_ALLOC(
char, p->nChunkSize );
132 p->nFreeSize = p->nChunkSize;
135 assert( p->nFreeSize >= nSizeReal );
136 pMemory = p->pFreeBuf;
137 p->pFreeBuf += nSizeReal;
138 p->nFreeSize -= nSizeReal;
177 pPart->
nRefs = nRefs;
215 int * pBeg1 = p1->
pOuts;
216 int * pBeg2 = p2->
pOuts;
217 int * pBeg = p->
pOuts;
220 while ( pBeg1 < pEnd1 && pBeg2 < pEnd2 )
222 if ( *pBeg1 == *pBeg2 )
223 *pBeg++ = *pBeg1++, pBeg2++;
224 else if ( *pBeg1 < *pBeg2 )
229 while ( pBeg1 < pEnd1 )
231 while ( pBeg2 < pEnd2 )
256 for ( i = 0; i < p->
nOuts; i++ )
347 if ( --pPart0->
nRefs == 0 )
350 if ( --pPart1->
nRefs == 0 )
365 if ( --pPart0->
nRefs == 0 )
472 memset( pBuffer, 0,
sizeof(
unsigned) * nWords );
515 int i, Entry, nCommon = 0;
568 int Attract, Repulse, Value, ValueBest;
569 int i, nCommon, iBest;
590 if ( nSuppSizeLimit > 0 &&
Vec_IntSize(vPartSupp) >= 2 * nSuppSizeLimit )
598 Value = Attract/Repulse;
599 if ( ValueBest < Value )
605 if ( ValueBest < 75 )
630 printf(
"%d=(%d,%d) ", i,
Vec_IntSize(vOne), nOutputs );
636 printf(
"\nTotal = %d. Outputs = %d.\n", Counter,
Abc_NtkCoNum(pNtk) );
652 Vec_Int_t * vOne, * vPart, * vPartSupp, * vTemp;
655 if ( nSuppSizeLimit == 0 )
656 nSuppSizeLimit = 200;
660 vPart = vPartSupp = NULL;
665 if ( vPartSupp == NULL )
701 assert( vPartSupp != NULL );
726 Vec_Ptr_t * vSupps, * vPartsAll, * vPartsAll2, * vPartSuppsAll;
727 Vec_Int_t * vOne, * vPart, * vPartSupp, * vTemp;
728 int i, iPart, iOut, timeFind = 0;
812 vPartsAll = vPartsAll2;
823 printf(
"Created %d partitions.\n",
Vec_PtrSize(vPartsAll) );
900 if ( pRepr == NULL || pRepr == pObj )
985 printf(
"Abc_NtkPartStartHop: HOP manager check has failed.\n" );
1024 if ( iNodeId == -1 )
1026 printf(
"Cannot find CI node %s in the original network.\n",
Abc_ObjName(pObj) );
1048 if ( iNodeId == -1 )
1050 printf(
"Cannot find CO node %s in the original network.\n",
Abc_ObjName(pObj) );
1080 printf(
"Abc_NtkPartStitchChoices: The network check has failed.\n" );
1100 Vec_Ptr_t * vParts, * vFraigs, * vOnePtr;
1102 Abc_Ntk_t * pNtk, * pNtk2, * pNtkAig, * pNtkFraig;
1127 printf(
"Fraiging part %4d (out of %4d) PI = %5d. PO = %5d. And = %6d. Lev = %4d.\r",
1162 Vec_Ptr_t * vParts, * vFraigs, * vOnePtr;
1186 printf(
"Finished part %5d (out of %5d)\r", i+1,
Vec_PtrSize(vParts) );
int Hop_ManCheck(Hop_Man_t *p)
DECLARATIONS ///.
void Supp_ManRecycle(Supp_Man_t *p, char *pMemory, int nSize)
static Supp_One_t * Supp_ManFetchEntry(Supp_Man_t *p, int nWords, int nRefs)
static int Abc_NtkIsStrash(Abc_Ntk_t *pNtk)
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
static Abc_Obj_t * Abc_ObjFanin1(Abc_Obj_t *pObj)
static int Abc_ObjIsCi(Abc_Obj_t *pObj)
static void Vec_VecSort(Vec_Vec_t *p, int fReverse)
ABC_DLL void Abc_NtkAppendToCone(Abc_Ntk_t *pNtkNew, Abc_Ntk_t *pNtk, Vec_Ptr_t *vRoots)
#define Vec_PtrForEachEntryStart(Type, vVec, pEntry, i, Start)
static Vec_Int_t * Vec_IntDup(Vec_Int_t *pVec)
static int Abc_NtkObjNumMax(Abc_Ntk_t *pNtk)
typedefABC_NAMESPACE_HEADER_START struct Vec_Vec_t_ Vec_Vec_t
INCLUDES ///.
static Hop_Obj_t * Hop_ManConst1(Hop_Man_t *p)
ABC_DLL Abc_Obj_t * Abc_AigConst1(Abc_Ntk_t *pNtk)
Hop_Obj_t * Hop_And(Hop_Man_t *p, Hop_Obj_t *p0, Hop_Obj_t *p1)
static int Abc_ObjFaninC1(Abc_Obj_t *pObj)
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
int Cmd_CommandExecute(void *pAbc, char *pCommandLine)
static int Abc_InfoHasBit(unsigned *p, int i)
unsigned * Abc_NtkSuppCharStart(Vec_Int_t *vOne, int nPis)
ABC_DLL Abc_Ntk_t * Abc_NtkCreateConeArray(Abc_Ntk_t *pNtk, Vec_Ptr_t *vRoots, int fUseAllCis)
static int Abc_ObjFanoutNum(Abc_Obj_t *pObj)
void Abc_NtkSuppCharAdd(unsigned *pBuffer, Vec_Int_t *vOne, int nPis)
int Abc_NtkPartitionSmartFindPart(Vec_Ptr_t *vPartSuppsAll, Vec_Ptr_t *vPartsAll, Vec_Ptr_t *vPartSuppsChar, int nSuppSizeLimit, Vec_Int_t *vOne)
void Supp_ManStop(Supp_Man_t *p)
void Abc_NtkPartitionPrint(Abc_Ntk_t *pNtk, Vec_Ptr_t *vPartsAll, Vec_Ptr_t *vPartSuppsAll)
static void Vec_PtrFillExtra(Vec_Ptr_t *p, int nSize, void *Fill)
static Abc_Obj_t * Abc_ObjChild1Copy(Abc_Obj_t *pObj)
static int Abc_ObjFaninNum(Abc_Obj_t *pObj)
static int Abc_ObjFaninC0(Abc_Obj_t *pObj)
static void Vec_PtrPush(Vec_Ptr_t *p, void *Entry)
static int Abc_NtkCiNum(Abc_Ntk_t *pNtk)
#define ABC_ALLOC(type, num)
#define Abc_NtkForEachCo(pNtk, pCo, i)
static Hop_Obj_t * Hop_ObjChild1Next(Abc_Obj_t *pObj)
ABC_DLL int Abc_NtkCheck(Abc_Ntk_t *pNtk)
FUNCTION DEFINITIONS ///.
Vec_Ptr_t * Abc_NtkPartitionSmart(Abc_Ntk_t *pNtk, int nSuppSizeLimit, int fVerbose)
static abctime Abc_Clock()
static Abc_Obj_t * Abc_NtkObj(Abc_Ntk_t *pNtk, int i)
static int Vec_PtrSize(Vec_Ptr_t *p)
static void Vec_VecFree(Vec_Vec_t *p)
static void Vec_IntSort(Vec_Int_t *p, int fReverse)
static Abc_Obj_t * Abc_ObjFanin0(Abc_Obj_t *pObj)
static int Abc_NtkCoNum(Abc_Ntk_t *pNtk)
static void Supp_ManRecycleEntry(Supp_Man_t *p, Supp_One_t *pEntry)
ABC_DLL Abc_Ntk_t * Abc_NtkFraig(Abc_Ntk_t *pNtk, void *pParams, int fAllNodes, int fExdc)
FUNCTION DEFINITIONS ///.
ABC_DLL void Abc_NtkDelete(Abc_Ntk_t *pNtk)
static int Abc_ObjIsCo(Abc_Obj_t *pObj)
static Abc_Obj_t * Abc_NtkCo(Abc_Ntk_t *pNtk, int i)
ABC_DLL void Abc_ObjAddFanin(Abc_Obj_t *pObj, Abc_Obj_t *pFanin)
#define Abc_AigForEachAnd(pNtk, pNode, i)
static void Vec_IntWriteEntry(Vec_Int_t *p, int i, int Entry)
static int Abc_ObjIsNode(Abc_Obj_t *pObj)
Vec_Ptr_t * Abc_NtkComputeSupportsNaive(Abc_Ntk_t *pNtk)
static int Abc_NtkNodeNum(Abc_Ntk_t *pNtk)
ABC_DLL Abc_Obj_t * Abc_AigAnd(Abc_Aig_t *pMan, Abc_Obj_t *p0, Abc_Obj_t *p1)
static Abc_Obj_t * Abc_ObjChild0Copy(Abc_Obj_t *pObj)
static char * Supp_OneNext(char *pPart)
ABC_DLL Abc_Ntk_t * Abc_NtkStartFrom(Abc_Ntk_t *pNtk, Abc_NtkType_t Type, Abc_NtkFunc_t Func)
Vec_Int_t * Supp_ManTransferEntry(Supp_One_t *p)
static Vec_Int_t * Vec_IntAlloc(int nCap)
FUNCTION DEFINITIONS ///.
ABC_DLL int Abc_AigLevel(Abc_Ntk_t *pNtk)
int Nm_ManFindIdByNameTwoTypes(Nm_Man_t *p, char *pName, int Type1, int Type2)
static int Supp_SizeType(int nSize, int nStepSize)
#define ABC_NAMESPACE_IMPL_END
void * Abc_FrameGetGlobalFrame()
static Abc_Obj_t * Abc_NtkPartStitchCopy0(Vec_Ptr_t *vEquiv, Abc_Obj_t *pObj)
ABC_DLL Vec_Ptr_t * Abc_NtkNodeSupport(Abc_Ntk_t *pNtk, Abc_Obj_t **ppNodes, int nNodes)
Hop_Man_t * Hop_ManStart()
DECLARATIONS ///.
Supp_One_t * Supp_ManMergeEntry(Supp_Man_t *pMan, Supp_One_t *p1, Supp_One_t *p2, int nRefs)
void Abc_NtkConvertCos(Abc_Ntk_t *pNtk, Vec_Int_t *vOuts, Vec_Ptr_t *vOutsPtr)
static void Vec_IntPush(Vec_Int_t *p, int Entry)
Abc_Ntk_t * Abc_NtkHopRemoveLoops(Abc_Ntk_t *pNtk, Hop_Man_t *pMan)
typedefABC_NAMESPACE_IMPL_START struct Supp_Man_t_ Supp_Man_t
DECLARATIONS ///.
static Vec_Int_t * Vec_IntTwoMerge(Vec_Int_t *vArr1, Vec_Int_t *vArr2)
static Vec_Vec_t * Vec_VecStart(int nSize)
Abc_Ntk_t * Abc_NtkFraigPartitioned(Vec_Ptr_t *vStore, void *pParams)
Vec_Ptr_t * Abc_NtkPartitionNaive(Abc_Ntk_t *pNtk, int nPartSize)
static void Vec_PtrWriteEntry(Vec_Ptr_t *p, int i, void *Entry)
#define Abc_NtkForEachNode(pNtk, pNode, i)
ABC_DLL Vec_Ptr_t * Abc_AigDfs(Abc_Ntk_t *pNtk, int fCollectAll, int fCollectCos)
#define ABC_NAMESPACE_IMPL_START
static void * Vec_PtrEntry(Vec_Ptr_t *p, int i)
static void Abc_InfoSetBit(unsigned *p, int i)
char * Supp_ManFetch(Supp_Man_t *p, int nSize)
static int Abc_NodeIsTravIdCurrent(Abc_Obj_t *p)
static int Abc_AigNodeIsChoice(Abc_Obj_t *pNode)
Vec_Ptr_t * Abc_NtkDfsNatural(Abc_Ntk_t *pNtk)
static int Vec_IntSize(Vec_Int_t *p)
void Abc_NtkFraigPartitionedTime(Abc_Ntk_t *pNtk, void *pParams)
#define Abc_ObjForEachFanout(pObj, pFanout, i)
#define Abc_NtkForEachCi(pNtk, pCi, i)
static int Abc_NtkPoNum(Abc_Ntk_t *pNtk)
static Vec_Ptr_t * Vec_PtrAlloc(int nCap)
FUNCTION DEFINITIONS ///.
int Abc_NtkSuppCharCommon(unsigned *pBuffer, Vec_Int_t *vOne)
#define Abc_ObjForEachFanin(pObj, pFanin, i)
static Hop_Obj_t * Hop_NotCond(Hop_Obj_t *p, int c)
static int Abc_NtkPiNum(Abc_Ntk_t *pNtk)
ABC_DLL char * Abc_ObjName(Abc_Obj_t *pNode)
DECLARATIONS ///.
static int Abc_Base2Log(unsigned n)
void Abc_NtkPartitionCompact(Vec_Ptr_t *vPartsAll, Vec_Ptr_t *vPartSuppsAll, int nSuppSizeLimit)
static void Abc_NtkIncrementTravId(Abc_Ntk_t *p)
static Hop_Obj_t * Hop_ObjChild0Next(Abc_Obj_t *pObj)
ABC_DLL void Abc_NtkCleanCopy(Abc_Ntk_t *pNtk)
static int Abc_BitWordNum(int nBits)
static Abc_Obj_t * Abc_ObjNotCond(Abc_Obj_t *p, int c)
static void Vec_PtrClear(Vec_Ptr_t *p)
Abc_Ntk_t * Abc_NtkPartStitchChoices(Abc_Ntk_t *pNtk, Vec_Ptr_t *vParts)
Hop_Obj_t * Hop_ObjCreatePo(Hop_Man_t *p, Hop_Obj_t *pDriver)
Vec_Ptr_t * Abc_NtkComputeSupportsSmart(Abc_Ntk_t *pNtk)
static void Vec_IntFree(Vec_Int_t *p)
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.
static int Abc_ObjIsComplement(Abc_Obj_t *p)
static void Supp_OneSetNext(char *pPart, char *pNext)
static void Vec_PtrShrink(Vec_Ptr_t *p, int nSizeNew)
static int Abc_NtkObjNum(Abc_Ntk_t *pNtk)
Hop_Obj_t * Hop_ObjCreatePi(Hop_Man_t *p)
DECLARATIONS ///.
#define Vec_IntForEachEntry(vVec, Entry, i)
MACRO DEFINITIONS ///.
typedefABC_NAMESPACE_HEADER_START struct Hop_Man_t_ Hop_Man_t
INCLUDES ///.
Supp_Man_t * Supp_ManStart(int nChunkSize, int nStepSize)
FUNCTION DEFINITIONS ///.
Hop_Man_t * Abc_NtkPartStartHop(Abc_Ntk_t *pNtk)
Abc_Obj_t * Abc_NtkPartStitchFindRepr_rec(Vec_Ptr_t *vEquiv, Abc_Obj_t *pObj)
static Abc_Obj_t * Abc_NtkPartStitchCopy1(Vec_Ptr_t *vEquiv, Abc_Obj_t *pObj)
static void Abc_NodeSetTravIdCurrent(Abc_Obj_t *p)
static void Vec_PtrFree(Vec_Ptr_t *p)