src/opt/lpk/lpk.h File Reference

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  Lpk_Par_t_

Typedefs

typedef struct Lpk_Par_t_ Lpk_Par_t

Functions

int Lpk_Resynthesize (Abc_Ntk_t *pNtk, Lpk_Par_t *pPars)

Typedef Documentation

typedef struct Lpk_Par_t_ Lpk_Par_t

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

] INCLUDES /// PARAMETERS /// BASIC TYPES ///

Definition at line 40 of file lpk.h.


Function Documentation

int Lpk_Resynthesize ( Abc_Ntk_t pNtk,
Lpk_Par_t pPars 
)

MACRO DEFINITIONS /// ITERATORS /// FUNCTION DECLARATIONS ///

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

Synopsis [Performs resynthesis for one network.]

Description []

SideEffects []

SeeAlso []

Definition at line 501 of file lpkCore.c.

00502 {
00503     ProgressBar * pProgress;
00504     Lpk_Man_t * p;
00505     Abc_Obj_t * pObj;
00506     double Delta;
00507     int i, Iter, nNodes, nNodesPrev, clk = clock();
00508     assert( Abc_NtkIsLogic(pNtk) );
00509 
00510     // sweep dangling nodes as a preprocessing step
00511     Abc_NtkSweep( pNtk, 0 );
00512 
00513     // get the number of inputs
00514     pPars->nLutSize = Abc_NtkGetFaninMax( pNtk );
00515     // adjust the number of crossbars based on LUT size
00516     if ( pPars->nVarsShared > pPars->nLutSize - 2 )
00517         pPars->nVarsShared = pPars->nLutSize - 2;
00518     // get the max number of LUTs tried
00519     pPars->nVarsMax = pPars->nLutsMax * (pPars->nLutSize - 1) + 1; // V = N * (K-1) + 1
00520     while ( pPars->nVarsMax > 16 )
00521     {
00522         pPars->nLutsMax--;
00523         pPars->nVarsMax = pPars->nLutsMax * (pPars->nLutSize - 1) + 1;
00524 
00525     }
00526     if ( pPars->fVerbose )
00527     {
00528         printf( "Resynthesis for %d %d-LUTs with %d non-MFFC LUTs, %d crossbars, and %d-input cuts.\n",
00529             pPars->nLutsMax, pPars->nLutSize, pPars->nLutsOver, pPars->nVarsShared, pPars->nVarsMax );
00530     }
00531  
00532 
00533     // convert into the AIG
00534     if ( !Abc_NtkToAig(pNtk) )
00535     {
00536         fprintf( stdout, "Converting to BDD has failed.\n" );
00537         return 0;
00538     }
00539     assert( Abc_NtkHasAig(pNtk) );
00540 
00541     // set the number of levels
00542     Abc_NtkLevel( pNtk );
00543     Abc_NtkStartReverseLevels( pNtk, pPars->nGrowthLevel );
00544 
00545     // start the manager
00546     p = Lpk_ManStart( pPars );
00547     p->pNtk = pNtk;
00548     p->nNodesTotal = Abc_NtkNodeNum(pNtk);
00549     p->vLevels = Vec_VecStart( pNtk->LevelMax ); 
00550     if ( p->pPars->fSatur )
00551         p->vVisited = Vec_VecStart( 0 );
00552     if ( pPars->fVerbose )
00553     {
00554         p->nTotalNets = Abc_NtkGetTotalFanins(pNtk);
00555         p->nTotalNodes = Abc_NtkNodeNum(pNtk);
00556     }
00557 
00558     // iterate over the network
00559     nNodesPrev = p->nNodesTotal;
00560     for ( Iter = 1; ; Iter++ )
00561     {
00562         // expand storage for changed nodes
00563         if ( p->pPars->fSatur )
00564             Vec_VecExpand( p->vVisited, Abc_NtkObjNumMax(pNtk) + 1 );
00565 
00566         // consider all nodes
00567         nNodes = Abc_NtkObjNumMax(pNtk);
00568         if ( !pPars->fVeryVerbose )
00569             pProgress = Extra_ProgressBarStart( stdout, nNodes );
00570         Abc_NtkForEachNode( pNtk, pObj, i )
00571         {
00572             // skip all except the final node
00573             if ( pPars->fFirst )
00574             {
00575                 if ( !Abc_ObjIsCo(Abc_ObjFanout0(pObj)) )
00576                     continue;
00577             }
00578             if ( i >= nNodes )
00579                 break;
00580             if ( !pPars->fVeryVerbose )
00581                 Extra_ProgressBarUpdate( pProgress, i, NULL );
00582             // skip the nodes that did not change
00583             if ( p->pPars->fSatur && !Lpk_NodeHasChanged(p, pObj->Id) )
00584                 continue;
00585             // resynthesize
00586             p->pObj = pObj;
00587             if ( p->pPars->fOldAlgo )
00588                 Lpk_ResynthesizeNode( p );
00589             else
00590                 Lpk_ResynthesizeNodeNew( p );
00591         }
00592         if ( !pPars->fVeryVerbose )
00593             Extra_ProgressBarStop( pProgress );
00594 
00595         // check the increase
00596         Delta = 100.00 * (nNodesPrev - Abc_NtkNodeNum(pNtk)) / p->nNodesTotal;
00597         if ( Delta < 0.05 )
00598             break;
00599         nNodesPrev = Abc_NtkNodeNum(pNtk);
00600         if ( !p->pPars->fSatur )
00601             break;
00602 
00603         if ( pPars->fFirst )
00604             break;
00605     }
00606     Abc_NtkStopReverseLevels( pNtk );
00607 
00608     if ( pPars->fVerbose )
00609     {
00610 //        Cloud_PrintInfo( p->pDsdMan->dd );
00611         p->nTotalNets2 = Abc_NtkGetTotalFanins(pNtk);
00612         p->nTotalNodes2 = Abc_NtkNodeNum(pNtk);
00613         printf( "Node gain = %5d. (%.2f %%)  ", 
00614             p->nTotalNodes-p->nTotalNodes2, 100.0*(p->nTotalNodes-p->nTotalNodes2)/p->nTotalNodes );
00615         printf( "Edge gain = %5d. (%.2f %%)  ", 
00616             p->nTotalNets-p->nTotalNets2, 100.0*(p->nTotalNets-p->nTotalNets2)/p->nTotalNets );
00617         printf( "Muxes = %4d. Dsds = %4d.", p->nMuxes, p->nDsds );
00618         printf( "\n" );
00619         printf( "Nodes = %5d (%3d)  Cuts = %5d (%4d)  Changes = %5d  Iter = %2d  Benefit = %d.\n", 
00620             p->nNodesTotal, p->nNodesOver, p->nCutsTotal, p->nCutsUseful, p->nChanges, Iter, p->nBenefited );
00621 
00622         printf( "Non-DSD:" );
00623         for ( i = 3; i <= pPars->nVarsMax; i++ )
00624             if ( p->nBlocks[i] )
00625                 printf( " %d=%d", i, p->nBlocks[i] );
00626         printf( "\n" );
00627 
00628         p->timeTotal = clock() - clk;
00629         p->timeEval  = p->timeEval  - p->timeMap;
00630         p->timeOther = p->timeTotal - p->timeCuts - p->timeTruth - p->timeEval - p->timeMap;
00631         PRTP( "Cuts  ", p->timeCuts,  p->timeTotal );
00632         PRTP( "Truth ", p->timeTruth, p->timeTotal );
00633         PRTP( "CSupps", p->timeSupps, p->timeTotal );
00634         PRTP( "Eval  ", p->timeEval,  p->timeTotal );
00635         PRTP( " MuxAn", p->timeEvalMuxAn, p->timeEval );
00636         PRTP( " MuxSp", p->timeEvalMuxSp, p->timeEval );
00637         PRTP( " DsdAn", p->timeEvalDsdAn, p->timeEval );
00638         PRTP( " DsdSp", p->timeEvalDsdSp, p->timeEval );
00639         PRTP( " Other", p->timeEval-p->timeEvalMuxAn-p->timeEvalMuxSp-p->timeEvalDsdAn-p->timeEvalDsdSp, p->timeEval );
00640         PRTP( "Map   ", p->timeMap,   p->timeTotal );
00641         PRTP( "Other ", p->timeOther, p->timeTotal );
00642         PRTP( "TOTAL ", p->timeTotal, p->timeTotal );
00643     }
00644 
00645     Lpk_ManStop( p );
00646     // check the resulting network
00647     if ( !Abc_NtkCheck( pNtk ) )
00648     {
00649         printf( "Lpk_Resynthesize: The network check has failed.\n" );
00650         return 0;
00651     }
00652     return 1;
00653 }


Generated on Tue Jan 5 12:19:27 2010 for abc70930 by  doxygen 1.6.1