ABC: A System for Sequential Synthesis and Verification
 
Loading...
Searching...
No Matches
abcPart.c File Reference
#include "base/abc/abc.h"
#include "base/main/main.h"
#include "base/cmd/cmd.h"
#include "map/mio/mio.h"
#include <unistd.h>
Include dependency graph for abcPart.c:

Go to the source code of this file.

Classes

struct  Supp_Man_t_
 
struct  Supp_One_t_
 
struct  StochSynData_t_
 

Typedefs

typedef struct Supp_One_t_ Supp_One_t
 
typedef struct StochSynData_t_ StochSynData_t
 

Functions

Supp_Man_tSupp_ManStart (int nChunkSize, int nStepSize)
 FUNCTION DEFINITIONS ///.
 
void Supp_ManStop (Supp_Man_t *p)
 
char * Supp_ManFetch (Supp_Man_t *p, int nSize)
 
void Supp_ManRecycle (Supp_Man_t *p, char *pMemory, int nSize)
 
Supp_One_tSupp_ManMergeEntry (Supp_Man_t *pMan, Supp_One_t *p1, Supp_One_t *p2, int nRefs)
 
Vec_Int_tSupp_ManTransferEntry (Supp_One_t *p)
 
Vec_Ptr_tAbc_NtkDfsNatural (Abc_Ntk_t *pNtk)
 
Vec_Ptr_tAbc_NtkComputeSupportsSmart (Abc_Ntk_t *pNtk)
 
Vec_Ptr_tAbc_NtkComputeSupportsNaive (Abc_Ntk_t *pNtk)
 
unsigned * Abc_NtkSuppCharStart (Vec_Int_t *vOne, int nPis)
 
void Abc_NtkSuppCharAdd (unsigned *pBuffer, Vec_Int_t *vOne, int nPis)
 
int Abc_NtkSuppCharCommon (unsigned *pBuffer, Vec_Int_t *vOne)
 
int Abc_NtkPartitionSmartFindPart (Vec_Ptr_t *vPartSuppsAll, Vec_Ptr_t *vPartsAll, Vec_Ptr_t *vPartSuppsChar, int nSuppSizeLimit, Vec_Int_t *vOne)
 
void Abc_NtkPartitionPrint (Abc_Ntk_t *pNtk, Vec_Ptr_t *vPartsAll, Vec_Ptr_t *vPartSuppsAll)
 
void Abc_NtkPartitionCompact (Vec_Ptr_t *vPartsAll, Vec_Ptr_t *vPartSuppsAll, int nSuppSizeLimit)
 
Vec_Ptr_tAbc_NtkPartitionSmart (Abc_Ntk_t *pNtk, int nSuppSizeLimit, int fVerbose)
 
Vec_Ptr_tAbc_NtkPartitionNaive (Abc_Ntk_t *pNtk, int nPartSize)
 
void Abc_NtkConvertCos (Abc_Ntk_t *pNtk, Vec_Int_t *vOuts, Vec_Ptr_t *vOutsPtr)
 
Abc_Obj_tAbc_NtkPartStitchFindRepr_rec (Vec_Ptr_t *vEquiv, Abc_Obj_t *pObj)
 
Hop_Man_tAbc_NtkPartStartHop (Abc_Ntk_t *pNtk)
 
Abc_Ntk_tAbc_NtkPartStitchChoices (Abc_Ntk_t *pNtk, Vec_Ptr_t *vParts)
 
Abc_Ntk_tAbc_NtkFraigPartitioned (Vec_Ptr_t *vStore, void *pParams)
 
void Abc_NtkFraigPartitionedTime (Abc_Ntk_t *pNtk, void *pParams)
 
Vec_Int_tAbc_NtkStochSynthesis (Vec_Ptr_t *vWins, char *pScript)
 
Abc_Ntk_tAbc_NtkStochProcessOne (Abc_Ntk_t *p, char *pScript0, int Rand, int TimeSecs)
 
int Abc_NtkStochProcess1 (void *p)
 
Vec_Int_tAbc_NtkStochProcess (Vec_Ptr_t *vWins, char *pScript, int nProcs, int TimeSecs, int fVerbose)
 
int Abc_NtkWindowCheckTopoError_rec (Abc_Obj_t *pObj)
 
int Abc_NtkWindowCheckTopoError (Abc_Ntk_t *p, Vec_Int_t *vIns, Vec_Int_t *vOuts)
 
void Abc_NtkCreateNodeMapped (Abc_Ntk_t *pNew, Abc_Obj_t *pObj)
 
void Abc_NtkInsertPartitions_rec (Abc_Ntk_t *pNew, Abc_Obj_t *pObj, Vec_Int_t *vMap, Vec_Ptr_t *vvIns, Vec_Ptr_t *vvOuts, Vec_Ptr_t *vWins)
 
Abc_Ntk_tAbc_NtkInsertPartitions (Abc_Ntk_t *p, Vec_Ptr_t *vvIns, Vec_Ptr_t *vvNodes, Vec_Ptr_t *vvOuts, Vec_Ptr_t *vWins, int fOverlap, Vec_Int_t *vGains)
 
void Abc_ObjDfsMark_rec (Abc_Obj_t *p)
 
void Abc_ObjDfsMark2_rec (Abc_Obj_t *p)
 
Vec_Int_tAbc_NtkDeriveWinNodes (Abc_Ntk_t *pNtk, Vec_Int_t *vIns, Vec_Wec_t *vStore)
 
Vec_Ptr_tAbc_NtkDeriveWinNodesAll (Abc_Ntk_t *pNtk, Vec_Ptr_t *vvIns, Vec_Wec_t *vStore)
 
Vec_Int_tAbc_NtkDeriveWinOuts (Abc_Ntk_t *pNtk, Vec_Int_t *vNodes)
 
Vec_Ptr_tAbc_NtkDeriveWinOutsAll (Abc_Ntk_t *pNtk, Vec_Ptr_t *vvNodes)
 
void Abc_NtkPermuteLevel (Abc_Ntk_t *pNtk, int Level)
 
Vec_Int_tAbc_NtkCollectObjectsPointedTo (Abc_Ntk_t *pNtk, int Level)
 
Vec_Wec_tAbc_NtkCollectObjectsWithSuppLimit (Abc_Ntk_t *pNtk, int Level, int nSuppMax)
 
void Abc_NtKSelectRemove (Vec_Wec_t *vSupps, Vec_Int_t *vOne)
 
void Abc_NtKMarkTfiTfo (Vec_Int_t *vOne, Abc_Ntk_t *pNtk)
 
void Abc_NtKSelectRemove2 (Vec_Wec_t *vSupps, Vec_Int_t *vOne, Abc_Ntk_t *pNtk)
 
void Abc_NtKSelectRemove3 (Vec_Wec_t *vSupps, Vec_Int_t *vOne)
 
Vec_Ptr_tAbc_NtkDeriveWinInsAll (Vec_Wec_t *vSupps, int nSuppMax, Abc_Ntk_t *pNtk, int fOverlap)
 
Abc_Ntk_tAbc_NtkDupWindow (Abc_Ntk_t *p, Vec_Int_t *vIns, Vec_Int_t *vNodes, Vec_Int_t *vOuts)
 
Vec_Ptr_tAbc_NtkDupWindows (Abc_Ntk_t *pNtk, Vec_Ptr_t *vvIns, Vec_Ptr_t *vvNodes, Vec_Ptr_t *vvOuts)
 
Vec_Ptr_tAbc_NtkExtractPartitions (Abc_Ntk_t *pNtk, int Iter, int nSuppMax, Vec_Ptr_t **pvIns, Vec_Ptr_t **pvOuts, Vec_Ptr_t **pvNodes, int fOverlap)
 
void Abc_NtkStochMap (int nSuppMax, int nIters, int TimeOut, int Seed, int fOverlap, int fVerbose, char *pScript, int nProcs)
 

Typedef Documentation

◆ StochSynData_t

Function*************************************************************

Synopsis [Generic concurrent processing.]

Description [User-defined problem-specific data and the way to process it.]

SideEffects []

SeeAlso []

◆ Supp_One_t

typedef struct Supp_One_t_ Supp_One_t

Definition at line 51 of file abcPart.c.

Function Documentation

◆ Abc_NtkCollectObjectsPointedTo()

Vec_Int_t * Abc_NtkCollectObjectsPointedTo ( Abc_Ntk_t * pNtk,
int Level )

Definition at line 1667 of file abcPart.c.

1668{
1669 Vec_Int_t * vRes = Vec_IntAlloc( 100 );
1670 Abc_Obj_t * pObj, * pFanin; int i, k;
1671 Abc_NtkIncrementTravId( pNtk );
1672 Abc_NtkForEachNode( pNtk, pObj, i ) {
1673 if ( Abc_ObjLevel(pObj) <= Level )
1674 continue;
1675 Abc_ObjForEachFanin( pObj, pFanin, k )
1676 if ( Abc_ObjLevel(pFanin) <= Level && !Abc_NodeIsTravIdCurrent(pFanin) ) {
1677 Abc_NodeSetTravIdCurrent(pFanin);
1678 Vec_IntPush( vRes, Abc_ObjId(pFanin) );
1679 }
1680 }
1681 Abc_NtkForEachCo( pNtk, pObj, i ) {
1682 pFanin = Abc_ObjFanin0(pObj);
1683 if ( Abc_ObjLevel(pFanin) <= Level && !Abc_NodeIsTravIdCurrent(pFanin) && Abc_ObjFaninNum(pFanin) > 0 ) {
1684 Abc_NodeSetTravIdCurrent(pFanin);
1685 Vec_IntPush( vRes, Abc_ObjId(pFanin) );
1686 }
1687 }
1688 Vec_IntSort( vRes, 0 );
1689 return vRes;
1690}
struct Abc_Obj_t_ Abc_Obj_t
Definition abc.h:116
#define Abc_NtkForEachCo(pNtk, pCo, i)
Definition abc.h:522
#define Abc_ObjForEachFanin(pObj, pFanin, i)
Definition abc.h:527
#define Abc_NtkForEachNode(pNtk, pNode, i)
Definition abc.h:464
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition bblif.c:37
Here is the caller graph for this function:

◆ Abc_NtkCollectObjectsWithSuppLimit()

Vec_Wec_t * Abc_NtkCollectObjectsWithSuppLimit ( Abc_Ntk_t * pNtk,
int Level,
int nSuppMax )

Definition at line 1691 of file abcPart.c.

1692{
1693 Vec_Wec_t * vResSupps = NULL;
1694 Vec_Int_t * vBelow = Abc_NtkCollectObjectsPointedTo( pNtk, Level );
1695 Vec_Wec_t * vSupps = Vec_WecStart( Vec_IntSize(vBelow) );
1696 Vec_Int_t * vSuppIds = Vec_IntStartFull( Abc_NtkObjNumMax(pNtk)+1 );
1697 Vec_Int_t * vTemp[2] = { Vec_IntAlloc(100), Vec_IntAlloc(100) };
1698 Abc_Obj_t * pObj, * pFanin; int i, k, Count = 0;
1699 Abc_NtkForEachObjVec( vBelow, pNtk, pObj, i ) {
1700 Vec_IntWriteEntry( vSuppIds, Abc_ObjId(pObj), i );
1701 Vec_IntPush( Vec_WecEntry(vSupps, i), Abc_ObjId(pObj) );
1702 }
1703 Abc_NtkForEachNode( pNtk, pObj, i ) {
1704 if ( Abc_ObjLevel(pObj) <= Level )
1705 continue;
1706 Vec_IntClear( vTemp[0] );
1707 Abc_ObjForEachFanin( pObj, pFanin, k ) {
1708 int iSuppId = Vec_IntEntry( vSuppIds, Abc_ObjId(pFanin) );
1709 if ( iSuppId == -1 )
1710 break;
1711 Vec_IntTwoMerge2( Vec_WecEntry(vSupps, iSuppId), vTemp[0], vTemp[1] );
1712 ABC_SWAP( Vec_Int_t *, vTemp[0], vTemp[1] );
1713 }
1714 if ( k < Abc_ObjFaninNum(pObj) || Vec_IntSize(vTemp[0]) > nSuppMax ) {
1715 Count++;
1716 continue;
1717 }
1718 Vec_IntWriteEntry( vSuppIds, Abc_ObjId(pObj), Vec_WecSize(vSupps) );
1719 Vec_IntAppend( Vec_WecPushLevel(vSupps), vTemp[0] );
1720 }
1721 // remove those supported nodes that are in the TFI cones of others
1722 Abc_NtkIncrementTravId( pNtk );
1723 Abc_NtkForEachNode( pNtk, pObj, i )
1724 if ( Abc_ObjLevel(pObj) > Level && Vec_IntEntry(vSuppIds, i) >= 0 && !Abc_NodeIsTravIdCurrent(pObj) ) {
1725 Abc_ObjDfsMark_rec(pObj);
1726 Abc_NodeSetTravIdPrevious(pObj);
1727 }
1728 // create the result
1729 vResSupps = Vec_WecAlloc( 100 );
1730 Abc_NtkForEachNode( pNtk, pObj, i )
1731 if ( Abc_ObjLevel(pObj) > Level && Vec_IntEntry(vSuppIds, i) >= 0 && !Abc_NodeIsTravIdCurrent(pObj) ) {
1732 Vec_Int_t * vSupp = Vec_WecEntry( vSupps, Vec_IntEntry(vSuppIds, i) );
1733 if ( Vec_IntSize(vSupp) < 4 )
1734 continue;
1735 Vec_Int_t * vThis = Vec_WecPushLevel( vResSupps );
1736 Vec_IntGrow( vThis, Vec_IntSize(vSupp) + 1 );
1737 Vec_IntAppend( vThis, vSupp );
1738 //Vec_IntPush( vThis, Abc_ObjId(pObj) );
1739 }
1740 //printf( "Inputs = %d. Nodes with %d-support = %d. Nodes with larger support = %d. Selected outputs = %d.\n",
1741 // Vec_IntSize(vBelow), nSuppMax, Vec_WecSize(vSupps), Count, Vec_WecSize(vResSupps) );
1742 Vec_WecFree( vSupps );
1743 Vec_IntFree( vSuppIds );
1744 Vec_IntFree( vBelow );
1745 Vec_IntFree( vTemp[0] );
1746 Vec_IntFree( vTemp[1] );
1747 return vResSupps;
1748}
Vec_Int_t * Abc_NtkCollectObjectsPointedTo(Abc_Ntk_t *pNtk, int Level)
Definition abcPart.c:1667
void Abc_ObjDfsMark_rec(Abc_Obj_t *p)
Definition abcPart.c:1550
#define Abc_NtkForEachObjVec(vIds, pNtk, pObj, i)
Definition abc.h:455
#define ABC_SWAP(Type, a, b)
Definition abc_global.h:253
int nSuppMax
Definition llb3Image.c:83
typedefABC_NAMESPACE_HEADER_START struct Vec_Wec_t_ Vec_Wec_t
INCLUDES ///.
Definition vecWec.h:42
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Abc_NtkComputeSupportsNaive()

Vec_Ptr_t * Abc_NtkComputeSupportsNaive ( Abc_Ntk_t * pNtk)

Function*************************************************************

Synopsis [Computes supports of the POs using naive method.]

Description [Returns the ptr-vector of int-vectors.]

SideEffects []

SeeAlso []

Definition at line 425 of file abcPart.c.

426{
427 Vec_Ptr_t * vSupp, * vSupports;
428 Vec_Int_t * vSuppI;
429 Abc_Obj_t * pObj, * pTemp;
430 int i, k;
431 // set the PI numbers
432 Abc_NtkForEachCi( pNtk, pObj, i )
433 pObj->pNext = (Abc_Obj_t *)(ABC_PTRINT_T)i;
434 // save the CI numbers
435 vSupports = Vec_PtrAlloc( Abc_NtkCoNum(pNtk) );
436 Abc_NtkForEachCo( pNtk, pObj, i )
437 {
438 if ( !Abc_ObjIsNode(Abc_ObjFanin0(pObj)) )
439 continue;
440 vSupp = Abc_NtkNodeSupport( pNtk, &pObj, 1 );
441 vSuppI = (Vec_Int_t *)vSupp;
442 Vec_PtrForEachEntry( Abc_Obj_t *, vSupp, pTemp, k )
443 Vec_IntWriteEntry( vSuppI, k, (int)(ABC_PTRINT_T)pTemp->pNext );
444 Vec_IntSort( vSuppI, 0 );
445 // append the number of this output
446 Vec_IntPush( vSuppI, i );
447 // save the support in the vector
448 Vec_PtrPush( vSupports, vSuppI );
449 }
450 // clean the CI numbers
451 Abc_NtkForEachCi( pNtk, pObj, i )
452 pObj->pNext = NULL;
453 // sort supports by size
454 Vec_VecSort( (Vec_Vec_t *)vSupports, 1 );
455/*
456 Vec_PtrForEachEntry( Vec_Int_t *, vSupports, vSuppI, i )
457 printf( "%d ", Vec_IntSize(vSuppI) );
458 printf( "\n" );
459*/
460 return vSupports;
461}
ABC_DLL Vec_Ptr_t * Abc_NtkNodeSupport(Abc_Ntk_t *pNtk, Abc_Obj_t **ppNodes, int nNodes)
Definition abcDfs.c:890
#define Abc_NtkForEachCi(pNtk, pCi, i)
Definition abc.h:518
Abc_Obj_t * pNext
Definition abc.h:131
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition vecPtr.h:42
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.
Definition vecPtr.h:55
typedefABC_NAMESPACE_HEADER_START struct Vec_Vec_t_ Vec_Vec_t
INCLUDES ///.
Definition vecVec.h:42
Here is the call graph for this function:

◆ Abc_NtkComputeSupportsSmart()

Vec_Ptr_t * Abc_NtkComputeSupportsSmart ( Abc_Ntk_t * pNtk)

Function*************************************************************

Synopsis [Computes supports of the POs.]

Description [Returns the ptr-vector of int-vectors.]

SideEffects []

SeeAlso []

Definition at line 326 of file abcPart.c.

327{
328 Vec_Ptr_t * vSupports;
329 Vec_Ptr_t * vNodes;
330 Vec_Int_t * vSupp;
331 Supp_Man_t * p;
332 Supp_One_t * pPart0, * pPart1;
333 Abc_Obj_t * pObj;
334 int i;
335 // set the number of PIs/POs
336 Abc_NtkForEachCi( pNtk, pObj, i )
337 pObj->pNext = (Abc_Obj_t *)(ABC_PTRINT_T)i;
338 Abc_NtkForEachCo( pNtk, pObj, i )
339 pObj->pNext = (Abc_Obj_t *)(ABC_PTRINT_T)i;
340 // start the support computation manager
341 p = Supp_ManStart( 1 << 20, 1 << 6 );
342 // consider objects in the topological order
343 vSupports = Vec_PtrAlloc( Abc_NtkCoNum(pNtk) );
344 Abc_NtkCleanCopy(pNtk);
345 // order the nodes so that the PIs and POs follow naturally
346 vNodes = Abc_NtkDfsNatural( pNtk );
347 Vec_PtrForEachEntry( Abc_Obj_t *, vNodes, pObj, i )
348 {
349 if ( Abc_ObjIsNode(pObj) )
350 {
351 pPart0 = (Supp_One_t *)Abc_ObjFanin0(pObj)->pCopy;
352 pPart1 = (Supp_One_t *)Abc_ObjFanin1(pObj)->pCopy;
353 pObj->pCopy = (Abc_Obj_t *)Supp_ManMergeEntry( p, pPart0, pPart1, Abc_ObjFanoutNum(pObj) );
354 assert( pPart0->nRefs > 0 );
355 if ( --pPart0->nRefs == 0 )
356 Supp_ManRecycleEntry( p, pPart0 );
357 assert( pPart1->nRefs > 0 );
358 if ( --pPart1->nRefs == 0 )
359 Supp_ManRecycleEntry( p, pPart1 );
360 continue;
361 }
362 if ( Abc_ObjIsCo(pObj) )
363 {
364 pPart0 = (Supp_One_t *)Abc_ObjFanin0(pObj)->pCopy;
365 // only save the CO if it is non-trivial
366 if ( Abc_ObjIsNode(Abc_ObjFanin0(pObj)) )
367 {
368 vSupp = Supp_ManTransferEntry(pPart0);
369 Vec_IntPush( vSupp, (int)(ABC_PTRINT_T)pObj->pNext );
370 Vec_PtrPush( vSupports, vSupp );
371 }
372 assert( pPart0->nRefs > 0 );
373 if ( --pPart0->nRefs == 0 )
374 Supp_ManRecycleEntry( p, pPart0 );
375 continue;
376 }
377 if ( Abc_ObjIsCi(pObj) )
378 {
379 if ( Abc_ObjFanoutNum(pObj) )
380 {
381 pPart0 = (Supp_One_t *)Supp_ManFetchEntry( p, 1, Abc_ObjFanoutNum(pObj) );
382 pPart0->pOuts[ pPart0->nOuts++ ] = (int)(ABC_PTRINT_T)pObj->pNext;
383 pObj->pCopy = (Abc_Obj_t *)pPart0;
384 }
385 continue;
386 }
387 if ( pObj == Abc_AigConst1(pNtk) )
388 {
389 if ( Abc_ObjFanoutNum(pObj) )
390 pObj->pCopy = (Abc_Obj_t *)Supp_ManFetchEntry( p, 0, Abc_ObjFanoutNum(pObj) );
391 continue;
392 }
393 assert( 0 );
394 }
395 Vec_PtrFree( vNodes );
396//printf( "Memory usage = %d MB.\n", Vec_PtrSize(p->vMemory) * p->nChunkSize / (1<<20) );
397 Supp_ManStop( p );
398 // sort supports by size
399 Vec_VecSort( (Vec_Vec_t *)vSupports, 1 );
400 // clear the number of PIs/POs
401 Abc_NtkForEachCi( pNtk, pObj, i )
402 pObj->pNext = NULL;
403 Abc_NtkForEachCo( pNtk, pObj, i )
404 pObj->pNext = NULL;
405/*
406 Vec_PtrForEachEntry( Vec_Int_t *, vSupports, vSupp, i )
407 printf( "%d ", Vec_IntSize(vSupp) );
408 printf( "\n" );
409*/
410 return vSupports;
411}
Supp_Man_t * Supp_ManStart(int nChunkSize, int nStepSize)
FUNCTION DEFINITIONS ///.
Definition abcPart.c:79
Supp_One_t * Supp_ManMergeEntry(Supp_Man_t *pMan, Supp_One_t *p1, Supp_One_t *p2, int nRefs)
Definition abcPart.c:220
struct Supp_One_t_ Supp_One_t
Definition abcPart.c:51
Vec_Ptr_t * Abc_NtkDfsNatural(Abc_Ntk_t *pNtk)
Definition abcPart.c:280
Vec_Int_t * Supp_ManTransferEntry(Supp_One_t *p)
Definition abcPart.c:259
void Supp_ManStop(Supp_Man_t *p)
Definition abcPart.c:102
ABC_DLL void Abc_NtkCleanCopy(Abc_Ntk_t *pNtk)
Definition abcUtil.c:540
ABC_DLL Abc_Obj_t * Abc_AigConst1(Abc_Ntk_t *pNtk)
Definition abcAig.c:683
Cube * p
Definition exorList.c:222
typedefABC_NAMESPACE_IMPL_START struct Supp_Man_t_ Supp_Man_t
DECLARATIONS ///.
Definition giaSupps.c:34
Abc_Obj_t * pCopy
Definition abc.h:148
int nOuts
Definition abcPart.c:55
int pOuts[0]
Definition abcPart.c:57
int nRefs
Definition abcPart.c:54
#define assert(ex)
Definition util_old.h:213
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Abc_NtkConvertCos()

void Abc_NtkConvertCos ( Abc_Ntk_t * pNtk,
Vec_Int_t * vOuts,
Vec_Ptr_t * vOutsPtr )

Function*************************************************************

Synopsis [Converts from intergers to pointers for the given network.]

Description []

SideEffects []

SeeAlso []

Definition at line 885 of file abcPart.c.

886{
887 int Out, i;
888 Vec_PtrClear( vOutsPtr );
889 Vec_IntForEachEntry( vOuts, Out, i )
890 Vec_PtrPush( vOutsPtr, Abc_NtkCo(pNtk, Out) );
891}
#define Vec_IntForEachEntry(vVec, Entry, i)
MACRO DEFINITIONS ///.
Definition vecInt.h:54
Here is the caller graph for this function:

◆ Abc_NtkCreateNodeMapped()

void Abc_NtkCreateNodeMapped ( Abc_Ntk_t * pNew,
Abc_Obj_t * pObj )

Function*************************************************************

Synopsis [Updates the AIG after multiple windows have been optimized.]

Description []

SideEffects []

SeeAlso []

Definition at line 1429 of file abcPart.c.

1430{
1431 Abc_Obj_t * pObjNew = Abc_NtkDupObj( pNew, pObj, 0 );
1432 Abc_Obj_t * pFanin; int i;
1433 Abc_ObjForEachFanin( pObj, pFanin, i )
1434 Abc_ObjAddFanin( pObjNew, pFanin->pCopy );
1435}
ABC_DLL void Abc_ObjAddFanin(Abc_Obj_t *pObj, Abc_Obj_t *pFanin)
Definition abcFanio.c:84
ABC_DLL Abc_Obj_t * Abc_NtkDupObj(Abc_Ntk_t *pNtkNew, Abc_Obj_t *pObj, int fCopyName)
Definition abcObj.c:342
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Abc_NtkDeriveWinInsAll()

Vec_Ptr_t * Abc_NtkDeriveWinInsAll ( Vec_Wec_t * vSupps,
int nSuppMax,
Abc_Ntk_t * pNtk,
int fOverlap )

Definition at line 1797 of file abcPart.c.

1798{
1799 Vec_Ptr_t * vRes = Vec_PtrAlloc( 100 );
1800 Abc_NtkIncrementTravId( pNtk );
1801 while ( Vec_WecSize(vSupps) > 0 ) {
1802 int i, Item, iRand = Abc_Random(0) % Vec_WecSize(vSupps);
1803 Vec_Int_t * vLevel, * vLevel2 = Vec_WecEntry( vSupps, iRand );
1804 Vec_Int_t * vCopy = Vec_IntDup( vLevel2 );
1805 if ( Vec_IntSize(vLevel2) == nSuppMax ) {
1806 Vec_PtrPush( vRes, vCopy );
1807 if ( fOverlap )
1808 Abc_NtKSelectRemove3( vSupps, vCopy );
1809 else
1810 Abc_NtKSelectRemove2( vSupps, vCopy, pNtk );
1811 continue;
1812 }
1813 // find another support, which maximizes the union but does not exceed nSuppMax
1814 int iBest = iRand, nUnion = Vec_IntSize(vCopy);
1815 Vec_WecForEachLevel( vSupps, vLevel, i ) {
1816 if ( i == iRand ) continue;
1817 int nCommon = Vec_IntTwoCountCommon(vLevel, vCopy);
1818 int nUnionCur = Vec_IntSize(vLevel) + Vec_IntSize(vCopy) - nCommon;
1819 if ( nUnionCur <= nSuppMax && nUnion < nUnionCur ) {
1820 nUnion = nUnionCur;
1821 iBest = i;
1822 }
1823 }
1824 vLevel = Vec_WecEntry( vSupps, iBest );
1825 Vec_IntForEachEntry( vLevel, Item, i )
1826 Vec_IntPushUniqueOrder( vCopy, Item );
1827 Vec_PtrPush( vRes, vCopy );
1828 if ( fOverlap )
1829 Abc_NtKSelectRemove3( vSupps, vCopy );
1830 else
1831 Abc_NtKSelectRemove2( vSupps, vCopy, pNtk );
1832 }
1833 return vRes;
1834}
void Abc_NtKSelectRemove3(Vec_Wec_t *vSupps, Vec_Int_t *vOne)
Definition abcPart.c:1789
void Abc_NtKSelectRemove2(Vec_Wec_t *vSupps, Vec_Int_t *vOne, Abc_Ntk_t *pNtk)
Definition abcPart.c:1770
unsigned Abc_Random(int fReset)
Definition utilSort.c:1004
#define Vec_WecForEachLevel(vGlob, vVec, i)
MACRO DEFINITIONS ///.
Definition vecWec.h:55
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Abc_NtkDeriveWinNodes()

Vec_Int_t * Abc_NtkDeriveWinNodes ( Abc_Ntk_t * pNtk,
Vec_Int_t * vIns,
Vec_Wec_t * vStore )

Definition at line 1570 of file abcPart.c.

1571{
1572 Vec_Int_t * vLevel, * vNodes = Vec_IntAlloc( 100 );
1573 Abc_Obj_t * pObj, * pNext; int i, k, iLevel;
1574 Vec_WecForEachLevel( vStore, vLevel, i )
1575 Vec_IntClear( vLevel );
1576 // mark the TFI cones of the inputs
1577 Abc_NtkIncrementTravId( pNtk );
1578 Abc_NtkForEachObjVec( vIns, pNtk, pObj, i )
1579 Abc_ObjDfsMark_rec( pObj );
1580 // add unrelated fanouts of the inputs to storage
1581 Abc_NtkForEachObjVec( vIns, pNtk, pObj, i )
1582 Abc_ObjForEachFanout( pObj, pNext, k )
1583 if ( Abc_ObjIsNode(pNext) && !Abc_NodeIsTravIdCurrent(pNext) && !pNext->fMarkA ) {
1584 pNext->fMarkA = 1;
1585 Vec_WecPush( vStore, Abc_ObjLevel(pNext), Abc_ObjId(pNext) );
1586 }
1587 // mark the inputs
1588 Abc_NtkIncrementTravId( pNtk );
1589 Abc_NtkForEachObjVec( vIns, pNtk, pObj, i )
1590 Abc_NodeSetTravIdCurrent(pObj);
1591 // collect those fanouts that are completely supported by the inputs
1592 Vec_WecForEachLevel( vStore, vLevel, iLevel )
1593 Abc_NtkForEachObjVec( vLevel, pNtk, pObj, i ) {
1594 assert( !Abc_NodeIsTravIdCurrent(pObj) );
1595 assert( pObj->fMarkA );
1596 pObj->fMarkA = 0;
1597 Abc_ObjForEachFanin( pObj, pNext, k )
1598 if ( !Abc_NodeIsTravIdCurrent(pNext) )
1599 break;
1600 if ( k < Abc_ObjFaninNum(pObj) )
1601 continue;
1602 Abc_NodeSetTravIdCurrent(pObj);
1603 Vec_IntPush( vNodes, Abc_ObjId(pObj) );
1604 assert( Abc_ObjIsNode(pObj) );
1605 // add fanouts of this node to storage
1606 Abc_ObjForEachFanout( pObj, pNext, k )
1607 if ( Abc_ObjIsNode(pNext) && !Abc_NodeIsTravIdCurrent(pNext) && !pNext->fMarkA ) {
1608 pNext->fMarkA = 1;
1609 assert( Abc_ObjLevel(pNext) > iLevel );
1610 Vec_WecPush( vStore, Abc_ObjLevel(pNext), Abc_ObjId(pNext) );
1611 }
1612 }
1613 Vec_IntSort( vNodes, 0 );
1614 return vNodes;
1615}
#define Abc_ObjForEachFanout(pObj, pFanout, i)
Definition abc.h:529
unsigned fMarkA
Definition abc.h:134
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Abc_NtkDeriveWinNodesAll()

Vec_Ptr_t * Abc_NtkDeriveWinNodesAll ( Abc_Ntk_t * pNtk,
Vec_Ptr_t * vvIns,
Vec_Wec_t * vStore )

Definition at line 1616 of file abcPart.c.

1617{
1618 Vec_Int_t * vIns; int i;
1619 Vec_Ptr_t * vvNodes = Vec_PtrAlloc( Vec_PtrSize(vvIns) );
1620 Vec_PtrForEachEntry( Vec_Int_t *, vvIns, vIns, i )
1621 Vec_PtrPush( vvNodes, Abc_NtkDeriveWinNodes(pNtk, vIns, vStore) );
1622 return vvNodes;
1623}
Vec_Int_t * Abc_NtkDeriveWinNodes(Abc_Ntk_t *pNtk, Vec_Int_t *vIns, Vec_Wec_t *vStore)
Definition abcPart.c:1570
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Abc_NtkDeriveWinOuts()

Vec_Int_t * Abc_NtkDeriveWinOuts ( Abc_Ntk_t * pNtk,
Vec_Int_t * vNodes )

Definition at line 1624 of file abcPart.c.

1625{
1626 Vec_Int_t * vOuts = Vec_IntAlloc( 100 );
1627 Abc_Obj_t * pObj, * pNext; int i, k;
1628 // mark the nodes in the window
1629 Abc_NtkIncrementTravId( pNtk );
1630 Abc_NtkForEachObjVec( vNodes, pNtk, pObj, i )
1631 Abc_NodeSetTravIdCurrent(pObj);
1632 // collect nodes that have unmarked fanouts
1633 Abc_NtkForEachObjVec( vNodes, pNtk, pObj, i ) {
1634 Abc_ObjForEachFanout( pObj, pNext, k )
1635 if ( !Abc_NodeIsTravIdCurrent(pNext) )
1636 break;
1637 if ( k < Abc_ObjFanoutNum(pObj) )
1638 Vec_IntPush( vOuts, Abc_ObjId(pObj) );
1639 }
1640 if ( Vec_IntSize(vOuts) == 0 )
1641 printf( "Window with %d internal nodes has no outputs (are these dangling nodes?).\n", Vec_IntSize(vNodes) );
1642 return vOuts;
1643}
Here is the caller graph for this function:

◆ Abc_NtkDeriveWinOutsAll()

Vec_Ptr_t * Abc_NtkDeriveWinOutsAll ( Abc_Ntk_t * pNtk,
Vec_Ptr_t * vvNodes )

Definition at line 1644 of file abcPart.c.

1645{
1646 Vec_Int_t * vNodes; int i;
1647 Vec_Ptr_t * vvOuts = Vec_PtrAlloc( Vec_PtrSize(vvNodes) );
1648 Vec_PtrForEachEntry( Vec_Int_t *, vvNodes, vNodes, i )
1649 Vec_PtrPush( vvOuts, Abc_NtkDeriveWinOuts(pNtk, vNodes) );
1650 return vvOuts;
1651}
Vec_Int_t * Abc_NtkDeriveWinOuts(Abc_Ntk_t *pNtk, Vec_Int_t *vNodes)
Definition abcPart.c:1624
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Abc_NtkDfsNatural()

Vec_Ptr_t * Abc_NtkDfsNatural ( Abc_Ntk_t * pNtk)

Function*************************************************************

Synopsis [Computes supports of the POs in the multi-output AIG.]

Description []

SideEffects []

SeeAlso []

Definition at line 280 of file abcPart.c.

281{
282 Vec_Ptr_t * vNodes;
283 Abc_Obj_t * pObj, * pNext;
284 int i, k;
285 assert( Abc_NtkIsStrash(pNtk) );
286 vNodes = Vec_PtrAlloc( Abc_NtkObjNum(pNtk) );
287 Abc_NtkIncrementTravId( pNtk );
288 // add the constant-1 nodes
289 pObj = Abc_AigConst1(pNtk);
290 Abc_NodeSetTravIdCurrent( pObj );
291 Vec_PtrPush( vNodes, pObj );
292 // add the CIs/nodes/COs in the topological order
293 Abc_NtkForEachNode( pNtk, pObj, i )
294 {
295 // check the fanins and add CIs
296 Abc_ObjForEachFanin( pObj, pNext, k )
297 if ( Abc_ObjIsCi(pNext) && !Abc_NodeIsTravIdCurrent(pNext) )
298 {
299 Abc_NodeSetTravIdCurrent( pNext );
300 Vec_PtrPush( vNodes, pNext );
301 }
302 // add the node
303 Vec_PtrPush( vNodes, pObj );
304 // check the fanouts and add COs
305 Abc_ObjForEachFanout( pObj, pNext, k )
306 if ( Abc_ObjIsCo(pNext) && !Abc_NodeIsTravIdCurrent(pNext) )
307 {
308 Abc_NodeSetTravIdCurrent( pNext );
309 Vec_PtrPush( vNodes, pNext );
310 }
311 }
312 return vNodes;
313}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Abc_NtkDupWindow()

Abc_Ntk_t * Abc_NtkDupWindow ( Abc_Ntk_t * p,
Vec_Int_t * vIns,
Vec_Int_t * vNodes,
Vec_Int_t * vOuts )

Definition at line 1835 of file abcPart.c.

1836{
1838 pNew->pName = Abc_UtilStrsav( p->pName );
1839 pNew->pSpec = Abc_UtilStrsav( p->pSpec );
1840 pNew->pManFunc = p->pManFunc;
1841 Abc_Obj_t * pObj; int i;
1842 Abc_NtkForEachObjVec( vIns, p, pObj, i )
1843 pObj->pCopy = Abc_NtkCreatePi(pNew);
1844 Abc_NtkForEachObjVec( vOuts, p, pObj, i )
1845 Abc_NtkCreatePo( pNew );
1846 Abc_NtkForEachObjVec( vNodes, p, pObj, i )
1847 Abc_NtkCreateNodeMapped( pNew, pObj );
1848 Abc_NtkForEachObjVec( vOuts, p, pObj, i )
1849 Abc_ObjAddFanin( Abc_NtkCo(pNew, i), pObj->pCopy );
1850 Abc_NtkForEachObjVec( vIns, p, pObj, i )
1851 pObj->pCopy = NULL;
1852 Abc_NtkForEachObjVec( vNodes, p, pObj, i )
1853 pObj->pCopy = NULL;
1854 Abc_NtkAddDummyPiNames( pNew );
1855 Abc_NtkAddDummyPoNames( pNew );
1856 return pNew;
1857}
void Abc_NtkCreateNodeMapped(Abc_Ntk_t *pNew, Abc_Obj_t *pObj)
Definition abcPart.c:1429
ABC_DLL Abc_Ntk_t * Abc_NtkAlloc(Abc_NtkType_t Type, Abc_NtkFunc_t Func, int fUseMemMan)
DECLARATIONS ///.
Definition abcNtk.c:53
struct Abc_Ntk_t_ Abc_Ntk_t
Definition abc.h:115
@ ABC_NTK_LOGIC
Definition abc.h:57
ABC_DLL void Abc_NtkAddDummyPoNames(Abc_Ntk_t *pNtk)
Definition abcNames.c:521
@ ABC_FUNC_MAP
Definition abc.h:68
ABC_DLL void Abc_NtkAddDummyPiNames(Abc_Ntk_t *pNtk)
Definition abcNames.c:495
char * pName
Definition abc.h:158
void * pManFunc
Definition abc.h:191
char * pSpec
Definition abc.h:159
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Abc_NtkDupWindows()

Vec_Ptr_t * Abc_NtkDupWindows ( Abc_Ntk_t * pNtk,
Vec_Ptr_t * vvIns,
Vec_Ptr_t * vvNodes,
Vec_Ptr_t * vvOuts )

Definition at line 1858 of file abcPart.c.

1859{
1860 Vec_Int_t * vNodes; int i;
1861 Vec_Ptr_t * vWins = Vec_PtrAlloc( Vec_PtrSize(vvIns) );
1862 assert( Vec_PtrSize(vvIns) == Vec_PtrSize(vvNodes) );
1863 assert( Vec_PtrSize(vvOuts) == Vec_PtrSize(vvNodes) );
1864 Abc_NtkCleanCopy( pNtk );
1865 Abc_NtkCleanMarkABC( pNtk );
1866 Vec_PtrForEachEntry( Vec_Int_t *, vvNodes, vNodes, i ) {
1867 Vec_Int_t * vIns = (Vec_Int_t *)Vec_PtrEntry(vvIns, i);
1868 Vec_Int_t * vOuts = (Vec_Int_t *)Vec_PtrEntry(vvOuts, i);
1869 Abc_Ntk_t * pNew = Abc_NtkDupWindow( pNtk, vIns, vNodes, vOuts );
1870 Vec_PtrPush( vWins, pNew );
1871 }
1872 return vWins;
1873}
Abc_Ntk_t * Abc_NtkDupWindow(Abc_Ntk_t *p, Vec_Int_t *vIns, Vec_Int_t *vNodes, Vec_Int_t *vOuts)
Definition abcPart.c:1835
ABC_DLL void Abc_NtkCleanMarkABC(Abc_Ntk_t *pNtk)
Definition abcUtil.c:772
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Abc_NtkExtractPartitions()

Vec_Ptr_t * Abc_NtkExtractPartitions ( Abc_Ntk_t * pNtk,
int Iter,
int nSuppMax,
Vec_Ptr_t ** pvIns,
Vec_Ptr_t ** pvOuts,
Vec_Ptr_t ** pvNodes,
int fOverlap )

Definition at line 1874 of file abcPart.c.

1875{
1876 // if ( Abc_NtkCiNum(pNtk) <= nSuppMax ) {
1877 // Vec_Ptr_t * vWins = Vec_PtrAlloc( 1 );
1878 // Vec_PtrPush( vWins, Abc_NtkDupDfs(pNtk) );
1879 // *pvIns = *pvOuts = *pvNodes = NULL;
1880 // return vWins;
1881 // }
1882 // int iUseRevL = Iter % 3 == 0 ? 0 : Abc_Random(0) & 1;
1883 int iUseRevL = Abc_Random(0) & 1;
1884 int LevelMax = iUseRevL ? Abc_NtkLevelR(pNtk) : Abc_NtkLevel(pNtk);
1885 // int LevelCut = Iter % 3 == 0 ? 0 : LevelMax > 8 ? 2 + (Abc_Random(0) % (LevelMax - 4)) : 0;
1886 int LevelCut = LevelMax > 8 ? (Abc_Random(0) % (LevelMax - 4)) : 0;
1887 // printf( "Using %s cut level %d (out of %d)\n", iUseRevL ? "reverse": "direct", LevelCut, LevelMax );
1888 // Abc_NtkPermuteLevel( pNtk, LevelMax );
1889 Vec_Wec_t * vStore = Vec_WecStart( LevelMax+1 );
1890 Vec_Wec_t * vSupps = Abc_NtkCollectObjectsWithSuppLimit( pNtk, LevelCut, nSuppMax );
1891 Vec_Ptr_t * vIns = Abc_NtkDeriveWinInsAll( vSupps, nSuppMax, pNtk, fOverlap );
1892 Vec_Ptr_t * vNodes = Abc_NtkDeriveWinNodesAll( pNtk, vIns, vStore );
1893 Vec_Ptr_t * vOuts = Abc_NtkDeriveWinOutsAll( pNtk, vNodes );
1894 Vec_Ptr_t * vWins = Abc_NtkDupWindows( pNtk, vIns, vNodes, vOuts );
1895 Vec_WecFree( vSupps );
1896 Vec_WecFree( vStore );
1897 *pvIns = vIns;
1898 *pvOuts = vOuts;
1899 *pvNodes = vNodes;
1900 return vWins;
1901}
Vec_Ptr_t * Abc_NtkDupWindows(Abc_Ntk_t *pNtk, Vec_Ptr_t *vvIns, Vec_Ptr_t *vvNodes, Vec_Ptr_t *vvOuts)
Definition abcPart.c:1858
Vec_Ptr_t * Abc_NtkDeriveWinOutsAll(Abc_Ntk_t *pNtk, Vec_Ptr_t *vvNodes)
Definition abcPart.c:1644
Vec_Wec_t * Abc_NtkCollectObjectsWithSuppLimit(Abc_Ntk_t *pNtk, int Level, int nSuppMax)
Definition abcPart.c:1691
Vec_Ptr_t * Abc_NtkDeriveWinInsAll(Vec_Wec_t *vSupps, int nSuppMax, Abc_Ntk_t *pNtk, int fOverlap)
Definition abcPart.c:1797
Vec_Ptr_t * Abc_NtkDeriveWinNodesAll(Abc_Ntk_t *pNtk, Vec_Ptr_t *vvIns, Vec_Wec_t *vStore)
Definition abcPart.c:1616
ABC_DLL int Abc_NtkLevelR(Abc_Ntk_t *pNtk)
Definition abcDfs.c:1517
ABC_DLL int Abc_NtkLevel(Abc_Ntk_t *pNtk)
Definition abcDfs.c:1449
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Abc_NtkFraigPartitioned()

Abc_Ntk_t * Abc_NtkFraigPartitioned ( Vec_Ptr_t * vStore,
void * pParams )

Function*************************************************************

Synopsis [Stitches together several networks with choice nodes.]

Description []

SideEffects []

SeeAlso []

Definition at line 1106 of file abcPart.c.

1107{
1108 Vec_Ptr_t * vParts, * vFraigs, * vOnePtr;
1109 Vec_Int_t * vOne;
1110 Abc_Ntk_t * pNtk, * pNtk2, * pNtkAig, * pNtkFraig;
1111 int i, k;
1112
1113 // perform partitioning
1114 pNtk = (Abc_Ntk_t *)Vec_PtrEntry( vStore, 0 );
1115 assert( Abc_NtkIsStrash(pNtk) );
1116// vParts = Abc_NtkPartitionNaive( pNtk, 20 );
1117 vParts = Abc_NtkPartitionSmart( pNtk, 300, 0 );
1118
1119 Cmd_CommandExecute( Abc_FrameGetGlobalFrame(), "unset progressbar" );
1120
1121 // fraig each partition
1122 vOnePtr = Vec_PtrAlloc( 1000 );
1123 vFraigs = Vec_PtrAlloc( Vec_PtrSize(vParts) );
1124 Vec_PtrForEachEntry( Vec_Int_t *, vParts, vOne, i )
1125 {
1126 // start the partition
1127 Abc_NtkConvertCos( pNtk, vOne, vOnePtr );
1128 pNtkAig = Abc_NtkCreateConeArray( pNtk, vOnePtr, 0 );
1129 // add nodes to the partition
1130 Vec_PtrForEachEntryStart( Abc_Ntk_t *, vStore, pNtk2, k, 1 )
1131 {
1132 Abc_NtkConvertCos( pNtk2, vOne, vOnePtr );
1133 Abc_NtkAppendToCone( pNtkAig, pNtk2, vOnePtr );
1134 }
1135 printf( "Fraiging part %4d (out of %4d) PI = %5d. PO = %5d. And = %6d. Lev = %4d.\r",
1136 i+1, Vec_PtrSize(vParts), Abc_NtkPiNum(pNtkAig), Abc_NtkPoNum(pNtkAig),
1137 Abc_NtkNodeNum(pNtkAig), Abc_AigLevel(pNtkAig) );
1138 // fraig the partition
1139 pNtkFraig = Abc_NtkFraig( pNtkAig, pParams, 1, 0 );
1140 Vec_PtrPush( vFraigs, pNtkFraig );
1141 Abc_NtkDelete( pNtkAig );
1142 }
1143 printf( " \r" );
1144 Vec_VecFree( (Vec_Vec_t *)vParts );
1145
1146 Cmd_CommandExecute( Abc_FrameGetGlobalFrame(), "set progressbar" );
1147
1148 // derive the final network
1149 pNtkFraig = Abc_NtkPartStitchChoices( pNtk, vFraigs );
1150 Vec_PtrForEachEntry( Abc_Ntk_t *, vFraigs, pNtkAig, i )
1151 Abc_NtkDelete( pNtkAig );
1152 Vec_PtrFree( vFraigs );
1153 Vec_PtrFree( vOnePtr );
1154 return pNtkFraig;
1155}
Abc_Ntk_t * Abc_NtkPartStitchChoices(Abc_Ntk_t *pNtk, Vec_Ptr_t *vParts)
Definition abcPart.c:1008
void Abc_NtkConvertCos(Abc_Ntk_t *pNtk, Vec_Int_t *vOuts, Vec_Ptr_t *vOutsPtr)
Definition abcPart.c:885
Vec_Ptr_t * Abc_NtkPartitionSmart(Abc_Ntk_t *pNtk, int nSuppSizeLimit, int fVerbose)
Definition abcPart.c:730
ABC_DLL int Abc_AigLevel(Abc_Ntk_t *pNtk)
Definition abcAig.c:292
ABC_DLL Abc_Ntk_t * Abc_NtkFraig(Abc_Ntk_t *pNtk, void *pParams, int fAllNodes, int fExdc)
FUNCTION DEFINITIONS ///.
Definition abcFraig.c:58
ABC_DLL void Abc_NtkDelete(Abc_Ntk_t *pNtk)
Definition abcNtk.c:1421
ABC_DLL Abc_Ntk_t * Abc_NtkCreateConeArray(Abc_Ntk_t *pNtk, Vec_Ptr_t *vRoots, int fUseAllCis)
Definition abcNtk.c:995
ABC_DLL void Abc_NtkAppendToCone(Abc_Ntk_t *pNtkNew, Abc_Ntk_t *pNtk, Vec_Ptr_t *vRoots)
Definition abcNtk.c:1075
ABC_DLL Abc_Frame_t * Abc_FrameGetGlobalFrame()
Definition mainFrame.c:643
ABC_DLL int Cmd_CommandExecute(Abc_Frame_t *pAbc, const char *sCommand)
Definition cmdApi.c:193
#define Vec_PtrForEachEntryStart(Type, vVec, pEntry, i, Start)
Definition vecPtr.h:57
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Abc_NtkFraigPartitionedTime()

void Abc_NtkFraigPartitionedTime ( Abc_Ntk_t * pNtk,
void * pParams )

Function*************************************************************

Synopsis [Stitches together several networks with choice nodes.]

Description []

SideEffects []

SeeAlso []

Definition at line 1168 of file abcPart.c.

1169{
1170 Vec_Ptr_t * vParts, * vFraigs, * vOnePtr;
1171 Vec_Int_t * vOne;
1172 Abc_Ntk_t * pNtkAig, * pNtkFraig;
1173 int i;
1174 abctime clk = Abc_Clock();
1175
1176 // perform partitioning
1177 assert( Abc_NtkIsStrash(pNtk) );
1178// vParts = Abc_NtkPartitionNaive( pNtk, 20 );
1179 vParts = Abc_NtkPartitionSmart( pNtk, 300, 0 );
1180
1181 Cmd_CommandExecute( Abc_FrameGetGlobalFrame(), "unset progressbar" );
1182
1183 // fraig each partition
1184 vOnePtr = Vec_PtrAlloc( 1000 );
1185 vFraigs = Vec_PtrAlloc( Vec_PtrSize(vParts) );
1186 Vec_PtrForEachEntry( Vec_Int_t *, vParts, vOne, i )
1187 {
1188 Abc_NtkConvertCos( pNtk, vOne, vOnePtr );
1189 pNtkAig = Abc_NtkCreateConeArray( pNtk, vOnePtr, 0 );
1190 pNtkFraig = Abc_NtkFraig( pNtkAig, pParams, 0, 0 );
1191 Vec_PtrPush( vFraigs, pNtkFraig );
1192 Abc_NtkDelete( pNtkAig );
1193
1194 printf( "Finished part %5d (out of %5d)\r", i+1, Vec_PtrSize(vParts) );
1195 }
1196 Vec_VecFree( (Vec_Vec_t *)vParts );
1197
1198 Cmd_CommandExecute( Abc_FrameGetGlobalFrame(), "set progressbar" );
1199
1200 // derive the final network
1201 Vec_PtrForEachEntry( Abc_Ntk_t *, vFraigs, pNtkAig, i )
1202 Abc_NtkDelete( pNtkAig );
1203 Vec_PtrFree( vFraigs );
1204 Vec_PtrFree( vOnePtr );
1205 ABC_PRT( "Partitioned fraiging time", Abc_Clock() - clk );
1206}
ABC_INT64_T abctime
Definition abc_global.h:332
#define ABC_PRT(a, t)
Definition abc_global.h:255
Here is the call graph for this function:

◆ Abc_NtkInsertPartitions()

Abc_Ntk_t * Abc_NtkInsertPartitions ( Abc_Ntk_t * p,
Vec_Ptr_t * vvIns,
Vec_Ptr_t * vvNodes,
Vec_Ptr_t * vvOuts,
Vec_Ptr_t * vWins,
int fOverlap,
Vec_Int_t * vGains )

Definition at line 1470 of file abcPart.c.

1471{
1472 if ( vvIns == NULL ) {
1473 assert( vvOuts == NULL );
1474 assert( Vec_PtrSize(vWins) == 1 );
1475 return Abc_NtkDupDfs( (Abc_Ntk_t *)Vec_PtrEntry(vWins, 0) );
1476 }
1477 if ( fOverlap ) {
1478 Vec_Ptr_t * vvInsNew = Vec_PtrAlloc( 10 );
1479 Vec_Ptr_t * vvOutsNew = Vec_PtrAlloc( 10 );
1480 Vec_Ptr_t * vvWinsNew = Vec_PtrAlloc( 10 );
1481 Abc_NtkIncrementTravId( p );
1482 while ( 1 ) {
1483 int i, Gain, iEntry = Vec_IntArgMax(vGains);
1484 if ( iEntry == -1 || Vec_IntEntry(vGains, iEntry) < 0 )
1485 break;
1486 //printf( "Selecting partition %d with gain %d.\n", iEntry, Vec_IntEntry(vGains, iEntry) );
1487 Vec_IntWriteEntry( vGains, iEntry, -1 );
1488 Vec_PtrPush( vvInsNew, Vec_IntDup((Vec_Int_t *)Vec_PtrEntry(vvIns, iEntry)) );
1489 Vec_PtrPush( vvOutsNew, Vec_IntDup((Vec_Int_t *)Vec_PtrEntry(vvOuts, iEntry)) );
1490 Vec_PtrPush( vvWinsNew, Abc_NtkDupDfs((Abc_Ntk_t *)Vec_PtrEntry(vWins, iEntry)) );
1491 extern void Abc_NtKMarkTfiTfo( Vec_Int_t * vOne, Abc_Ntk_t * pNtk );
1492 Abc_NtKMarkTfiTfo( (Vec_Int_t *)Vec_PtrEntryLast(vvInsNew), p );
1493 Vec_IntForEachEntry( vGains, Gain, i ) {
1494 if ( Gain < 0 )
1495 continue;
1496 Vec_Int_t * vNodes = (Vec_Int_t *)Vec_PtrEntry(vvNodes, i);
1497 Abc_Obj_t * pNode; int j;
1498 Abc_NtkForEachObjVec( vNodes, p, pNode, j )
1499 if ( Abc_NodeIsTravIdCurrent(pNode) )
1500 break;
1501 if ( j < Vec_IntSize(vNodes) )
1502 Vec_IntWriteEntry( vGains, i, -1 );
1503 }
1504 }
1505 ABC_SWAP( Vec_Ptr_t, *vvInsNew, *vvIns );
1506 ABC_SWAP( Vec_Ptr_t, *vvOutsNew, *vvOuts );
1507 ABC_SWAP( Vec_Ptr_t, *vvWinsNew, *vWins );
1508 Vec_PtrFreeFunc( vvInsNew, (void (*)(void *)) Vec_IntFree );
1509 Vec_PtrFreeFunc( vvOutsNew, (void (*)(void *)) Vec_IntFree );
1510 Vec_PtrFreeFunc( vvWinsNew, (void (*)(void *)) Abc_NtkDelete );
1511 }
1512 // check consistency of input data
1513 Abc_Ntk_t * pNew, * pTemp; Abc_Obj_t * pObj; int i, k, iNode;
1514 Vec_PtrForEachEntry( Abc_Ntk_t *, vWins, pTemp, i ) {
1515 Vec_Int_t * vIns = (Vec_Int_t *)Vec_PtrEntry(vvIns, i);
1516 Vec_Int_t * vOuts = (Vec_Int_t *)Vec_PtrEntry(vvOuts, i);
1517 assert( Vec_IntSize(vIns) == Abc_NtkPiNum(pTemp) );
1518 assert( Vec_IntSize(vOuts) == Abc_NtkPoNum(pTemp) );
1519 assert( !Abc_NtkWindowCheckTopoError(p, vIns, vOuts) );
1520 }
1521 // create mapping of window outputs into window IDs
1522 Vec_Int_t * vMap = Vec_IntStartFull( Abc_NtkObjNumMax(p) ), * vOuts;
1523 Vec_PtrForEachEntry( Vec_Int_t *, vvOuts, vOuts, i )
1524 Vec_IntForEachEntry( vOuts, iNode, k ) {
1525 assert( Vec_IntEntry(vMap, iNode) == -1 );
1526 Vec_IntWriteEntry( vMap, iNode, i );
1527 }
1529 pNew = Abc_NtkStartFrom( p, p->ntkType, p->ntkFunc );
1530 pNew->pManFunc = p->pManFunc;
1531 Abc_NtkForEachCo( p, pObj, i )
1532 Abc_NtkInsertPartitions_rec( pNew, Abc_ObjFanin0(pObj), vMap, vvIns, vvOuts, vWins );
1533 Abc_NtkForEachCo( p, pObj, i )
1534 Abc_ObjAddFanin( Abc_NtkCo(pNew, i), Abc_ObjFanin0(pObj)->pCopy );
1535 Vec_IntFree( vMap );
1536 return pNew;
1537}
void Abc_NtKMarkTfiTfo(Vec_Int_t *vOne, Abc_Ntk_t *pNtk)
Definition abcPart.c:1759
void Abc_NtkInsertPartitions_rec(Abc_Ntk_t *pNew, Abc_Obj_t *pObj, Vec_Int_t *vMap, Vec_Ptr_t *vvIns, Vec_Ptr_t *vvOuts, Vec_Ptr_t *vWins)
Definition abcPart.c:1436
int Abc_NtkWindowCheckTopoError(Abc_Ntk_t *p, Vec_Int_t *vIns, Vec_Int_t *vOuts)
Definition abcPart.c:1401
ABC_DLL Abc_Ntk_t * Abc_NtkDupDfs(Abc_Ntk_t *pNtk)
Definition abcNtk.c:538
ABC_DLL Abc_Ntk_t * Abc_NtkStartFrom(Abc_Ntk_t *pNtk, Abc_NtkType_t Type, Abc_NtkFunc_t Func)
Definition abcNtk.c:157
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Abc_NtkInsertPartitions_rec()

void Abc_NtkInsertPartitions_rec ( Abc_Ntk_t * pNew,
Abc_Obj_t * pObj,
Vec_Int_t * vMap,
Vec_Ptr_t * vvIns,
Vec_Ptr_t * vvOuts,
Vec_Ptr_t * vWins )

Definition at line 1436 of file abcPart.c.

1437{
1438 if ( pObj->pCopy )
1439 return;
1440 assert( Abc_ObjIsNode(pObj) );
1441 if ( Vec_IntEntry(vMap, Abc_ObjId(pObj)) == -1 ) // this is a regular node
1442 {
1443 Abc_Obj_t * pFanin; int i;
1444 Abc_ObjForEachFanin( pObj, pFanin, i )
1445 Abc_NtkInsertPartitions_rec( pNew, pFanin, vMap, vvIns, vvOuts, vWins );
1446 Abc_NtkCreateNodeMapped( pNew, pObj );
1447 return;
1448 }
1449 // this node is an output of a window
1450 int iWin = Vec_IntEntry(vMap, Abc_ObjId(pObj));
1451 Vec_Int_t * vIns = (Vec_Int_t *)Vec_PtrEntry(vvIns, iWin);
1452 Vec_Int_t * vOuts = (Vec_Int_t *)Vec_PtrEntry(vvOuts, iWin);
1453 Abc_Ntk_t * pWin = (Abc_Ntk_t *)Vec_PtrEntry(vWins, iWin);
1454 // build transinvite fanins of window inputs
1455 Abc_Obj_t * pNode; int i;
1456 Abc_NtkForEachObjVec( vIns, pObj->pNtk, pNode, i ) {
1457 Abc_NtkInsertPartitions_rec( pNew, pNode, vMap, vvIns, vvOuts, vWins );
1458 Abc_NtkPi(pWin, i)->pCopy = pNode->pCopy;
1459 }
1460 // add window nodes
1461 Vec_Ptr_t * vNodes = Abc_NtkDfs( pWin, 0 );
1462 Vec_PtrForEachEntry( Abc_Obj_t *, vNodes, pNode, i )
1463 Abc_NtkCreateNodeMapped( pNew, pNode );
1464 Vec_PtrFree( vNodes );
1465 // transfer to window outputs
1466 Abc_NtkForEachObjVec( vOuts, pObj->pNtk, pNode, i )
1467 pNode->pCopy = Abc_ObjFanin0(Abc_NtkPo(pWin, i))->pCopy;
1468 assert( pObj->pCopy );
1469}
ABC_DLL Vec_Ptr_t * Abc_NtkDfs(Abc_Ntk_t *pNtk, int fCollectAll)
Definition abcDfs.c:82
Abc_Ntk_t * pNtk
Definition abc.h:130
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Abc_NtKMarkTfiTfo()

void Abc_NtKMarkTfiTfo ( Vec_Int_t * vOne,
Abc_Ntk_t * pNtk )

Definition at line 1759 of file abcPart.c.

1760{
1761 int i; Abc_Obj_t * pObj;
1762 Abc_NtkForEachObjVec( vOne, pNtk, pObj, i ) {
1763 //Abc_NodeSetTravIdPrevious(pObj);
1764 //Abc_ObjDfsMark_rec( pObj );
1765 Abc_NodeSetTravIdPrevious(pObj);
1766 Abc_ObjDfsMark2_rec( pObj );
1767 }
1768}
void Abc_ObjDfsMark2_rec(Abc_Obj_t *p)
Definition abcPart.c:1560
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Abc_NtkPartitionCompact()

void Abc_NtkPartitionCompact ( Vec_Ptr_t * vPartsAll,
Vec_Ptr_t * vPartSuppsAll,
int nSuppSizeLimit )

Function*************************************************************

Synopsis [Perform the smart partitioning.]

Description []

SideEffects []

SeeAlso []

Definition at line 658 of file abcPart.c.

659{
660 Vec_Int_t * vOne, * vPart, * vPartSupp, * vTemp;
661 int i, iPart;
662
663 if ( nSuppSizeLimit == 0 )
664 nSuppSizeLimit = 200;
665
666 // pack smaller partitions into larger blocks
667 iPart = 0;
668 vPart = vPartSupp = NULL;
669 Vec_PtrForEachEntry( Vec_Int_t *, vPartSuppsAll, vOne, i )
670 {
671 if ( Vec_IntSize(vOne) < nSuppSizeLimit )
672 {
673 if ( vPartSupp == NULL )
674 {
675 assert( vPart == NULL );
676 vPartSupp = Vec_IntDup(vOne);
677 vPart = (Vec_Int_t *)Vec_PtrEntry(vPartsAll, i);
678 }
679 else
680 {
681 vPartSupp = Vec_IntTwoMerge( vTemp = vPartSupp, vOne );
682 Vec_IntFree( vTemp );
683 vPart = Vec_IntTwoMerge( vTemp = vPart, (Vec_Int_t *)Vec_PtrEntry(vPartsAll, i) );
684 Vec_IntFree( vTemp );
685 Vec_IntFree( (Vec_Int_t *)Vec_PtrEntry(vPartsAll, i) );
686 }
687 if ( Vec_IntSize(vPartSupp) < nSuppSizeLimit )
688 continue;
689 }
690 else
691 vPart = (Vec_Int_t *)Vec_PtrEntry(vPartsAll, i);
692 // add the partition
693 Vec_PtrWriteEntry( vPartsAll, iPart, vPart );
694 vPart = NULL;
695 if ( vPartSupp )
696 {
697 Vec_IntFree( (Vec_Int_t *)Vec_PtrEntry(vPartSuppsAll, iPart) );
698 Vec_PtrWriteEntry( vPartSuppsAll, iPart, vPartSupp );
699 vPartSupp = NULL;
700 }
701 iPart++;
702 }
703 // add the last one
704 if ( vPart )
705 {
706 Vec_PtrWriteEntry( vPartsAll, iPart, vPart );
707 vPart = NULL;
708
709 assert( vPartSupp != NULL );
710 Vec_IntFree( (Vec_Int_t *)Vec_PtrEntry(vPartSuppsAll, iPart) );
711 Vec_PtrWriteEntry( vPartSuppsAll, iPart, vPartSupp );
712 vPartSupp = NULL;
713 iPart++;
714 }
715 Vec_PtrShrink( vPartsAll, iPart );
716 Vec_PtrShrink( vPartsAll, iPart );
717}
Here is the caller graph for this function:

◆ Abc_NtkPartitionNaive()

Vec_Ptr_t * Abc_NtkPartitionNaive ( Abc_Ntk_t * pNtk,
int nPartSize )

Function*************************************************************

Synopsis [Perform the naive partitioning.]

Description [Returns the ptr-vector of int-vectors.]

SideEffects []

SeeAlso []

Definition at line 862 of file abcPart.c.

863{
864 Vec_Ptr_t * vParts;
865 Abc_Obj_t * pObj;
866 int nParts, i;
867 nParts = (Abc_NtkCoNum(pNtk) / nPartSize) + ((Abc_NtkCoNum(pNtk) % nPartSize) > 0);
868 vParts = (Vec_Ptr_t *)Vec_VecStart( nParts );
869 Abc_NtkForEachCo( pNtk, pObj, i )
870 Vec_IntPush( (Vec_Int_t *)Vec_PtrEntry(vParts, i / nPartSize), i );
871 return vParts;
872}

◆ Abc_NtkPartitionPrint()

void Abc_NtkPartitionPrint ( Abc_Ntk_t * pNtk,
Vec_Ptr_t * vPartsAll,
Vec_Ptr_t * vPartSuppsAll )

Function*************************************************************

Synopsis [Perform the smart partitioning.]

Description []

SideEffects []

SeeAlso []

Definition at line 629 of file abcPart.c.

630{
631 Vec_Int_t * vOne;
632 int i, nOutputs, Counter;
633
634 Counter = 0;
635 Vec_PtrForEachEntry( Vec_Int_t *, vPartSuppsAll, vOne, i )
636 {
637 nOutputs = Vec_IntSize((Vec_Int_t *)Vec_PtrEntry(vPartsAll, i));
638 printf( "%d=(%d,%d) ", i, Vec_IntSize(vOne), nOutputs );
639 Counter += nOutputs;
640 if ( i == Vec_PtrSize(vPartsAll) - 1 )
641 break;
642 }
643// assert( Counter == Abc_NtkCoNum(pNtk) );
644 printf( "\nTotal = %d. Outputs = %d.\n", Counter, Abc_NtkCoNum(pNtk) );
645}

◆ Abc_NtkPartitionSmart()

Vec_Ptr_t * Abc_NtkPartitionSmart ( Abc_Ntk_t * pNtk,
int nSuppSizeLimit,
int fVerbose )

Function*************************************************************

Synopsis [Perform the smart partitioning.]

Description [Returns the ptr-vector of int-vectors.]

SideEffects []

SeeAlso []

Definition at line 730 of file abcPart.c.

731{
732 ProgressBar * pProgress;
733 Vec_Ptr_t * vPartSuppsChar;
734 Vec_Ptr_t * vSupps, * vPartsAll, * vPartsAll2, * vPartSuppsAll;
735 Vec_Int_t * vOne, * vPart, * vPartSupp, * vTemp;
736 int i, iPart, iOut, timeFind = 0;
737 abctime clk, clk2;
738
739 // compute the supports for all outputs
740clk = Abc_Clock();
741// vSupps = Abc_NtkComputeSupportsNaive( pNtk );
742 vSupps = Abc_NtkComputeSupportsSmart( pNtk );
743if ( fVerbose )
744{
745ABC_PRT( "Supps", Abc_Clock() - clk );
746}
747 // start char-based support representation
748 vPartSuppsChar = Vec_PtrAlloc( 1000 );
749
750 // create partitions
751clk = Abc_Clock();
752 vPartsAll = Vec_PtrAlloc( 256 );
753 vPartSuppsAll = Vec_PtrAlloc( 256 );
754 pProgress = Extra_ProgressBarStart( stdout, Vec_PtrSize(vSupps) );
755 Vec_PtrForEachEntry( Vec_Int_t *, vSupps, vOne, i )
756 {
757 Extra_ProgressBarUpdate( pProgress, i, NULL );
758// if ( i % 1000 == 0 )
759// printf( "CIs = %6d. COs = %6d. Processed = %6d (out of %6d). Parts = %6d.\r",
760// Abc_NtkCiNum(pNtk), Abc_NtkCoNum(pNtk), i, Vec_PtrSize(vSupps), Vec_PtrSize(vPartsAll) );
761 // get the output number
762 iOut = Vec_IntPop(vOne);
763 // find closely matching part
764clk2 = Abc_Clock();
765 iPart = Abc_NtkPartitionSmartFindPart( vPartSuppsAll, vPartsAll, vPartSuppsChar, nSuppSizeLimit, vOne );
766timeFind += Abc_Clock() - clk2;
767 if ( iPart == -1 )
768 {
769 // create new partition
770 vPart = Vec_IntAlloc( 32 );
771 Vec_IntPush( vPart, iOut );
772 // create new partition support
773 vPartSupp = Vec_IntDup( vOne );
774 // add this partition and its support
775 Vec_PtrPush( vPartsAll, vPart );
776 Vec_PtrPush( vPartSuppsAll, vPartSupp );
777
778 Vec_PtrPush( vPartSuppsChar, Abc_NtkSuppCharStart(vOne, Abc_NtkCiNum(pNtk)) );
779 }
780 else
781 {
782 // add output to this partition
783 vPart = (Vec_Int_t *)Vec_PtrEntry( vPartsAll, iPart );
784 Vec_IntPush( vPart, iOut );
785 // merge supports
786 vPartSupp = (Vec_Int_t *)Vec_PtrEntry( vPartSuppsAll, iPart );
787 vPartSupp = Vec_IntTwoMerge( vTemp = vPartSupp, vOne );
788 Vec_IntFree( vTemp );
789 // reinsert new support
790 Vec_PtrWriteEntry( vPartSuppsAll, iPart, vPartSupp );
791
792 Abc_NtkSuppCharAdd( (unsigned *)Vec_PtrEntry(vPartSuppsChar, iPart), vOne, Abc_NtkCiNum(pNtk) );
793 }
794 }
795 Extra_ProgressBarStop( pProgress );
796
797 // stop char-based support representation
798 Vec_PtrForEachEntry( Vec_Int_t *, vPartSuppsChar, vTemp, i )
799 ABC_FREE( vTemp );
800 Vec_PtrFree( vPartSuppsChar );
801
802//printf( "\n" );
803if ( fVerbose )
804{
805ABC_PRT( "Parts", Abc_Clock() - clk );
806//ABC_PRT( "Find ", timeFind );
807}
808
809clk = Abc_Clock();
810 // remember number of supports
811 Vec_PtrForEachEntry( Vec_Int_t *, vPartSuppsAll, vOne, i )
812 Vec_IntPush( vOne, i );
813 // sort the supports in the decreasing order
814 Vec_VecSort( (Vec_Vec_t *)vPartSuppsAll, 1 );
815 // reproduce partitions
816 vPartsAll2 = Vec_PtrAlloc( 256 );
817 Vec_PtrForEachEntry( Vec_Int_t *, vPartSuppsAll, vOne, i )
818 Vec_PtrPush( vPartsAll2, Vec_PtrEntry(vPartsAll, Vec_IntPop(vOne)) );
819 Vec_PtrFree( vPartsAll );
820 vPartsAll = vPartsAll2;
821
822 // compact small partitions
823// Abc_NtkPartitionPrint( pNtk, vPartsAll, vPartSuppsAll );
824 Abc_NtkPartitionCompact( vPartsAll, vPartSuppsAll, nSuppSizeLimit );
825
826if ( fVerbose )
827{
828ABC_PRT( "Comps", Abc_Clock() - clk );
829}
830 if ( fVerbose )
831 printf( "Created %d partitions.\n", Vec_PtrSize(vPartsAll) );
832// Abc_NtkPartitionPrint( pNtk, vPartsAll, vPartSuppsAll );
833
834 // cleanup
835 Vec_VecFree( (Vec_Vec_t *)vSupps );
836 Vec_VecFree( (Vec_Vec_t *)vPartSuppsAll );
837/*
838 // converts from intergers to nodes
839 Vec_PtrForEachEntry( Vec_Int_t *, vPartsAll, vPart, iPart )
840 {
841 vPartPtr = Vec_PtrAlloc( Vec_IntSize(vPart) );
842 Vec_IntForEachEntry( vPart, iOut, i )
843 Vec_PtrPush( vPartPtr, Abc_NtkCo(pNtk, iOut) );
844 Vec_IntFree( vPart );
845 Vec_PtrWriteEntry( vPartsAll, iPart, vPartPtr );
846 }
847*/
848 return vPartsAll;
849}
void Abc_NtkSuppCharAdd(unsigned *pBuffer, Vec_Int_t *vOne, int nPis)
Definition abcPart.c:500
unsigned * Abc_NtkSuppCharStart(Vec_Int_t *vOne, int nPis)
Definition abcPart.c:474
Vec_Ptr_t * Abc_NtkComputeSupportsSmart(Abc_Ntk_t *pNtk)
Definition abcPart.c:326
int Abc_NtkPartitionSmartFindPart(Vec_Ptr_t *vPartSuppsAll, Vec_Ptr_t *vPartsAll, Vec_Ptr_t *vPartSuppsChar, int nSuppSizeLimit, Vec_Int_t *vOne)
Definition abcPart.c:540
void Abc_NtkPartitionCompact(Vec_Ptr_t *vPartsAll, Vec_Ptr_t *vPartSuppsAll, int nSuppSizeLimit)
Definition abcPart.c:658
#define ABC_FREE(obj)
Definition abc_global.h:267
ABC_NAMESPACE_IMPL_START typedef char ProgressBar
Definition bbrNtbdd.c:27
void Extra_ProgressBarStop(ProgressBar *p)
ProgressBar * Extra_ProgressBarStart(FILE *pFile, int nItemsTotal)
FUNCTION DEFINITIONS ///.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Abc_NtkPartitionSmartFindPart()

int Abc_NtkPartitionSmartFindPart ( Vec_Ptr_t * vPartSuppsAll,
Vec_Ptr_t * vPartsAll,
Vec_Ptr_t * vPartSuppsChar,
int nSuppSizeLimit,
Vec_Int_t * vOne )

Function*************************************************************

Synopsis [Find the best partition.]

Description []

SideEffects []

SeeAlso []

Definition at line 540 of file abcPart.c.

541{
542/*
543 Vec_Int_t * vPartSupp, * vPart;
544 double Attract, Repulse, Cost, CostBest;
545 int i, nCommon, iBest;
546 iBest = -1;
547 CostBest = 0.0;
548 Vec_PtrForEachEntry( Vec_Int_t *, vPartSuppsAll, vPartSupp, i )
549 {
550 vPart = Vec_PtrEntry( vPartsAll, i );
551 if ( nPartSizeLimit > 0 && Vec_IntSize(vPart) >= nPartSizeLimit )
552 continue;
553 nCommon = Vec_IntTwoCountCommon( vPartSupp, vOne );
554 if ( nCommon == 0 )
555 continue;
556 if ( nCommon == Vec_IntSize(vOne) )
557 return i;
558 Attract = 1.0 * nCommon / Vec_IntSize(vOne);
559 if ( Vec_IntSize(vPartSupp) < 100 )
560 Repulse = 1.0;
561 else
562 Repulse = log10( Vec_IntSize(vPartSupp) / 10.0 );
563 Cost = pow( Attract, pow(Repulse, 5.0) );
564 if ( CostBest < Cost )
565 {
566 CostBest = Cost;
567 iBest = i;
568 }
569 }
570 if ( CostBest < 0.6 )
571 return -1;
572 return iBest;
573*/
574
575 Vec_Int_t * vPartSupp;//, * vPart;
576 int Attract, Repulse, Value, ValueBest;
577 int i, nCommon, iBest;
578// int nCommon2;
579 iBest = -1;
580 ValueBest = 0;
581 Vec_PtrForEachEntry( Vec_Int_t *, vPartSuppsAll, vPartSupp, i )
582 {
583 // skip partitions with too many outputs
584// vPart = Vec_PtrEntry( vPartsAll, i );
585// if ( nSuppSizeLimit > 0 && Vec_IntSize(vPart) >= nSuppSizeLimit )
586// continue;
587 // find the number of common variables between this output and the partitions
588// nCommon2 = Vec_IntTwoCountCommon( vPartSupp, vOne );
589 nCommon = Abc_NtkSuppCharCommon( (unsigned *)Vec_PtrEntry(vPartSuppsChar, i), vOne );
590// assert( nCommon2 == nCommon );
591 // if no common variables, continue searching
592 if ( nCommon == 0 )
593 continue;
594 // if all variables are common, the best partition if found
595 if ( nCommon == Vec_IntSize(vOne) )
596 return i;
597 // skip partitions whose size exceeds the limit
598 if ( nSuppSizeLimit > 0 && Vec_IntSize(vPartSupp) >= 2 * nSuppSizeLimit )
599 continue;
600 // figure out might be the good partition for this one
601 Attract = 1000 * nCommon / Vec_IntSize(vOne);
602 if ( Vec_IntSize(vPartSupp) < 100 )
603 Repulse = 1;
604 else
605 Repulse = 1+Abc_Base2Log(Vec_IntSize(vPartSupp)-100);
606 Value = Attract/Repulse;
607 if ( ValueBest < Value )
608 {
609 ValueBest = Value;
610 iBest = i;
611 }
612 }
613 if ( ValueBest < 75 )
614 return -1;
615 return iBest;
616}
int Abc_NtkSuppCharCommon(unsigned *pBuffer, Vec_Int_t *vOne)
Definition abcPart.c:521
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Abc_NtkPartStartHop()

Hop_Man_t * Abc_NtkPartStartHop ( Abc_Ntk_t * pNtk)

Function*************************************************************

Synopsis [Stitches together several networks with choice nodes.]

Description []

SideEffects []

SeeAlso []

Definition at line 963 of file abcPart.c.

964{
965 Hop_Man_t * pMan;
966 Abc_Obj_t * pObj;
967 int i;
968 // start the HOP package
969 pMan = Hop_ManStart();
970 pMan->vObjs = Vec_PtrAlloc( Abc_NtkObjNumMax(pNtk) + 1 );
971 Vec_PtrPush( pMan->vObjs, Hop_ManConst1(pMan) );
972 // map constant node and PIs
973 Abc_AigConst1(pNtk)->pNext = (Abc_Obj_t *)Hop_ManConst1(pMan);
974 Abc_NtkForEachCi( pNtk, pObj, i )
975 pObj->pNext = (Abc_Obj_t *)Hop_ObjCreatePi(pMan);
976 // map the internal nodes
977 Abc_AigForEachAnd( pNtk, pObj, i )
978 {
979 pObj->pNext = (Abc_Obj_t *)Hop_And( pMan, Hop_ObjChild0Next(pObj), Hop_ObjChild1Next(pObj) );
980 assert( !Abc_ObjIsComplement(pObj->pNext) );
981 }
982 // set the choice nodes
983 Abc_AigForEachAnd( pNtk, pObj, i )
984 {
985 if ( pObj->pCopy )
986 ((Hop_Obj_t *)pObj->pNext)->pData = pObj->pCopy->pNext;
987 }
988 // transfer the POs
989 Abc_NtkForEachCo( pNtk, pObj, i )
990 Hop_ObjCreatePo( pMan, Hop_ObjChild0Next(pObj) );
991 // check the new manager
992 if ( !Hop_ManCheck(pMan) )
993 printf( "Abc_NtkPartStartHop: HOP manager check has failed.\n" );
994 return pMan;
995}
#define Abc_AigForEachAnd(pNtk, pNode, i)
Definition abc.h:488
Hop_Obj_t * Hop_ObjCreatePo(Hop_Man_t *p, Hop_Obj_t *pDriver)
Definition hopObj.c:67
typedefABC_NAMESPACE_HEADER_START struct Hop_Man_t_ Hop_Man_t
INCLUDES ///.
Definition hop.h:49
int Hop_ManCheck(Hop_Man_t *p)
DECLARATIONS ///.
Definition hopCheck.c:45
Hop_Obj_t * Hop_And(Hop_Man_t *p, Hop_Obj_t *p0, Hop_Obj_t *p1)
Definition hopOper.c:104
Hop_Obj_t * Hop_ObjCreatePi(Hop_Man_t *p)
DECLARATIONS ///.
Definition hopObj.c:45
Hop_Man_t * Hop_ManStart()
DECLARATIONS ///.
Definition hopMan.c:45
struct Hop_Obj_t_ Hop_Obj_t
Definition hop.h:50
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Abc_NtkPartStitchChoices()

Abc_Ntk_t * Abc_NtkPartStitchChoices ( Abc_Ntk_t * pNtk,
Vec_Ptr_t * vParts )

Function*************************************************************

Synopsis [Stitches together several networks with choice nodes.]

Description []

SideEffects []

SeeAlso []

Definition at line 1008 of file abcPart.c.

1009{
1010 extern Abc_Ntk_t * Abc_NtkHopRemoveLoops( Abc_Ntk_t * pNtk, Hop_Man_t * pMan );
1011 Hop_Man_t * pMan;
1012 Vec_Ptr_t * vNodes;
1013 Abc_Ntk_t * pNtkNew, * pNtkTemp;
1014 Abc_Obj_t * pObj, * pFanin;
1015 int i, k, iNodeId;
1016
1017 // start a new network similar to the original one
1018 assert( Abc_NtkIsStrash(pNtk) );
1019 pNtkNew = Abc_NtkStartFrom( pNtk, ABC_NTK_STRASH, ABC_FUNC_AIG );
1020
1021 // annotate parts to point to the new network
1022 Vec_PtrForEachEntry( Abc_Ntk_t *, vParts, pNtkTemp, i )
1023 {
1024 assert( Abc_NtkIsStrash(pNtkTemp) );
1025 Abc_NtkCleanCopy( pNtkTemp );
1026
1027 // map the CI nodes
1028 Abc_AigConst1(pNtkTemp)->pCopy = Abc_AigConst1(pNtkNew);
1029 Abc_NtkForEachCi( pNtkTemp, pObj, k )
1030 {
1032 if ( iNodeId == -1 )
1033 {
1034 printf( "Cannot find CI node %s in the original network.\n", Abc_ObjName(pObj) );
1035 return NULL;
1036 }
1037 pObj->pCopy = Abc_NtkObj( pNtkNew, iNodeId );
1038 }
1039
1040 // add the internal nodes while saving representatives
1041 vNodes = Abc_AigDfs( pNtkTemp, 1, 0 );
1042 Vec_PtrForEachEntry( Abc_Obj_t *, vNodes, pObj, k )
1043 {
1044 pObj->pCopy = Abc_AigAnd( (Abc_Aig_t *)pNtkNew->pManFunc, Abc_ObjChild0Copy(pObj), Abc_ObjChild1Copy(pObj) );
1045 assert( !Abc_ObjIsComplement(pObj->pCopy) );
1046 if ( Abc_AigNodeIsChoice(pObj) )
1047 for ( pFanin = (Abc_Obj_t *)pObj->pData; pFanin; pFanin = (Abc_Obj_t *)pFanin->pData )
1048 pFanin->pCopy->pCopy = pObj->pCopy;
1049 }
1050 Vec_PtrFree( vNodes );
1051
1052 // map the CO nodes
1053 Abc_NtkForEachCo( pNtkTemp, pObj, k )
1054 {
1056 if ( iNodeId == -1 )
1057 {
1058 printf( "Cannot find CO node %s in the original network.\n", Abc_ObjName(pObj) );
1059 return NULL;
1060 }
1061 pObj->pCopy = Abc_NtkObj( pNtkNew, iNodeId );
1062 Abc_ObjAddFanin( pObj->pCopy, Abc_ObjChild0Copy(pObj) );
1063 }
1064 }
1065
1066 // connect the remaining POs
1067/*
1068 Abc_AigConst1(pNtk)->pCopy = Abc_AigConst1(pNtkNew);
1069 Abc_NtkForEachCi( pNtk, pObj, i )
1070 pObj->pCopy = Abc_NtkCi( pNtkNew, i );
1071 Abc_NtkForEachCo( pNtk, pObj, i )
1072 pObj->pCopy = Abc_NtkCo( pNtkNew, i );
1073*/
1074 Abc_NtkForEachCo( pNtk, pObj, i )
1075 {
1076 if ( Abc_ObjFaninNum(pObj->pCopy) == 0 )
1077 Abc_ObjAddFanin( pObj->pCopy, Abc_ObjChild0Copy(pObj) );
1078 }
1079
1080 // transform into the HOP manager
1081 pMan = Abc_NtkPartStartHop( pNtkNew );
1082 pNtkNew = Abc_NtkHopRemoveLoops( pNtkTemp = pNtkNew, pMan );
1083 Abc_NtkDelete( pNtkTemp );
1084
1085 // check correctness of the new network
1086 if ( !Abc_NtkCheck( pNtkNew ) )
1087 {
1088 printf( "Abc_NtkPartStitchChoices: The network check has failed.\n" );
1089 Abc_NtkDelete( pNtkNew );
1090 return NULL;
1091 }
1092 return pNtkNew;
1093}
Abc_Ntk_t * Abc_NtkHopRemoveLoops(Abc_Ntk_t *pNtk, Hop_Man_t *pMan)
Definition abcHaig.c:533
Hop_Man_t * Abc_NtkPartStartHop(Abc_Ntk_t *pNtk)
Definition abcPart.c:963
ABC_DLL Vec_Ptr_t * Abc_AigDfs(Abc_Ntk_t *pNtk, int fCollectAll, int fCollectCos)
Definition abcDfs.c:1198
ABC_DLL int Abc_NtkCheck(Abc_Ntk_t *pNtk)
FUNCTION DEFINITIONS ///.
Definition abcCheck.c:64
@ ABC_OBJ_BI
Definition abc.h:91
@ ABC_OBJ_BO
Definition abc.h:92
@ ABC_OBJ_PI
Definition abc.h:89
@ ABC_OBJ_PO
Definition abc.h:90
struct Abc_Aig_t_ Abc_Aig_t
Definition abc.h:117
ABC_DLL char * Abc_ObjName(Abc_Obj_t *pNode)
DECLARATIONS ///.
Definition abcNames.c:49
@ ABC_NTK_STRASH
Definition abc.h:58
ABC_DLL Abc_Obj_t * Abc_AigAnd(Abc_Aig_t *pMan, Abc_Obj_t *p0, Abc_Obj_t *p1)
Definition abcAig.c:700
@ ABC_FUNC_AIG
Definition abc.h:67
int Nm_ManFindIdByNameTwoTypes(Nm_Man_t *p, char *pName, int Type1, int Type2)
Definition nmApi.c:239
Nm_Man_t * pManName
Definition abc.h:160
void * pData
Definition abc.h:145
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Abc_NtkPartStitchFindRepr_rec()

Abc_Obj_t * Abc_NtkPartStitchFindRepr_rec ( Vec_Ptr_t * vEquiv,
Abc_Obj_t * pObj )

Function*************************************************************

Synopsis [Returns representative of the given node.]

Description []

SideEffects []

SeeAlso []

Definition at line 904 of file abcPart.c.

905{
906 Abc_Obj_t * pRepr;
907 pRepr = (Abc_Obj_t *)Vec_PtrEntry( vEquiv, pObj->Id );
908 if ( pRepr == NULL || pRepr == pObj )
909 return pObj;
910 return Abc_NtkPartStitchFindRepr_rec( vEquiv, pRepr );
911}
Abc_Obj_t * Abc_NtkPartStitchFindRepr_rec(Vec_Ptr_t *vEquiv, Abc_Obj_t *pObj)
Definition abcPart.c:904
int Id
Definition abc.h:132
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Abc_NtkPermuteLevel()

void Abc_NtkPermuteLevel ( Abc_Ntk_t * pNtk,
int Level )

Definition at line 1652 of file abcPart.c.

1653{
1654 Abc_Obj_t * pObj, * pNext; int i, k;
1655 Abc_NtkForEachNode( pNtk, pObj, i ) {
1656 int LevelMin = Abc_ObjLevel(pObj), LevelMax = Level + 1;
1657 Abc_ObjForEachFanout( pObj, pNext, k )
1658 if ( Abc_ObjIsNode(pNext) )
1659 LevelMax = Abc_MinInt( LevelMax, Abc_ObjLevel(pNext) );
1660 if ( LevelMin == LevelMax ) continue;
1661 assert( LevelMin < LevelMax );
1662 // randomly set level between LevelMin and LevelMax-1
1663 pObj->Level = LevelMin + (Abc_Random(0) % (LevelMax - LevelMin));
1664 assert( pObj->Level < LevelMax );
1665 }
1666}
unsigned Level
Definition abc.h:142
Here is the call graph for this function:

◆ Abc_NtKSelectRemove()

void Abc_NtKSelectRemove ( Vec_Wec_t * vSupps,
Vec_Int_t * vOne )

Definition at line 1750 of file abcPart.c.

1751{
1752 Vec_Int_t * vLevel; int i;
1753 Vec_WecForEachLevel( vSupps, vLevel, i )
1754 if ( Vec_IntTwoCountCommon(vLevel, vOne) > 0 )
1755 Vec_IntClear( vLevel );
1756 Vec_WecRemoveEmpty( vSupps );
1757}

◆ Abc_NtKSelectRemove2()

void Abc_NtKSelectRemove2 ( Vec_Wec_t * vSupps,
Vec_Int_t * vOne,
Abc_Ntk_t * pNtk )

Definition at line 1770 of file abcPart.c.

1771{
1772 Vec_Int_t * vLevel; int i, k; Abc_Obj_t * pObj;
1773 Abc_NtkForEachObjVec( vOne, pNtk, pObj, i ) {
1774 Abc_NodeSetTravIdPrevious(pObj);
1775 Abc_ObjDfsMark_rec( pObj );
1776 Abc_NodeSetTravIdPrevious(pObj);
1777 Abc_ObjDfsMark2_rec( pObj );
1778 }
1779 Vec_WecForEachLevel( vSupps, vLevel, i ) {
1780 Abc_NtkForEachObjVec( vLevel, pNtk, pObj, k )
1781 if ( Abc_NodeIsTravIdCurrent(pObj) )
1782 break;
1783 if ( k < Vec_IntSize(vLevel) )
1784 Vec_IntClear( vLevel );
1785 }
1786 Vec_WecRemoveEmpty( vSupps );
1787}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Abc_NtKSelectRemove3()

void Abc_NtKSelectRemove3 ( Vec_Wec_t * vSupps,
Vec_Int_t * vOne )

Definition at line 1789 of file abcPart.c.

1790{
1791 Vec_Int_t * vLevel; int i;
1792 Vec_WecForEachLevel( vSupps, vLevel, i )
1793 if ( Vec_IntTwoCountCommon(vLevel, vOne) == Vec_IntSize(vLevel) )
1794 Vec_IntClear( vLevel );
1795 Vec_WecRemoveEmpty( vSupps );
1796}
Here is the caller graph for this function:

◆ Abc_NtkStochMap()

void Abc_NtkStochMap ( int nSuppMax,
int nIters,
int TimeOut,
int Seed,
int fOverlap,
int fVerbose,
char * pScript,
int nProcs )

Function*************************************************************

Synopsis [Performs stochastic mapping.]

Description []

SideEffects []

SeeAlso []

Definition at line 1914 of file abcPart.c.

1915{
1916 abctime clkStart = Abc_Clock(); int i;
1917 abctime nTimeToStop = TimeOut ? Abc_Clock() + TimeOut * CLOCKS_PER_SEC : 0;
1919 assert( Abc_NtkIsMappedLogic(Abc_FrameReadNtk(Abc_FrameGetGlobalFrame())) );
1920 Abc_Random(1);
1921 for ( i = 0; i < 10+Seed; i++ )
1922 Abc_Random(0);
1923 if ( fVerbose ) {
1924 printf( "Running %d iterations of the script \"%s\"", nIters, pScript );
1925 if ( nProcs > 2 )
1926 printf( " using %d concurrent threads.\n", nProcs-1 );
1927 else
1928 printf( " without concurrency.\n" );
1929 fflush(stdout);
1930 }
1931 Vec_Ptr_t * vIns = NULL, * vOuts = NULL, * vNodes = NULL;
1932 for ( i = 0; i < nIters; i++ )
1933 {
1934 abctime clk = Abc_Clock();
1936 Vec_Ptr_t * vWins = Abc_NtkExtractPartitions( pNtk, i, nSuppMax, &vIns, &vOuts, &vNodes, fOverlap );
1937 Vec_Int_t * vGains = Abc_NtkStochProcess( vWins, pScript, nProcs, 0, 0 ); int nPartsInit = Vec_PtrSize(vWins);
1938 Abc_Ntk_t * pNew = Abc_NtkInsertPartitions( pNtk, vIns, vNodes, vOuts, vWins, fOverlap, vGains );
1940 if ( fVerbose )
1941 printf( "Iteration %3d : Using %3d -> %3d partitions. Reducing area from %.2f to %.2f. ",
1942 i, nPartsInit, Vec_PtrSize(vWins), Abc_NtkGetMappedArea(pNtk), Abc_NtkGetMappedArea(pNew) );
1943 if ( fVerbose )
1944 Abc_PrintTime( 0, "Time", Abc_Clock() - clk );
1945 // cleanup
1946 Abc_NtkDelete( pNtk );
1947 Vec_PtrFreeFunc( vWins, (void (*)(void *)) Abc_NtkDelete );
1948 Vec_IntFreeP( &vGains );
1949 if ( vIns ) Vec_PtrFreeFunc( vIns, (void (*)(void *)) Vec_IntFree );
1950 if ( vOuts ) Vec_PtrFreeFunc( vOuts, (void (*)(void *)) Vec_IntFree );
1951 if ( vNodes ) Vec_PtrFreeFunc( vNodes, (void (*)(void *)) Vec_IntFree );
1952 if ( nTimeToStop && Abc_Clock() > nTimeToStop )
1953 {
1954 printf( "Runtime limit (%d sec) is reached after %d iterations.\n", TimeOut, i );
1955 break;
1956 }
1957 }
1959 if ( fVerbose )
1960 printf( "Cumulatively reduced area by %.2f %% after %d iterations. ", 100.0*(aBeg - aEnd)/Abc_MaxFloat(aBeg, (float)1.0), nIters );
1961 if ( fVerbose )
1962 Abc_PrintTime( 0, "Total time", Abc_Clock() - clkStart );
1963}
Abc_Ntk_t * Abc_NtkInsertPartitions(Abc_Ntk_t *p, Vec_Ptr_t *vvIns, Vec_Ptr_t *vvNodes, Vec_Ptr_t *vvOuts, Vec_Ptr_t *vWins, int fOverlap, Vec_Int_t *vGains)
Definition abcPart.c:1470
Vec_Int_t * Abc_NtkStochProcess(Vec_Ptr_t *vWins, char *pScript, int nProcs, int TimeSecs, int fVerbose)
Definition abcPart.c:1341
Vec_Ptr_t * Abc_NtkExtractPartitions(Abc_Ntk_t *pNtk, int Iter, int nSuppMax, Vec_Ptr_t **pvIns, Vec_Ptr_t **pvOuts, Vec_Ptr_t **pvNodes, int fOverlap)
Definition abcPart.c:1874
ABC_DLL double Abc_NtkGetMappedArea(Abc_Ntk_t *pNtk)
Definition abcUtil.c:347
ABC_DLL Abc_Ntk_t * Abc_FrameReadNtk(Abc_Frame_t *p)
Definition mainFrame.c:327
ABC_DLL void Abc_FrameReplaceCurrentNetwork(Abc_Frame_t *p, Abc_Ntk_t *pNet)
Definition mainFrame.c:538
Here is the call graph for this function:

◆ Abc_NtkStochProcess()

Vec_Int_t * Abc_NtkStochProcess ( Vec_Ptr_t * vWins,
char * pScript,
int nProcs,
int TimeSecs,
int fVerbose )

Definition at line 1341 of file abcPart.c.

1342{
1343 if ( nProcs <= 2 ) {
1344 return Abc_NtkStochSynthesis( vWins, pScript );
1345 }
1346 Vec_Int_t * vGains = Vec_IntStartFull( Vec_PtrSize(vWins) );
1347 StochSynData_t * pData = ABC_CALLOC( StochSynData_t, Vec_PtrSize(vWins) );
1348 Vec_Ptr_t * vData = Vec_PtrAlloc( Vec_PtrSize(vWins) );
1349 Abc_Ntk_t * pNtk; int i;
1350 //Abc_Random(1);
1351 Vec_PtrForEachEntry( Abc_Ntk_t *, vWins, pNtk, i ) {
1352 pData[i].pIn = pNtk;
1353 pData[i].pOut = NULL;
1354 pData[i].pScript = pScript;
1355 pData[i].Rand = Abc_Random(0) % 0x1000000;
1356 pData[i].TimeOut = TimeSecs;
1357 Vec_PtrPush( vData, pData+i );
1358 }
1359 Util_ProcessThreads( Abc_NtkStochProcess1, vData, nProcs, TimeSecs, fVerbose );
1360 // replace old AIGs by new AIGs
1361 Vec_PtrForEachEntry( Abc_Ntk_t *, vWins, pNtk, i ) {
1362 if ( Abc_NtkIsMappedLogic(pNtk) )
1363 Vec_IntWriteEntry( vGains, i, (int)(Abc_NtkGetMappedArea(pNtk) - Abc_NtkGetMappedArea(pData[i].pOut)) );
1364 else
1365 Vec_IntWriteEntry( vGains, i, Abc_NtkNodeNum(pNtk) - Abc_NtkNodeNum(pData[i].pOut) );
1366 Abc_NtkDelete( pNtk );
1367 Vec_PtrWriteEntry( vWins, i, pData[i].pOut );
1368 }
1369 Vec_PtrFree( vData );
1370 ABC_FREE( pData );
1371 return vGains;
1372}
int Abc_NtkStochProcess1(void *p)
Definition abcPart.c:1332
Vec_Int_t * Abc_NtkStochSynthesis(Vec_Ptr_t *vWins, char *pScript)
Definition abcPart.c:1220
void Util_ProcessThreads(int(*pUserFunc)(void *), void *vData, int nProcs, int TimeOut, int fVerbose)
DECLARATIONS ///.
Definition utilPth.c:70
#define ABC_CALLOC(type, num)
Definition abc_global.h:265
struct StochSynData_t_ StochSynData_t
Gia_Man_t * pIn
Definition giaStoch.c:155
Gia_Man_t * pOut
Definition giaStoch.c:156
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Abc_NtkStochProcess1()

int Abc_NtkStochProcess1 ( void * p)

Definition at line 1332 of file abcPart.c.

1333{
1334 StochSynData_t * pData = (StochSynData_t *)p;
1335 assert( pData->pIn != NULL );
1336 assert( pData->pOut == NULL );
1337 pData->pOut = Abc_NtkStochProcessOne( pData->pIn, pData->pScript, pData->Rand, pData->TimeOut );
1338 return 1;
1339}
Abc_Ntk_t * Abc_NtkStochProcessOne(Abc_Ntk_t *p, char *pScript0, int Rand, int TimeSecs)
Definition abcPart.c:1294
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Abc_NtkStochProcessOne()

Abc_Ntk_t * Abc_NtkStochProcessOne ( Abc_Ntk_t * p,
char * pScript0,
int Rand,
int TimeSecs )

Definition at line 1294 of file abcPart.c.

1295{
1296 extern int Abc_NtkWriteToFile( char * pFileName, Abc_Ntk_t * pNtk );
1297 extern Abc_Ntk_t * Abc_NtkReadFromFile( char * pFileName );
1298 Abc_Ntk_t * pNew, * pTemp;
1299 char FileName[100], Command[1000], PreCommand[500] = {0};
1300 char * pLibFileName = Abc_NtkIsMappedLogic(p) ? Mio_LibraryReadFileName((Mio_Library_t *)p->pManFunc) : NULL;
1301 if ( pLibFileName ) sprintf( PreCommand, "read_genlib %s; ", pLibFileName );
1302 sprintf( FileName, "%06x.mm", Rand );
1303 Abc_NtkWriteToFile( FileName, p );
1304 char * pScript = Abc_UtilStrsav( pScript0 );
1305 sprintf( Command, "./abc -q \"%sread_mm %s; %s; write_mm %s\"", PreCommand[0] ? PreCommand : "", FileName, pScript, FileName );
1306#if defined(__wasm)
1307 if ( 1 )
1308#else
1309 if ( system( (char *)Command ) )
1310#endif
1311 {
1312 fprintf( stderr, "The following command has returned non-zero exit status:\n" );
1313 fprintf( stderr, "\"%s\"\n", (char *)Command );
1314 fprintf( stderr, "Sorry for the inconvenience.\n" );
1315 fflush( stdout );
1316 unlink( FileName );
1317 ABC_FREE( pScript );
1318 return Abc_NtkDupDfs(p);
1319 }
1320 ABC_FREE( pScript );
1321 pNew = Abc_NtkReadFromFile( FileName );
1322 unlink( FileName );
1323 if ( pNew && Abc_NtkGetMappedArea(pNew) <= Abc_NtkGetMappedArea(p) ) {
1324 pNew = Abc_NtkDupDfs( pTemp = pNew );
1325 Abc_NtkDelete( pTemp );
1326 return pNew;
1327 }
1328 if ( pNew ) Abc_NtkDelete( pNew );
1329 return Abc_NtkDupDfs(p);
1330}
int Abc_NtkWriteToFile(char *pFileName, Abc_Ntk_t *pNtk)
Definition abcMap.c:1006
Abc_Ntk_t * Abc_NtkReadFromFile(char *pFileName)
Definition abcMap.c:992
struct Mio_LibraryStruct_t_ Mio_Library_t
Definition mio.h:42
char * Mio_LibraryReadFileName(Mio_Library_t *pLib)
Definition mioApi.c:44
int system()
char * sprintf()
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Abc_NtkStochSynthesis()

Vec_Int_t * Abc_NtkStochSynthesis ( Vec_Ptr_t * vWins,
char * pScript )

Function*************************************************************

Synopsis [Optimization.]

Description []

SideEffects []

SeeAlso []

Definition at line 1220 of file abcPart.c.

1221{
1222 Vec_Int_t * vGains = Vec_IntStartFull( Vec_PtrSize(vWins) );
1223 Abc_Ntk_t * pNtk, * pNew; int i;
1224 Vec_PtrForEachEntry( Abc_Ntk_t *, vWins, pNtk, i )
1225 {
1227 if ( Abc_FrameIsBatchMode() )
1228 {
1230 {
1231 Abc_Print( 1, "Something did not work out with the command \"%s\".\n", pScript );
1232 return vGains;
1233 }
1234 }
1235 else
1236 {
1239 {
1240 Abc_Print( 1, "Something did not work out with the command \"%s\".\n", pScript );
1242 return vGains;
1243 }
1245 }
1247 if ( Abc_NtkIsMappedLogic(pNew) && Abc_NtkIsMappedLogic(pNtk) )
1248 {
1249 double Before = Abc_NtkGetMappedArea(pNtk);
1250 double After = Abc_NtkGetMappedArea(pNew);
1251 if ( Before >= After )
1252 {
1253 Vec_IntWriteEntry( vGains, i, (int)(Before - After) );
1254 Abc_NtkDelete( pNtk );
1255 pNtk = Abc_NtkDupDfs( pNew );
1256 }
1257 }
1258 else
1259 {
1260 if ( Abc_NtkNodeNum(pNtk) >= Abc_NtkNodeNum(pNew) )
1261 {
1262 Vec_IntWriteEntry( vGains, i, Abc_NtkNodeNum(pNtk) - Abc_NtkNodeNum(pNew) );
1263 Abc_NtkDelete( pNtk );
1264 pNtk = Abc_NtkDupDfs( pNew );
1265 }
1266 }
1267 Vec_PtrWriteEntry( vWins, i, pNtk );
1268 }
1269 return vGains;
1270}
ABC_DLL void Abc_FrameSetBatchMode(int Mode)
Definition mainFrame.c:111
ABC_DLL int Abc_FrameIsBatchMode()
Definition mainFrame.c:110
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Abc_NtkSuppCharAdd()

void Abc_NtkSuppCharAdd ( unsigned * pBuffer,
Vec_Int_t * vOne,
int nPis )

Function*************************************************************

Synopsis [Add to bitwise support representation.]

Description []

SideEffects []

SeeAlso []

Definition at line 500 of file abcPart.c.

501{
502 int i, Entry;
503 Vec_IntForEachEntry( vOne, Entry, i )
504 {
505 assert( Entry < nPis );
506 Abc_InfoSetBit( pBuffer, Entry );
507 }
508}
Here is the caller graph for this function:

◆ Abc_NtkSuppCharCommon()

int Abc_NtkSuppCharCommon ( unsigned * pBuffer,
Vec_Int_t * vOne )

Function*************************************************************

Synopsis [Find the common variables using bitwise support representation.]

Description []

SideEffects []

SeeAlso []

Definition at line 521 of file abcPart.c.

522{
523 int i, Entry, nCommon = 0;
524 Vec_IntForEachEntry( vOne, Entry, i )
525 nCommon += Abc_InfoHasBit(pBuffer, Entry);
526 return nCommon;
527}
Here is the caller graph for this function:

◆ Abc_NtkSuppCharStart()

unsigned * Abc_NtkSuppCharStart ( Vec_Int_t * vOne,
int nPis )

Function*************************************************************

Synopsis [Start bitwise support representation.]

Description []

SideEffects []

SeeAlso []

Definition at line 474 of file abcPart.c.

475{
476 unsigned * pBuffer;
477 int i, Entry;
478 int nWords = Abc_BitWordNum(nPis);
479 pBuffer = ABC_ALLOC( unsigned, nWords );
480 memset( pBuffer, 0, sizeof(unsigned) * nWords );
481 Vec_IntForEachEntry( vOne, Entry, i )
482 {
483 assert( Entry < nPis );
484 Abc_InfoSetBit( pBuffer, Entry );
485 }
486 return pBuffer;
487}
int nWords
Definition abcNpn.c:127
#define ABC_ALLOC(type, num)
Definition abc_global.h:264
char * memset()
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Abc_NtkWindowCheckTopoError()

int Abc_NtkWindowCheckTopoError ( Abc_Ntk_t * p,
Vec_Int_t * vIns,
Vec_Int_t * vOuts )

Definition at line 1401 of file abcPart.c.

1402{
1403 Abc_Obj_t * pObj; int i, fError = 0;
1404 // outputs should be internal nodes
1405 Abc_NtkForEachObjVec( vOuts, p, pObj, i )
1406 assert(Abc_ObjIsNode(pObj));
1407 // mark outputs
1408 Abc_NtkIncrementTravId( p );
1409 Abc_NtkForEachObjVec( vOuts, p, pObj, i )
1410 Abc_NodeSetTravIdCurrent(pObj);
1411 // start from inputs and make sure we do not reach any of the outputs
1412 Abc_NtkIncrementTravId( p );
1413 Abc_NtkForEachObjVec( vIns, p, pObj, i )
1414 fError |= Abc_NtkWindowCheckTopoError_rec(pObj);
1415 return fError;
1416}
int Abc_NtkWindowCheckTopoError_rec(Abc_Obj_t *pObj)
Definition abcPart.c:1385
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Abc_NtkWindowCheckTopoError_rec()

int Abc_NtkWindowCheckTopoError_rec ( Abc_Obj_t * pObj)

Function*************************************************************

Synopsis [Returns 1 if this window has a topo error (forward path from an output to an input).]

Description []

SideEffects []

SeeAlso []

Definition at line 1385 of file abcPart.c.

1386{
1387 if ( !Abc_ObjIsNode(pObj) )
1388 return 0;
1389 if ( Abc_NodeIsTravIdPrevious(pObj) )
1390 return 1; // there is an error
1391 if ( Abc_NodeIsTravIdCurrent(pObj) )
1392 return 0; // there is no error; visited this node before
1393 Abc_NodeSetTravIdPrevious(pObj);
1394 Abc_Obj_t * pFanin; int i;
1395 Abc_ObjForEachFanin( pObj, pFanin, i )
1396 if ( Abc_NtkWindowCheckTopoError_rec(pFanin) )
1397 return 1;
1398 Abc_NodeSetTravIdCurrent(pObj);
1399 return 0;
1400}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Abc_ObjDfsMark2_rec()

void Abc_ObjDfsMark2_rec ( Abc_Obj_t * p)

Definition at line 1560 of file abcPart.c.

1561{
1562 Abc_Obj_t * pFanout; int i;
1563 assert( !p->fMarkA );
1564 if ( Abc_NodeIsTravIdCurrent( p ) )
1565 return;
1566 Abc_NodeSetTravIdCurrent( p );
1567 Abc_ObjForEachFanout( p, pFanout, i )
1568 Abc_ObjDfsMark2_rec( pFanout );
1569}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Abc_ObjDfsMark_rec()

void Abc_ObjDfsMark_rec ( Abc_Obj_t * p)

Function*************************************************************

Synopsis [Partitioning.]

Description []

SideEffects []

SeeAlso []

Definition at line 1550 of file abcPart.c.

1551{
1552 Abc_Obj_t * pFanin; int i;
1553 assert( !p->fMarkA );
1554 if ( Abc_NodeIsTravIdCurrent( p ) )
1555 return;
1556 Abc_NodeSetTravIdCurrent( p );
1557 Abc_ObjForEachFanin( p, pFanin, i )
1558 Abc_ObjDfsMark_rec( pFanin );
1559}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Supp_ManFetch()

char * Supp_ManFetch ( Supp_Man_t * p,
int nSize )

Function*************************************************************

Synopsis [Fetches the memory entry of the given size.]

Description []

SideEffects []

SeeAlso []

Definition at line 124 of file abcPart.c.

125{
126 int Type, nSizeReal;
127 char * pMemory;
128 assert( nSize > 0 );
129 Type = Supp_SizeType( nSize, p->nStepSize );
130 Vec_PtrFillExtra( p->vFree, Type + 1, NULL );
131 if ( (pMemory = (char *)Vec_PtrEntry( p->vFree, Type )) )
132 {
133 Vec_PtrWriteEntry( p->vFree, Type, Supp_OneNext(pMemory) );
134 return pMemory;
135 }
136 nSizeReal = p->nStepSize * Type;
137 if ( p->nFreeSize < nSizeReal )
138 {
139 p->pFreeBuf = ABC_ALLOC( char, p->nChunkSize );
140 p->nFreeSize = p->nChunkSize;
141 Vec_PtrPush( p->vMemory, p->pFreeBuf );
142 }
143 assert( p->nFreeSize >= nSizeReal );
144 pMemory = p->pFreeBuf;
145 p->pFreeBuf += nSizeReal;
146 p->nFreeSize -= nSizeReal;
147 return pMemory;
148}

◆ Supp_ManMergeEntry()

Supp_One_t * Supp_ManMergeEntry ( Supp_Man_t * pMan,
Supp_One_t * p1,
Supp_One_t * p2,
int nRefs )

Function*************************************************************

Synopsis [Merges two entries.]

Description []

SideEffects []

SeeAlso []

Definition at line 220 of file abcPart.c.

221{
222 Supp_One_t * p = Supp_ManFetchEntry( pMan, p1->nOuts + p2->nOuts, nRefs );
223 int * pBeg1 = p1->pOuts;
224 int * pBeg2 = p2->pOuts;
225 int * pBeg = p->pOuts;
226 int * pEnd1 = p1->pOuts + p1->nOuts;
227 int * pEnd2 = p2->pOuts + p2->nOuts;
228 while ( pBeg1 < pEnd1 && pBeg2 < pEnd2 )
229 {
230 if ( *pBeg1 == *pBeg2 )
231 *pBeg++ = *pBeg1++, pBeg2++;
232 else if ( *pBeg1 < *pBeg2 )
233 *pBeg++ = *pBeg1++;
234 else
235 *pBeg++ = *pBeg2++;
236 }
237 while ( pBeg1 < pEnd1 )
238 *pBeg++ = *pBeg1++;
239 while ( pBeg2 < pEnd2 )
240 *pBeg++ = *pBeg2++;
241 p->nOuts = pBeg - p->pOuts;
242 assert( p->nOuts <= p->nOutsAlloc );
243 assert( p->nOuts >= p1->nOuts );
244 assert( p->nOuts >= p2->nOuts );
245 return p;
246}
Here is the caller graph for this function:

◆ Supp_ManRecycle()

void Supp_ManRecycle ( Supp_Man_t * p,
char * pMemory,
int nSize )

Function*************************************************************

Synopsis [Recycles the memory entry of the given size.]

Description []

SideEffects []

SeeAlso []

Definition at line 161 of file abcPart.c.

162{
163 int Type;
164 Type = Supp_SizeType( nSize, p->nStepSize );
165 Vec_PtrFillExtra( p->vFree, Type + 1, NULL );
166 Supp_OneSetNext( pMemory, (char *)Vec_PtrEntry(p->vFree, Type) );
167 Vec_PtrWriteEntry( p->vFree, Type, pMemory );
168}

◆ Supp_ManStart()

Supp_Man_t * Supp_ManStart ( int nChunkSize,
int nStepSize )

FUNCTION DEFINITIONS ///.

Function*************************************************************

Synopsis [Start the memory manager.]

Description []

SideEffects []

SeeAlso []

Definition at line 79 of file abcPart.c.

80{
81 Supp_Man_t * p;
82 p = ABC_ALLOC( Supp_Man_t, 1 );
83 memset( p, 0, sizeof(Supp_Man_t) );
84 p->nChunkSize = nChunkSize;
85 p->nStepSize = nStepSize;
86 p->vMemory = Vec_PtrAlloc( 1000 );
87 p->vFree = Vec_PtrAlloc( 1000 );
88 return p;
89}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Supp_ManStop()

void Supp_ManStop ( Supp_Man_t * p)

Function*************************************************************

Synopsis [Stops the memory manager.]

Description []

SideEffects []

SeeAlso []

Definition at line 102 of file abcPart.c.

103{
104 void * pMemory;
105 int i;
106 Vec_PtrForEachEntry( void *, p->vMemory, pMemory, i )
107 ABC_FREE( pMemory );
108 Vec_PtrFree( p->vMemory );
109 Vec_PtrFree( p->vFree );
110 ABC_FREE( p );
111}
Here is the caller graph for this function:

◆ Supp_ManTransferEntry()

Vec_Int_t * Supp_ManTransferEntry ( Supp_One_t * p)

Function*************************************************************

Synopsis [Tranfers the entry.]

Description []

SideEffects []

SeeAlso []

Definition at line 259 of file abcPart.c.

260{
261 Vec_Int_t * vSupp;
262 int i;
263 vSupp = Vec_IntAlloc( p->nOuts );
264 for ( i = 0; i < p->nOuts; i++ )
265 Vec_IntPush( vSupp, p->pOuts[i] );
266 return vSupp;
267}
Here is the caller graph for this function: