00001
00021 #include "darInt.h"
00022
00026
00030
00042 Dar_Man_t * Dar_ManStart( Aig_Man_t * pAig, Dar_RwrPar_t * pPars )
00043 {
00044 Dar_Man_t * p;
00045
00046 p = ALLOC( Dar_Man_t, 1 );
00047 memset( p, 0, sizeof(Dar_Man_t) );
00048 p->pPars = pPars;
00049 p->pAig = pAig;
00050
00051 p->pMemCuts = Aig_MmFixedStart( p->pPars->nCutsMax * sizeof(Dar_Cut_t), 1024 );
00052
00053 p->vLeavesBest = Vec_PtrAlloc( 4 );
00054 return p;
00055 }
00056
00068 void Dar_ManStop( Dar_Man_t * p )
00069 {
00070 if ( p->pPars->fVerbose )
00071 Dar_ManPrintStats( p );
00072 if ( p->pMemCuts )
00073 Aig_MmFixedStop( p->pMemCuts, 0 );
00074 if ( p->vLeavesBest )
00075 Vec_PtrFree( p->vLeavesBest );
00076 free( p );
00077 }
00078
00090 void Dar_ManPrintStats( Dar_Man_t * p )
00091 {
00092 unsigned pCanons[222];
00093 int Gain, i;
00094 extern void Kit_DsdPrintFromTruth( unsigned * pTruth, int nVars );
00095
00096 Gain = p->nNodesInit - Aig_ManNodeNum(p->pAig);
00097 printf( "Tried = %8d. Beg = %8d. End = %8d. Gain = %6d. (%6.2f %%). Cut mem = %d Mb\n",
00098 p->nNodesTried, p->nNodesInit, Aig_ManNodeNum(p->pAig), Gain, 100.0*Gain/p->nNodesInit, p->nCutMemUsed );
00099 printf( "Cuts = %8d. Tried = %8d. Used = %8d. Bad = %5d. Skipped = %5d. Ave = %.2f.\n",
00100 p->nCutsAll, p->nCutsTried, p->nCutsUsed, p->nCutsBad, p->nCutsSkipped,
00101 (float)p->nCutsUsed/Aig_ManNodeNum(p->pAig) );
00102
00103 printf( "Bufs = %5d. BufMax = %5d. BufReplace = %6d. BufFix = %6d. Levels = %4d.\n",
00104 Aig_ManBufNum(p->pAig), p->pAig->nBufMax, p->pAig->nBufReplaces, p->pAig->nBufFixes, Aig_ManLevels(p->pAig) );
00105 PRT( "Cuts ", p->timeCuts );
00106 PRT( "Eval ", p->timeEval );
00107 PRT( "Other ", p->timeOther );
00108 PRT( "TOTAL ", p->timeTotal );
00109
00110 if ( !p->pPars->fVeryVerbose )
00111 return;
00112 Dar_LibReturnCanonicals( pCanons );
00113 for ( i = 0; i < 222; i++ )
00114 {
00115 if ( p->ClassGains[i] == 0 && p->ClassTimes[i] == 0 )
00116 continue;
00117 printf( "%3d : ", i );
00118 printf( "G = %6d (%5.2f %%) ", p->ClassGains[i], Gain? 100.0*p->ClassGains[i]/Gain : 0.0 );
00119 printf( "S = %8d (%5.2f %%) ", p->ClassSubgs[i], p->nTotalSubgs? 100.0*p->ClassSubgs[i]/p->nTotalSubgs : 0.0 );
00120 printf( "R = %7d ", p->ClassGains[i]? p->ClassSubgs[i]/p->ClassGains[i] : 9999999 );
00121
00122
00123 printf( "\n" );
00124 }
00125 }
00126
00127
00128
00132
00133