52 static inline int Part_SizeType(
int nSize,
int nStepSize ) {
return nSize / nStepSize + ((nSize % nStepSize) > 0); }
53 static inline char *
Part_OneNext(
char * pPart ) {
return *((
char **)pPart); }
54 static inline void Part_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++ )
299 if ( --pPart0->
nRefs == 0 )
302 if ( --pPart1->
nRefs == 0 )
315 if ( --pPart0->
nRefs == 0 )
325 pObj->
pData = pPart0;
422 int iOut, iIn, k, m, i;
476 memset( pBuffer, 0,
sizeof(
unsigned) * nWords );
519 int i, Entry, nCommon = 0;
539 int Attract, Repulse, Value, ValueBest;
540 int i, nCommon, iBest;
555 if ( nSuppSizeLimit > 0 &&
Vec_IntSize(vPartSupp) >= 2 * nSuppSizeLimit )
562 Value = Attract/Repulse;
563 if ( ValueBest < Value )
569 if ( ValueBest < 75 )
594 printf(
"%d=(%d,%d) ", i,
Vec_IntSize(vOne), nOutputs );
616 Vec_Int_t * vOne, * vPart, * vPartSupp, * vTemp;
619 if ( nSuppSizeLimit == 0 )
620 nSuppSizeLimit = 200;
624 vPart = vPartSupp = NULL;
629 if ( vPartSupp == NULL )
665 assert( vPartSupp != NULL );
689 Vec_Ptr_t * vSupports, * vPartsAll, * vPartsAll2, * vPartSuppsAll;
690 Vec_Int_t * vOne, * vPart, * vPartSupp, * vTemp;
766 vPartsAll = vPartsAll2;
773 printf(
"Created %d partitions.\n",
Vec_PtrSize(vPartsAll) );
782 if ( pvPartSupps == NULL )
785 *pvPartSupps = vPartSuppsAll;
814 Vec_Ptr_t * vSupports, * vPartsAll, * vPartsAll2, * vPartSuppsAll;
815 Vec_Int_t * vOne, * vPart, * vPartSupp, * vTemp;
895 vPartsAll = vPartsAll2;
902 printf(
"Created %d partitions.\n",
Vec_PtrSize(vPartsAll) );
1083 pObj->
pData = pObjNew;
1084 pObjNew->
pData = pObj;
1108 pObj->
pData = pObjNew;
1109 pObjNew->
pData = pObj;
1193 Vec_Ptr_t * vMiters, * vNodes1, * vNodes2;
1255 Aig_Man_t * pAigTotal, * pAigPart, * pAig, * pTemp;
1260 int i, k, m, nIdMax;
1303 vOuts =
Aig_ManDupPart( pAigTotal, pAigPart, vPart, vPartSupp, 1 );
1314 ppData[k] = pObj->
pData;
1317 printf(
"Part %4d (out of %4d) PI = %5d. PO = %5d. And = %6d. Lev = %4d.\r",
1325 pObj->
pData = ppData[k];
1328 if ( pAigPart->pReprs )
1360 if ( pTemp->pManTime )
1407 ppData[k] = pObj->
pData;
1410 printf(
"Part %4d (out of %4d) PI = %5d. PO = %5d. And = %6d. Lev = %4d.\r",
1418 pObj->
pData = ppData[k];
1421 if ( pAigPart->pReprs )
1452 assert( p->pReprs != NULL );
1455 assert( pNode1->
Id < p->nReprsAlloc );
1456 assert( pNode2->
Id < p->nReprsAlloc );
1457 if ( pNode1 == pNode2 )
1459 if ( pNode1->
Id < pNode2->
Id )
1460 p->pReprs[pNode2->
Id] = pNode1;
1462 p->pReprs[pNode1->
Id] = pNode2;
1540 for ( pTemp = pNode; pTemp; pTemp =
Aig_ObjEquiv(p, pTemp) )
1542 printf(
"Choice node = %5d. Level = %2d. Choices = %d. { ", pNode->
Id, pNode->
Level, Counter );
1543 for ( pTemp = pNode; pTemp; pTemp =
Aig_ObjEquiv(p, pTemp) )
1567 Aig_Man_t * pNew, * pThis, * pPrev, * pTemp;
1573 assert( pNew->pReprs == NULL );
1594 if ( pTemp->pManTime )
Aig_Obj_t * Aig_ObjCreateCo(Aig_Man_t *p, Aig_Obj_t *pDriver)
void Part_ManStop(Part_Man_t *p)
static Vec_Ptr_t * Vec_PtrStart(int nSize)
Part_Man_t * Part_ManStart(int nChunkSize, int nStepSize)
FUNCTION DEFINITIONS ///.
Aig_Obj_t * Aig_ManDupPart_rec(Aig_Man_t *pNew, Aig_Man_t *pOld, Aig_Obj_t *pObj, Vec_Int_t *vSuppMap)
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Aig_Man_t * Aig_ManChoiceConstructive(Vec_Ptr_t *vAigs, int fVerbose)
static void Vec_VecSort(Vec_Vec_t *p, int fReverse)
Vec_Ptr_t * Aig_ManSupportNodes(Aig_Man_t *p, Vec_Ptr_t *vParts)
#define Vec_PtrForEachEntryStart(Type, vVec, pEntry, i, Start)
static Vec_Int_t * Vec_IntDup(Vec_Int_t *pVec)
typedefABC_NAMESPACE_HEADER_START struct Vec_Vec_t_ Vec_Vec_t
INCLUDES ///.
typedefABC_NAMESPACE_HEADER_START struct Aig_Man_t_ Aig_Man_t
INCLUDES ///.
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
void Aig_ManStop(Aig_Man_t *p)
static int Abc_InfoHasBit(unsigned *p, int i)
static int Aig_ObjIsTravIdCurrent(Aig_Man_t *p, Aig_Obj_t *pObj)
Aig_Man_t * Aig_ManDupOrdered(Aig_Man_t *p)
static Aig_Obj_t * Aig_ObjFanin0(Aig_Obj_t *pObj)
static void Aig_ObjSetRepr_(Aig_Man_t *p, Aig_Obj_t *pNode1, Aig_Obj_t *pNode2)
Aig_Man_t * Aig_ManStart(int nNodesMax)
DECLARATIONS ///.
static void Vec_PtrFillExtra(Vec_Ptr_t *p, int nSize, void *Fill)
typedefABC_NAMESPACE_IMPL_START struct Part_Man_t_ Part_Man_t
DECLARATIONS ///.
static int Aig_IsComplement(Aig_Obj_t *p)
unsigned * Aig_ManSuppCharStart(Vec_Int_t *vOne, int nPis)
Vec_Ptr_t * Aig_ManSupportsInverse(Aig_Man_t *p)
#define Aig_ManForEachCi(p, pObj, i)
ITERATORS ///.
static Aig_Obj_t * Aig_Regular(Aig_Obj_t *p)
Aig_Obj_t * Aig_ObjCreateCi(Aig_Man_t *p)
DECLARATIONS ///.
static void Vec_PtrPush(Vec_Ptr_t *p, void *Entry)
#define Aig_ManForEachCo(p, pObj, i)
#define ABC_ALLOC(type, num)
Vec_Ptr_t * Aig_ManSupportsRegisters(Aig_Man_t *p)
void Aig_ManSuppCharAdd(unsigned *pBuffer, Vec_Int_t *vOne, int nPis)
Aig_Man_t * Aig_ManRehash(Aig_Man_t *p)
static abctime Abc_Clock()
static Aig_Obj_t * Aig_ObjFanin1(Aig_Obj_t *pObj)
static int Vec_PtrSize(Vec_Ptr_t *p)
static void Vec_VecFree(Vec_Vec_t *p)
static void Aig_ObjSetTravIdCurrent(Aig_Man_t *p, Aig_Obj_t *pObj)
static int Aig_ManNodeNum(Aig_Man_t *p)
Aig_Obj_t * Aig_And(Aig_Man_t *p, Aig_Obj_t *p0, Aig_Obj_t *p1)
int Aig_ManChoiceLevel(Aig_Man_t *p)
static char * Part_OneNext(char *pPart)
Part_One_t * Part_ManMergeEntry(Part_Man_t *pMan, Part_One_t *p1, Part_One_t *p2, int nRefs)
Aig_Man_t * Fra_FraigChoice(Aig_Man_t *pManAig, int nConfMax, int nLevelMax)
void Aig_ManIncrementTravId(Aig_Man_t *p)
DECLARATIONS ///.
int Aig_NodeMffcSupp(Aig_Man_t *p, Aig_Obj_t *pNode, int LevelMin, Vec_Ptr_t *vSupp)
static int Aig_ObjIsNode(Aig_Obj_t *pObj)
static void Vec_IntWriteEntry(Vec_Int_t *p, int i, int Entry)
static int Aig_ManCoNum(Aig_Man_t *p)
Aig_Man_t * Aig_ManDupDfsGuided(Aig_Man_t *p, Vec_Ptr_t *vPios)
#define Aig_ManForEachNode(p, pObj, i)
void Aig_ManReprStart(Aig_Man_t *p, int nIdMax)
DECLARATIONS ///.
static Vec_Int_t * Vec_IntAlloc(int nCap)
FUNCTION DEFINITIONS ///.
static Part_One_t * Part_ManFetchEntry(Part_Man_t *p, int nWords, int nRefs)
static Aig_Obj_t * Aig_ManCi(Aig_Man_t *p, int i)
static int Vec_IntEntry(Vec_Int_t *p, int i)
static int Aig_ManCiNum(Aig_Man_t *p)
void Aig_ManMarkValidChoices(Aig_Man_t *p)
#define ABC_NAMESPACE_IMPL_END
Vec_Ptr_t * Aig_ManOrderPios(Aig_Man_t *p, Aig_Man_t *pOrder)
static int Aig_ObjIsConst1(Aig_Obj_t *pObj)
static Aig_Obj_t * Aig_ObjEquiv(Aig_Man_t *p, Aig_Obj_t *pObj)
static Aig_Obj_t * Aig_ObjChild1Copy(Aig_Obj_t *pObj)
Tim_Man_t * Tim_ManDup(Tim_Man_t *p, int fUnitDelay)
static void Vec_IntPush(Vec_Int_t *p, int Entry)
static Aig_Obj_t * Aig_ObjChild0Copy(Aig_Obj_t *pObj)
static Vec_Int_t * Vec_IntTwoMerge(Vec_Int_t *vArr1, Vec_Int_t *vArr2)
Aig_Obj_t * Aig_MiterTwo(Aig_Man_t *p, Vec_Ptr_t *vNodes1, Vec_Ptr_t *vNodes2)
static Vec_Vec_t * Vec_VecStart(int nSize)
void Aig_ManSetCioIds(Aig_Man_t *p)
static void Part_OneSetNext(char *pPart, char *pNext)
static void Part_ManRecycleEntry(Part_Man_t *p, Part_One_t *pEntry)
Aig_Man_t * Aig_ManStartFrom(Aig_Man_t *p)
Aig_Man_t * Aig_ManDupRepr(Aig_Man_t *p, int fOrdered)
static void Vec_PtrWriteEntry(Vec_Ptr_t *p, int i, void *Entry)
static int Aig_ManObjNumMax(Aig_Man_t *p)
static Aig_Obj_t * Aig_ManConst1(Aig_Man_t *p)
#define ABC_NAMESPACE_IMPL_START
static void * Vec_PtrEntry(Vec_Ptr_t *p, int i)
static void Abc_InfoSetBit(unsigned *p, int i)
static Aig_Obj_t * Aig_ManCo(Aig_Man_t *p, int i)
int Aig_ManLevelNum(Aig_Man_t *p)
Vec_Ptr_t * Aig_ManPartitionNaive(Aig_Man_t *p, int nPartSize)
void Aig_ManChoiceEval(Aig_Man_t *p)
static int Aig_ManRegNum(Aig_Man_t *p)
void Aig_ManDupPartAll_rec(Aig_Man_t *pNew, Aig_Man_t *pOld, Aig_Obj_t *pObj)
static int Vec_IntSize(Vec_Int_t *p)
#define Aig_ManForEachObj(p, pObj, i)
void Aig_ManChoiceConstructiveOne(Aig_Man_t *pNew, Aig_Man_t *pPrev, Aig_Man_t *pThis)
static Vec_Ptr_t * Vec_PtrAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Vec_Ptr_t * Aig_ManPartitionSmartRegisters(Aig_Man_t *pAig, int nSuppSizeLimit, int fVerbose)
static void Vec_IntShrink(Vec_Int_t *p, int nSizeNew)
void Part_ManRecycle(Part_Man_t *p, char *pMemory, int nSize)
Vec_Ptr_t * Aig_ManPartitionSmart(Aig_Man_t *p, int nSuppSizeLimit, int fVerbose, Vec_Ptr_t **pvPartSupps)
static int Abc_Base2Log(unsigned n)
void Aig_ManTransferRepr(Aig_Man_t *pNew, Aig_Man_t *p)
Aig_Man_t * Aig_ManDupPartAll(Aig_Man_t *pOld, Vec_Int_t *vPart)
void Aig_ManCleanCioIds(Aig_Man_t *p)
void Aig_ManSupportNodes_rec(Aig_Man_t *p, Aig_Obj_t *pObj, Vec_Int_t *vSupport)
static int Abc_BitWordNum(int nBits)
static int Part_SizeType(int nSize, int nStepSize)
Aig_Man_t * Aig_ManFraigPartitioned(Aig_Man_t *pAig, int nPartSize, int nConfMax, int nLevelMax, int fVerbose)
Vec_Ptr_t * Aig_ManMiterPartitioned(Aig_Man_t *p1, Aig_Man_t *p2, int nPartSize, int fSmart)
typedefABC_NAMESPACE_HEADER_START struct Tim_Man_t_ Tim_Man_t
INCLUDES ///.
int Aig_ManSuppCharCommon(unsigned *pBuffer, Vec_Int_t *vOne)
int Aig_ManPartitionSmartFindPart(Vec_Ptr_t *vPartSuppsAll, Vec_Ptr_t *vPartsAll, Vec_Ptr_t *vPartSuppsBit, int nSuppSizeLimit, Vec_Int_t *vOne)
Vec_Int_t * Part_ManTransferEntry(Part_One_t *p)
void Aig_ManPartitionCompact(Vec_Ptr_t *vPartsAll, Vec_Ptr_t *vPartSuppsAll, int nSuppSizeLimit)
static void Vec_IntFree(Vec_Int_t *p)
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.
char * Part_ManFetch(Part_Man_t *p, int nSize)
void Aig_ManPartitionPrint(Aig_Man_t *p, Vec_Ptr_t *vPartsAll, Vec_Ptr_t *vPartSuppsAll)
static int Aig_ObjIsCi(Aig_Obj_t *pObj)
static void Vec_IntClear(Vec_Int_t *p)
static void Vec_PtrShrink(Vec_Ptr_t *p, int nSizeNew)
#define Vec_IntForEachEntry(vVec, Entry, i)
MACRO DEFINITIONS ///.
void Aig_ManCleanData(Aig_Man_t *p)
int Aig_ManCleanup(Aig_Man_t *p)
static int Aig_ObjIsCo(Aig_Obj_t *pObj)
static int Aig_ObjIsChoice(Aig_Man_t *p, Aig_Obj_t *pObj)
Vec_Ptr_t * Aig_ManDupPart(Aig_Man_t *pNew, Aig_Man_t *pOld, Vec_Int_t *vPart, Vec_Int_t *vSuppMap, int fInverse)
static int Aig_ObjCioId(Aig_Obj_t *pObj)
Aig_Man_t * Aig_ManChoicePartitioned(Vec_Ptr_t *vAigs, int nPartSize, int nConfMax, int nLevelMax, int fVerbose)
Vec_Ptr_t * Aig_ManSupports(Aig_Man_t *pMan)
void Aig_ManSupportsTest(Aig_Man_t *pMan)
static void Vec_PtrFree(Vec_Ptr_t *p)