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

Go to the source code of this file.

Classes

struct  Lpk_Par_t_
 

Typedefs

typedef typedefABC_NAMESPACE_HEADER_START struct Lpk_Par_t_ Lpk_Par_t
 INCLUDES ///.
 

Functions

int Lpk_Resynthesize (Abc_Ntk_t *pNtk, Lpk_Par_t *pPars)
 MACRO DEFINITIONS ///.
 

Typedef Documentation

◆ Lpk_Par_t

typedef typedefABC_NAMESPACE_HEADER_START struct Lpk_Par_t_ Lpk_Par_t

INCLUDES ///.

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

FileName [lpk.h]

SystemName [ABC: Logic synthesis and verification system.]

PackageName [Fast Boolean matching for LUT structures.]

Synopsis [External declarations.]

Author [Alan Mishchenko]

Affiliation [UC Berkeley]

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

Revision [

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

] PARAMETERS /// BASIC TYPES ///

Definition at line 42 of file lpk.h.

Function Documentation

◆ Lpk_Resynthesize()

int Lpk_Resynthesize ( Abc_Ntk_t * pNtk,
Lpk_Par_t * pPars )
extern

MACRO DEFINITIONS ///.

ITERATORS /// FUNCTION DECLARATIONS ///

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

Synopsis [Performs resynthesis for one network.]

Description []

SideEffects []

SeeAlso []

Definition at line 584 of file lpkCore.c.

585{
586 ProgressBar * pProgress = NULL; // Suppress "might be used uninitialized"
587 Lpk_Man_t * p;
588 Abc_Obj_t * pObj;
589 double Delta;
590// int * pnFanouts, nObjMax;
591 int i, Iter, nNodes, nNodesPrev;
592 abctime clk = Abc_Clock();
593 assert( Abc_NtkIsLogic(pNtk) );
594
595 // sweep dangling nodes as a preprocessing step
596 Abc_NtkSweep( pNtk, 0 );
597
598 // get the number of inputs
599 if ( Abc_FrameReadLibLut() )
600 pPars->nLutSize = ((If_LibLut_t *)Abc_FrameReadLibLut())->LutMax;
601 else
602 pPars->nLutSize = Abc_NtkGetFaninMax( pNtk );
603 if ( pPars->nLutSize > 6 )
604 pPars->nLutSize = 6;
605 if ( pPars->nLutSize < 3 )
606 pPars->nLutSize = 3;
607 // adjust the number of crossbars based on LUT size
608 if ( pPars->nVarsShared > pPars->nLutSize - 2 )
609 pPars->nVarsShared = pPars->nLutSize - 2;
610 // get the max number of LUTs tried
611 pPars->nVarsMax = pPars->nLutsMax * (pPars->nLutSize - 1) + 1; // V = N * (K-1) + 1
612 while ( pPars->nVarsMax > 16 )
613 {
614 pPars->nLutsMax--;
615 pPars->nVarsMax = pPars->nLutsMax * (pPars->nLutSize - 1) + 1;
616
617 }
618 if ( pPars->fVerbose )
619 {
620 printf( "Resynthesis for %d %d-LUTs with %d non-MFFC LUTs, %d crossbars, and %d-input cuts.\n",
621 pPars->nLutsMax, pPars->nLutSize, pPars->nLutsOver, pPars->nVarsShared, pPars->nVarsMax );
622 }
623
624
625 // convert into the AIG
626 if ( !Abc_NtkToAig(pNtk) )
627 {
628 fprintf( stdout, "Converting to BDD has failed.\n" );
629 return 0;
630 }
631 assert( Abc_NtkHasAig(pNtk) );
632
633 // set the number of levels
634 Abc_NtkLevel( pNtk );
635 Abc_NtkStartReverseLevels( pNtk, pPars->nGrowthLevel );
636
637 // start the manager
638 p = Lpk_ManStart( pPars );
639 p->pNtk = pNtk;
640 p->nNodesTotal = Abc_NtkNodeNum(pNtk);
641 p->vLevels = Vec_VecStart( pNtk->LevelMax );
642 if ( p->pPars->fSatur )
643 p->vVisited = Vec_VecStart( 0 );
644 if ( pPars->fVerbose )
645 {
646 p->nTotalNets = Abc_NtkGetTotalFanins(pNtk);
647 p->nTotalNodes = Abc_NtkNodeNum(pNtk);
648 }
649/*
650 // save the number of fanouts of all objects
651 nObjMax = Abc_NtkObjNumMax( pNtk );
652 pnFanouts = ABC_ALLOC( int, nObjMax );
653 memset( pnFanouts, 0, sizeof(int) * nObjMax );
654 Abc_NtkForEachObj( pNtk, pObj, i )
655 pnFanouts[pObj->Id] = Abc_ObjFanoutNum(pObj);
656*/
657
658 // iterate over the network
659 nNodesPrev = p->nNodesTotal;
660 for ( Iter = 1; ; Iter++ )
661 {
662 // expand storage for changed nodes
663 if ( p->pPars->fSatur )
664 Vec_VecExpand( p->vVisited, Abc_NtkObjNumMax(pNtk) + 1 );
665
666 // consider all nodes
667 nNodes = Abc_NtkObjNumMax(pNtk);
668 if ( !pPars->fVeryVerbose )
669 pProgress = Extra_ProgressBarStart( stdout, nNodes );
670 Abc_NtkForEachNode( pNtk, pObj, i )
671 {
672 // skip all except the final node
673 if ( pPars->fFirst )
674 {
675 if ( !Abc_ObjIsCo(Abc_ObjFanout0(pObj)) )
676 continue;
677 }
678 if ( i >= nNodes )
679 break;
680 if ( !pPars->fVeryVerbose )
681 Extra_ProgressBarUpdate( pProgress, i, NULL );
682 // skip the nodes that did not change
683 if ( p->pPars->fSatur && !Lpk_NodeHasChanged(p, pObj->Id) )
684 continue;
685 // resynthesize
686 p->pObj = pObj;
687 if ( p->pPars->fOldAlgo )
689 else
691 }
692 if ( !pPars->fVeryVerbose )
693 Extra_ProgressBarStop( pProgress );
694
695 // check the increase
696 Delta = 100.00 * (nNodesPrev - Abc_NtkNodeNum(pNtk)) / p->nNodesTotal;
697 if ( Delta < 0.05 )
698 break;
699 nNodesPrev = Abc_NtkNodeNum(pNtk);
700 if ( !p->pPars->fSatur )
701 break;
702
703 if ( pPars->fFirst )
704 break;
705 }
707/*
708 // report the fanout changes
709 Abc_NtkForEachObj( pNtk, pObj, i )
710 {
711 if ( i >= nObjMax )
712 continue;
713 if ( Abc_ObjFanoutNum(pObj) - pnFanouts[pObj->Id] == 0 )
714 continue;
715 printf( "%d ", Abc_ObjFanoutNum(pObj) - pnFanouts[pObj->Id] );
716 }
717 printf( "\n" );
718*/
719
720 if ( pPars->fVerbose )
721 {
722// Cloud_PrintInfo( p->pDsdMan->dd );
723 p->nTotalNets2 = Abc_NtkGetTotalFanins(pNtk);
724 p->nTotalNodes2 = Abc_NtkNodeNum(pNtk);
725 printf( "Node gain = %5d. (%.2f %%) ",
726 p->nTotalNodes-p->nTotalNodes2, 100.0*(p->nTotalNodes-p->nTotalNodes2)/p->nTotalNodes );
727 printf( "Edge gain = %5d. (%.2f %%) ",
728 p->nTotalNets-p->nTotalNets2, 100.0*(p->nTotalNets-p->nTotalNets2)/p->nTotalNets );
729 printf( "Muxes = %4d. Dsds = %4d.", p->nMuxes, p->nDsds );
730 printf( "\n" );
731 printf( "Nodes = %5d (%3d) Cuts = %5d (%4d) Changes = %5d Iter = %2d Benefit = %d.\n",
732 p->nNodesTotal, p->nNodesOver, p->nCutsTotal, p->nCutsUseful, p->nChanges, Iter, p->nBenefited );
733
734 printf( "Non-DSD:" );
735 for ( i = 3; i <= pPars->nVarsMax; i++ )
736 if ( p->nBlocks[i] )
737 printf( " %d=%d", i, p->nBlocks[i] );
738 printf( "\n" );
739
740 p->timeTotal = Abc_Clock() - clk;
741 p->timeEval = p->timeEval - p->timeMap;
742 p->timeOther = p->timeTotal - p->timeCuts - p->timeTruth - p->timeEval - p->timeMap;
743 ABC_PRTP( "Cuts ", p->timeCuts, p->timeTotal );
744 ABC_PRTP( "Truth ", p->timeTruth, p->timeTotal );
745 ABC_PRTP( "CSupps", p->timeSupps, p->timeTotal );
746 ABC_PRTP( "Eval ", p->timeEval, p->timeTotal );
747 ABC_PRTP( " MuxAn", p->timeEvalMuxAn, p->timeEval );
748 ABC_PRTP( " MuxSp", p->timeEvalMuxSp, p->timeEval );
749 ABC_PRTP( " DsdAn", p->timeEvalDsdAn, p->timeEval );
750 ABC_PRTP( " DsdSp", p->timeEvalDsdSp, p->timeEval );
751 ABC_PRTP( " Other", p->timeEval-p->timeEvalMuxAn-p->timeEvalMuxSp-p->timeEvalDsdAn-p->timeEvalDsdSp, p->timeEval );
752 ABC_PRTP( "Map ", p->timeMap, p->timeTotal );
753 ABC_PRTP( "Other ", p->timeOther, p->timeTotal );
754 ABC_PRTP( "TOTAL ", p->timeTotal, p->timeTotal );
755 }
756
757 Lpk_ManStop( p );
758 // check the resulting network
759 if ( !Abc_NtkCheck( pNtk ) )
760 {
761 printf( "Lpk_Resynthesize: The network check has failed.\n" );
762 return 0;
763 }
764 return 1;
765}
ABC_DLL int Abc_NtkSweep(Abc_Ntk_t *pNtk, int fVerbose)
Definition abcSweep.c:692
struct Abc_Obj_t_ Abc_Obj_t
Definition abc.h:116
ABC_DLL int Abc_NtkGetFaninMax(Abc_Ntk_t *pNtk)
Definition abcUtil.c:486
ABC_DLL int Abc_NtkCheck(Abc_Ntk_t *pNtk)
FUNCTION DEFINITIONS ///.
Definition abcCheck.c:64
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 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
#define ABC_PRTP(a, t, T)
Definition abc_global.h:258
ABC_DLL void * Abc_FrameReadLibLut()
Definition mainFrame.c:57
ABC_NAMESPACE_IMPL_START typedef char ProgressBar
Definition bbrNtbdd.c:27
Cube * p
Definition exorList.c:222
void Extra_ProgressBarStop(ProgressBar *p)
ProgressBar * Extra_ProgressBarStart(FILE *pFile, int nItemsTotal)
FUNCTION DEFINITIONS ///.
struct If_LibLut_t_ If_LibLut_t
Definition if.h:82
int Lpk_NodeHasChanged(Lpk_Man_t *p, int iNode)
Definition lpkCore.c:172
int Lpk_ResynthesizeNodeNew(Lpk_Man_t *p)
Definition lpkCore.c:443
int Lpk_ResynthesizeNode(Lpk_Man_t *p)
Definition lpkCore.c:315
Lpk_Man_t * Lpk_ManStart(Lpk_Par_t *pPars)
DECLARATIONS ///.
Definition lpkMan.c:45
struct Lpk_Man_t_ Lpk_Man_t
Definition lpkInt.h:50
void Lpk_ManStop(Lpk_Man_t *p)
Definition lpkMan.c:95
int LevelMax
Definition abc.h:195
int Id
Definition abc.h:132
#define assert(ex)
Definition util_old.h:213
Here is the call graph for this function: