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

Go to the source code of this file.

Data Structures

struct  Mfs_Par_t_
 

Typedefs

typedef
typedefABC_NAMESPACE_HEADER_START
struct Mfs_Par_t_ 
Mfs_Par_t
 INCLUDES ///. More...
 

Functions

void Abc_NtkMfsParsDefault (Mfs_Par_t *pPars)
 MACRO DEFINITIONS ///. More...
 
int Abc_NtkMfs (Abc_Ntk_t *pNtk, Mfs_Par_t *pPars)
 

Typedef Documentation

typedef typedefABC_NAMESPACE_HEADER_START struct Mfs_Par_t_ Mfs_Par_t

INCLUDES ///.

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

FileName [mfs.h]

SystemName [ABC: Logic synthesis and verification system.]

PackageName [The good old minimization with complete don't-cares.]

Synopsis [External declarations.]

Author [Alan Mishchenko]

Affiliation [UC Berkeley]

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

Revision [

Id:
mfs.h,v 1.00 2005/06/20 00:00:00 alanmi Exp

]PARAMETERS ///BASIC TYPES ///

Definition at line 42 of file mfs.h.

Function Documentation

int Abc_NtkMfs ( Abc_Ntk_t pNtk,
Mfs_Par_t pPars 
)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 377 of file mfsCore.c.

378 {
379  extern Aig_Man_t * Abc_NtkToDar( Abc_Ntk_t * pNtk, int fExors, int fRegisters );
380 
381  Bdc_Par_t Pars = {0}, * pDecPars = &Pars;
382  ProgressBar * pProgress;
383  Mfs_Man_t * p;
384  Abc_Obj_t * pObj;
385  Vec_Vec_t * vLevels;
386  Vec_Ptr_t * vNodes;
387  int i, k, nNodes, nFaninMax;
388  abctime clk = Abc_Clock(), clk2;
389  int nTotalNodesBeg = Abc_NtkNodeNum(pNtk);
390  int nTotalEdgesBeg = Abc_NtkGetTotalFanins(pNtk);
391 
392  assert( Abc_NtkIsLogic(pNtk) );
393  nFaninMax = Abc_NtkGetFaninMax(pNtk);
394  if ( pPars->fResub )
395  {
396  if ( nFaninMax > 8 )
397  {
398  printf( "Nodes with more than %d fanins will not be processed.\n", 8 );
399  nFaninMax = 8;
400  }
401  }
402  else
403  {
404  if ( nFaninMax > MFS_FANIN_MAX )
405  {
406  printf( "Nodes with more than %d fanins will not be processed.\n", MFS_FANIN_MAX );
407  nFaninMax = MFS_FANIN_MAX;
408  }
409  }
410  // perform the network sweep
411 // Abc_NtkSweep( pNtk, 0 );
412  // convert into the AIG
413  if ( !Abc_NtkToAig(pNtk) )
414  {
415  fprintf( stdout, "Converting to AIGs has failed.\n" );
416  return 0;
417  }
418  assert( Abc_NtkHasAig(pNtk) );
419 
420  // start the manager
421  p = Mfs_ManAlloc( pPars );
422  p->pNtk = pNtk;
423  p->nFaninMax = nFaninMax;
424 
425  // precomputer power-aware metrics
426  if ( pPars->fPower )
427  {
428  extern Vec_Int_t * Abc_NtkPowerEstimate( Abc_Ntk_t * pNtk, int fProbOne );
429  if ( pPars->fResub )
430  p->vProbs = Abc_NtkPowerEstimate( pNtk, 0 );
431  else
432  p->vProbs = Abc_NtkPowerEstimate( pNtk, 1 );
433 #if 0
434  printf( "Total switching before = %7.2f.\n", Abc_NtkMfsTotalSwitching(pNtk) );
435 #else
437 #endif
438  }
439 
440  if ( pNtk->pExcare )
441  {
442  Abc_Ntk_t * pTemp;
443  if ( Abc_NtkPiNum((Abc_Ntk_t *)pNtk->pExcare) != Abc_NtkCiNum(pNtk) )
444  printf( "The PI count of careset (%d) and logic network (%d) differ. Careset is not used.\n",
445  Abc_NtkPiNum((Abc_Ntk_t *)pNtk->pExcare), Abc_NtkCiNum(pNtk) );
446  else
447  {
448  pTemp = Abc_NtkStrash( (Abc_Ntk_t *)pNtk->pExcare, 0, 0, 0 );
449  p->pCare = Abc_NtkToDar( pTemp, 0, 0 );
450  Abc_NtkDelete( pTemp );
452  }
453  }
454  if ( p->pCare != NULL )
455  printf( "Performing optimization with %d external care clauses.\n", Aig_ManCoNum(p->pCare) );
456  // prepare the BDC manager
457  if ( !pPars->fResub )
458  {
459  pDecPars->nVarsMax = (nFaninMax < 3) ? 3 : nFaninMax;
460  pDecPars->fVerbose = pPars->fVerbose;
461  p->vTruth = Vec_IntAlloc( 0 );
462  p->pManDec = Bdc_ManAlloc( pDecPars );
463  }
464 
465  // label the register outputs
466  if ( p->pCare )
467  {
468  Abc_NtkForEachCi( pNtk, pObj, i )
469  pObj->pData = (void *)(ABC_PTRUINT_T)i;
470  }
471 
472  // compute levels
473  Abc_NtkLevel( pNtk );
474  Abc_NtkStartReverseLevels( pNtk, pPars->nGrowthLevel );
475 
476  // compute don't-cares for each node
477  nNodes = 0;
478  p->nTotalNodesBeg = nTotalNodesBeg;
479  p->nTotalEdgesBeg = nTotalEdgesBeg;
480  if ( pPars->fResub )
481  {
482 #if 0
483  printf( "TotalSwitching (%7.2f --> ", Abc_NtkMfsTotalSwitching(pNtk) );
484 #endif
485  if (pPars->fPower)
486  {
487  Abc_NtkMfsPowerResub( p, pPars);
488  } else
489  {
490  pProgress = Extra_ProgressBarStart( stdout, Abc_NtkObjNumMax(pNtk) );
491  Abc_NtkForEachNode( pNtk, pObj, i )
492  {
493  if ( p->pPars->nDepthMax && (int)pObj->Level > p->pPars->nDepthMax )
494  continue;
495  if ( Abc_ObjFaninNum(pObj) < 2 || Abc_ObjFaninNum(pObj) > nFaninMax )
496  continue;
497  if ( !p->pPars->fVeryVerbose )
498  Extra_ProgressBarUpdate( pProgress, i, NULL );
499  if ( pPars->fResub )
500  Abc_NtkMfsResub( p, pObj );
501  else
502  Abc_NtkMfsNode( p, pObj );
503  }
504  Extra_ProgressBarStop( pProgress );
505 #if 0
506  printf( " %7.2f )\n", Abc_NtkMfsTotalSwitching(pNtk) );
507 #endif
508  }
509  } else
510  {
511 #if 0
512  printf( "Total switching before = %7.2f, ----> ", Abc_NtkMfsTotalSwitching(pNtk) );
513 #endif
514  pProgress = Extra_ProgressBarStart( stdout, Abc_NtkNodeNum(pNtk) );
515  vLevels = Abc_NtkLevelize( pNtk );
516  Vec_VecForEachLevelStart( vLevels, vNodes, k, 1 )
517  {
518  if ( !p->pPars->fVeryVerbose )
519  Extra_ProgressBarUpdate( pProgress, nNodes, NULL );
520  p->nNodesGainedLevel = 0;
521  p->nTotConfLevel = 0;
522  p->nTimeOutsLevel = 0;
523  clk2 = Abc_Clock();
524  Vec_PtrForEachEntry( Abc_Obj_t *, vNodes, pObj, i )
525  {
526  if ( p->pPars->nDepthMax && (int)pObj->Level > p->pPars->nDepthMax )
527  break;
528  if ( Abc_ObjFaninNum(pObj) < 2 || Abc_ObjFaninNum(pObj) > nFaninMax )
529  continue;
530  if ( pPars->fResub )
531  Abc_NtkMfsResub( p, pObj );
532  else
533  Abc_NtkMfsNode( p, pObj );
534  }
535  nNodes += Vec_PtrSize(vNodes);
536  if ( pPars->fVerbose )
537  {
538  /*
539  printf( "Lev = %2d. Node = %5d. Ave gain = %5.2f. Ave conf = %5.2f. T/o = %6.2f %% ",
540  k, Vec_PtrSize(vNodes),
541  1.0*p->nNodesGainedLevel/Vec_PtrSize(vNodes),
542  1.0*p->nTotConfLevel/Vec_PtrSize(vNodes),
543  100.0*p->nTimeOutsLevel/Vec_PtrSize(vNodes) );
544  ABC_PRT( "Time", Abc_Clock() - clk2 );
545  */
546  }
547  }
548  Extra_ProgressBarStop( pProgress );
549  Vec_VecFree( vLevels );
550 #if 0
551  printf( " %7.2f.\n", Abc_NtkMfsTotalSwitching(pNtk) );
552 #endif
553  }
554  Abc_NtkStopReverseLevels( pNtk );
555 
556  // perform the sweeping
557  if ( !pPars->fResub )
558  {
559  extern void Abc_NtkBidecResyn( Abc_Ntk_t * pNtk, int fVerbose );
560 // Abc_NtkSweep( pNtk, 0 );
561 // Abc_NtkBidecResyn( pNtk, 0 );
562  }
563 
564  p->nTotalNodesEnd = Abc_NtkNodeNum(pNtk);
566 
567  // undo labesl
568  if ( p->pCare )
569  {
570  Abc_NtkForEachCi( pNtk, pObj, i )
571  pObj->pData = NULL;
572  }
573 
574  if ( pPars->fPower )
575  {
576 #if 1
578 // printf( "Total switching after = %7.2f.\n", Abc_NtkMfsTotalSwitching(pNtk) );
579 #else
580  printf( "Total switching after = %7.2f.\n", Abc_NtkMfsTotalSwitching(pNtk) );
581 #endif
582  }
583 
584  // free the manager
585  p->timeTotal = Abc_Clock() - clk;
586  Mfs_ManStop( p );
587  return 1;
588 }
ABC_DLL Vec_Vec_t * Abc_NtkLevelize(Abc_Ntk_t *pNtk)
Definition: abcDfs.c:1239
Vec_Int_t * vProbs
Definition: mfsInt.h:97
static int Abc_NtkIsLogic(Abc_Ntk_t *pNtk)
Definition: abc.h:250
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition: vecPtr.h:42
void Abc_NtkMfsPowerResub(Mfs_Man_t *p, Mfs_Par_t *pPars)
Definition: mfsCore.c:154
static int Abc_NtkObjNumMax(Abc_Ntk_t *pNtk)
Definition: abc.h:284
typedefABC_NAMESPACE_HEADER_START struct Vec_Vec_t_ Vec_Vec_t
INCLUDES ///.
Definition: vecVec.h:42
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
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition: bblif.c:37
int nTotalNodesEnd
Definition: mfsInt.h:121
Mfs_Par_t * pPars
Definition: mfsInt.h:53
#define Vec_VecForEachLevelStart(vGlob, vVec, i, LevelStart)
Definition: vecVec.h:57
ABC_DLL Abc_Ntk_t * Abc_NtkStrash(Abc_Ntk_t *pNtk, int fAllNodes, int fCleanup, int fRecord)
Definition: abcStrash.c:265
int nNodesGainedLevel
Definition: mfsInt.h:85
Bdc_Man_t * Bdc_ManAlloc(Bdc_Par_t *pPars)
MACRO DEFINITIONS ///.
Definition: bdcCore.c:68
static int Abc_ObjFaninNum(Abc_Obj_t *pObj)
Definition: abc.h:364
ABC_DLL int Abc_NtkGetFaninMax(Abc_Ntk_t *pNtk)
Definition: abcUtil.c:453
Bdc_Man_t * pManDec
Definition: mfsInt.h:82
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
ABC_DLL int Abc_NtkGetTotalFanins(Abc_Ntk_t *pNtk)
Definition: abcUtil.c:487
ABC_DLL float Abc_NtkMfsTotalSwitching(Abc_Ntk_t *pNtk)
Definition: abcPrint.c:132
ABC_DLL void Abc_NtkStopReverseLevels(Abc_Ntk_t *pNtk)
Definition: abcTiming.c:1190
ABC_DLL void Abc_NtkDelete(Abc_Ntk_t *pNtk)
Definition: abcNtk.c:1233
unsigned Level
Definition: abc.h:142
void Mfs_ManStop(Mfs_Man_t *p)
Definition: mfsMan.c:170
Vec_Ptr_t * vSuppsInv
Definition: mfsInt.h:56
static int Abc_NtkNodeNum(Abc_Ntk_t *pNtk)
Definition: abc.h:293
static int Aig_ManCoNum(Aig_Man_t *p)
Definition: aig.h:252
int nTimeOutsLevel
Definition: mfsInt.h:115
DECLARATIONS ///.
static Vec_Int_t * Vec_IntAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: bblif.c:149
Vec_Int_t * Abc_NtkPowerEstimate(Abc_Ntk_t *pNtk, int fProbOne)
Definition: abcSpeedup.c:669
Aig_Man_t * Abc_NtkToDar(Abc_Ntk_t *pNtk, int fExors, int fRegisters)
Definition: abcDar.c:233
void * pExcare
Definition: abc.h:202
int Abc_NtkMfsNode(Mfs_Man_t *p, Abc_Obj_t *pNode)
Definition: mfsCore.c:306
if(last==0)
Definition: sparse_int.h:34
int nFaninMax
Definition: mfsInt.h:57
ABC_DLL void Abc_NtkStartReverseLevels(Abc_Ntk_t *pNtk, int nMaxLevelIncrease)
Definition: abcTiming.c:1162
void Extra_ProgressBarStop(ProgressBar *p)
abctime timeTotal
Definition: mfsInt.h:134
#define Abc_NtkForEachNode(pNtk, pNode, i)
Definition: abc.h:461
Vec_Ptr_t * Aig_ManSupportsInverse(Aig_Man_t *p)
Definition: aigPart.c:385
float TotalSwitchingBeg
Definition: mfsInt.h:124
int nTotConfLevel
Definition: mfsInt.h:95
Mfs_Man_t * Mfs_ManAlloc(Mfs_Par_t *pPars)
DECLARATIONS ///.
Definition: mfsMan.c:45
#define Abc_NtkForEachCi(pNtk, pCi, i)
Definition: abc.h:515
Definition: bdc.h:45
static int Abc_NtkPiNum(Abc_Ntk_t *pNtk)
Definition: abc.h:285
void Abc_NtkBidecResyn(Abc_Ntk_t *pNtk, int fVerbose)
Definition: abcBidec.c:110
Abc_Ntk_t * pNtk
Definition: mfsInt.h:54
ProgressBar * Extra_ProgressBarStart(FILE *pFile, int nItemsTotal)
FUNCTION DEFINITIONS ///.
ABC_DLL int Abc_NtkToAig(Abc_Ntk_t *pNtk)
Definition: abcFunc.c:1192
#define assert(ex)
Definition: util_old.h:213
static void Extra_ProgressBarUpdate(ProgressBar *p, int nItemsCur, char *pString)
Definition: extra.h:243
static int Abc_NtkHasAig(Abc_Ntk_t *pNtk)
Definition: abc.h:255
float TotalSwitchingEnd
Definition: mfsInt.h:125
Aig_Man_t * pCare
Definition: mfsInt.h:55
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.
Definition: vecPtr.h:55
int Abc_NtkMfsResub(Mfs_Man_t *p, Abc_Obj_t *pNode)
Definition: mfsCore.c:236
ABC_INT64_T abctime
Definition: abc_global.h:278
Vec_Int_t * vTruth
Definition: mfsInt.h:81
ABC_DLL int Abc_NtkLevel(Abc_Ntk_t *pNtk)
Definition: abcDfs.c:1265
int nTotalEdgesEnd
Definition: mfsInt.h:123
#define MFS_FANIN_MAX
INCLUDES ///.
Definition: mfsInt.h:47
void Abc_NtkMfsParsDefault ( Mfs_Par_t pPars)

MACRO DEFINITIONS ///.

FUNCTION DECLARATIONS ///

MACRO DEFINITIONS ///.

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

Synopsis []

Description []

SideEffects []

SeeAlso []

MACRO DEFINITIONS ///.

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

FileName [mfsCore.c]

SystemName [ABC: Logic synthesis and verification system.]

PackageName [The good old minimization with complete don't-cares.]

Synopsis [Core procedures of this package.]

Author [Alan Mishchenko]

Affiliation [UC Berkeley]

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

Revision [

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

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 47 of file mfsCore.c.

48 {
49  memset( pPars, 0, sizeof(Mfs_Par_t) );
50  pPars->nWinTfoLevs = 2;
51  pPars->nFanoutsMax = 30;
52  pPars->nDepthMax = 20;
53  pPars->nWinMax = 300;
54  pPars->nGrowthLevel = 0;
55  pPars->nBTLimit = 5000;
56  pPars->fRrOnly = 0;
57  pPars->fResub = 1;
58  pPars->fArea = 0;
59  pPars->fMoreEffort = 0;
60  pPars->fSwapEdge = 0;
61  pPars->fOneHotness = 0;
62  pPars->fVerbose = 0;
63  pPars->fVeryVerbose = 0;
64 }
char * memset()
typedefABC_NAMESPACE_HEADER_START struct Mfs_Par_t_ Mfs_Par_t
INCLUDES ///.
Definition: mfs.h:42