abc-master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
abcPart.c File Reference
#include "base/abc/abc.h"
#include "base/main/main.h"
#include "base/cmd/cmd.h"

Go to the source code of this file.

Data Structures

struct  Supp_Man_t_
 
struct  Supp_One_t_
 

Typedefs

typedef
typedefABC_NAMESPACE_IMPL_START
struct Supp_Man_t_ 
Supp_Man_t
 DECLARATIONS ///. More...
 
typedef struct Supp_One_t_ Supp_One_t
 

Functions

static int Supp_SizeType (int nSize, int nStepSize)
 
static char * Supp_OneNext (char *pPart)
 
static void Supp_OneSetNext (char *pPart, char *pNext)
 
Supp_Man_tSupp_ManStart (int nChunkSize, int nStepSize)
 FUNCTION DEFINITIONS ///. More...
 
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)
 
static Supp_One_tSupp_ManFetchEntry (Supp_Man_t *p, int nWords, int nRefs)
 
static void Supp_ManRecycleEntry (Supp_Man_t *p, Supp_One_t *pEntry)
 
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)
 
static Abc_Obj_tAbc_NtkPartStitchCopy0 (Vec_Ptr_t *vEquiv, Abc_Obj_t *pObj)
 
static Abc_Obj_tAbc_NtkPartStitchCopy1 (Vec_Ptr_t *vEquiv, Abc_Obj_t *pObj)
 
static Hop_Obj_tHop_ObjChild0Next (Abc_Obj_t *pObj)
 
static Hop_Obj_tHop_ObjChild1Next (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)
 

Typedef Documentation

typedef typedefABC_NAMESPACE_IMPL_START struct Supp_Man_t_ Supp_Man_t

DECLARATIONS ///.

CFile****************************************************************

FileName [abcPart.c]

SystemName [ABC: Logic synthesis and verification system.]

PackageName [Network and node package.]

Synopsis [Output partitioning package.]

Author [Alan Mishchenko]

Affiliation [UC Berkeley]

Date [Ver. 1.0. Started - June 20, 2005.]

Revision [

Id:
abcPart.c,v 1.00 2005/06/20 00:00:00 alanmi Exp

]

Definition at line 32 of file abcPart.c.

typedef struct Supp_One_t_ Supp_One_t

Definition at line 43 of file abcPart.c.

Function Documentation

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 417 of file abcPart.c.

418 {
419  Vec_Ptr_t * vSupp, * vSupports;
420  Vec_Int_t * vSuppI;
421  Abc_Obj_t * pObj, * pTemp;
422  int i, k;
423  // set the PI numbers
424  Abc_NtkForEachCi( pNtk, pObj, i )
425  pObj->pNext = (Abc_Obj_t *)(ABC_PTRINT_T)i;
426  // save the CI numbers
427  vSupports = Vec_PtrAlloc( Abc_NtkCoNum(pNtk) );
428  Abc_NtkForEachCo( pNtk, pObj, i )
429  {
430  if ( !Abc_ObjIsNode(Abc_ObjFanin0(pObj)) )
431  continue;
432  vSupp = Abc_NtkNodeSupport( pNtk, &pObj, 1 );
433  vSuppI = (Vec_Int_t *)vSupp;
434  Vec_PtrForEachEntry( Abc_Obj_t *, vSupp, pTemp, k )
435  Vec_IntWriteEntry( vSuppI, k, (int)(ABC_PTRINT_T)pTemp->pNext );
436  Vec_IntSort( vSuppI, 0 );
437  // append the number of this output
438  Vec_IntPush( vSuppI, i );
439  // save the support in the vector
440  Vec_PtrPush( vSupports, vSuppI );
441  }
442  // clean the CI numbers
443  Abc_NtkForEachCi( pNtk, pObj, i )
444  pObj->pNext = NULL;
445  // sort supports by size
446  Vec_VecSort( (Vec_Vec_t *)vSupports, 1 );
447 /*
448  Vec_PtrForEachEntry( Vec_Int_t *, vSupports, vSuppI, i )
449  printf( "%d ", Vec_IntSize(vSuppI) );
450  printf( "\n" );
451 */
452  return vSupports;
453 }
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition: vecPtr.h:42
static void Vec_VecSort(Vec_Vec_t *p, int fReverse)
Definition: vecVec.h:546
typedefABC_NAMESPACE_HEADER_START struct Vec_Vec_t_ Vec_Vec_t
INCLUDES ///.
Definition: vecVec.h:42
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition: bblif.c:37
static void Vec_PtrPush(Vec_Ptr_t *p, void *Entry)
Definition: vecPtr.h:606
#define Abc_NtkForEachCo(pNtk, pCo, i)
Definition: abc.h:519
static void Vec_IntSort(Vec_Int_t *p, int fReverse)
Definition: vecInt.h:1293
static Abc_Obj_t * Abc_ObjFanin0(Abc_Obj_t *pObj)
Definition: abc.h:373
static int Abc_NtkCoNum(Abc_Ntk_t *pNtk)
Definition: abc.h:288
static void Vec_IntWriteEntry(Vec_Int_t *p, int i, int Entry)
Definition: bblif.c:285
static int Abc_ObjIsNode(Abc_Obj_t *pObj)
Definition: abc.h:355
ABC_DLL Vec_Ptr_t * Abc_NtkNodeSupport(Abc_Ntk_t *pNtk, Abc_Obj_t **ppNodes, int nNodes)
Definition: abcDfs.c:859
static void Vec_IntPush(Vec_Int_t *p, int Entry)
Definition: bblif.c:468
#define Abc_NtkForEachCi(pNtk, pCi, i)
Definition: abc.h:515
static Vec_Ptr_t * Vec_PtrAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: vecPtr.h:83
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.
Definition: vecPtr.h:55
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 318 of file abcPart.c.

319 {
320  Vec_Ptr_t * vSupports;
321  Vec_Ptr_t * vNodes;
322  Vec_Int_t * vSupp;
323  Supp_Man_t * p;
324  Supp_One_t * pPart0, * pPart1;
325  Abc_Obj_t * pObj;
326  int i;
327  // set the number of PIs/POs
328  Abc_NtkForEachCi( pNtk, pObj, i )
329  pObj->pNext = (Abc_Obj_t *)(ABC_PTRINT_T)i;
330  Abc_NtkForEachCo( pNtk, pObj, i )
331  pObj->pNext = (Abc_Obj_t *)(ABC_PTRINT_T)i;
332  // start the support computation manager
333  p = Supp_ManStart( 1 << 20, 1 << 6 );
334  // consider objects in the topological order
335  vSupports = Vec_PtrAlloc( Abc_NtkCoNum(pNtk) );
336  Abc_NtkCleanCopy(pNtk);
337  // order the nodes so that the PIs and POs follow naturally
338  vNodes = Abc_NtkDfsNatural( pNtk );
339  Vec_PtrForEachEntry( Abc_Obj_t *, vNodes, pObj, i )
340  {
341  if ( Abc_ObjIsNode(pObj) )
342  {
343  pPart0 = (Supp_One_t *)Abc_ObjFanin0(pObj)->pCopy;
344  pPart1 = (Supp_One_t *)Abc_ObjFanin1(pObj)->pCopy;
345  pObj->pCopy = (Abc_Obj_t *)Supp_ManMergeEntry( p, pPart0, pPart1, Abc_ObjFanoutNum(pObj) );
346  assert( pPart0->nRefs > 0 );
347  if ( --pPart0->nRefs == 0 )
348  Supp_ManRecycleEntry( p, pPart0 );
349  assert( pPart1->nRefs > 0 );
350  if ( --pPart1->nRefs == 0 )
351  Supp_ManRecycleEntry( p, pPart1 );
352  continue;
353  }
354  if ( Abc_ObjIsCo(pObj) )
355  {
356  pPart0 = (Supp_One_t *)Abc_ObjFanin0(pObj)->pCopy;
357  // only save the CO if it is non-trivial
358  if ( Abc_ObjIsNode(Abc_ObjFanin0(pObj)) )
359  {
360  vSupp = Supp_ManTransferEntry(pPart0);
361  Vec_IntPush( vSupp, (int)(ABC_PTRINT_T)pObj->pNext );
362  Vec_PtrPush( vSupports, vSupp );
363  }
364  assert( pPart0->nRefs > 0 );
365  if ( --pPart0->nRefs == 0 )
366  Supp_ManRecycleEntry( p, pPart0 );
367  continue;
368  }
369  if ( Abc_ObjIsCi(pObj) )
370  {
371  if ( Abc_ObjFanoutNum(pObj) )
372  {
373  pPart0 = (Supp_One_t *)Supp_ManFetchEntry( p, 1, Abc_ObjFanoutNum(pObj) );
374  pPart0->pOuts[ pPart0->nOuts++ ] = (int)(ABC_PTRINT_T)pObj->pNext;
375  pObj->pCopy = (Abc_Obj_t *)pPart0;
376  }
377  continue;
378  }
379  if ( pObj == Abc_AigConst1(pNtk) )
380  {
381  if ( Abc_ObjFanoutNum(pObj) )
382  pObj->pCopy = (Abc_Obj_t *)Supp_ManFetchEntry( p, 0, Abc_ObjFanoutNum(pObj) );
383  continue;
384  }
385  assert( 0 );
386  }
387  Vec_PtrFree( vNodes );
388 //printf( "Memory usage = %d MB.\n", Vec_PtrSize(p->vMemory) * p->nChunkSize / (1<<20) );
389  Supp_ManStop( p );
390  // sort supports by size
391  Vec_VecSort( (Vec_Vec_t *)vSupports, 1 );
392  // clear the number of PIs/POs
393  Abc_NtkForEachCi( pNtk, pObj, i )
394  pObj->pNext = NULL;
395  Abc_NtkForEachCo( pNtk, pObj, i )
396  pObj->pNext = NULL;
397 /*
398  Vec_PtrForEachEntry( Vec_Int_t *, vSupports, vSupp, i )
399  printf( "%d ", Vec_IntSize(vSupp) );
400  printf( "\n" );
401 */
402  return vSupports;
403 }
static Supp_One_t * Supp_ManFetchEntry(Supp_Man_t *p, int nWords, int nRefs)
Definition: abcPart.c:173
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition: vecPtr.h:42
static Abc_Obj_t * Abc_ObjFanin1(Abc_Obj_t *pObj)
Definition: abc.h:374
static int Abc_ObjIsCi(Abc_Obj_t *pObj)
Definition: abc.h:351
static void Vec_VecSort(Vec_Vec_t *p, int fReverse)
Definition: vecVec.h:546
int nRefs
Definition: abcPart.c:46
typedefABC_NAMESPACE_HEADER_START struct Vec_Vec_t_ Vec_Vec_t
INCLUDES ///.
Definition: vecVec.h:42
ABC_DLL Abc_Obj_t * Abc_AigConst1(Abc_Ntk_t *pNtk)
Definition: abcAig.c:683
static Llb_Mgr_t * p
Definition: llb3Image.c:950
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition: bblif.c:37
static int Abc_ObjFanoutNum(Abc_Obj_t *pObj)
Definition: abc.h:365
void Supp_ManStop(Supp_Man_t *p)
Definition: abcPart.c:94
static void Vec_PtrPush(Vec_Ptr_t *p, void *Entry)
Definition: vecPtr.h:606
#define Abc_NtkForEachCo(pNtk, pCo, i)
Definition: abc.h:519
static Abc_Obj_t * Abc_ObjFanin0(Abc_Obj_t *pObj)
Definition: abc.h:373
static int Abc_NtkCoNum(Abc_Ntk_t *pNtk)
Definition: abc.h:288
static void Supp_ManRecycleEntry(Supp_Man_t *p, Supp_One_t *pEntry)
Definition: abcPart.c:194
static int Abc_ObjIsCo(Abc_Obj_t *pObj)
Definition: abc.h:352
static int Abc_ObjIsNode(Abc_Obj_t *pObj)
Definition: abc.h:355
int pOuts[0]
Definition: abcPart.c:49
Abc_Obj_t * pCopy
Definition: abc.h:148
Vec_Int_t * Supp_ManTransferEntry(Supp_One_t *p)
Definition: abcPart.c:251
Supp_One_t * Supp_ManMergeEntry(Supp_Man_t *pMan, Supp_One_t *p1, Supp_One_t *p2, int nRefs)
Definition: abcPart.c:212
static void Vec_IntPush(Vec_Int_t *p, int Entry)
Definition: bblif.c:468
typedefABC_NAMESPACE_IMPL_START struct Supp_Man_t_ Supp_Man_t
DECLARATIONS ///.
Definition: abcPart.c:32
Vec_Ptr_t * Abc_NtkDfsNatural(Abc_Ntk_t *pNtk)
Definition: abcPart.c:272
#define Abc_NtkForEachCi(pNtk, pCi, i)
Definition: abc.h:515
static Vec_Ptr_t * Vec_PtrAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: vecPtr.h:83
ABC_DLL void Abc_NtkCleanCopy(Abc_Ntk_t *pNtk)
Definition: abcUtil.c:507
int nOuts
Definition: abcPart.c:47
#define assert(ex)
Definition: util_old.h:213
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.
Definition: vecPtr.h:55
Supp_Man_t * Supp_ManStart(int nChunkSize, int nStepSize)
FUNCTION DEFINITIONS ///.
Definition: abcPart.c:71
static void Vec_PtrFree(Vec_Ptr_t *p)
Definition: vecPtr.h:223
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 877 of file abcPart.c.

878 {
879  int Out, i;
880  Vec_PtrClear( vOutsPtr );
881  Vec_IntForEachEntry( vOuts, Out, i )
882  Vec_PtrPush( vOutsPtr, Abc_NtkCo(pNtk, Out) );
883 }
static void Vec_PtrPush(Vec_Ptr_t *p, void *Entry)
Definition: vecPtr.h:606
static Abc_Obj_t * Abc_NtkCo(Abc_Ntk_t *pNtk, int i)
Definition: abc.h:318
static void Vec_PtrClear(Vec_Ptr_t *p)
Definition: vecPtr.h:545
#define Vec_IntForEachEntry(vVec, Entry, i)
MACRO DEFINITIONS ///.
Definition: vecInt.h:54
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 272 of file abcPart.c.

273 {
274  Vec_Ptr_t * vNodes;
275  Abc_Obj_t * pObj, * pNext;
276  int i, k;
277  assert( Abc_NtkIsStrash(pNtk) );
278  vNodes = Vec_PtrAlloc( Abc_NtkObjNum(pNtk) );
279  Abc_NtkIncrementTravId( pNtk );
280  // add the constant-1 nodes
281  pObj = Abc_AigConst1(pNtk);
282  Abc_NodeSetTravIdCurrent( pObj );
283  Vec_PtrPush( vNodes, pObj );
284  // add the CIs/nodes/COs in the topological order
285  Abc_NtkForEachNode( pNtk, pObj, i )
286  {
287  // check the fanins and add CIs
288  Abc_ObjForEachFanin( pObj, pNext, k )
289  if ( Abc_ObjIsCi(pNext) && !Abc_NodeIsTravIdCurrent(pNext) )
290  {
291  Abc_NodeSetTravIdCurrent( pNext );
292  Vec_PtrPush( vNodes, pNext );
293  }
294  // add the node
295  Vec_PtrPush( vNodes, pObj );
296  // check the fanouts and add COs
297  Abc_ObjForEachFanout( pObj, pNext, k )
298  if ( Abc_ObjIsCo(pNext) && !Abc_NodeIsTravIdCurrent(pNext) )
299  {
300  Abc_NodeSetTravIdCurrent( pNext );
301  Vec_PtrPush( vNodes, pNext );
302  }
303  }
304  return vNodes;
305 }
static int Abc_NtkIsStrash(Abc_Ntk_t *pNtk)
Definition: abc.h:251
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition: vecPtr.h:42
static int Abc_ObjIsCi(Abc_Obj_t *pObj)
Definition: abc.h:351
ABC_DLL Abc_Obj_t * Abc_AigConst1(Abc_Ntk_t *pNtk)
Definition: abcAig.c:683
static void Vec_PtrPush(Vec_Ptr_t *p, void *Entry)
Definition: vecPtr.h:606
static int Abc_ObjIsCo(Abc_Obj_t *pObj)
Definition: abc.h:352
if(last==0)
Definition: sparse_int.h:34
#define Abc_NtkForEachNode(pNtk, pNode, i)
Definition: abc.h:461
static int Abc_NodeIsTravIdCurrent(Abc_Obj_t *p)
Definition: abc.h:411
#define Abc_ObjForEachFanout(pObj, pFanout, i)
Definition: abc.h:526
static Vec_Ptr_t * Vec_PtrAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: vecPtr.h:83
#define Abc_ObjForEachFanin(pObj, pFanin, i)
Definition: abc.h:524
static void Abc_NtkIncrementTravId(Abc_Ntk_t *p)
Definition: abc.h:406
#define assert(ex)
Definition: util_old.h:213
static int Abc_NtkObjNum(Abc_Ntk_t *pNtk)
Definition: abc.h:283
static void Abc_NodeSetTravIdCurrent(Abc_Obj_t *p)
Definition: abc.h:409
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 1098 of file abcPart.c.

1099 {
1100  Vec_Ptr_t * vParts, * vFraigs, * vOnePtr;
1101  Vec_Int_t * vOne;
1102  Abc_Ntk_t * pNtk, * pNtk2, * pNtkAig, * pNtkFraig;
1103  int i, k;
1104 
1105  // perform partitioning
1106  pNtk = (Abc_Ntk_t *)Vec_PtrEntry( vStore, 0 );
1107  assert( Abc_NtkIsStrash(pNtk) );
1108 // vParts = Abc_NtkPartitionNaive( pNtk, 20 );
1109  vParts = Abc_NtkPartitionSmart( pNtk, 300, 0 );
1110 
1111  Cmd_CommandExecute( Abc_FrameGetGlobalFrame(), "unset progressbar" );
1112 
1113  // fraig each partition
1114  vOnePtr = Vec_PtrAlloc( 1000 );
1115  vFraigs = Vec_PtrAlloc( Vec_PtrSize(vParts) );
1116  Vec_PtrForEachEntry( Vec_Int_t *, vParts, vOne, i )
1117  {
1118  // start the partition
1119  Abc_NtkConvertCos( pNtk, vOne, vOnePtr );
1120  pNtkAig = Abc_NtkCreateConeArray( pNtk, vOnePtr, 0 );
1121  // add nodes to the partition
1122  Vec_PtrForEachEntryStart( Abc_Ntk_t *, vStore, pNtk2, k, 1 )
1123  {
1124  Abc_NtkConvertCos( pNtk2, vOne, vOnePtr );
1125  Abc_NtkAppendToCone( pNtkAig, pNtk2, vOnePtr );
1126  }
1127  printf( "Fraiging part %4d (out of %4d) PI = %5d. PO = %5d. And = %6d. Lev = %4d.\r",
1128  i+1, Vec_PtrSize(vParts), Abc_NtkPiNum(pNtkAig), Abc_NtkPoNum(pNtkAig),
1129  Abc_NtkNodeNum(pNtkAig), Abc_AigLevel(pNtkAig) );
1130  // fraig the partition
1131  pNtkFraig = Abc_NtkFraig( pNtkAig, pParams, 1, 0 );
1132  Vec_PtrPush( vFraigs, pNtkFraig );
1133  Abc_NtkDelete( pNtkAig );
1134  }
1135  printf( " \r" );
1136  Vec_VecFree( (Vec_Vec_t *)vParts );
1137 
1138  Cmd_CommandExecute( Abc_FrameGetGlobalFrame(), "set progressbar" );
1139 
1140  // derive the final network
1141  pNtkFraig = Abc_NtkPartStitchChoices( pNtk, vFraigs );
1142  Vec_PtrForEachEntry( Abc_Ntk_t *, vFraigs, pNtkAig, i )
1143  Abc_NtkDelete( pNtkAig );
1144  Vec_PtrFree( vFraigs );
1145  Vec_PtrFree( vOnePtr );
1146  return pNtkFraig;
1147 }
static int Abc_NtkIsStrash(Abc_Ntk_t *pNtk)
Definition: abc.h:251
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition: vecPtr.h:42
ABC_DLL void Abc_NtkAppendToCone(Abc_Ntk_t *pNtkNew, Abc_Ntk_t *pNtk, Vec_Ptr_t *vRoots)
Definition: abcNtk.c:969
#define Vec_PtrForEachEntryStart(Type, vVec, pEntry, i, Start)
Definition: vecPtr.h:57
typedefABC_NAMESPACE_HEADER_START struct Vec_Vec_t_ Vec_Vec_t
INCLUDES ///.
Definition: vecVec.h:42
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition: bblif.c:37
int Cmd_CommandExecute(void *pAbc, char *pCommandLine)
ABC_DLL Abc_Ntk_t * Abc_NtkCreateConeArray(Abc_Ntk_t *pNtk, Vec_Ptr_t *vRoots, int fUseAllCis)
Definition: abcNtk.c:889
static void Vec_PtrPush(Vec_Ptr_t *p, void *Entry)
Definition: vecPtr.h:606
Vec_Ptr_t * Abc_NtkPartitionSmart(Abc_Ntk_t *pNtk, int nSuppSizeLimit, int fVerbose)
Definition: abcPart.c:722
static int Vec_PtrSize(Vec_Ptr_t *p)
Definition: vecPtr.h:295
static void Vec_VecFree(Vec_Vec_t *p)
Definition: vecVec.h:347
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:1233
static int Abc_NtkNodeNum(Abc_Ntk_t *pNtk)
Definition: abc.h:293
ABC_DLL int Abc_AigLevel(Abc_Ntk_t *pNtk)
Definition: abcAig.c:292
void * Abc_FrameGetGlobalFrame()
Definition: mainFrame.c:593
void Abc_NtkConvertCos(Abc_Ntk_t *pNtk, Vec_Int_t *vOuts, Vec_Ptr_t *vOutsPtr)
Definition: abcPart.c:877
static void * Vec_PtrEntry(Vec_Ptr_t *p, int i)
Definition: vecPtr.h:362
static int Abc_NtkPoNum(Abc_Ntk_t *pNtk)
Definition: abc.h:286
static Vec_Ptr_t * Vec_PtrAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: vecPtr.h:83
static int Abc_NtkPiNum(Abc_Ntk_t *pNtk)
Definition: abc.h:285
#define assert(ex)
Definition: util_old.h:213
Abc_Ntk_t * Abc_NtkPartStitchChoices(Abc_Ntk_t *pNtk, Vec_Ptr_t *vParts)
Definition: abcPart.c:1000
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.
Definition: vecPtr.h:55
static void Vec_PtrFree(Vec_Ptr_t *p)
Definition: vecPtr.h:223
void Abc_NtkFraigPartitionedTime ( Abc_Ntk_t pNtk,
void *  pParams 
)

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

Synopsis [Stitches together several networks with choice nodes.]

Description []

SideEffects []

SeeAlso []

Definition at line 1160 of file abcPart.c.

1161 {
1162  Vec_Ptr_t * vParts, * vFraigs, * vOnePtr;
1163  Vec_Int_t * vOne;
1164  Abc_Ntk_t * pNtkAig, * pNtkFraig;
1165  int i;
1166  abctime clk = Abc_Clock();
1167 
1168  // perform partitioning
1169  assert( Abc_NtkIsStrash(pNtk) );
1170 // vParts = Abc_NtkPartitionNaive( pNtk, 20 );
1171  vParts = Abc_NtkPartitionSmart( pNtk, 300, 0 );
1172 
1173  Cmd_CommandExecute( Abc_FrameGetGlobalFrame(), "unset progressbar" );
1174 
1175  // fraig each partition
1176  vOnePtr = Vec_PtrAlloc( 1000 );
1177  vFraigs = Vec_PtrAlloc( Vec_PtrSize(vParts) );
1178  Vec_PtrForEachEntry( Vec_Int_t *, vParts, vOne, i )
1179  {
1180  Abc_NtkConvertCos( pNtk, vOne, vOnePtr );
1181  pNtkAig = Abc_NtkCreateConeArray( pNtk, vOnePtr, 0 );
1182  pNtkFraig = Abc_NtkFraig( pNtkAig, pParams, 0, 0 );
1183  Vec_PtrPush( vFraigs, pNtkFraig );
1184  Abc_NtkDelete( pNtkAig );
1185 
1186  printf( "Finished part %5d (out of %5d)\r", i+1, Vec_PtrSize(vParts) );
1187  }
1188  Vec_VecFree( (Vec_Vec_t *)vParts );
1189 
1190  Cmd_CommandExecute( Abc_FrameGetGlobalFrame(), "set progressbar" );
1191 
1192  // derive the final network
1193  Vec_PtrForEachEntry( Abc_Ntk_t *, vFraigs, pNtkAig, i )
1194  Abc_NtkDelete( pNtkAig );
1195  Vec_PtrFree( vFraigs );
1196  Vec_PtrFree( vOnePtr );
1197  ABC_PRT( "Partitioned fraiging time", Abc_Clock() - clk );
1198 }
static int Abc_NtkIsStrash(Abc_Ntk_t *pNtk)
Definition: abc.h:251
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition: vecPtr.h:42
typedefABC_NAMESPACE_HEADER_START struct Vec_Vec_t_ Vec_Vec_t
INCLUDES ///.
Definition: vecVec.h:42
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition: bblif.c:37
int Cmd_CommandExecute(void *pAbc, char *pCommandLine)
ABC_DLL Abc_Ntk_t * Abc_NtkCreateConeArray(Abc_Ntk_t *pNtk, Vec_Ptr_t *vRoots, int fUseAllCis)
Definition: abcNtk.c:889
static void Vec_PtrPush(Vec_Ptr_t *p, void *Entry)
Definition: vecPtr.h:606
Vec_Ptr_t * Abc_NtkPartitionSmart(Abc_Ntk_t *pNtk, int nSuppSizeLimit, int fVerbose)
Definition: abcPart.c:722
static abctime Abc_Clock()
Definition: abc_global.h:279
static int Vec_PtrSize(Vec_Ptr_t *p)
Definition: vecPtr.h:295
static void Vec_VecFree(Vec_Vec_t *p)
Definition: vecVec.h:347
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:1233
void * Abc_FrameGetGlobalFrame()
Definition: mainFrame.c:593
void Abc_NtkConvertCos(Abc_Ntk_t *pNtk, Vec_Int_t *vOuts, Vec_Ptr_t *vOutsPtr)
Definition: abcPart.c:877
static Vec_Ptr_t * Vec_PtrAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: vecPtr.h:83
#define ABC_PRT(a, t)
Definition: abc_global.h:220
#define assert(ex)
Definition: util_old.h:213
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.
Definition: vecPtr.h:55
ABC_INT64_T abctime
Definition: abc_global.h:278
static void Vec_PtrFree(Vec_Ptr_t *p)
Definition: vecPtr.h:223
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 650 of file abcPart.c.

651 {
652  Vec_Int_t * vOne, * vPart, * vPartSupp, * vTemp;
653  int i, iPart;
654 
655  if ( nSuppSizeLimit == 0 )
656  nSuppSizeLimit = 200;
657 
658  // pack smaller partitions into larger blocks
659  iPart = 0;
660  vPart = vPartSupp = NULL;
661  Vec_PtrForEachEntry( Vec_Int_t *, vPartSuppsAll, vOne, i )
662  {
663  if ( Vec_IntSize(vOne) < nSuppSizeLimit )
664  {
665  if ( vPartSupp == NULL )
666  {
667  assert( vPart == NULL );
668  vPartSupp = Vec_IntDup(vOne);
669  vPart = (Vec_Int_t *)Vec_PtrEntry(vPartsAll, i);
670  }
671  else
672  {
673  vPartSupp = Vec_IntTwoMerge( vTemp = vPartSupp, vOne );
674  Vec_IntFree( vTemp );
675  vPart = Vec_IntTwoMerge( vTemp = vPart, (Vec_Int_t *)Vec_PtrEntry(vPartsAll, i) );
676  Vec_IntFree( vTemp );
677  Vec_IntFree( (Vec_Int_t *)Vec_PtrEntry(vPartsAll, i) );
678  }
679  if ( Vec_IntSize(vPartSupp) < nSuppSizeLimit )
680  continue;
681  }
682  else
683  vPart = (Vec_Int_t *)Vec_PtrEntry(vPartsAll, i);
684  // add the partition
685  Vec_PtrWriteEntry( vPartsAll, iPart, vPart );
686  vPart = NULL;
687  if ( vPartSupp )
688  {
689  Vec_IntFree( (Vec_Int_t *)Vec_PtrEntry(vPartSuppsAll, iPart) );
690  Vec_PtrWriteEntry( vPartSuppsAll, iPart, vPartSupp );
691  vPartSupp = NULL;
692  }
693  iPart++;
694  }
695  // add the last one
696  if ( vPart )
697  {
698  Vec_PtrWriteEntry( vPartsAll, iPart, vPart );
699  vPart = NULL;
700 
701  assert( vPartSupp != NULL );
702  Vec_IntFree( (Vec_Int_t *)Vec_PtrEntry(vPartSuppsAll, iPart) );
703  Vec_PtrWriteEntry( vPartSuppsAll, iPart, vPartSupp );
704  vPartSupp = NULL;
705  iPart++;
706  }
707  Vec_PtrShrink( vPartsAll, iPart );
708  Vec_PtrShrink( vPartsAll, iPart );
709 }
static Vec_Int_t * Vec_IntDup(Vec_Int_t *pVec)
Definition: vecInt.h:214
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition: bblif.c:37
static Vec_Int_t * Vec_IntTwoMerge(Vec_Int_t *vArr1, Vec_Int_t *vArr2)
Definition: vecInt.h:1684
static void Vec_PtrWriteEntry(Vec_Ptr_t *p, int i, void *Entry)
Definition: vecPtr.h:396
static void * Vec_PtrEntry(Vec_Ptr_t *p, int i)
Definition: vecPtr.h:362
static int Vec_IntSize(Vec_Int_t *p)
Definition: bblif.c:252
#define assert(ex)
Definition: util_old.h:213
static void Vec_IntFree(Vec_Int_t *p)
Definition: bblif.c:235
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.
Definition: vecPtr.h:55
static void Vec_PtrShrink(Vec_Ptr_t *p, int nSizeNew)
Definition: vecPtr.h:528
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 854 of file abcPart.c.

855 {
856  Vec_Ptr_t * vParts;
857  Abc_Obj_t * pObj;
858  int nParts, i;
859  nParts = (Abc_NtkCoNum(pNtk) / nPartSize) + ((Abc_NtkCoNum(pNtk) % nPartSize) > 0);
860  vParts = (Vec_Ptr_t *)Vec_VecStart( nParts );
861  Abc_NtkForEachCo( pNtk, pObj, i )
862  Vec_IntPush( (Vec_Int_t *)Vec_PtrEntry(vParts, i / nPartSize), i );
863  return vParts;
864 }
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition: vecPtr.h:42
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition: bblif.c:37
#define Abc_NtkForEachCo(pNtk, pCo, i)
Definition: abc.h:519
static int Abc_NtkCoNum(Abc_Ntk_t *pNtk)
Definition: abc.h:288
static void Vec_IntPush(Vec_Int_t *p, int Entry)
Definition: bblif.c:468
static Vec_Vec_t * Vec_VecStart(int nSize)
Definition: vecVec.h:168
static void * Vec_PtrEntry(Vec_Ptr_t *p, int i)
Definition: vecPtr.h:362
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 621 of file abcPart.c.

622 {
623  Vec_Int_t * vOne;
624  int i, nOutputs, Counter;
625 
626  Counter = 0;
627  Vec_PtrForEachEntry( Vec_Int_t *, vPartSuppsAll, vOne, i )
628  {
629  nOutputs = Vec_IntSize((Vec_Int_t *)Vec_PtrEntry(vPartsAll, i));
630  printf( "%d=(%d,%d) ", i, Vec_IntSize(vOne), nOutputs );
631  Counter += nOutputs;
632  if ( i == Vec_PtrSize(vPartsAll) - 1 )
633  break;
634  }
635 // assert( Counter == Abc_NtkCoNum(pNtk) );
636  printf( "\nTotal = %d. Outputs = %d.\n", Counter, Abc_NtkCoNum(pNtk) );
637 }
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition: bblif.c:37
static int Vec_PtrSize(Vec_Ptr_t *p)
Definition: vecPtr.h:295
static int Abc_NtkCoNum(Abc_Ntk_t *pNtk)
Definition: abc.h:288
static int Counter
static void * Vec_PtrEntry(Vec_Ptr_t *p, int i)
Definition: vecPtr.h:362
static int Vec_IntSize(Vec_Int_t *p)
Definition: bblif.c:252
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.
Definition: vecPtr.h:55
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 722 of file abcPart.c.

723 {
724  ProgressBar * pProgress;
725  Vec_Ptr_t * vPartSuppsChar;
726  Vec_Ptr_t * vSupps, * vPartsAll, * vPartsAll2, * vPartSuppsAll;
727  Vec_Int_t * vOne, * vPart, * vPartSupp, * vTemp;
728  int i, iPart, iOut, timeFind = 0;
729  abctime clk, clk2;
730 
731  // compute the supports for all outputs
732 clk = Abc_Clock();
733 // vSupps = Abc_NtkComputeSupportsNaive( pNtk );
734  vSupps = Abc_NtkComputeSupportsSmart( pNtk );
735 if ( fVerbose )
736 {
737 ABC_PRT( "Supps", Abc_Clock() - clk );
738 }
739  // start char-based support representation
740  vPartSuppsChar = Vec_PtrAlloc( 1000 );
741 
742  // create partitions
743 clk = Abc_Clock();
744  vPartsAll = Vec_PtrAlloc( 256 );
745  vPartSuppsAll = Vec_PtrAlloc( 256 );
746  pProgress = Extra_ProgressBarStart( stdout, Vec_PtrSize(vSupps) );
747  Vec_PtrForEachEntry( Vec_Int_t *, vSupps, vOne, i )
748  {
749  Extra_ProgressBarUpdate( pProgress, i, NULL );
750 // if ( i % 1000 == 0 )
751 // printf( "CIs = %6d. COs = %6d. Processed = %6d (out of %6d). Parts = %6d.\r",
752 // Abc_NtkCiNum(pNtk), Abc_NtkCoNum(pNtk), i, Vec_PtrSize(vSupps), Vec_PtrSize(vPartsAll) );
753  // get the output number
754  iOut = Vec_IntPop(vOne);
755  // find closely matching part
756 clk2 = Abc_Clock();
757  iPart = Abc_NtkPartitionSmartFindPart( vPartSuppsAll, vPartsAll, vPartSuppsChar, nSuppSizeLimit, vOne );
758 timeFind += Abc_Clock() - clk2;
759  if ( iPart == -1 )
760  {
761  // create new partition
762  vPart = Vec_IntAlloc( 32 );
763  Vec_IntPush( vPart, iOut );
764  // create new partition support
765  vPartSupp = Vec_IntDup( vOne );
766  // add this partition and its support
767  Vec_PtrPush( vPartsAll, vPart );
768  Vec_PtrPush( vPartSuppsAll, vPartSupp );
769 
770  Vec_PtrPush( vPartSuppsChar, Abc_NtkSuppCharStart(vOne, Abc_NtkCiNum(pNtk)) );
771  }
772  else
773  {
774  // add output to this partition
775  vPart = (Vec_Int_t *)Vec_PtrEntry( vPartsAll, iPart );
776  Vec_IntPush( vPart, iOut );
777  // merge supports
778  vPartSupp = (Vec_Int_t *)Vec_PtrEntry( vPartSuppsAll, iPart );
779  vPartSupp = Vec_IntTwoMerge( vTemp = vPartSupp, vOne );
780  Vec_IntFree( vTemp );
781  // reinsert new support
782  Vec_PtrWriteEntry( vPartSuppsAll, iPart, vPartSupp );
783 
784  Abc_NtkSuppCharAdd( (unsigned *)Vec_PtrEntry(vPartSuppsChar, iPart), vOne, Abc_NtkCiNum(pNtk) );
785  }
786  }
787  Extra_ProgressBarStop( pProgress );
788 
789  // stop char-based support representation
790  Vec_PtrForEachEntry( Vec_Int_t *, vPartSuppsChar, vTemp, i )
791  ABC_FREE( vTemp );
792  Vec_PtrFree( vPartSuppsChar );
793 
794 //printf( "\n" );
795 if ( fVerbose )
796 {
797 ABC_PRT( "Parts", Abc_Clock() - clk );
798 //ABC_PRT( "Find ", timeFind );
799 }
800 
801 clk = Abc_Clock();
802  // remember number of supports
803  Vec_PtrForEachEntry( Vec_Int_t *, vPartSuppsAll, vOne, i )
804  Vec_IntPush( vOne, i );
805  // sort the supports in the decreasing order
806  Vec_VecSort( (Vec_Vec_t *)vPartSuppsAll, 1 );
807  // reproduce partitions
808  vPartsAll2 = Vec_PtrAlloc( 256 );
809  Vec_PtrForEachEntry( Vec_Int_t *, vPartSuppsAll, vOne, i )
810  Vec_PtrPush( vPartsAll2, Vec_PtrEntry(vPartsAll, Vec_IntPop(vOne)) );
811  Vec_PtrFree( vPartsAll );
812  vPartsAll = vPartsAll2;
813 
814  // compact small partitions
815 // Abc_NtkPartitionPrint( pNtk, vPartsAll, vPartSuppsAll );
816  Abc_NtkPartitionCompact( vPartsAll, vPartSuppsAll, nSuppSizeLimit );
817 
818 if ( fVerbose )
819 {
820 ABC_PRT( "Comps", Abc_Clock() - clk );
821 }
822  if ( fVerbose )
823  printf( "Created %d partitions.\n", Vec_PtrSize(vPartsAll) );
824 // Abc_NtkPartitionPrint( pNtk, vPartsAll, vPartSuppsAll );
825 
826  // cleanup
827  Vec_VecFree( (Vec_Vec_t *)vSupps );
828  Vec_VecFree( (Vec_Vec_t *)vPartSuppsAll );
829 /*
830  // converts from intergers to nodes
831  Vec_PtrForEachEntry( Vec_Int_t *, vPartsAll, vPart, iPart )
832  {
833  vPartPtr = Vec_PtrAlloc( Vec_IntSize(vPart) );
834  Vec_IntForEachEntry( vPart, iOut, i )
835  Vec_PtrPush( vPartPtr, Abc_NtkCo(pNtk, iOut) );
836  Vec_IntFree( vPart );
837  Vec_PtrWriteEntry( vPartsAll, iPart, vPartPtr );
838  }
839 */
840  return vPartsAll;
841 }
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition: vecPtr.h:42
static void Vec_VecSort(Vec_Vec_t *p, int fReverse)
Definition: vecVec.h:546
static Vec_Int_t * Vec_IntDup(Vec_Int_t *pVec)
Definition: vecInt.h:214
typedefABC_NAMESPACE_HEADER_START struct Vec_Vec_t_ Vec_Vec_t
INCLUDES ///.
Definition: vecVec.h:42
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition: bblif.c:37
unsigned * Abc_NtkSuppCharStart(Vec_Int_t *vOne, int nPis)
Definition: abcPart.c:466
void Abc_NtkSuppCharAdd(unsigned *pBuffer, Vec_Int_t *vOne, int nPis)
Definition: abcPart.c:492
int Abc_NtkPartitionSmartFindPart(Vec_Ptr_t *vPartSuppsAll, Vec_Ptr_t *vPartsAll, Vec_Ptr_t *vPartSuppsChar, int nSuppSizeLimit, Vec_Int_t *vOne)
Definition: abcPart.c:532
static void Vec_PtrPush(Vec_Ptr_t *p, void *Entry)
Definition: vecPtr.h:606
static int Abc_NtkCiNum(Abc_Ntk_t *pNtk)
Definition: abc.h:287
static abctime Abc_Clock()
Definition: abc_global.h:279
static int Vec_PtrSize(Vec_Ptr_t *p)
Definition: vecPtr.h:295
static void Vec_VecFree(Vec_Vec_t *p)
Definition: vecVec.h:347
DECLARATIONS ///.
static Vec_Int_t * Vec_IntAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: bblif.c:149
if(last==0)
Definition: sparse_int.h:34
static int Vec_IntPop(Vec_Int_t *p)
static void Vec_IntPush(Vec_Int_t *p, int Entry)
Definition: bblif.c:468
static Vec_Int_t * Vec_IntTwoMerge(Vec_Int_t *vArr1, Vec_Int_t *vArr2)
Definition: vecInt.h:1684
void Extra_ProgressBarStop(ProgressBar *p)
static void Vec_PtrWriteEntry(Vec_Ptr_t *p, int i, void *Entry)
Definition: vecPtr.h:396
static void * Vec_PtrEntry(Vec_Ptr_t *p, int i)
Definition: vecPtr.h:362
static Vec_Ptr_t * Vec_PtrAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: vecPtr.h:83
#define ABC_FREE(obj)
Definition: abc_global.h:232
#define ABC_PRT(a, t)
Definition: abc_global.h:220
void Abc_NtkPartitionCompact(Vec_Ptr_t *vPartsAll, Vec_Ptr_t *vPartSuppsAll, int nSuppSizeLimit)
Definition: abcPart.c:650
ProgressBar * Extra_ProgressBarStart(FILE *pFile, int nItemsTotal)
FUNCTION DEFINITIONS ///.
static void Extra_ProgressBarUpdate(ProgressBar *p, int nItemsCur, char *pString)
Definition: extra.h:243
Vec_Ptr_t * Abc_NtkComputeSupportsSmart(Abc_Ntk_t *pNtk)
Definition: abcPart.c:318
static void Vec_IntFree(Vec_Int_t *p)
Definition: bblif.c:235
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.
Definition: vecPtr.h:55
ABC_INT64_T abctime
Definition: abc_global.h:278
static void Vec_PtrFree(Vec_Ptr_t *p)
Definition: vecPtr.h:223
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 532 of file abcPart.c.

533 {
534 /*
535  Vec_Int_t * vPartSupp, * vPart;
536  double Attract, Repulse, Cost, CostBest;
537  int i, nCommon, iBest;
538  iBest = -1;
539  CostBest = 0.0;
540  Vec_PtrForEachEntry( Vec_Int_t *, vPartSuppsAll, vPartSupp, i )
541  {
542  vPart = Vec_PtrEntry( vPartsAll, i );
543  if ( nPartSizeLimit > 0 && Vec_IntSize(vPart) >= nPartSizeLimit )
544  continue;
545  nCommon = Vec_IntTwoCountCommon( vPartSupp, vOne );
546  if ( nCommon == 0 )
547  continue;
548  if ( nCommon == Vec_IntSize(vOne) )
549  return i;
550  Attract = 1.0 * nCommon / Vec_IntSize(vOne);
551  if ( Vec_IntSize(vPartSupp) < 100 )
552  Repulse = 1.0;
553  else
554  Repulse = log10( Vec_IntSize(vPartSupp) / 10.0 );
555  Cost = pow( Attract, pow(Repulse, 5.0) );
556  if ( CostBest < Cost )
557  {
558  CostBest = Cost;
559  iBest = i;
560  }
561  }
562  if ( CostBest < 0.6 )
563  return -1;
564  return iBest;
565 */
566 
567  Vec_Int_t * vPartSupp;//, * vPart;
568  int Attract, Repulse, Value, ValueBest;
569  int i, nCommon, iBest;
570 // int nCommon2;
571  iBest = -1;
572  ValueBest = 0;
573  Vec_PtrForEachEntry( Vec_Int_t *, vPartSuppsAll, vPartSupp, i )
574  {
575  // skip partitions with too many outputs
576 // vPart = Vec_PtrEntry( vPartsAll, i );
577 // if ( nSuppSizeLimit > 0 && Vec_IntSize(vPart) >= nSuppSizeLimit )
578 // continue;
579  // find the number of common variables between this output and the partitions
580 // nCommon2 = Vec_IntTwoCountCommon( vPartSupp, vOne );
581  nCommon = Abc_NtkSuppCharCommon( (unsigned *)Vec_PtrEntry(vPartSuppsChar, i), vOne );
582 // assert( nCommon2 == nCommon );
583  // if no common variables, continue searching
584  if ( nCommon == 0 )
585  continue;
586  // if all variables are common, the best partition if found
587  if ( nCommon == Vec_IntSize(vOne) )
588  return i;
589  // skip partitions whose size exceeds the limit
590  if ( nSuppSizeLimit > 0 && Vec_IntSize(vPartSupp) >= 2 * nSuppSizeLimit )
591  continue;
592  // figure out might be the good partition for this one
593  Attract = 1000 * nCommon / Vec_IntSize(vOne);
594  if ( Vec_IntSize(vPartSupp) < 100 )
595  Repulse = 1;
596  else
597  Repulse = 1+Abc_Base2Log(Vec_IntSize(vPartSupp)-100);
598  Value = Attract/Repulse;
599  if ( ValueBest < Value )
600  {
601  ValueBest = Value;
602  iBest = i;
603  }
604  }
605  if ( ValueBest < 75 )
606  return -1;
607  return iBest;
608 }
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition: bblif.c:37
static void * Vec_PtrEntry(Vec_Ptr_t *p, int i)
Definition: vecPtr.h:362
static int Vec_IntSize(Vec_Int_t *p)
Definition: bblif.c:252
int Abc_NtkSuppCharCommon(unsigned *pBuffer, Vec_Int_t *vOne)
Definition: abcPart.c:513
static int Abc_Base2Log(unsigned n)
Definition: abc_global.h:251
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.
Definition: vecPtr.h:55
Hop_Man_t* Abc_NtkPartStartHop ( Abc_Ntk_t pNtk)

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

Synopsis [Stitches together several networks with choice nodes.]

Description []

SideEffects []

SeeAlso []

Definition at line 955 of file abcPart.c.

956 {
957  Hop_Man_t * pMan;
958  Abc_Obj_t * pObj;
959  int i;
960  // start the HOP package
961  pMan = Hop_ManStart();
962  pMan->vObjs = Vec_PtrAlloc( Abc_NtkObjNumMax(pNtk) + 1 );
963  Vec_PtrPush( pMan->vObjs, Hop_ManConst1(pMan) );
964  // map constant node and PIs
965  Abc_AigConst1(pNtk)->pNext = (Abc_Obj_t *)Hop_ManConst1(pMan);
966  Abc_NtkForEachCi( pNtk, pObj, i )
967  pObj->pNext = (Abc_Obj_t *)Hop_ObjCreatePi(pMan);
968  // map the internal nodes
969  Abc_AigForEachAnd( pNtk, pObj, i )
970  {
971  pObj->pNext = (Abc_Obj_t *)Hop_And( pMan, Hop_ObjChild0Next(pObj), Hop_ObjChild1Next(pObj) );
972  assert( !Abc_ObjIsComplement(pObj->pNext) );
973  }
974  // set the choice nodes
975  Abc_AigForEachAnd( pNtk, pObj, i )
976  {
977  if ( pObj->pCopy )
978  ((Hop_Obj_t *)pObj->pNext)->pData = pObj->pCopy->pNext;
979  }
980  // transfer the POs
981  Abc_NtkForEachCo( pNtk, pObj, i )
982  Hop_ObjCreatePo( pMan, Hop_ObjChild0Next(pObj) );
983  // check the new manager
984  if ( !Hop_ManCheck(pMan) )
985  printf( "Abc_NtkPartStartHop: HOP manager check has failed.\n" );
986  return pMan;
987 }
int Hop_ManCheck(Hop_Man_t *p)
DECLARATIONS ///.
Definition: hopCheck.c:45
static int Abc_NtkObjNumMax(Abc_Ntk_t *pNtk)
Definition: abc.h:284
static Hop_Obj_t * Hop_ManConst1(Hop_Man_t *p)
Definition: hop.h:132
ABC_DLL Abc_Obj_t * Abc_AigConst1(Abc_Ntk_t *pNtk)
Definition: abcAig.c:683
Hop_Obj_t * Hop_And(Hop_Man_t *p, Hop_Obj_t *p0, Hop_Obj_t *p1)
Definition: hopOper.c:104
static void Vec_PtrPush(Vec_Ptr_t *p, void *Entry)
Definition: vecPtr.h:606
#define Abc_NtkForEachCo(pNtk, pCo, i)
Definition: abc.h:519
static Hop_Obj_t * Hop_ObjChild1Next(Abc_Obj_t *pObj)
Definition: abcPart.c:941
Definition: hop.h:65
static void check(int expr)
Definition: satSolver.c:46
#define Abc_AigForEachAnd(pNtk, pNode, i)
Definition: abc.h:485
if(last==0)
Definition: sparse_int.h:34
Hop_Man_t * Hop_ManStart()
DECLARATIONS ///.
Definition: hopMan.c:45
#define Abc_NtkForEachCi(pNtk, pCi, i)
Definition: abc.h:515
static Vec_Ptr_t * Vec_PtrAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: vecPtr.h:83
static Hop_Obj_t * Hop_ObjChild0Next(Abc_Obj_t *pObj)
Definition: abcPart.c:940
Abc_Obj_t * pNext
Definition: abc.h:131
#define assert(ex)
Definition: util_old.h:213
Hop_Obj_t * Hop_ObjCreatePo(Hop_Man_t *p, Hop_Obj_t *pDriver)
Definition: hopObj.c:67
static int Abc_ObjIsComplement(Abc_Obj_t *p)
Definition: abc.h:322
Hop_Obj_t * Hop_ObjCreatePi(Hop_Man_t *p)
DECLARATIONS ///.
Definition: hopObj.c:45
typedefABC_NAMESPACE_HEADER_START struct Hop_Man_t_ Hop_Man_t
INCLUDES ///.
Definition: hop.h:49
Hop_Man_t * Abc_NtkPartStartHop(Abc_Ntk_t *pNtk)
Definition: abcPart.c:955
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 1000 of file abcPart.c.

1001 {
1002  extern Abc_Ntk_t * Abc_NtkHopRemoveLoops( Abc_Ntk_t * pNtk, Hop_Man_t * pMan );
1003  Hop_Man_t * pMan;
1004  Vec_Ptr_t * vNodes;
1005  Abc_Ntk_t * pNtkNew, * pNtkTemp;
1006  Abc_Obj_t * pObj, * pFanin;
1007  int i, k, iNodeId;
1008 
1009  // start a new network similar to the original one
1010  assert( Abc_NtkIsStrash(pNtk) );
1011  pNtkNew = Abc_NtkStartFrom( pNtk, ABC_NTK_STRASH, ABC_FUNC_AIG );
1012 
1013  // annotate parts to point to the new network
1014  Vec_PtrForEachEntry( Abc_Ntk_t *, vParts, pNtkTemp, i )
1015  {
1016  assert( Abc_NtkIsStrash(pNtkTemp) );
1017  Abc_NtkCleanCopy( pNtkTemp );
1018 
1019  // map the CI nodes
1020  Abc_AigConst1(pNtkTemp)->pCopy = Abc_AigConst1(pNtkNew);
1021  Abc_NtkForEachCi( pNtkTemp, pObj, k )
1022  {
1023  iNodeId = Nm_ManFindIdByNameTwoTypes( pNtkNew->pManName, Abc_ObjName(pObj), ABC_OBJ_PI, ABC_OBJ_BO );
1024  if ( iNodeId == -1 )
1025  {
1026  printf( "Cannot find CI node %s in the original network.\n", Abc_ObjName(pObj) );
1027  return NULL;
1028  }
1029  pObj->pCopy = Abc_NtkObj( pNtkNew, iNodeId );
1030  }
1031 
1032  // add the internal nodes while saving representatives
1033  vNodes = Abc_AigDfs( pNtkTemp, 1, 0 );
1034  Vec_PtrForEachEntry( Abc_Obj_t *, vNodes, pObj, k )
1035  {
1036  pObj->pCopy = Abc_AigAnd( (Abc_Aig_t *)pNtkNew->pManFunc, Abc_ObjChild0Copy(pObj), Abc_ObjChild1Copy(pObj) );
1037  assert( !Abc_ObjIsComplement(pObj->pCopy) );
1038  if ( Abc_AigNodeIsChoice(pObj) )
1039  for ( pFanin = (Abc_Obj_t *)pObj->pData; pFanin; pFanin = (Abc_Obj_t *)pFanin->pData )
1040  pFanin->pCopy->pCopy = pObj->pCopy;
1041  }
1042  Vec_PtrFree( vNodes );
1043 
1044  // map the CO nodes
1045  Abc_NtkForEachCo( pNtkTemp, pObj, k )
1046  {
1047  iNodeId = Nm_ManFindIdByNameTwoTypes( pNtkNew->pManName, Abc_ObjName(pObj), ABC_OBJ_PO, ABC_OBJ_BI );
1048  if ( iNodeId == -1 )
1049  {
1050  printf( "Cannot find CO node %s in the original network.\n", Abc_ObjName(pObj) );
1051  return NULL;
1052  }
1053  pObj->pCopy = Abc_NtkObj( pNtkNew, iNodeId );
1054  Abc_ObjAddFanin( pObj->pCopy, Abc_ObjChild0Copy(pObj) );
1055  }
1056  }
1057 
1058  // connect the remaining POs
1059 /*
1060  Abc_AigConst1(pNtk)->pCopy = Abc_AigConst1(pNtkNew);
1061  Abc_NtkForEachCi( pNtk, pObj, i )
1062  pObj->pCopy = Abc_NtkCi( pNtkNew, i );
1063  Abc_NtkForEachCo( pNtk, pObj, i )
1064  pObj->pCopy = Abc_NtkCo( pNtkNew, i );
1065 */
1066  Abc_NtkForEachCo( pNtk, pObj, i )
1067  {
1068  if ( Abc_ObjFaninNum(pObj->pCopy) == 0 )
1069  Abc_ObjAddFanin( pObj->pCopy, Abc_ObjChild0Copy(pObj) );
1070  }
1071 
1072  // transform into the HOP manager
1073  pMan = Abc_NtkPartStartHop( pNtkNew );
1074  pNtkNew = Abc_NtkHopRemoveLoops( pNtkTemp = pNtkNew, pMan );
1075  Abc_NtkDelete( pNtkTemp );
1076 
1077  // check correctness of the new network
1078  if ( !Abc_NtkCheck( pNtkNew ) )
1079  {
1080  printf( "Abc_NtkPartStitchChoices: The network check has failed.\n" );
1081  Abc_NtkDelete( pNtkNew );
1082  return NULL;
1083  }
1084  return pNtkNew;
1085 }
static int Abc_NtkIsStrash(Abc_Ntk_t *pNtk)
Definition: abc.h:251
Definition: abc.h:91
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition: vecPtr.h:42
Nm_Man_t * pManName
Definition: abc.h:160
ABC_DLL Abc_Obj_t * Abc_AigConst1(Abc_Ntk_t *pNtk)
Definition: abcAig.c:683
static Abc_Obj_t * Abc_ObjChild1Copy(Abc_Obj_t *pObj)
Definition: abc.h:387
static int Abc_ObjFaninNum(Abc_Obj_t *pObj)
Definition: abc.h:364
#define Abc_NtkForEachCo(pNtk, pCo, i)
Definition: abc.h:519
ABC_DLL int Abc_NtkCheck(Abc_Ntk_t *pNtk)
FUNCTION DEFINITIONS ///.
Definition: abcCheck.c:61
static Abc_Obj_t * Abc_NtkObj(Abc_Ntk_t *pNtk, int i)
Definition: abc.h:314
DECLARATIONS ///.
Definition: abcAig.c:52
ABC_DLL void Abc_NtkDelete(Abc_Ntk_t *pNtk)
Definition: abcNtk.c:1233
ABC_DLL void Abc_ObjAddFanin(Abc_Obj_t *pObj, Abc_Obj_t *pFanin)
Definition: abcFanio.c:84
void * pManFunc
Definition: abc.h:191
ABC_DLL Abc_Obj_t * Abc_AigAnd(Abc_Aig_t *pMan, Abc_Obj_t *p0, Abc_Obj_t *p1)
Definition: abcAig.c:700
static Abc_Obj_t * Abc_ObjChild0Copy(Abc_Obj_t *pObj)
Definition: abc.h:386
ABC_DLL Abc_Ntk_t * Abc_NtkStartFrom(Abc_Ntk_t *pNtk, Abc_NtkType_t Type, Abc_NtkFunc_t Func)
Definition: abcNtk.c:106
Abc_Obj_t * pCopy
Definition: abc.h:148
int Nm_ManFindIdByNameTwoTypes(Nm_Man_t *p, char *pName, int Type1, int Type2)
Definition: nmApi.c:239
Abc_Ntk_t * Abc_NtkHopRemoveLoops(Abc_Ntk_t *pNtk, Hop_Man_t *pMan)
Definition: abcHaig.c:533
ABC_DLL Vec_Ptr_t * Abc_AigDfs(Abc_Ntk_t *pNtk, int fCollectAll, int fCollectCos)
Definition: abcDfs.c:1014
static int Abc_AigNodeIsChoice(Abc_Obj_t *pNode)
Definition: abc.h:398
Definition: abc.h:89
#define Abc_NtkForEachCi(pNtk, pCi, i)
Definition: abc.h:515
ABC_DLL char * Abc_ObjName(Abc_Obj_t *pNode)
DECLARATIONS ///.
Definition: abcNames.c:48
Definition: abc.h:90
Definition: abc.h:92
ABC_DLL void Abc_NtkCleanCopy(Abc_Ntk_t *pNtk)
Definition: abcUtil.c:507
#define assert(ex)
Definition: util_old.h:213
void * pData
Definition: abc.h:145
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.
Definition: vecPtr.h:55
static int Abc_ObjIsComplement(Abc_Obj_t *p)
Definition: abc.h:322
typedefABC_NAMESPACE_HEADER_START struct Hop_Man_t_ Hop_Man_t
INCLUDES ///.
Definition: hop.h:49
Hop_Man_t * Abc_NtkPartStartHop(Abc_Ntk_t *pNtk)
Definition: abcPart.c:955
static void Vec_PtrFree(Vec_Ptr_t *p)
Definition: vecPtr.h:223
static Abc_Obj_t* Abc_NtkPartStitchCopy0 ( Vec_Ptr_t vEquiv,
Abc_Obj_t pObj 
)
inlinestatic

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

Synopsis [Returns the representative of the fanin.]

Description []

SideEffects []

SeeAlso []

Definition at line 916 of file abcPart.c.

917 {
918  Abc_Obj_t * pFan = Abc_ObjFanin0( pObj );
919  Abc_Obj_t * pRepr = Abc_NtkPartStitchFindRepr_rec( vEquiv, pFan );
920  return Abc_ObjNotCond( pRepr->pCopy, pRepr->fPhase ^ pFan->fPhase ^ (int)Abc_ObjFaninC1(pObj) );
921 }
static int Abc_ObjFaninC1(Abc_Obj_t *pObj)
Definition: abc.h:378
static Abc_Obj_t * Abc_ObjFanin0(Abc_Obj_t *pObj)
Definition: abc.h:373
Abc_Obj_t * pCopy
Definition: abc.h:148
static Abc_Obj_t * Abc_ObjNotCond(Abc_Obj_t *p, int c)
Definition: abc.h:325
unsigned fPhase
Definition: abc.h:137
Abc_Obj_t * Abc_NtkPartStitchFindRepr_rec(Vec_Ptr_t *vEquiv, Abc_Obj_t *pObj)
Definition: abcPart.c:896
static Abc_Obj_t* Abc_NtkPartStitchCopy1 ( Vec_Ptr_t vEquiv,
Abc_Obj_t pObj 
)
inlinestatic

Definition at line 922 of file abcPart.c.

923 {
924  Abc_Obj_t * pFan = Abc_ObjFanin1( pObj );
925  Abc_Obj_t * pRepr = Abc_NtkPartStitchFindRepr_rec( vEquiv, pFan );
926  return Abc_ObjNotCond( pRepr->pCopy, pRepr->fPhase ^ pFan->fPhase ^ (int)Abc_ObjFaninC1(pObj) );
927 }
static Abc_Obj_t * Abc_ObjFanin1(Abc_Obj_t *pObj)
Definition: abc.h:374
static int Abc_ObjFaninC1(Abc_Obj_t *pObj)
Definition: abc.h:378
Abc_Obj_t * pCopy
Definition: abc.h:148
static Abc_Obj_t * Abc_ObjNotCond(Abc_Obj_t *p, int c)
Definition: abc.h:325
unsigned fPhase
Definition: abc.h:137
Abc_Obj_t * Abc_NtkPartStitchFindRepr_rec(Vec_Ptr_t *vEquiv, Abc_Obj_t *pObj)
Definition: abcPart.c:896
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 896 of file abcPart.c.

897 {
898  Abc_Obj_t * pRepr;
899  pRepr = (Abc_Obj_t *)Vec_PtrEntry( vEquiv, pObj->Id );
900  if ( pRepr == NULL || pRepr == pObj )
901  return pObj;
902  return Abc_NtkPartStitchFindRepr_rec( vEquiv, pRepr );
903 }
static void * Vec_PtrEntry(Vec_Ptr_t *p, int i)
Definition: vecPtr.h:362
int Id
Definition: abc.h:132
Abc_Obj_t * Abc_NtkPartStitchFindRepr_rec(Vec_Ptr_t *vEquiv, Abc_Obj_t *pObj)
Definition: abcPart.c:896
void Abc_NtkSuppCharAdd ( unsigned *  pBuffer,
Vec_Int_t vOne,
int  nPis 
)

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

Synopsis [Add to bitwise support representation.]

Description []

SideEffects []

SeeAlso []

Definition at line 492 of file abcPart.c.

493 {
494  int i, Entry;
495  Vec_IntForEachEntry( vOne, Entry, i )
496  {
497  assert( Entry < nPis );
498  Abc_InfoSetBit( pBuffer, Entry );
499  }
500 }
static void Abc_InfoSetBit(unsigned *p, int i)
Definition: abc_global.h:259
#define assert(ex)
Definition: util_old.h:213
#define Vec_IntForEachEntry(vVec, Entry, i)
MACRO DEFINITIONS ///.
Definition: vecInt.h:54
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 513 of file abcPart.c.

514 {
515  int i, Entry, nCommon = 0;
516  Vec_IntForEachEntry( vOne, Entry, i )
517  nCommon += Abc_InfoHasBit(pBuffer, Entry);
518  return nCommon;
519 }
static int Abc_InfoHasBit(unsigned *p, int i)
Definition: abc_global.h:258
#define Vec_IntForEachEntry(vVec, Entry, i)
MACRO DEFINITIONS ///.
Definition: vecInt.h:54
unsigned* Abc_NtkSuppCharStart ( Vec_Int_t vOne,
int  nPis 
)

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

Synopsis [Start bitwise support representation.]

Description []

SideEffects []

SeeAlso []

Definition at line 466 of file abcPart.c.

467 {
468  unsigned * pBuffer;
469  int i, Entry;
470  int nWords = Abc_BitWordNum(nPis);
471  pBuffer = ABC_ALLOC( unsigned, nWords );
472  memset( pBuffer, 0, sizeof(unsigned) * nWords );
473  Vec_IntForEachEntry( vOne, Entry, i )
474  {
475  assert( Entry < nPis );
476  Abc_InfoSetBit( pBuffer, Entry );
477  }
478  return pBuffer;
479 }
char * memset()
#define ABC_ALLOC(type, num)
Definition: abc_global.h:229
int nWords
Definition: abcNpn.c:127
static void Abc_InfoSetBit(unsigned *p, int i)
Definition: abc_global.h:259
static int Abc_BitWordNum(int nBits)
Definition: abc_global.h:255
#define assert(ex)
Definition: util_old.h:213
#define Vec_IntForEachEntry(vVec, Entry, i)
MACRO DEFINITIONS ///.
Definition: vecInt.h:54
static Hop_Obj_t* Hop_ObjChild0Next ( Abc_Obj_t pObj)
inlinestatic

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 940 of file abcPart.c.

940 { return Hop_NotCond( (Hop_Obj_t *)Abc_ObjFanin0(pObj)->pNext, Abc_ObjFaninC0(pObj) ); }
static int Abc_ObjFaninC0(Abc_Obj_t *pObj)
Definition: abc.h:377
static Abc_Obj_t * Abc_ObjFanin0(Abc_Obj_t *pObj)
Definition: abc.h:373
Definition: hop.h:65
static Hop_Obj_t * Hop_NotCond(Hop_Obj_t *p, int c)
Definition: hop.h:128
static Hop_Obj_t* Hop_ObjChild1Next ( Abc_Obj_t pObj)
inlinestatic

Definition at line 941 of file abcPart.c.

941 { return Hop_NotCond( (Hop_Obj_t *)Abc_ObjFanin1(pObj)->pNext, Abc_ObjFaninC1(pObj) ); }
static Abc_Obj_t * Abc_ObjFanin1(Abc_Obj_t *pObj)
Definition: abc.h:374
static int Abc_ObjFaninC1(Abc_Obj_t *pObj)
Definition: abc.h:378
Definition: hop.h:65
static Hop_Obj_t * Hop_NotCond(Hop_Obj_t *p, int c)
Definition: hop.h:128
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 116 of file abcPart.c.

117 {
118  int Type, nSizeReal;
119  char * pMemory;
120  assert( nSize > 0 );
121  Type = Supp_SizeType( nSize, p->nStepSize );
122  Vec_PtrFillExtra( p->vFree, Type + 1, NULL );
123  if ( (pMemory = (char *)Vec_PtrEntry( p->vFree, Type )) )
124  {
125  Vec_PtrWriteEntry( p->vFree, Type, Supp_OneNext(pMemory) );
126  return pMemory;
127  }
128  nSizeReal = p->nStepSize * Type;
129  if ( p->nFreeSize < nSizeReal )
130  {
131  p->pFreeBuf = ABC_ALLOC( char, p->nChunkSize );
132  p->nFreeSize = p->nChunkSize;
133  Vec_PtrPush( p->vMemory, p->pFreeBuf );
134  }
135  assert( p->nFreeSize >= nSizeReal );
136  pMemory = p->pFreeBuf;
137  p->pFreeBuf += nSizeReal;
138  p->nFreeSize -= nSizeReal;
139  return pMemory;
140 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static void Vec_PtrFillExtra(Vec_Ptr_t *p, int nSize, void *Fill)
Definition: vecPtr.h:469
static void Vec_PtrPush(Vec_Ptr_t *p, void *Entry)
Definition: vecPtr.h:606
#define ABC_ALLOC(type, num)
Definition: abc_global.h:229
static char * Supp_OneNext(char *pPart)
Definition: abcPart.c:53
static int Supp_SizeType(int nSize, int nStepSize)
Definition: abcPart.c:52
static void Vec_PtrWriteEntry(Vec_Ptr_t *p, int i, void *Entry)
Definition: vecPtr.h:396
static void * Vec_PtrEntry(Vec_Ptr_t *p, int i)
Definition: vecPtr.h:362
#define assert(ex)
Definition: util_old.h:213
static Supp_One_t* Supp_ManFetchEntry ( Supp_Man_t p,
int  nWords,
int  nRefs 
)
inlinestatic

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

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

Description []

SideEffects []

SeeAlso []

Definition at line 173 of file abcPart.c.

174 {
175  Supp_One_t * pPart;
176  pPart = (Supp_One_t *)Supp_ManFetch( p, sizeof(Supp_One_t) + sizeof(int) * nWords );
177  pPart->nRefs = nRefs;
178  pPart->nOuts = 0;
179  pPart->nOutsAlloc = nWords;
180  return pPart;
181 }
int nRefs
Definition: abcPart.c:46
static Llb_Mgr_t * p
Definition: llb3Image.c:950
int nWords
Definition: abcNpn.c:127
int nOutsAlloc
Definition: abcPart.c:48
char * Supp_ManFetch(Supp_Man_t *p, int nSize)
Definition: abcPart.c:116
int nOuts
Definition: abcPart.c:47
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 212 of file abcPart.c.

213 {
214  Supp_One_t * p = Supp_ManFetchEntry( pMan, p1->nOuts + p2->nOuts, nRefs );
215  int * pBeg1 = p1->pOuts;
216  int * pBeg2 = p2->pOuts;
217  int * pBeg = p->pOuts;
218  int * pEnd1 = p1->pOuts + p1->nOuts;
219  int * pEnd2 = p2->pOuts + p2->nOuts;
220  while ( pBeg1 < pEnd1 && pBeg2 < pEnd2 )
221  {
222  if ( *pBeg1 == *pBeg2 )
223  *pBeg++ = *pBeg1++, pBeg2++;
224  else if ( *pBeg1 < *pBeg2 )
225  *pBeg++ = *pBeg1++;
226  else
227  *pBeg++ = *pBeg2++;
228  }
229  while ( pBeg1 < pEnd1 )
230  *pBeg++ = *pBeg1++;
231  while ( pBeg2 < pEnd2 )
232  *pBeg++ = *pBeg2++;
233  p->nOuts = pBeg - p->pOuts;
234  assert( p->nOuts <= p->nOutsAlloc );
235  assert( p->nOuts >= p1->nOuts );
236  assert( p->nOuts >= p2->nOuts );
237  return p;
238 }
static Supp_One_t * Supp_ManFetchEntry(Supp_Man_t *p, int nWords, int nRefs)
Definition: abcPart.c:173
static Llb_Mgr_t * p
Definition: llb3Image.c:950
int pOuts[0]
Definition: abcPart.c:49
int nOutsAlloc
Definition: abcPart.c:48
int nOuts
Definition: abcPart.c:47
#define assert(ex)
Definition: util_old.h:213
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 153 of file abcPart.c.

154 {
155  int Type;
156  Type = Supp_SizeType( nSize, p->nStepSize );
157  Vec_PtrFillExtra( p->vFree, Type + 1, NULL );
158  Supp_OneSetNext( pMemory, (char *)Vec_PtrEntry(p->vFree, Type) );
159  Vec_PtrWriteEntry( p->vFree, Type, pMemory );
160 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static void Vec_PtrFillExtra(Vec_Ptr_t *p, int nSize, void *Fill)
Definition: vecPtr.h:469
static int Supp_SizeType(int nSize, int nStepSize)
Definition: abcPart.c:52
static void Vec_PtrWriteEntry(Vec_Ptr_t *p, int i, void *Entry)
Definition: vecPtr.h:396
static void * Vec_PtrEntry(Vec_Ptr_t *p, int i)
Definition: vecPtr.h:362
static void Supp_OneSetNext(char *pPart, char *pNext)
Definition: abcPart.c:54
static void Supp_ManRecycleEntry ( Supp_Man_t p,
Supp_One_t pEntry 
)
inlinestatic

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

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

Description []

SideEffects []

SeeAlso []

Definition at line 194 of file abcPart.c.

195 {
196  assert( pEntry->nOuts <= pEntry->nOutsAlloc );
197  assert( pEntry->nOuts >= pEntry->nOutsAlloc/2 );
198  Supp_ManRecycle( p, (char *)pEntry, sizeof(Supp_One_t) + sizeof(int) * pEntry->nOutsAlloc );
199 }
void Supp_ManRecycle(Supp_Man_t *p, char *pMemory, int nSize)
Definition: abcPart.c:153
static Llb_Mgr_t * p
Definition: llb3Image.c:950
int nOutsAlloc
Definition: abcPart.c:48
int nOuts
Definition: abcPart.c:47
#define assert(ex)
Definition: util_old.h:213
Supp_Man_t* Supp_ManStart ( int  nChunkSize,
int  nStepSize 
)

FUNCTION DEFINITIONS ///.

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

Synopsis [Start the memory manager.]

Description []

SideEffects []

SeeAlso []

Definition at line 71 of file abcPart.c.

72 {
73  Supp_Man_t * p;
74  p = ABC_ALLOC( Supp_Man_t, 1 );
75  memset( p, 0, sizeof(Supp_Man_t) );
76  p->nChunkSize = nChunkSize;
77  p->nStepSize = nStepSize;
78  p->vMemory = Vec_PtrAlloc( 1000 );
79  p->vFree = Vec_PtrAlloc( 1000 );
80  return p;
81 }
char * memset()
static Llb_Mgr_t * p
Definition: llb3Image.c:950
#define ABC_ALLOC(type, num)
Definition: abc_global.h:229
typedefABC_NAMESPACE_IMPL_START struct Supp_Man_t_ Supp_Man_t
DECLARATIONS ///.
Definition: abcPart.c:32
static Vec_Ptr_t * Vec_PtrAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: vecPtr.h:83
void Supp_ManStop ( Supp_Man_t p)

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

Synopsis [Stops the memory manager.]

Description []

SideEffects []

SeeAlso []

Definition at line 94 of file abcPart.c.

95 {
96  void * pMemory;
97  int i;
98  Vec_PtrForEachEntry( void *, p->vMemory, pMemory, i )
99  ABC_FREE( pMemory );
100  Vec_PtrFree( p->vMemory );
101  Vec_PtrFree( p->vFree );
102  ABC_FREE( p );
103 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
#define ABC_FREE(obj)
Definition: abc_global.h:232
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.
Definition: vecPtr.h:55
static void Vec_PtrFree(Vec_Ptr_t *p)
Definition: vecPtr.h:223
Vec_Int_t* Supp_ManTransferEntry ( Supp_One_t p)

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

Synopsis [Tranfers the entry.]

Description []

SideEffects []

SeeAlso []

Definition at line 251 of file abcPart.c.

252 {
253  Vec_Int_t * vSupp;
254  int i;
255  vSupp = Vec_IntAlloc( p->nOuts );
256  for ( i = 0; i < p->nOuts; i++ )
257  Vec_IntPush( vSupp, p->pOuts[i] );
258  return vSupp;
259 }
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition: bblif.c:37
int pOuts[0]
Definition: abcPart.c:49
static Vec_Int_t * Vec_IntAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: bblif.c:149
static void Vec_IntPush(Vec_Int_t *p, int Entry)
Definition: bblif.c:468
int nOuts
Definition: abcPart.c:47
static char* Supp_OneNext ( char *  pPart)
inlinestatic

Definition at line 53 of file abcPart.c.

53 { return *((char **)pPart); }
static void Supp_OneSetNext ( char *  pPart,
char *  pNext 
)
inlinestatic

Definition at line 54 of file abcPart.c.

54 { *((char **)pPart) = pNext; }
static int Supp_SizeType ( int  nSize,
int  nStepSize 
)
inlinestatic

Definition at line 52 of file abcPart.c.

52 { return nSize / nStepSize + ((nSize % nStepSize) > 0); }