ABC: A System for Sequential Synthesis and Verification
 
Loading...
Searching...
No Matches
mfs.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  Mfs_Par_t_
 

Typedefs

typedef typedefABC_NAMESPACE_HEADER_START struct Mfs_Par_t_ Mfs_Par_t
 INCLUDES ///.
 

Functions

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

Typedef Documentation

◆ Mfs_Par_t

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

◆ Abc_NtkMfs()

int Abc_NtkMfs ( Abc_Ntk_t * pNtk,
Mfs_Par_t * pPars )
extern

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
436 p->TotalSwitchingBeg = Abc_NtkMfsTotalSwitching(pNtk);
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 );
451 p->vSuppsInv = Aig_ManSupportsInverse( p->pCare );
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 }
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);
565 p->nTotalEdgesEnd = Abc_NtkGetTotalFanins(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
577 p->TotalSwitchingEnd = Abc_NtkMfsTotalSwitching(pNtk);
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}
void Abc_NtkBidecResyn(Abc_Ntk_t *pNtk, int fVerbose)
Definition abcBidec.c:110
Vec_Int_t * Abc_NtkPowerEstimate(Abc_Ntk_t *pNtk, int fProbOne)
Definition abcSpeedup.c:669
struct Abc_Obj_t_ Abc_Obj_t
Definition abc.h:116
ABC_DLL float Abc_NtkMfsTotalSwitching(Abc_Ntk_t *pNtk)
Definition abcPrint.c:163
ABC_DLL Vec_Vec_t * Abc_NtkLevelize(Abc_Ntk_t *pNtk)
Definition abcDfs.c:1423
ABC_DLL int Abc_NtkGetFaninMax(Abc_Ntk_t *pNtk)
Definition abcUtil.c:486
struct Abc_Ntk_t_ Abc_Ntk_t
Definition abc.h:115
ABC_DLL void Abc_NtkStopReverseLevels(Abc_Ntk_t *pNtk)
Definition abcTiming.c:1302
ABC_DLL int Abc_NtkLevel(Abc_Ntk_t *pNtk)
Definition abcDfs.c:1449
ABC_DLL void Abc_NtkStartReverseLevels(Abc_Ntk_t *pNtk, int nMaxLevelIncrease)
Definition abcTiming.c:1274
ABC_DLL int Abc_NtkToAig(Abc_Ntk_t *pNtk)
Definition abcFunc.c:1333
ABC_DLL Abc_Ntk_t * Abc_NtkStrash(Abc_Ntk_t *pNtk, int fAllNodes, int fCleanup, int fRecord)
Definition abcStrash.c:265
#define Abc_NtkForEachCi(pNtk, pCi, i)
Definition abc.h:518
ABC_DLL void Abc_NtkDelete(Abc_Ntk_t *pNtk)
Definition abcNtk.c:1421
ABC_DLL int Abc_NtkGetTotalFanins(Abc_Ntk_t *pNtk)
Definition abcUtil.c:520
#define Abc_NtkForEachNode(pNtk, pNode, i)
Definition abc.h:464
ABC_INT64_T abctime
Definition abc_global.h:332
typedefABC_NAMESPACE_HEADER_START struct Aig_Man_t_ Aig_Man_t
INCLUDES ///.
Definition aig.h:50
Vec_Ptr_t * Aig_ManSupportsInverse(Aig_Man_t *p)
Definition aigPart.c:385
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition bblif.c:37
ABC_NAMESPACE_IMPL_START typedef char ProgressBar
Definition bbrNtbdd.c:27
struct Bdc_Par_t_ Bdc_Par_t
Definition bdc.h:44
Bdc_Man_t * Bdc_ManAlloc(Bdc_Par_t *pPars)
MACRO DEFINITIONS ///.
Definition bdcCore.c:68
Cube * p
Definition exorList.c:222
void Extra_ProgressBarStop(ProgressBar *p)
ProgressBar * Extra_ProgressBarStart(FILE *pFile, int nItemsTotal)
FUNCTION DEFINITIONS ///.
Aig_Man_t * Abc_NtkToDar(Abc_Ntk_t *pNtk, int fExors, int fRegisters)
Definition abcDar.c:237
int Abc_NtkMfsNode(Mfs_Man_t *p, Abc_Obj_t *pNode)
Definition mfsCore.c:306
int Abc_NtkMfsResub(Mfs_Man_t *p, Abc_Obj_t *pNode)
Definition mfsCore.c:236
void Abc_NtkMfsPowerResub(Mfs_Man_t *p, Mfs_Par_t *pPars)
Definition mfsCore.c:154
Mfs_Man_t * Mfs_ManAlloc(Mfs_Par_t *pPars)
DECLARATIONS ///.
Definition mfsMan.c:45
struct Mfs_Man_t_ Mfs_Man_t
Definition mfsInt.h:49
#define MFS_FANIN_MAX
INCLUDES ///.
Definition mfsInt.h:47
void Mfs_ManStop(Mfs_Man_t *p)
Definition mfsMan.c:170
void * pExcare
Definition abc.h:202
void * pData
Definition abc.h:145
unsigned Level
Definition abc.h:142
#define assert(ex)
Definition util_old.h:213
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition vecPtr.h:42
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.
Definition vecPtr.h:55
#define Vec_VecForEachLevelStart(vGlob, vVec, i, LevelStart)
Definition vecVec.h:57
typedefABC_NAMESPACE_HEADER_START struct Vec_Vec_t_ Vec_Vec_t
INCLUDES ///.
Definition vecVec.h:42
Here is the call graph for this function:

◆ Abc_NtkMfsParsDefault()

void Abc_NtkMfsParsDefault ( Mfs_Par_t * pPars)
extern

MACRO DEFINITIONS ///.

FUNCTION DECLARATIONS ///

MACRO 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}
typedefABC_NAMESPACE_HEADER_START struct Mfs_Par_t_ Mfs_Par_t
INCLUDES ///.
Definition mfs.h:42
char * memset()
Here is the call graph for this function: