abc-master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
dar.h File Reference

Go to the source code of this file.

Data Structures

struct  Dar_RwrPar_t_
 
struct  Dar_RefPar_t_
 

Typedefs

typedef
typedefABC_NAMESPACE_HEADER_START
struct Dar_RwrPar_t_ 
Dar_RwrPar_t
 INCLUDES ///. More...
 
typedef struct Dar_RefPar_t_ Dar_RefPar_t
 

Functions

void Dar_LibStart ()
 MACRO DEFINITIONS ///. More...
 
void Dar_LibStop ()
 
void Dar_LibPrepare (int nSubgraphs)
 
int Dar_LibReturnClass (unsigned uTruth)
 
Aig_Man_tDar_ManBalance (Aig_Man_t *p, int fUpdateLevel)
 
Aig_Man_tDar_ManBalanceXor (Aig_Man_t *pAig, int fExor, int fUpdateLevel, int fVerbose)
 
void Dar_BalancePrintStats (Aig_Man_t *p)
 
void Dar_ManDefaultRwrParams (Dar_RwrPar_t *pPars)
 FUNCTION DEFINITIONS ///. More...
 
int Dar_ManRewrite (Aig_Man_t *pAig, Dar_RwrPar_t *pPars)
 
Aig_MmFixed_tDar_ManComputeCuts (Aig_Man_t *pAig, int nCutsMax, int fSkipTtMin, int fVerbose)
 
void Dar_ManDefaultRefParams (Dar_RefPar_t *pPars)
 FUNCTION DEFINITIONS ///. More...
 
int Dar_ManRefactor (Aig_Man_t *pAig, Dar_RefPar_t *pPars)
 
Aig_Man_tDar_ManRewriteDefault (Aig_Man_t *pAig)
 DECLARATIONS ///. More...
 
Aig_Man_tDar_ManRwsat (Aig_Man_t *pAig, int fBalance, int fVerbose)
 DECLARATIONS ///. More...
 
Aig_Man_tDar_ManCompress (Aig_Man_t *pAig, int fBalance, int fUpdateLevel, int fPower, int fVerbose)
 
Aig_Man_tDar_ManCompress2 (Aig_Man_t *pAig, int fBalance, int fUpdateLevel, int fFanout, int fPower, int fVerbose)
 
Aig_Man_tDar_ManChoice (Aig_Man_t *pAig, int fBalance, int fUpdateLevel, int fConstruct, int nConfMax, int nLevelMax, int fVerbose)
 

Typedef Documentation

typedef struct Dar_RefPar_t_ Dar_RefPar_t

Definition at line 43 of file dar.h.

typedef typedefABC_NAMESPACE_HEADER_START struct Dar_RwrPar_t_ Dar_RwrPar_t

INCLUDES ///.

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

FileName [dar.h]

SystemName [ABC: Logic synthesis and verification system.]

PackageName [DAG-aware AIG rewriting.]

Synopsis [External declarations.]

Author [Alan Mishchenko]

Affiliation [UC Berkeley]

Date [Ver. 1.0. Started - April 28, 2007.]

Revision [

Id:
dar.h,v 1.00 2007/04/28 00:00:00 alanmi Exp

]PARAMETERS ///BASIC TYPES ///

Definition at line 42 of file dar.h.

Function Documentation

void Dar_BalancePrintStats ( Aig_Man_t p)

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

Synopsis [Inserts a new node in the order by levels.]

Description []

SideEffects []

SeeAlso []

Definition at line 716 of file darBalance.c.

717 {
718  Vec_Ptr_t * vSuper;
719  Aig_Obj_t * pObj, * pTemp;
720  int i, k;
721  if ( Aig_ManExorNum(p) == 0 )
722  {
723  printf( "There is no EXOR gates.\n" );
724  return;
725  }
726  Aig_ManForEachExor( p, pObj, i )
727  {
728  Aig_ObjFanin0(pObj)->fMarkA = 1;
729  Aig_ObjFanin1(pObj)->fMarkA = 1;
730  assert( !Aig_ObjFaninC0(pObj) );
731  assert( !Aig_ObjFaninC1(pObj) );
732  }
733  vSuper = Vec_PtrAlloc( 1000 );
734  Aig_ManForEachExor( p, pObj, i )
735  {
736  if ( pObj->fMarkA && pObj->nRefs == 1 )
737  continue;
738  Vec_PtrClear( vSuper );
739  Dar_BalanceCone_rec( pObj, pObj, vSuper );
740  Vec_PtrForEachEntry( Aig_Obj_t *, vSuper, pTemp, k )
741  pTemp->fMarkB = 0;
742  if ( Vec_PtrSize(vSuper) < 3 )
743  continue;
744  printf( " %d(", Vec_PtrSize(vSuper) );
745  Vec_PtrForEachEntry( Aig_Obj_t *, vSuper, pTemp, k )
746  printf( " %d", pTemp->Level );
747  printf( " )" );
748  }
749  Vec_PtrFree( vSuper );
750  Aig_ManForEachObj( p, pObj, i )
751  pObj->fMarkA = 0;
752  printf( "\n" );
753 }
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition: vecPtr.h:42
#define Aig_ManForEachExor(p, pObj, i)
Definition: aig.h:418
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static Aig_Obj_t * Aig_ObjFanin0(Aig_Obj_t *pObj)
Definition: aig.h:308
unsigned int fMarkA
Definition: aig.h:79
static Aig_Obj_t * Aig_ObjFanin1(Aig_Obj_t *pObj)
Definition: aig.h:309
static int Vec_PtrSize(Vec_Ptr_t *p)
Definition: vecPtr.h:295
if(last==0)
Definition: sparse_int.h:34
Definition: aig.h:69
static int Aig_ObjFaninC0(Aig_Obj_t *pObj)
Definition: aig.h:306
#define Aig_ManForEachObj(p, pObj, i)
Definition: aig.h:403
static Vec_Ptr_t * Vec_PtrAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: vecPtr.h:83
static int Aig_ObjFaninC1(Aig_Obj_t *pObj)
Definition: aig.h:307
#define assert(ex)
Definition: util_old.h:213
static void Vec_PtrClear(Vec_Ptr_t *p)
Definition: vecPtr.h:545
static int Aig_ManExorNum(Aig_Man_t *p)
Definition: aig.h:255
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.
Definition: vecPtr.h:55
unsigned int nRefs
Definition: aig.h:81
void Dar_BalanceCone_rec(Aig_Obj_t *pRoot, Aig_Obj_t *pObj, Vec_Ptr_t *vSuper)
Definition: darBalance.c:106
static void Vec_PtrFree(Vec_Ptr_t *p)
Definition: vecPtr.h:223
void Dar_LibPrepare ( int  nSubgraphs)

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

Synopsis [Starts the library.]

Description []

SideEffects []

SeeAlso []

Definition at line 478 of file darLib.c.

479 {
480  Dar_Lib_t * p = s_DarLib;
481  int i, k, nNodes0Total;
482  if ( p->nSubgraphs == nSubgraphs )
483  return;
484 
485  // favor special classes:
486  // 1 : F = (!d*!c*!b*!a)
487  // 4 : F = (!d*!c*!(b*a))
488  // 12 : F = (!d*!(c*!(!b*!a)))
489  // 20 : F = (!d*!(c*b*a))
490 
491  // set the subgraph counters
492  p->nSubgr0Total = 0;
493  for ( i = 0; i < 222; i++ )
494  {
495 // if ( i == 1 || i == 4 || i == 12 || i == 20 ) // special classes
496  if ( i == 1 ) // special classes
497  p->nSubgr0[i] = p->nSubgr[i];
498  else
499  p->nSubgr0[i] = Abc_MinInt( p->nSubgr[i], nSubgraphs );
500  p->nSubgr0Total += p->nSubgr0[i];
501  for ( k = 0; k < p->nSubgr0[i]; k++ )
502  p->pSubgr0[i][k] = p->pSubgr[i][ p->pPrios[i][k] ];
503  }
504 
505  // count the number of nodes
506  // clean node counters
507  for ( i = 0; i < 222; i++ )
508  p->nNodes0[i] = 0;
509  // create traversal IDs
510  for ( i = 0; i < p->iObj; i++ )
511  Dar_LibObj(p, i)->Num = 0xff;
512  // count nodes in each class
513  // count the total number of nodes and the largest class
514  p->nNodes0Total = 0;
515  p->nNodes0Max = 0;
516  for ( i = 0; i < 222; i++ )
517  {
518  for ( k = 0; k < p->nSubgr0[i]; k++ )
519  Dar_LibSetup0_rec( p, Dar_LibObj(p, p->pSubgr0[i][k]), i, 0 );
520  p->nNodes0Total += p->nNodes0[i];
521  p->nNodes0Max = Abc_MaxInt( p->nNodes0Max, p->nNodes0[i] );
522  }
523 
524  // clean node counters
525  for ( i = 0; i < 222; i++ )
526  p->nNodes0[i] = 0;
527  // create traversal IDs
528  for ( i = 0; i < p->iObj; i++ )
529  Dar_LibObj(p, i)->Num = 0xff;
530  // add the nodes to storage
531  nNodes0Total = 0;
532  for ( i = 0; i < 222; i++ )
533  {
534  for ( k = 0; k < p->nSubgr0[i]; k++ )
535  Dar_LibSetup0_rec( p, Dar_LibObj(p, p->pSubgr0[i][k]), i, 1 );
536  nNodes0Total += p->nNodes0[i];
537  }
538  assert( nNodes0Total == p->nNodes0Total );
539  // prepare the number of the PI nodes
540  for ( i = 0; i < 4; i++ )
541  Dar_LibObj(p, i)->Num = i;
542 
543  // realloc the datas
544  Dar_LibCreateData( p, p->nNodes0Max + 32 );
545  // allocated more because Dar_LibBuildBest() sometimes requires more entries
546 }
typedefABC_NAMESPACE_IMPL_START struct Dar_Lib_t_ Dar_Lib_t
DECLARATIONS ///.
Definition: darLib.c:32
void Dar_LibCreateData(Dar_Lib_t *p, int nDatas)
Definition: darLib.c:432
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static Dar_LibObj_t * Dar_LibObj(Dar_Lib_t *p, int Id)
Definition: darLib.c:110
void Dar_LibSetup0_rec(Dar_Lib_t *p, Dar_LibObj_t *pObj, int Class, int fCollect)
Definition: darLib.c:454
static int Abc_MaxInt(int a, int b)
Definition: abc_global.h:238
for(p=first;p->value< newval;p=p->next)
static int Abc_MinInt(int a, int b)
Definition: abc_global.h:239
unsigned Num
Definition: darLib.c:44
static Dar_Lib_t * s_DarLib
Definition: darLib.c:108
#define assert(ex)
Definition: util_old.h:213
int Dar_LibReturnClass ( unsigned  uTruth)

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

Synopsis [Returns canonical truth tables.]

Description []

SideEffects []

SeeAlso []

Definition at line 194 of file darLib.c.

195 {
196  return s_DarLib->pMap[uTruth & 0xffff];
197 }
static Dar_Lib_t * s_DarLib
Definition: darLib.c:108
void Dar_LibStart ( )

MACRO DEFINITIONS ///.

ITERATORS ///FUNCTION DECLARATIONS ///

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

Synopsis [Starts the library.]

Description []

SideEffects []

SeeAlso []

Definition at line 593 of file darLib.c.

594 {
595 // abctime clk = Abc_Clock();
596  if ( s_DarLib != NULL )
597  return;
598  assert( s_DarLib == NULL );
599  s_DarLib = Dar_LibRead();
600 // printf( "The 4-input library started with %d nodes and %d subgraphs. ", s_DarLib->nObjs - 4, s_DarLib->nSubgrTotal );
601 // ABC_PRT( "Time", Abc_Clock() - clk );
602 }
static Dar_Lib_t * s_DarLib
Definition: darLib.c:108
#define assert(ex)
Definition: util_old.h:213
Dar_Lib_t * Dar_LibRead()
Definition: darLib.c:559
void Dar_LibStop ( )

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

Synopsis [Stops the library.]

Description []

SideEffects []

SeeAlso []

Definition at line 615 of file darLib.c.

616 {
617  assert( s_DarLib != NULL );
619  s_DarLib = NULL;
620 }
static Dar_Lib_t * s_DarLib
Definition: darLib.c:108
#define assert(ex)
Definition: util_old.h:213
void Dar_LibFree(Dar_Lib_t *p)
Definition: darLib.c:164
Aig_Man_t* Dar_ManBalance ( Aig_Man_t p,
int  fUpdateLevel 
)

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

Synopsis [Performs algebraic balancing of the AIG.]

Description []

SideEffects []

SeeAlso []

Definition at line 554 of file darBalance.c.

555 {
556  Aig_Man_t * pNew;
557  Aig_Obj_t * pObj, * pDriver, * pObjNew;
558  Vec_Vec_t * vStore;
559  int i;
561  // create the new manager
562  pNew = Aig_ManStart( Aig_ManObjNumMax(p) );
563  pNew->pName = Abc_UtilStrsav( p->pName );
564  pNew->pSpec = Abc_UtilStrsav( p->pSpec );
565  pNew->nAsserts = p->nAsserts;
566  pNew->nConstrs = p->nConstrs;
567  pNew->nBarBufs = p->nBarBufs;
568  pNew->Time2Quit = p->Time2Quit;
569  if ( p->vFlopNums )
570  pNew->vFlopNums = Vec_IntDup( p->vFlopNums );
571  // map the PI nodes
572  Aig_ManCleanData( p );
574  vStore = Vec_VecAlloc( 50 );
575  if ( p->pManTime != NULL )
576  {
577  float arrTime;
578  Tim_ManIncrementTravId( (Tim_Man_t *)p->pManTime );
579  Aig_ManSetCioIds( p );
580  Aig_ManForEachObj( p, pObj, i )
581  {
582  if ( Aig_ObjIsNode(pObj) || Aig_ObjIsConst1(pObj) )
583  continue;
584  if ( Aig_ObjIsCi(pObj) )
585  {
586  // copy the PI
587  pObjNew = Aig_ObjCreateCi(pNew);
588  pObj->pData = pObjNew;
589  // set the arrival time of the new PI
590  arrTime = Tim_ManGetCiArrival( (Tim_Man_t *)p->pManTime, Aig_ObjCioId(pObj) );
591  pObjNew->Level = (int)arrTime;
592  }
593  else if ( Aig_ObjIsCo(pObj) )
594  {
595  // perform balancing
596  pDriver = Aig_ObjReal_rec( Aig_ObjChild0(pObj) );
597  pObjNew = Dar_Balance_rec( pNew, Aig_Regular(pDriver), vStore, 0, fUpdateLevel );
598  if ( pObjNew == NULL )
599  {
600  Vec_VecFree( vStore );
601  Aig_ManStop( pNew );
602  return NULL;
603  }
604  pObjNew = Aig_NotCond( pObjNew, Aig_IsComplement(pDriver) );
605  // save arrival time of the output
606  arrTime = (float)Aig_Regular(pObjNew)->Level;
607  Tim_ManSetCoArrival( (Tim_Man_t *)p->pManTime, Aig_ObjCioId(pObj), arrTime );
608  // create PO
609  pObjNew = Aig_ObjCreateCo( pNew, pObjNew );
610  }
611  else
612  assert( 0 );
613  }
615  pNew->pManTime = Tim_ManDup( (Tim_Man_t *)p->pManTime, 0 );
616  }
617  else
618  {
619  Aig_ManForEachCi( p, pObj, i )
620  {
621  pObjNew = Aig_ObjCreateCi(pNew);
622  pObjNew->Level = pObj->Level;
623  pObj->pData = pObjNew;
624  }
625  if ( p->nBarBufs == 0 )
626  {
627  Aig_ManForEachCo( p, pObj, i )
628  {
629  pDriver = Aig_ObjReal_rec( Aig_ObjChild0(pObj) );
630  pObjNew = Dar_Balance_rec( pNew, Aig_Regular(pDriver), vStore, 0, fUpdateLevel );
631  if ( pObjNew == NULL )
632  {
633  Vec_VecFree( vStore );
634  Aig_ManStop( pNew );
635  return NULL;
636  }
637  pObjNew = Aig_NotCond( pObjNew, Aig_IsComplement(pDriver) );
638  pObjNew = Aig_ObjCreateCo( pNew, pObjNew );
639  }
640  }
641  else
642  {
643  Vec_Ptr_t * vLits = Vec_PtrStart( Aig_ManCoNum(p) );
644  Aig_ManForEachCo( p, pObj, i )
645  {
646  int k = i < p->nBarBufs ? Aig_ManCoNum(p) - p->nBarBufs + i : i - p->nBarBufs;
647  pObj = Aig_ManCo( p, k );
648  pDriver = Aig_ObjReal_rec( Aig_ObjChild0(pObj) );
649  pObjNew = Dar_Balance_rec( pNew, Aig_Regular(pDriver), vStore, 0, fUpdateLevel );
650  if ( pObjNew == NULL )
651  {
652  Vec_VecFree( vStore );
653  Aig_ManStop( pNew );
654  return NULL;
655  }
656  pObjNew = Aig_NotCond( pObjNew, Aig_IsComplement(pDriver) );
657  Vec_PtrWriteEntry( vLits, k, pObjNew );
658  if ( i < p->nBarBufs )
659  Aig_ManCi(pNew, Aig_ManCiNum(p) - p->nBarBufs + i)->Level = Aig_Regular(pObjNew)->Level;
660  }
661  Aig_ManForEachCo( p, pObj, i )
662  Aig_ObjCreateCo( pNew, (Aig_Obj_t *)Vec_PtrEntry(vLits, i) );
663  Vec_PtrFree(vLits);
664  }
665  }
666  Vec_VecFree( vStore );
667  // remove dangling nodes
668  Aig_ManCleanup( pNew );
669  Aig_ManSetRegNum( pNew, Aig_ManRegNum(p) );
670  // check the resulting AIG
671  if ( !Aig_ManCheck(pNew) )
672  printf( "Dar_ManBalance(): The check has failed.\n" );
673  return pNew;
674 }
Aig_Obj_t * Aig_ObjCreateCo(Aig_Man_t *p, Aig_Obj_t *pDriver)
Definition: aigObj.c:66
static Vec_Ptr_t * Vec_PtrStart(int nSize)
Definition: vecPtr.h:106
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition: vecPtr.h:42
ABC_DLL int Aig_ManCheck(Aig_Man_t *p)
FUNCTION DECLARATIONS ///.
Definition: aigCheck.c:45
unsigned Level
Definition: aig.h:82
static Vec_Vec_t * Vec_VecAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: vecVec.h:145
void Tim_ManIncrementTravId(Tim_Man_t *p)
DECLARATIONS ///.
Definition: timTrav.c:44
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
int Aig_ManVerifyTopoOrder(Aig_Man_t *p)
DECLARATIONS ///.
Definition: aigDfs.c:46
typedefABC_NAMESPACE_HEADER_START struct Aig_Man_t_ Aig_Man_t
INCLUDES ///.
Definition: aig.h:50
static Aig_Obj_t * Aig_ObjChild0(Aig_Obj_t *pObj)
Definition: aig.h:310
static Llb_Mgr_t * p
Definition: llb3Image.c:950
void Aig_ManStop(Aig_Man_t *p)
Definition: aigMan.c:187
Aig_Obj_t * Aig_ObjReal_rec(Aig_Obj_t *pObj)
Definition: aigUtil.c:476
void * pData
Definition: aig.h:87
void Tim_ManSetCoArrival(Tim_Man_t *p, int iCo, float Delay)
Definition: timTime.c:116
Aig_Man_t * Aig_ManStart(int nNodesMax)
DECLARATIONS ///.
Definition: aigMan.c:47
static int Aig_IsComplement(Aig_Obj_t *p)
Definition: aig.h:249
#define Aig_ManForEachCi(p, pObj, i)
ITERATORS ///.
Definition: aig.h:393
static Aig_Obj_t * Aig_Regular(Aig_Obj_t *p)
Definition: aig.h:246
Aig_Obj_t * Aig_ObjCreateCi(Aig_Man_t *p)
DECLARATIONS ///.
Definition: aigObj.c:45
#define Aig_ManForEachCo(p, pObj, i)
Definition: aig.h:398
static void Vec_VecFree(Vec_Vec_t *p)
Definition: vecVec.h:347
Aig_Man_t * Dar_ManBalance(Aig_Man_t *p, int fUpdateLevel)
Definition: darBalance.c:554
static void check(int expr)
Definition: satSolver.c:46
Aig_Obj_t * Dar_Balance_rec(Aig_Man_t *pNew, Aig_Obj_t *pObjOld, Vec_Vec_t *vStore, int Level, int fUpdateLevel)
Definition: darBalance.c:502
static int Aig_ObjIsNode(Aig_Obj_t *pObj)
Definition: aig.h:280
static int Aig_ManCoNum(Aig_Man_t *p)
Definition: aig.h:252
void Aig_ManSetRegNum(Aig_Man_t *p, int nRegs)
Definition: aigMan.c:438
static Aig_Obj_t * Aig_ManCi(Aig_Man_t *p, int i)
Definition: aig.h:266
static int Aig_ManCiNum(Aig_Man_t *p)
Definition: aig.h:251
if(last==0)
Definition: sparse_int.h:34
static int Aig_ObjIsConst1(Aig_Obj_t *pObj)
Definition: aig.h:274
Tim_Man_t * Tim_ManDup(Tim_Man_t *p, int fUnitDelay)
Definition: timMan.c:86
Definition: aig.h:69
void Aig_ManSetCioIds(Aig_Man_t *p)
Definition: aigUtil.c:965
static void Vec_PtrWriteEntry(Vec_Ptr_t *p, int i, void *Entry)
Definition: vecPtr.h:396
static int Aig_ManObjNumMax(Aig_Man_t *p)
Definition: aig.h:259
static Aig_Obj_t * Aig_ManConst1(Aig_Man_t *p)
Definition: aig.h:264
static void * Vec_PtrEntry(Vec_Ptr_t *p, int i)
Definition: vecPtr.h:362
static Aig_Obj_t * Aig_ManCo(Aig_Man_t *p, int i)
Definition: aig.h:267
static int Aig_ManRegNum(Aig_Man_t *p)
Definition: aig.h:260
#define Aig_ManForEachObj(p, pObj, i)
Definition: aig.h:403
void Aig_ManCleanCioIds(Aig_Man_t *p)
Definition: aigUtil.c:986
#define assert(ex)
Definition: util_old.h:213
typedefABC_NAMESPACE_HEADER_START struct Tim_Man_t_ Tim_Man_t
INCLUDES ///.
Definition: tim.h:92
static Aig_Obj_t * Aig_NotCond(Aig_Obj_t *p, int c)
Definition: aig.h:248
static int Aig_ObjIsCi(Aig_Obj_t *pObj)
Definition: aig.h:275
char * Abc_UtilStrsav(char *s)
Definition: starter.c:47
float Tim_ManGetCiArrival(Tim_Man_t *p, int iCi)
Definition: timTime.c:174
void Aig_ManCleanData(Aig_Man_t *p)
Definition: aigUtil.c:205
int Aig_ManCleanup(Aig_Man_t *p)
Definition: aigMan.c:265
static int Aig_ObjIsCo(Aig_Obj_t *pObj)
Definition: aig.h:276
static int Aig_ObjCioId(Aig_Obj_t *pObj)
Definition: aig.h:285
static void Vec_PtrFree(Vec_Ptr_t *p)
Definition: vecPtr.h:223
Aig_Man_t* Dar_ManBalanceXor ( Aig_Man_t pAig,
int  fExor,
int  fUpdateLevel,
int  fVerbose 
)

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

Synopsis [Reproduces script "compress2".]

Description []

SideEffects []

SeeAlso []

Definition at line 687 of file darBalance.c.

688 {
689  Aig_Man_t * pAigXor, * pRes;
690  if ( fExor )
691  {
692  pAigXor = Aig_ManDupExor( pAig );
693  if ( fVerbose )
694  Dar_BalancePrintStats( pAigXor );
695  pRes = Dar_ManBalance( pAigXor, fUpdateLevel );
696  Aig_ManStop( pAigXor );
697  }
698  else
699  {
700  pRes = Dar_ManBalance( pAig, fUpdateLevel );
701  }
702  return pRes;
703 }
Aig_Man_t * Aig_ManDupExor(Aig_Man_t *p)
Definition: aigDup.c:462
typedefABC_NAMESPACE_HEADER_START struct Aig_Man_t_ Aig_Man_t
INCLUDES ///.
Definition: aig.h:50
void Aig_ManStop(Aig_Man_t *p)
Definition: aigMan.c:187
void Dar_BalancePrintStats(Aig_Man_t *p)
Definition: darBalance.c:716
Aig_Man_t * Dar_ManBalance(Aig_Man_t *p, int fUpdateLevel)
Definition: darBalance.c:554
Aig_Man_t* Dar_ManChoice ( Aig_Man_t pAig,
int  fBalance,
int  fUpdateLevel,
int  fConstruct,
int  nConfMax,
int  nLevelMax,
int  fVerbose 
)

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

Synopsis [Reproduces script "compress2".]

Description []

SideEffects []

SeeAlso []

Definition at line 378 of file darScript.c.

379 {
380  Aig_Man_t * pMan, * pTemp;
381  Vec_Ptr_t * vAigs;
382  int i;
383  abctime clk;
384 
385 clk = Abc_Clock();
386 // vAigs = Dar_ManChoiceSynthesisExt();
387  vAigs = Dar_ManChoiceSynthesis( pAig, fBalance, fUpdateLevel, 0, fVerbose );
388 
389  // swap the first and last network
390  // this should lead to the primary choice being "better" because of synthesis
391  // (it is also important when constructing choices)
392  if ( !fConstruct )
393  {
394  pMan = (Aig_Man_t *)Vec_PtrPop( vAigs );
395  Vec_PtrPush( vAigs, Vec_PtrEntry(vAigs,0) );
396  Vec_PtrWriteEntry( vAigs, 0, pMan );
397  }
398 
399 if ( fVerbose )
400 {
401 ABC_PRT( "Synthesis time", Abc_Clock() - clk );
402 }
403 clk = Abc_Clock();
404  if ( fConstruct )
405  pMan = Aig_ManChoiceConstructive( vAigs, fVerbose );
406  else
407  pMan = Aig_ManChoicePartitioned( vAigs, 300, nConfMax, nLevelMax, fVerbose );
408  Vec_PtrForEachEntry( Aig_Man_t *, vAigs, pTemp, i )
409  Aig_ManStop( pTemp );
410  Vec_PtrFree( vAigs );
411 if ( fVerbose )
412 {
413 ABC_PRT( "Choicing time ", Abc_Clock() - clk );
414 }
415  return pMan;
416 // return NULL;
417 }
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition: vecPtr.h:42
typedefABC_NAMESPACE_HEADER_START struct Aig_Man_t_ Aig_Man_t
INCLUDES ///.
Definition: aig.h:50
void Aig_ManStop(Aig_Man_t *p)
Definition: aigMan.c:187
static void Vec_PtrPush(Vec_Ptr_t *p, void *Entry)
Definition: vecPtr.h:606
Aig_Man_t * Aig_ManChoiceConstructive(Vec_Ptr_t *vAigs, int fVerbose)
Definition: aigPart.c:1564
static abctime Abc_Clock()
Definition: abc_global.h:279
static void * Vec_PtrPop(Vec_Ptr_t *p)
Definition: vecPtr.h:677
if(last==0)
Definition: sparse_int.h:34
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
Aig_Man_t * Aig_ManChoicePartitioned(Vec_Ptr_t *vAigs, int nPartSize, int nConfMax, int nLevelMax, int fVerbose)
Definition: aigPart.c:1247
#define ABC_PRT(a, t)
Definition: abc_global.h:220
Vec_Ptr_t * Dar_ManChoiceSynthesis(Aig_Man_t *pAig, int fBalance, int fUpdateLevel, int fPower, int fVerbose)
Definition: darScript.c:345
#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
Aig_Man_t* Dar_ManCompress ( Aig_Man_t pAig,
int  fBalance,
int  fUpdateLevel,
int  fPower,
int  fVerbose 
)

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

Synopsis [Reproduces script "compress".]

Description []

SideEffects []

SeeAlso []

Definition at line 162 of file darScript.c.

164 {
165  Aig_Man_t * pTemp;
166 
167  Dar_RwrPar_t ParsRwr, * pParsRwr = &ParsRwr;
168  Dar_RefPar_t ParsRef, * pParsRef = &ParsRef;
169 
170  Dar_ManDefaultRwrParams( pParsRwr );
171  Dar_ManDefaultRefParams( pParsRef );
172 
173  pParsRwr->fUpdateLevel = fUpdateLevel;
174  pParsRef->fUpdateLevel = fUpdateLevel;
175 
176  pParsRwr->fPower = fPower;
177 
178  pParsRwr->fVerbose = 0;//fVerbose;
179  pParsRef->fVerbose = 0;//fVerbose;
180 
181  pAig = Aig_ManDupDfs( pAig );
182  if ( fVerbose ) printf( "Starting: " ), Aig_ManPrintStats( pAig );
183 /*
184  // balance
185  if ( fBalance )
186  {
187  pAig = Dar_ManBalance( pTemp = pAig, fUpdateLevel );
188  Aig_ManStop( pTemp );
189  if ( fVerbose ) printf( "Balance: " ), Aig_ManPrintStats( pAig );
190  }
191 */
192  // rewrite
193  Dar_ManRewrite( pAig, pParsRwr );
194  pAig = Aig_ManDupDfs( pTemp = pAig );
195  Aig_ManStop( pTemp );
196  if ( fVerbose ) printf( "Rewrite: " ), Aig_ManPrintStats( pAig );
197 
198  // refactor
199  Dar_ManRefactor( pAig, pParsRef );
200  pAig = Aig_ManDupDfs( pTemp = pAig );
201  Aig_ManStop( pTemp );
202  if ( fVerbose ) printf( "Refactor: " ), Aig_ManPrintStats( pAig );
203 
204  // balance
205  if ( fBalance )
206  {
207  pAig = Dar_ManBalance( pTemp = pAig, fUpdateLevel );
208  Aig_ManStop( pTemp );
209  if ( fVerbose ) printf( "Balance: " ), Aig_ManPrintStats( pAig );
210  }
211 
212  pParsRwr->fUseZeros = 1;
213  pParsRef->fUseZeros = 1;
214 
215  // rewrite
216  Dar_ManRewrite( pAig, pParsRwr );
217  pAig = Aig_ManDupDfs( pTemp = pAig );
218  Aig_ManStop( pTemp );
219  if ( fVerbose ) printf( "RewriteZ: " ), Aig_ManPrintStats( pAig );
220 
221  return pAig;
222 }
typedefABC_NAMESPACE_HEADER_START struct Aig_Man_t_ Aig_Man_t
INCLUDES ///.
Definition: aig.h:50
void Aig_ManStop(Aig_Man_t *p)
Definition: aigMan.c:187
int fUpdateLevel
Definition: dar.h:64
Aig_Man_t * Aig_ManDupDfs(Aig_Man_t *p)
Definition: aigDup.c:563
void Aig_ManPrintStats(Aig_Man_t *p)
Definition: aigMan.c:379
int Dar_ManRewrite(Aig_Man_t *pAig, Dar_RwrPar_t *pPars)
Definition: darCore.c:78
int fVerbose
Definition: dar.h:66
int Dar_ManRefactor(Aig_Man_t *pAig, Dar_RefPar_t *pPars)
Definition: darRefact.c:496
void Dar_ManDefaultRefParams(Dar_RefPar_t *pPars)
FUNCTION DEFINITIONS ///.
Definition: darRefact.c:85
int fUseZeros
Definition: dar.h:65
typedefABC_NAMESPACE_HEADER_START struct Dar_RwrPar_t_ Dar_RwrPar_t
INCLUDES ///.
Definition: dar.h:42
Aig_Man_t * Dar_ManBalance(Aig_Man_t *p, int fUpdateLevel)
Definition: darBalance.c:554
void Dar_ManDefaultRwrParams(Dar_RwrPar_t *pPars)
FUNCTION DEFINITIONS ///.
Definition: darCore.c:51
Aig_Man_t* Dar_ManCompress2 ( Aig_Man_t pAig,
int  fBalance,
int  fUpdateLevel,
int  fFanout,
int  fPower,
int  fVerbose 
)

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

Synopsis [Reproduces script "compress2".]

Description []

SideEffects []

SeeAlso []

Definition at line 235 of file darScript.c.

237 {
238  Aig_Man_t * pTemp;
239 
240  Dar_RwrPar_t ParsRwr, * pParsRwr = &ParsRwr;
241  Dar_RefPar_t ParsRef, * pParsRef = &ParsRef;
242 
243  Dar_ManDefaultRwrParams( pParsRwr );
244  Dar_ManDefaultRefParams( pParsRef );
245 
246  pParsRwr->fUpdateLevel = fUpdateLevel;
247  pParsRef->fUpdateLevel = fUpdateLevel;
248  pParsRwr->fFanout = fFanout;
249  pParsRwr->fPower = fPower;
250 
251  pParsRwr->fVerbose = 0;//fVerbose;
252  pParsRef->fVerbose = 0;//fVerbose;
253 
254  pAig = Aig_ManDupDfs( pAig );
255  if ( fVerbose ) printf( "Starting: " ), Aig_ManPrintStats( pAig );
256 /*
257  // balance
258  if ( fBalance )
259  {
260  pAig = Dar_ManBalance( pTemp = pAig, fUpdateLevel );
261  Aig_ManStop( pTemp );
262  if ( fVerbose ) printf( "Balance: " ), Aig_ManPrintStats( pAig );
263  }
264 */
265  // rewrite
266 // Dar_ManRewrite( pAig, pParsRwr );
267  pParsRwr->fUpdateLevel = 0; // disable level update
268  Dar_ManRewrite( pAig, pParsRwr );
269  pParsRwr->fUpdateLevel = fUpdateLevel; // reenable level update if needed
270 
271  pAig = Aig_ManDupDfs( pTemp = pAig );
272  Aig_ManStop( pTemp );
273  if ( fVerbose ) printf( "Rewrite: " ), Aig_ManPrintStats( pAig );
274 
275  // refactor
276  Dar_ManRefactor( pAig, pParsRef );
277  pAig = Aig_ManDupDfs( pTemp = pAig );
278  Aig_ManStop( pTemp );
279  if ( fVerbose ) printf( "Refactor: " ), Aig_ManPrintStats( pAig );
280 
281  // balance
282 // if ( fBalance )
283  {
284  pAig = Dar_ManBalance( pTemp = pAig, fUpdateLevel );
285  Aig_ManStop( pTemp );
286  if ( fVerbose ) printf( "Balance: " ), Aig_ManPrintStats( pAig );
287  }
288 
289  // rewrite
290  Dar_ManRewrite( pAig, pParsRwr );
291  pAig = Aig_ManDupDfs( pTemp = pAig );
292  Aig_ManStop( pTemp );
293  if ( fVerbose ) printf( "Rewrite: " ), Aig_ManPrintStats( pAig );
294 
295  pParsRwr->fUseZeros = 1;
296  pParsRef->fUseZeros = 1;
297 
298  // rewrite
299  Dar_ManRewrite( pAig, pParsRwr );
300  pAig = Aig_ManDupDfs( pTemp = pAig );
301  Aig_ManStop( pTemp );
302  if ( fVerbose ) printf( "RewriteZ: " ), Aig_ManPrintStats( pAig );
303 
304  // balance
305  if ( fBalance )
306  {
307  pAig = Dar_ManBalance( pTemp = pAig, fUpdateLevel );
308  Aig_ManStop( pTemp );
309  if ( fVerbose ) printf( "Balance: " ), Aig_ManPrintStats( pAig );
310  }
311 
312  // refactor
313  Dar_ManRefactor( pAig, pParsRef );
314  pAig = Aig_ManDupDfs( pTemp = pAig );
315  Aig_ManStop( pTemp );
316  if ( fVerbose ) printf( "RefactorZ: " ), Aig_ManPrintStats( pAig );
317 
318  // rewrite
319  Dar_ManRewrite( pAig, pParsRwr );
320  pAig = Aig_ManDupDfs( pTemp = pAig );
321  Aig_ManStop( pTemp );
322  if ( fVerbose ) printf( "RewriteZ: " ), Aig_ManPrintStats( pAig );
323 
324  // balance
325  if ( fBalance )
326  {
327  pAig = Dar_ManBalance( pTemp = pAig, fUpdateLevel );
328  Aig_ManStop( pTemp );
329  if ( fVerbose ) printf( "Balance: " ), Aig_ManPrintStats( pAig );
330  }
331  return pAig;
332 }
typedefABC_NAMESPACE_HEADER_START struct Aig_Man_t_ Aig_Man_t
INCLUDES ///.
Definition: aig.h:50
void Aig_ManStop(Aig_Man_t *p)
Definition: aigMan.c:187
int fUpdateLevel
Definition: dar.h:64
Aig_Man_t * Aig_ManDupDfs(Aig_Man_t *p)
Definition: aigDup.c:563
void Aig_ManPrintStats(Aig_Man_t *p)
Definition: aigMan.c:379
int Dar_ManRewrite(Aig_Man_t *pAig, Dar_RwrPar_t *pPars)
Definition: darCore.c:78
int fVerbose
Definition: dar.h:66
int Dar_ManRefactor(Aig_Man_t *pAig, Dar_RefPar_t *pPars)
Definition: darRefact.c:496
void Dar_ManDefaultRefParams(Dar_RefPar_t *pPars)
FUNCTION DEFINITIONS ///.
Definition: darRefact.c:85
int fUseZeros
Definition: dar.h:65
typedefABC_NAMESPACE_HEADER_START struct Dar_RwrPar_t_ Dar_RwrPar_t
INCLUDES ///.
Definition: dar.h:42
Aig_Man_t * Dar_ManBalance(Aig_Man_t *p, int fUpdateLevel)
Definition: darBalance.c:554
void Dar_ManDefaultRwrParams(Dar_RwrPar_t *pPars)
FUNCTION DEFINITIONS ///.
Definition: darCore.c:51
Aig_MmFixed_t* Dar_ManComputeCuts ( Aig_Man_t pAig,
int  nCutsMax,
int  fSkipTtMin,
int  fVerbose 
)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 287 of file darCore.c.

288 {
289  Dar_Man_t * p;
290  Dar_RwrPar_t Pars, * pPars = &Pars;
291  Aig_Obj_t * pObj;
292  Aig_MmFixed_t * pMemCuts;
293  int i, nNodes;
294  abctime clk = Abc_Clock();
295  // remove dangling nodes
296  if ( (nNodes = Aig_ManCleanup( pAig )) )
297  {
298 // printf( "Removing %d nodes.\n", nNodes );
299  }
300  // create default parameters
301  Dar_ManDefaultRwrParams( pPars );
302  pPars->nCutsMax = nCutsMax;
303  // create rewriting manager
304  p = Dar_ManStart( pAig, pPars );
305  // set elementary cuts for the PIs
306 // Dar_ManCutsStart( p );
307  Aig_MmFixedRestart( p->pMemCuts );
308  Dar_ObjPrepareCuts( p, Aig_ManConst1(p->pAig) );
309  Aig_ManForEachCi( pAig, pObj, i )
310  Dar_ObjPrepareCuts( p, pObj );
311  // compute cuts for each nodes in the topological order
312  Aig_ManForEachNode( pAig, pObj, i )
313  Dar_ObjComputeCuts( p, pObj, fSkipTtMin );
314  // print verbose stats
315  if ( fVerbose )
316  {
317 // Aig_Obj_t * pObj;
318  int nCuts, nCutsK;//, i;
319  nCuts = Dar_ManCutCount( pAig, &nCutsK );
320  printf( "Nodes = %6d. Total cuts = %6d. 4-input cuts = %6d.\n",
321  Aig_ManObjNum(pAig), nCuts, nCutsK );
322  printf( "Cut size = %2d. Truth size = %2d. Total mem = %5.2f MB ",
323  (int)sizeof(Dar_Cut_t), (int)4, 1.0*Aig_MmFixedReadMemUsage(p->pMemCuts)/(1<<20) );
324  ABC_PRT( "Runtime", Abc_Clock() - clk );
325 /*
326  Aig_ManForEachNode( pAig, pObj, i )
327  if ( i % 300 == 0 )
328  Dar_ObjCutPrint( pAig, pObj );
329 */
330  }
331  // free the cuts
332  pMemCuts = p->pMemCuts;
333  p->pMemCuts = NULL;
334 // Dar_ManCutsFree( p );
335  // stop the rewriting manager
336  Dar_ManStop( p );
337  return pMemCuts;
338 }
void Dar_ManStop(Dar_Man_t *p)
Definition: darMan.c:69
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static int Aig_ManObjNum(Aig_Man_t *p)
Definition: aig.h:258
Dar_Cut_t * Dar_ObjComputeCuts(Dar_Man_t *p, Aig_Obj_t *pObj, int fSkipTtMin)
Definition: darCut.c:738
#define Aig_ManForEachCi(p, pObj, i)
ITERATORS ///.
Definition: aig.h:393
int Dar_ManCutCount(Aig_Man_t *pAig, int *pnCutsK)
Definition: darCore.c:259
static abctime Abc_Clock()
Definition: abc_global.h:279
DECLARATIONS ///.
Definition: aigMem.c:30
typedefABC_NAMESPACE_HEADER_START struct Dar_Man_t_ Dar_Man_t
INCLUDES ///.
Definition: darInt.h:51
#define Aig_ManForEachNode(p, pObj, i)
Definition: aig.h:413
if(last==0)
Definition: sparse_int.h:34
Definition: aig.h:69
static Aig_Obj_t * Aig_ManConst1(Aig_Man_t *p)
Definition: aig.h:264
Dar_Man_t * Dar_ManStart(Aig_Man_t *pAig, Dar_RwrPar_t *pPars)
DECLARATIONS ///.
Definition: darMan.c:44
int Aig_MmFixedReadMemUsage(Aig_MmFixed_t *p)
Definition: aigMem.c:271
#define ABC_PRT(a, t)
Definition: abc_global.h:220
typedefABC_NAMESPACE_HEADER_START struct Dar_RwrPar_t_ Dar_RwrPar_t
INCLUDES ///.
Definition: dar.h:42
void Aig_MmFixedRestart(Aig_MmFixed_t *p)
Definition: aigMem.c:232
void Dar_ManDefaultRwrParams(Dar_RwrPar_t *pPars)
FUNCTION DEFINITIONS ///.
Definition: darCore.c:51
Dar_Cut_t * Dar_ObjPrepareCuts(Dar_Man_t *p, Aig_Obj_t *pObj)
Definition: darCut.c:668
ABC_INT64_T abctime
Definition: abc_global.h:278
int Aig_ManCleanup(Aig_Man_t *p)
Definition: aigMan.c:265
void Dar_ManDefaultRefParams ( Dar_RefPar_t pPars)

FUNCTION DEFINITIONS ///.

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

Synopsis [Returns the structure with default assignment of parameters.]

Description []

SideEffects []

SeeAlso []

Definition at line 85 of file darRefact.c.

86 {
87  memset( pPars, 0, sizeof(Dar_RefPar_t) );
88  pPars->nMffcMin = 2; // the min MFFC size for which refactoring is used
89  pPars->nLeafMax = 12; // the max number of leaves of a cut
90  pPars->nCutsMax = 5; // the max number of cuts to consider
91  pPars->fUpdateLevel = 0;
92  pPars->fUseZeros = 0;
93  pPars->fVerbose = 0;
94  pPars->fVeryVerbose = 0;
95 }
char * memset()
int fUpdateLevel
Definition: dar.h:64
int fVeryVerbose
Definition: dar.h:67
int nCutsMax
Definition: dar.h:62
int nLeafMax
Definition: dar.h:61
int fVerbose
Definition: dar.h:66
int nMffcMin
Definition: dar.h:60
int fUseZeros
Definition: dar.h:65
void Dar_ManDefaultRwrParams ( Dar_RwrPar_t pPars)

FUNCTION DEFINITIONS ///.

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

Synopsis [Returns the structure with default assignment of parameters.]

Description []

SideEffects []

SeeAlso []

Definition at line 51 of file darCore.c.

52 {
53  memset( pPars, 0, sizeof(Dar_RwrPar_t) );
54  pPars->nCutsMax = 8; // 8
55  pPars->nSubgMax = 5; // 5 is a "magic number"
56  pPars->fFanout = 1;
57  pPars->fUpdateLevel = 0;
58  pPars->fUseZeros = 0;
59  pPars->fPower = 0;
60  pPars->fRecycle = 1;
61  pPars->fVerbose = 0;
62  pPars->fVeryVerbose = 0;
63 }
char * memset()
typedefABC_NAMESPACE_HEADER_START struct Dar_RwrPar_t_ Dar_RwrPar_t
INCLUDES ///.
Definition: dar.h:42
int Dar_ManRefactor ( Aig_Man_t pAig,
Dar_RefPar_t pPars 
)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 496 of file darRefact.c.

497 {
498 // Bar_Progress_t * pProgress;
499  Ref_Man_t * p;
500  Vec_Ptr_t * vCut, * vCut2;
501  Aig_Obj_t * pObj, * pObjNew;
502  int nNodesOld, nNodeBefore, nNodeAfter, nNodesSaved, nNodesSaved2;
503  int i, Required, nLevelMin;
504  abctime clkStart, clk;
505 
506  // start the manager
507  p = Dar_ManRefStart( pAig, pPars );
508  // remove dangling nodes
509  Aig_ManCleanup( pAig );
510  // if updating levels is requested, start fanout and timing
511  Aig_ManFanoutStart( pAig );
512  if ( p->pPars->fUpdateLevel )
513  Aig_ManStartReverseLevels( pAig, 0 );
514 
515  // resynthesize each node once
516  clkStart = Abc_Clock();
517  vCut = Vec_VecEntry( p->vCuts, 0 );
518  vCut2 = Vec_VecEntry( p->vCuts, 1 );
519  p->nNodesInit = Aig_ManNodeNum(pAig);
520  nNodesOld = Vec_PtrSize( pAig->vObjs );
521 // pProgress = Bar_ProgressStart( stdout, nNodesOld );
522  Aig_ManForEachObj( pAig, pObj, i )
523  {
524 // Bar_ProgressUpdate( pProgress, i, NULL );
525  if ( !Aig_ObjIsNode(pObj) )
526  continue;
527  if ( i > nNodesOld )
528  break;
529  if ( pAig->Time2Quit && !(i & 256) && Abc_Clock() > pAig->Time2Quit )
530  break;
531  Vec_VecClear( p->vCuts );
532 
533 //printf( "\nConsidering node %d.\n", pObj->Id );
534  // get the bounded MFFC size
535 clk = Abc_Clock();
536  nLevelMin = Abc_MaxInt( 0, Aig_ObjLevel(pObj) - 10 );
537  nNodesSaved = Aig_NodeMffcSupp( pAig, pObj, nLevelMin, vCut );
538  if ( nNodesSaved < p->pPars->nMffcMin ) // too small to consider
539  {
540 p->timeCuts += Abc_Clock() - clk;
541  continue;
542  }
543  p->nNodesTried++;
544  if ( Vec_PtrSize(vCut) > p->pPars->nLeafMax ) // get one reconv-driven cut
545  {
546  Aig_ManFindCut( pObj, vCut, p->vCutNodes, p->pPars->nLeafMax, 50 );
547  nNodesSaved = Aig_NodeMffcLabelCut( p->pAig, pObj, vCut );
548  }
549  else if ( Vec_PtrSize(vCut) < p->pPars->nLeafMax - 2 && p->pPars->fExtend )
550  {
551  if ( !Dar_ObjCutLevelAchieved(vCut, nLevelMin) )
552  {
553  if ( Aig_NodeMffcExtendCut( pAig, pObj, vCut, vCut2 ) )
554  {
555  nNodesSaved2 = Aig_NodeMffcLabelCut( p->pAig, pObj, vCut );
556  assert( nNodesSaved2 == nNodesSaved );
557  }
558  if ( Vec_PtrSize(vCut2) > p->pPars->nLeafMax )
559  Vec_PtrClear(vCut2);
560  if ( Vec_PtrSize(vCut2) > 0 )
561  {
562  p->nNodesExten++;
563 // printf( "%d(%d) ", Vec_PtrSize(vCut), Vec_PtrSize(vCut2) );
564  }
565  }
566  else
567  p->nNodesBelow++;
568  }
569 p->timeCuts += Abc_Clock() - clk;
570 
571  // try the cuts
572 clk = Abc_Clock();
573  Required = pAig->vLevelR? Aig_ObjRequiredLevel(pAig, pObj) : ABC_INFINITY;
574  Dar_ManRefactorTryCuts( p, pObj, nNodesSaved, Required );
575 p->timeEval += Abc_Clock() - clk;
576 
577  // check the best gain
578  if ( !(p->GainBest > 0 || (p->GainBest == 0 && p->pPars->fUseZeros)) )
579  {
580  if ( p->pGraphBest )
581  Kit_GraphFree( p->pGraphBest );
582  continue;
583  }
584 //printf( "\n" );
585 
586  // if we end up here, a rewriting step is accepted
587  nNodeBefore = Aig_ManNodeNum( pAig );
588  pObjNew = Dar_RefactBuildGraph( pAig, p->vLeavesBest, p->pGraphBest );
589  assert( (int)Aig_Regular(pObjNew)->Level <= Required );
590  // replace the node
591  Aig_ObjReplace( pAig, pObj, pObjNew, p->pPars->fUpdateLevel );
592  // compare the gains
593  nNodeAfter = Aig_ManNodeNum( pAig );
594  assert( p->GainBest <= nNodeBefore - nNodeAfter );
595  Kit_GraphFree( p->pGraphBest );
596  p->nCutsUsed++;
597 // break;
598  }
599 p->timeTotal = Abc_Clock() - clkStart;
600 p->timeOther = p->timeTotal - p->timeCuts - p->timeEval;
601 
602 // Bar_ProgressStop( pProgress );
603  // put the nodes into the DFS order and reassign their IDs
604 // Aig_NtkReassignIds( p );
605  // fix the levels
606  Aig_ManFanoutStop( pAig );
607  if ( p->pPars->fUpdateLevel )
608  Aig_ManStopReverseLevels( pAig );
609 /*
610  Aig_ManForEachObj( p->pAig, pObj, i )
611  if ( Aig_ObjIsNode(pObj) && Aig_ObjRefs(pObj) == 0 )
612  {
613  printf( "Unreferenced " );
614  Aig_ObjPrintVerbose( pObj, 0 );
615  printf( "\n" );
616  }
617 */
618  // remove dangling nodes (they should not be here!)
619  Aig_ManCleanup( pAig );
620 
621  // stop the rewriting manager
622  Dar_ManRefStop( p );
623 // Aig_ManCheckPhase( pAig );
624  if ( !Aig_ManCheck( pAig ) )
625  {
626  printf( "Dar_ManRefactor: The network check has failed.\n" );
627  return 0;
628  }
629  return 1;
630 
631 }
void Dar_ManRefStop(Ref_Man_t *p)
Definition: darRefact.c:166
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition: vecPtr.h:42
ABC_DLL int Aig_ManCheck(Aig_Man_t *p)
FUNCTION DECLARATIONS ///.
Definition: aigCheck.c:45
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static Aig_Obj_t * Aig_Regular(Aig_Obj_t *p)
Definition: aig.h:246
int Aig_ObjRequiredLevel(Aig_Man_t *p, Aig_Obj_t *pObj)
Definition: aigTiming.c:100
static abctime Abc_Clock()
Definition: abc_global.h:279
static int Abc_MaxInt(int a, int b)
Definition: abc_global.h:238
int Dar_ObjCutLevelAchieved(Vec_Ptr_t *vCut, int nLevelMin)
Definition: darRefact.c:475
static int Vec_PtrSize(Vec_Ptr_t *p)
Definition: vecPtr.h:295
static int Aig_ManNodeNum(Aig_Man_t *p)
Definition: aig.h:256
Aig_Obj_t * Dar_RefactBuildGraph(Aig_Man_t *pAig, Vec_Ptr_t *vCut, Kit_Graph_t *pGraph)
Definition: darRefact.c:313
void Aig_ManFanoutStart(Aig_Man_t *p)
FUNCTION DEFINITIONS ///.
Definition: aigFanout.c:56
static void Vec_VecClear(Vec_Vec_t *p)
Definition: vecVec.h:437
void Aig_ManStartReverseLevels(Aig_Man_t *p, int nMaxLevelIncrease)
Definition: aigTiming.c:142
void Aig_ManFanoutStop(Aig_Man_t *p)
Definition: aigFanout.c:89
int Aig_NodeMffcSupp(Aig_Man_t *p, Aig_Obj_t *pNode, int LevelMin, Vec_Ptr_t *vSupp)
Definition: aigMffc.c:179
static int Aig_ObjIsNode(Aig_Obj_t *pObj)
Definition: aig.h:280
void Aig_ManStopReverseLevels(Aig_Man_t *p)
Definition: aigTiming.c:175
void Kit_GraphFree(Kit_Graph_t *pGraph)
Definition: kitGraph.c:131
void Aig_ObjReplace(Aig_Man_t *p, Aig_Obj_t *pObjOld, Aig_Obj_t *pObjNew, int fUpdateLevel)
Definition: aigObj.c:467
Definition: aig.h:69
int nMffcMin
Definition: dar.h:60
typedefABC_NAMESPACE_IMPL_START struct Ref_Man_t_ Ref_Man_t
DECLARATIONS ///.
Definition: darRefact.c:35
#define Aig_ManForEachObj(p, pObj, i)
Definition: aig.h:403
int Aig_NodeMffcExtendCut(Aig_Man_t *p, Aig_Obj_t *pNode, Vec_Ptr_t *vLeaves, Vec_Ptr_t *vResult)
Definition: aigMffc.c:265
static int Aig_ObjLevel(Aig_Obj_t *pObj)
Definition: aig.h:323
#define ABC_INFINITY
MACRO DEFINITIONS ///.
Definition: abc_global.h:216
#define assert(ex)
Definition: util_old.h:213
static void Vec_PtrClear(Vec_Ptr_t *p)
Definition: vecPtr.h:545
int Dar_ManRefactorTryCuts(Ref_Man_t *p, Aig_Obj_t *pObj, int nNodesSaved, int Required)
Definition: darRefact.c:359
int Aig_NodeMffcLabelCut(Aig_Man_t *p, Aig_Obj_t *pNode, Vec_Ptr_t *vLeaves)
Definition: aigMffc.c:236
static Vec_Ptr_t * Vec_VecEntry(Vec_Vec_t *p, int i)
Definition: vecVec.h:271
void Aig_ManFindCut(Aig_Obj_t *pRoot, Vec_Ptr_t *vFront, Vec_Ptr_t *vVisited, int nSizeLimit, int nFanoutLimit)
Definition: aigWin.c:145
ABC_INT64_T abctime
Definition: abc_global.h:278
Ref_Man_t * Dar_ManRefStart(Aig_Man_t *pAig, Dar_RefPar_t *pPars)
Definition: darRefact.c:108
int Aig_ManCleanup(Aig_Man_t *p)
Definition: aigMan.c:265
int Dar_ManRewrite ( Aig_Man_t pAig,
Dar_RwrPar_t pPars 
)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 78 of file darCore.c.

79 {
80  extern Vec_Int_t * Saig_ManComputeSwitchProbs( Aig_Man_t * p, int nFrames, int nPref, int fProbOne );
81  Dar_Man_t * p;
82 // Bar_Progress_t * pProgress;
83  Dar_Cut_t * pCut;
84  Aig_Obj_t * pObj, * pObjNew;
85  int i, k, nNodesOld, nNodeBefore, nNodeAfter, Required;
86  abctime clk = 0, clkStart;
87  int Counter = 0;
88  int nMffcSize;//, nMffcGains[MAX_VAL+1][MAX_VAL+1] = {{0}};
89  // prepare the library
90  Dar_LibPrepare( pPars->nSubgMax );
91  // create rewriting manager
92  p = Dar_ManStart( pAig, pPars );
93  if ( pPars->fPower )
94  pAig->vProbs = Saig_ManComputeSwitchProbs( pAig, 48, 16, 1 );
95  // remove dangling nodes
96  Aig_ManCleanup( pAig );
97  // if updating levels is requested, start fanout and timing
98  if ( p->pPars->fFanout )
99  Aig_ManFanoutStart( pAig );
100  if ( p->pPars->fUpdateLevel )
101  Aig_ManStartReverseLevels( pAig, 0 );
102  // set elementary cuts for the PIs
103 // Dar_ManCutsStart( p );
104  // resynthesize each node once
105  clkStart = Abc_Clock();
106  p->nNodesInit = Aig_ManNodeNum(pAig);
107  nNodesOld = Vec_PtrSize( pAig->vObjs );
108 
109 // pProgress = Bar_ProgressStart( stdout, nNodesOld );
110  Aig_ManForEachObj( pAig, pObj, i )
111 // pProgress = Bar_ProgressStart( stdout, 100 );
112 // Aig_ManOrderStart( pAig );
113 // Aig_ManForEachNodeInOrder( pAig, pObj )
114  {
115  if ( pAig->Time2Quit && !(i & 256) && Abc_Clock() > pAig->Time2Quit )
116  break;
117 // Bar_ProgressUpdate( pProgress, 100*pAig->nAndPrev/pAig->nAndTotal, NULL );
118 // Bar_ProgressUpdate( pProgress, i, NULL );
119  if ( !Aig_ObjIsNode(pObj) )
120  continue;
121  if ( i > nNodesOld )
122 // if ( p->pPars->fUseZeros && i > nNodesOld )
123  break;
124  if ( pPars->fRecycle && ++Counter % 50000 == 0 && Aig_DagSize(pObj) < Vec_PtrSize(p->vCutNodes)/100 )
125  {
126 // printf( "Counter = %7d. Node = %7d. Dag = %5d. Vec = %5d.\n",
127 // Counter, i, Aig_DagSize(pObj), Vec_PtrSize(p->vCutNodes) );
128 // fflush( stdout );
129  Dar_ManCutsRestart( p, pObj );
130  }
131 
132  // consider freeing the cuts
133 // if ( (i & 0xFFF) == 0 && Aig_MmFixedReadMemUsage(p->pMemCuts)/(1<<20) > 100 )
134 // Dar_ManCutsStart( p );
135 
136  // compute cuts for the node
137  p->nNodesTried++;
138 clk = Abc_Clock();
139  Dar_ObjSetCuts( pObj, NULL );
140  Dar_ObjComputeCuts_rec( p, pObj );
141 p->timeCuts += Abc_Clock() - clk;
142 
143  // check if there is a trivial cut
144  Dar_ObjForEachCut( pObj, pCut, k )
145  if ( pCut->nLeaves == 0 || (pCut->nLeaves == 1 && pCut->pLeaves[0] != pObj->Id && Aig_ManObj(p->pAig, pCut->pLeaves[0])) )
146  break;
147  if ( k < (int)pObj->nCuts )
148  {
149  assert( pCut->nLeaves < 2 );
150  if ( pCut->nLeaves == 0 ) // replace by constant
151  {
152  assert( pCut->uTruth == 0 || pCut->uTruth == 0xFFFF );
153  pObjNew = Aig_NotCond( Aig_ManConst1(p->pAig), pCut->uTruth==0 );
154  }
155  else
156  {
157  assert( pCut->uTruth == 0xAAAA || pCut->uTruth == 0x5555 );
158  pObjNew = Aig_NotCond( Aig_ManObj(p->pAig, pCut->pLeaves[0]), pCut->uTruth==0x5555 );
159  }
160  // remove the old cuts
161  Dar_ObjSetCuts( pObj, NULL );
162  // replace the node
163  Aig_ObjReplace( pAig, pObj, pObjNew, p->pPars->fUpdateLevel );
164  continue;
165  }
166 
167  // evaluate the cuts
168  p->GainBest = -1;
169  nMffcSize = -1;
170  Required = pAig->vLevelR? Aig_ObjRequiredLevel(pAig, pObj) : ABC_INFINITY;
171  Dar_ObjForEachCut( pObj, pCut, k )
172  {
173  int nLeavesOld = pCut->nLeaves;
174  if ( pCut->nLeaves == 3 )
175  pCut->pLeaves[pCut->nLeaves++] = 0;
176  Dar_LibEval( p, pObj, pCut, Required, &nMffcSize );
177  pCut->nLeaves = nLeavesOld;
178  }
179  // check the best gain
180  if ( !(p->GainBest > 0 || (p->GainBest == 0 && p->pPars->fUseZeros)) )
181  {
182 // Aig_ObjOrderAdvance( pAig );
183  continue;
184  }
185 // nMffcGains[p->GainBest < MAX_VAL ? p->GainBest : MAX_VAL][nMffcSize < MAX_VAL ? nMffcSize : MAX_VAL]++;
186  // remove the old cuts
187  Dar_ObjSetCuts( pObj, NULL );
188  // if we end up here, a rewriting step is accepted
189  nNodeBefore = Aig_ManNodeNum( pAig );
190  pObjNew = Dar_LibBuildBest( p ); // pObjNew can be complemented!
191  pObjNew = Aig_NotCond( pObjNew, Aig_ObjPhaseReal(pObjNew) ^ pObj->fPhase );
192  assert( (int)Aig_Regular(pObjNew)->Level <= Required );
193  // replace the node
194  Aig_ObjReplace( pAig, pObj, pObjNew, p->pPars->fUpdateLevel );
195  // compare the gains
196  nNodeAfter = Aig_ManNodeNum( pAig );
197  assert( p->GainBest <= nNodeBefore - nNodeAfter );
198  // count gains of this class
199  p->ClassGains[p->ClassBest] += nNodeBefore - nNodeAfter;
200  }
201 // Aig_ManOrderStop( pAig );
202 /*
203  printf( "Distribution of gain (row) by MFFC size (column) %s 0-costs:\n", p->pPars->fUseZeros? "with":"without" );
204  for ( k = 0; k <= MAX_VAL; k++ )
205  printf( "<%4d> ", k );
206  printf( "\n" );
207  for ( i = 0; i <= MAX_VAL; i++ )
208  {
209  for ( k = 0; k <= MAX_VAL; k++ )
210  printf( "%6d ", nMffcGains[i][k] );
211  printf( "\n" );
212  }
213 */
214 
215 p->timeTotal = Abc_Clock() - clkStart;
216 p->timeOther = p->timeTotal - p->timeCuts - p->timeEval;
217 
218 // Bar_ProgressStop( pProgress );
219  Dar_ManCutsFree( p );
220  // put the nodes into the DFS order and reassign their IDs
221 // Aig_NtkReassignIds( p );
222  // fix the levels
223 // Aig_ManVerifyLevel( pAig );
224  if ( p->pPars->fFanout )
225  Aig_ManFanoutStop( pAig );
226  if ( p->pPars->fUpdateLevel )
227  {
228 // Aig_ManVerifyReverseLevel( pAig );
229  Aig_ManStopReverseLevels( pAig );
230  }
231  if ( pAig->vProbs )
232  {
233  Vec_IntFree( pAig->vProbs );
234  pAig->vProbs = NULL;
235  }
236  // stop the rewriting manager
237  Dar_ManStop( p );
238  Aig_ManCheckPhase( pAig );
239  // check
240  if ( !Aig_ManCheck( pAig ) )
241  {
242  printf( "Aig_ManRewrite: The network check has failed.\n" );
243  return 0;
244  }
245  return 1;
246 }
ABC_DLL int Aig_ManCheck(Aig_Man_t *p)
FUNCTION DECLARATIONS ///.
Definition: aigCheck.c:45
void Dar_ManStop(Dar_Man_t *p)
Definition: darMan.c:69
typedefABC_NAMESPACE_HEADER_START struct Aig_Man_t_ Aig_Man_t
INCLUDES ///.
Definition: aig.h:50
static Llb_Mgr_t * p
Definition: llb3Image.c:950
void Aig_ManCheckPhase(Aig_Man_t *p)
Definition: aigCheck.c:151
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition: bblif.c:37
unsigned uTruth
Definition: darInt.h:58
static void Dar_ObjSetCuts(Aig_Obj_t *pObj, Dar_Cut_t *pCuts)
Definition: darInt.h:108
static Aig_Obj_t * Aig_Regular(Aig_Obj_t *p)
Definition: aig.h:246
static Aig_Obj_t * Aig_ManObj(Aig_Man_t *p, int i)
Definition: aig.h:270
int Aig_ObjRequiredLevel(Aig_Man_t *p, Aig_Obj_t *pObj)
Definition: aigTiming.c:100
static abctime Abc_Clock()
Definition: abc_global.h:279
void Dar_ManCutsRestart(Dar_Man_t *p, Aig_Obj_t *pRoot)
FUNCTION DECLARATIONS ///.
Definition: darCut.c:714
static int Vec_PtrSize(Vec_Ptr_t *p)
Definition: vecPtr.h:295
static int Aig_ManNodeNum(Aig_Man_t *p)
Definition: aig.h:256
void Aig_ManFanoutStart(Aig_Man_t *p)
FUNCTION DEFINITIONS ///.
Definition: aigFanout.c:56
void Aig_ManStartReverseLevels(Aig_Man_t *p, int nMaxLevelIncrease)
Definition: aigTiming.c:142
void Aig_ManFanoutStop(Aig_Man_t *p)
Definition: aigFanout.c:89
Dar_Cut_t * Dar_ObjComputeCuts_rec(Dar_Man_t *p, Aig_Obj_t *pObj)
Definition: darCut.c:818
#define Dar_ObjForEachCut(pObj, pCut, i)
Definition: darInt.h:121
static int Aig_ObjIsNode(Aig_Obj_t *pObj)
Definition: aig.h:280
void Aig_ManStopReverseLevels(Aig_Man_t *p)
Definition: aigTiming.c:175
typedefABC_NAMESPACE_HEADER_START struct Dar_Man_t_ Dar_Man_t
INCLUDES ///.
Definition: darInt.h:51
int pLeaves[4]
Definition: darInt.h:63
Vec_Int_t * Saig_ManComputeSwitchProbs(Aig_Man_t *pAig, int nFrames, int nPref, int fProbOne)
Definition: giaSwitch.c:684
void Aig_ObjReplace(Aig_Man_t *p, Aig_Obj_t *pObjOld, Aig_Obj_t *pObjNew, int fUpdateLevel)
Definition: aigObj.c:467
void Dar_LibEval(Dar_Man_t *p, Aig_Obj_t *pRoot, Dar_Cut_t *pCut, int Required, int *pnMffcSize)
Definition: darLib.c:920
if(last==0)
Definition: sparse_int.h:34
static int Aig_ObjPhaseReal(Aig_Obj_t *pObj)
Definition: aig.h:299
Definition: aig.h:69
static int Counter
void Dar_ManCutsFree(Dar_Man_t *p)
Definition: darCut.c:648
unsigned nLeaves
Definition: darInt.h:62
void Dar_LibPrepare(int nSubgraphs)
Definition: darLib.c:478
static Aig_Obj_t * Aig_ManConst1(Aig_Man_t *p)
Definition: aig.h:264
int Aig_DagSize(Aig_Obj_t *pObj)
Definition: aigDfs.c:712
unsigned int fPhase
Definition: aig.h:78
#define Aig_ManForEachObj(p, pObj, i)
Definition: aig.h:403
Dar_Man_t * Dar_ManStart(Aig_Man_t *pAig, Dar_RwrPar_t *pPars)
DECLARATIONS ///.
Definition: darMan.c:44
#define ABC_INFINITY
MACRO DEFINITIONS ///.
Definition: abc_global.h:216
#define assert(ex)
Definition: util_old.h:213
static Aig_Obj_t * Aig_NotCond(Aig_Obj_t *p, int c)
Definition: aig.h:248
static void Vec_IntFree(Vec_Int_t *p)
Definition: bblif.c:235
ABC_INT64_T abctime
Definition: abc_global.h:278
int Aig_ManCleanup(Aig_Man_t *p)
Definition: aigMan.c:265
Aig_Obj_t * Dar_LibBuildBest(Dar_Man_t *p)
Definition: darLib.c:1031
Aig_Man_t* Dar_ManRewriteDefault ( Aig_Man_t pAig)

DECLARATIONS ///.

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

FileName [darScript.c]

SystemName [ABC: Logic synthesis and verification system.]

PackageName [DAG-aware AIG rewriting.]

Synopsis [Rewriting scripts.]

Author [Alan Mishchenko]

Affiliation [UC Berkeley]

Date [Ver. 1.0. Started - April 28, 2007.]

Revision [

Id:
darScript.c,v 1.00 2007/04/28 00:00:00 alanmi Exp

]FUNCTION DEFINITIONS /// Function*************************************************************

Synopsis [Performs one iteration of AIG rewriting.]

Description []

SideEffects []

SeeAlso []

Definition at line 48 of file darScript.c.

49 {
50  Aig_Man_t * pTemp;
51  Dar_RwrPar_t Pars, * pPars = &Pars;
52  Dar_ManDefaultRwrParams( pPars );
53  pAig = Aig_ManDupDfs( pAig );
54  Dar_ManRewrite( pAig, pPars );
55  pAig = Aig_ManDupDfs( pTemp = pAig );
56  Aig_ManStop( pTemp );
57  return pAig;
58 }
typedefABC_NAMESPACE_HEADER_START struct Aig_Man_t_ Aig_Man_t
INCLUDES ///.
Definition: aig.h:50
void Aig_ManStop(Aig_Man_t *p)
Definition: aigMan.c:187
Aig_Man_t * Aig_ManDupDfs(Aig_Man_t *p)
Definition: aigDup.c:563
int Dar_ManRewrite(Aig_Man_t *pAig, Dar_RwrPar_t *pPars)
Definition: darCore.c:78
typedefABC_NAMESPACE_HEADER_START struct Dar_RwrPar_t_ Dar_RwrPar_t
INCLUDES ///.
Definition: dar.h:42
void Dar_ManDefaultRwrParams(Dar_RwrPar_t *pPars)
FUNCTION DEFINITIONS ///.
Definition: darCore.c:51
Aig_Man_t* Dar_ManRwsat ( Aig_Man_t pAig,
int  fBalance,
int  fVerbose 
)

DECLARATIONS ///.

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

Synopsis [Reproduces script "rwsat".]

Description []

SideEffects [This procedure does not tighten level during restructuring.]

SeeAlso []

Definition at line 71 of file darScript.c.

73 {
74  Aig_Man_t * pTemp;
75  abctime Time = pAig->Time2Quit;
76 
77  Dar_RwrPar_t ParsRwr, * pParsRwr = &ParsRwr;
78  Dar_RefPar_t ParsRef, * pParsRef = &ParsRef;
79 
80  Dar_ManDefaultRwrParams( pParsRwr );
81  Dar_ManDefaultRefParams( pParsRef );
82 
83  pParsRwr->fUpdateLevel = 0;
84  pParsRef->fUpdateLevel = 0;
85 
86  pParsRwr->fVerbose = fVerbose;
87  pParsRef->fVerbose = fVerbose;
88 //printf( "1" );
89  pAig = Aig_ManDupDfs( pAig );
90  if ( fVerbose ) printf( "Starting: " ), Aig_ManPrintStats( pAig );
91 
92 //printf( "2" );
93  // balance
94  if ( fBalance )
95  {
96  pAig->Time2Quit = Time;
97  pAig = Dar_ManBalance( pTemp = pAig, 0 );
98  Aig_ManStop( pTemp );
99  if ( fVerbose ) printf( "Balance: " ), Aig_ManPrintStats( pAig );
100  if ( Time && Abc_Clock() > Time )
101  { if ( pAig ) Aig_ManStop( pAig ); return NULL; }
102  }
103 
104 //Aig_ManDumpBlif( pAig, "inter.blif", NULL, NULL );
105 //printf( "3" );
106  // rewrite
107  pAig->Time2Quit = Time;
108  Dar_ManRewrite( pAig, pParsRwr );
109  pAig = Aig_ManDupDfs( pTemp = pAig );
110  Aig_ManStop( pTemp );
111  if ( fVerbose ) printf( "Rewrite: " ), Aig_ManPrintStats( pAig );
112  if ( Time && Abc_Clock() > Time )
113  { if ( pAig ) Aig_ManStop( pAig ); return NULL; }
114 
115 //printf( "4" );
116  // refactor
117  pAig->Time2Quit = Time;
118  Dar_ManRefactor( pAig, pParsRef );
119  pAig = Aig_ManDupDfs( pTemp = pAig );
120  Aig_ManStop( pTemp );
121  if ( fVerbose ) printf( "Refactor: " ), Aig_ManPrintStats( pAig );
122  if ( Time && Abc_Clock() > Time )
123  { if ( pAig ) Aig_ManStop( pAig ); return NULL; }
124 
125 //printf( "5" );
126  // balance
127  if ( fBalance )
128  {
129  pAig->Time2Quit = Time;
130  pAig = Dar_ManBalance( pTemp = pAig, 0 );
131  Aig_ManStop( pTemp );
132  if ( fVerbose ) printf( "Balance: " ), Aig_ManPrintStats( pAig );
133  if ( Time && Abc_Clock() > Time )
134  { if ( pAig ) Aig_ManStop( pAig ); return NULL; }
135  }
136 
137 //printf( "6" );
138  // rewrite
139  pAig->Time2Quit = Time;
140  Dar_ManRewrite( pAig, pParsRwr );
141  pAig = Aig_ManDupDfs( pTemp = pAig );
142  Aig_ManStop( pTemp );
143  if ( fVerbose ) printf( "Rewrite: " ), Aig_ManPrintStats( pAig );
144  if ( Time && Abc_Clock() > Time )
145  { if ( pAig ) Aig_ManStop( pAig ); return NULL; }
146 
147 //printf( "7" );
148  return pAig;
149 }
typedefABC_NAMESPACE_HEADER_START struct Aig_Man_t_ Aig_Man_t
INCLUDES ///.
Definition: aig.h:50
void Aig_ManStop(Aig_Man_t *p)
Definition: aigMan.c:187
int fUpdateLevel
Definition: dar.h:64
Aig_Man_t * Aig_ManDupDfs(Aig_Man_t *p)
Definition: aigDup.c:563
void Aig_ManPrintStats(Aig_Man_t *p)
Definition: aigMan.c:379
int Dar_ManRewrite(Aig_Man_t *pAig, Dar_RwrPar_t *pPars)
Definition: darCore.c:78
static abctime Abc_Clock()
Definition: abc_global.h:279
int fVerbose
Definition: dar.h:66
int Dar_ManRefactor(Aig_Man_t *pAig, Dar_RefPar_t *pPars)
Definition: darRefact.c:496
void Dar_ManDefaultRefParams(Dar_RefPar_t *pPars)
FUNCTION DEFINITIONS ///.
Definition: darRefact.c:85
typedefABC_NAMESPACE_HEADER_START struct Dar_RwrPar_t_ Dar_RwrPar_t
INCLUDES ///.
Definition: dar.h:42
Aig_Man_t * Dar_ManBalance(Aig_Man_t *p, int fUpdateLevel)
Definition: darBalance.c:554
ABC_INT64_T abctime
Definition: abc_global.h:278
void Dar_ManDefaultRwrParams(Dar_RwrPar_t *pPars)
FUNCTION DEFINITIONS ///.
Definition: darCore.c:51