src/opt/cut/cutMan.c File Reference

#include "cutInt.h"
Include dependency graph for cutMan.c:

Go to the source code of this file.

Functions

void Npn_StartTruth8 (uint8 uTruths[][32])
Cut_Man_tCut_ManStart (Cut_Params_t *pParams)
void Cut_ManStop (Cut_Man_t *p)
void Cut_ManPrintStats (Cut_Man_t *p)
void Cut_ManPrintStatsToFile (Cut_Man_t *p, char *pFileName, int TimeTotal)
void Cut_ManSetFanoutCounts (Cut_Man_t *p, Vec_Int_t *vFanCounts)
void Cut_ManSetNodeAttrs (Cut_Man_t *p, Vec_Int_t *vNodeAttrs)
int Cut_ManReadVarsMax (Cut_Man_t *p)
Cut_Params_tCut_ManReadParams (Cut_Man_t *p)
Vec_Int_tCut_ManReadNodeAttrs (Cut_Man_t *p)
void Cut_ManIncrementDagNodes (Cut_Man_t *p)

Function Documentation

void Cut_ManIncrementDagNodes ( Cut_Man_t p  ) 

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 317 of file cutMan.c.

00318 {
00319     p->nNodesDag++;
00320 }

void Cut_ManPrintStats ( Cut_Man_t p  ) 

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 163 of file cutMan.c.

00164 {
00165     if ( p->pReady )
00166     {
00167         Cut_CutRecycle( p, p->pReady );
00168         p->pReady = NULL;
00169     }
00170     printf( "Cut computation statistics:\n" );
00171     printf( "Current cuts      = %8d. (Trivial = %d.)\n", p->nCutsCur-p->nCutsTriv, p->nCutsTriv );
00172     printf( "Peak cuts         = %8d.\n", p->nCutsPeak );
00173     printf( "Total allocated   = %8d.\n", p->nCutsAlloc );
00174     printf( "Total deallocated = %8d.\n", p->nCutsDealloc );
00175     printf( "Cuts filtered     = %8d.\n", p->nCutsFilter );
00176     printf( "Nodes saturated   = %8d. (Max cuts = %d.)\n", p->nCutsLimit, p->pParams->nKeepMax );
00177     printf( "Cuts per node     = %8.1f\n", ((float)(p->nCutsCur-p->nCutsTriv))/p->nNodes );
00178     printf( "The cut size      = %8d bytes.\n", p->EntrySize );
00179     printf( "Peak memory       = %8.2f Mb.\n", (float)p->nCutsPeak * p->EntrySize / (1<<20) );
00180     printf( "Total nodes       = %8d.\n", p->nNodes );
00181     if ( p->pParams->fDag || p->pParams->fTree )
00182     {
00183     printf( "DAG nodes         = %8d.\n", p->nNodesDag );
00184     printf( "Tree nodes        = %8d.\n", p->nNodes - p->nNodesDag );
00185     }
00186     printf( "Nodes w/o cuts    = %8d.\n", p->nNodesNoCuts );
00187     if ( p->pParams->fMap && !p->pParams->fSeq )
00188     printf( "Mapping delay     = %8d.\n", p->nDelayMin );
00189 
00190     PRT( "Merge ", p->timeMerge );
00191     PRT( "Union ", p->timeUnion );
00192     PRT( "Filter", p->timeFilter );
00193     PRT( "Truth ", p->timeTruth );
00194     PRT( "Map   ", p->timeMap );
00195 //    printf( "Nodes = %d. Multi = %d.  Cuts = %d. Multi = %d.\n", 
00196 //        p->nNodes, p->nNodesMulti, p->nCutsCur-p->nCutsTriv, p->nCutsMulti );
00197 //    printf( "Count0 = %d. Count1 = %d. Count2 = %d.\n\n", p->Count0, p->Count1, p->Count2 );
00198 }

void Cut_ManPrintStatsToFile ( Cut_Man_t p,
char *  pFileName,
int  TimeTotal 
)

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

Synopsis [Prints some interesting stats.]

Description []

SideEffects []

SeeAlso []

Definition at line 212 of file cutMan.c.

00213 {
00214     FILE * pTable;
00215     pTable = fopen( "cut_stats.txt", "a+" );
00216     fprintf( pTable, "%-20s ", pFileName );
00217     fprintf( pTable, "%8d ", p->nNodes );
00218     fprintf( pTable, "%6.1f ", ((float)(p->nCutsCur))/p->nNodes );
00219     fprintf( pTable, "%6.2f ", ((float)(100.0 * p->nCutsLimit))/p->nNodes );
00220     fprintf( pTable, "%6.2f ", (float)p->nCutsPeak * p->EntrySize / (1<<20) );
00221     fprintf( pTable, "%6.2f ", (float)(TimeTotal)/(float)(CLOCKS_PER_SEC) );
00222     fprintf( pTable, "\n" );
00223     fclose( pTable );
00224 }

Vec_Int_t* Cut_ManReadNodeAttrs ( Cut_Man_t p  ) 

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 301 of file cutMan.c.

00302 {
00303     return p->vNodeAttrs;
00304 }

Cut_Params_t* Cut_ManReadParams ( Cut_Man_t p  ) 

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 285 of file cutMan.c.

00286 {
00287     return p->pParams;
00288 }

int Cut_ManReadVarsMax ( Cut_Man_t p  ) 

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 269 of file cutMan.c.

00270 {
00271     return p->pParams->nVarsMax;
00272 }

void Cut_ManSetFanoutCounts ( Cut_Man_t p,
Vec_Int_t vFanCounts 
)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 237 of file cutMan.c.

00238 {
00239     p->vFanCounts = vFanCounts;
00240 }

void Cut_ManSetNodeAttrs ( Cut_Man_t p,
Vec_Int_t vNodeAttrs 
)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 253 of file cutMan.c.

00254 {
00255     p->vNodeAttrs = vNodeAttrs;
00256 }

Cut_Man_t* Cut_ManStart ( Cut_Params_t pParams  ) 

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

Synopsis [Starts the cut manager.]

Description []

SideEffects []

SeeAlso []

Definition at line 44 of file cutMan.c.

00045 {
00046     Cut_Man_t * p;
00047     int clk = clock();
00048 //    extern int nTruthDsd;
00049 //    nTruthDsd = 0;
00050     assert( pParams->nVarsMax >= 3 && pParams->nVarsMax <= CUT_SIZE_MAX );
00051     p = ALLOC( Cut_Man_t, 1 );
00052     memset( p, 0, sizeof(Cut_Man_t) );
00053     // set and correct parameters
00054     p->pParams = pParams;
00055     // prepare storage for cuts
00056     p->vCutsNew = Vec_PtrAlloc( pParams->nIdsMax );
00057     Vec_PtrFill( p->vCutsNew, pParams->nIdsMax, NULL );
00058     // prepare storage for sequential cuts
00059     if ( pParams->fSeq )
00060     {
00061         p->pParams->fFilter = 1;
00062         p->vCutsOld = Vec_PtrAlloc( pParams->nIdsMax );
00063         Vec_PtrFill( p->vCutsOld, pParams->nIdsMax, NULL );
00064         p->vCutsTemp = Vec_PtrAlloc( pParams->nCutSet );
00065         Vec_PtrFill( p->vCutsTemp, pParams->nCutSet, NULL );
00066         if ( pParams->fTruth && pParams->nVarsMax > 5 )
00067         {
00068             pParams->fTruth = 0;
00069             printf( "Skipping computation of truth tables for sequential cuts with more than 5 inputs.\n" );
00070         }
00071     }
00072     // entry size
00073     p->EntrySize = sizeof(Cut_Cut_t) + pParams->nVarsMax * sizeof(int);
00074     if ( pParams->fTruth )
00075     {
00076         if ( pParams->nVarsMax > 14 )
00077         {
00078             pParams->fTruth = 0;
00079             printf( "Skipping computation of truth table for more than %d inputs.\n", 14 );
00080         }
00081         else
00082         {
00083             p->nTruthWords = Cut_TruthWords( pParams->nVarsMax );
00084             p->EntrySize += p->nTruthWords * sizeof(unsigned);
00085         }
00086         p->puTemp[0] = ALLOC( unsigned, 4 * p->nTruthWords );
00087         p->puTemp[1] = p->puTemp[0] + p->nTruthWords;
00088         p->puTemp[2] = p->puTemp[1] + p->nTruthWords;
00089         p->puTemp[3] = p->puTemp[2] + p->nTruthWords;
00090     }
00091     // enable cut computation recording
00092     if ( pParams->fRecord )
00093     {
00094         p->vNodeCuts   = Vec_IntStart( pParams->nIdsMax );
00095         p->vNodeStarts = Vec_IntStart( pParams->nIdsMax );
00096         p->vCutPairs   = Vec_IntAlloc( 0 );
00097     }
00098     // allocate storage for delays
00099     if ( pParams->fMap && !p->pParams->fSeq )
00100     {
00101         p->vDelays = Vec_IntStart( pParams->nIdsMax );
00102         p->vDelays2 = Vec_IntStart( pParams->nIdsMax );
00103         p->vCutsMax = Vec_PtrStart( pParams->nIdsMax );
00104     }
00105     // memory for cuts
00106     p->pMmCuts = Extra_MmFixedStart( p->EntrySize );
00107     p->vTemp = Vec_PtrAlloc( 100 );
00108     return p;
00109 }

void Cut_ManStop ( Cut_Man_t p  ) 

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

Synopsis [Stops the cut manager.]

Description []

SideEffects []

SeeAlso []

Definition at line 122 of file cutMan.c.

00123 {
00124     Cut_Cut_t * pCut;
00125     int i;
00126 //    extern int nTruthDsd;
00127 //    printf( "Decomposable cuts = %d.\n", nTruthDsd );
00128 
00129     Vec_PtrForEachEntry( p->vCutsNew, pCut, i )
00130         if ( pCut != NULL )
00131         {
00132             int k = 0;
00133         }
00134     if ( p->vCutsNew )    Vec_PtrFree( p->vCutsNew );
00135     if ( p->vCutsOld )    Vec_PtrFree( p->vCutsOld );
00136     if ( p->vCutsTemp )   Vec_PtrFree( p->vCutsTemp );
00137     if ( p->vFanCounts )  Vec_IntFree( p->vFanCounts );
00138     if ( p->vTemp )       Vec_PtrFree( p->vTemp );
00139 
00140     if ( p->vCutsMax )    Vec_PtrFree( p->vCutsMax );
00141     if ( p->vDelays )     Vec_IntFree( p->vDelays );
00142     if ( p->vDelays2 )    Vec_IntFree( p->vDelays2 );
00143     if ( p->vNodeCuts )   Vec_IntFree( p->vNodeCuts );
00144     if ( p->vNodeStarts ) Vec_IntFree( p->vNodeStarts );
00145     if ( p->vCutPairs )   Vec_IntFree( p->vCutPairs );
00146     if ( p->puTemp[0] )   free( p->puTemp[0] );
00147 
00148     Extra_MmFixedStop( p->pMmCuts );
00149     free( p );
00150 }

void Npn_StartTruth8 ( uint8  uTruths[][32]  ) 

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

FileName [cutMan.c]

SystemName [ABC: Logic synthesis and verification system.]

PackageName [K-feasible cut computation package.]

Synopsis [Cut manager.]

Author [Alan Mishchenko]

Affiliation [UC Berkeley]

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

Revision [

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

] DECLARATIONS ///


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