src/aig/rwt/rwtMan.c File Reference

#include "rwt.h"
#include "deco.h"
Include dependency graph for rwtMan.c:

Go to the source code of this file.

Functions

void Rwt_ManGlobalStart ()
void Rwt_ManGlobalStop ()
Rwt_Man_tRwt_ManStart (int fPrecompute)
void Rwt_ManStop (Rwt_Man_t *p)
void Rwt_ManPrintStats (Rwt_Man_t *p)
void Rwt_ManPrintStatsFile (Rwt_Man_t *p)
void * Rwt_ManReadDecs (Rwt_Man_t *p)
Vec_Ptr_tRwt_ManReadLeaves (Rwt_Man_t *p)
int Rwt_ManReadCompl (Rwt_Man_t *p)
void Rwt_ManAddTimeCuts (Rwt_Man_t *p, int Time)
void Rwt_ManAddTimeUpdate (Rwt_Man_t *p, int Time)
void Rwt_ManAddTimeTotal (Rwt_Man_t *p, int Time)
void Rwt_Precompute ()

Variables

static unsigned short * s_puCanons = NULL
static char * s_pPhases = NULL
static char * s_pPerms = NULL
static unsigned char * s_pMap = NULL

Function Documentation

void Rwt_ManAddTimeCuts ( Rwt_Man_t p,
int  Time 
)

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

Synopsis [Stops the resynthesis manager.]

Description []

SideEffects []

SeeAlso []

Definition at line 298 of file rwtMan.c.

00299 {
00300     p->timeCut += Time;
00301 }

void Rwt_ManAddTimeTotal ( Rwt_Man_t p,
int  Time 
)

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

Synopsis [Stops the resynthesis manager.]

Description []

SideEffects []

SeeAlso []

Definition at line 330 of file rwtMan.c.

00331 {
00332     p->timeTotal += Time;
00333 }

void Rwt_ManAddTimeUpdate ( Rwt_Man_t p,
int  Time 
)

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

Synopsis [Stops the resynthesis manager.]

Description []

SideEffects []

SeeAlso []

Definition at line 314 of file rwtMan.c.

00315 {
00316     p->timeUpdate += Time;
00317 }

void Rwt_ManGlobalStart (  ) 

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

Synopsis [Starts residual rewriting manager.]

Description []

SideEffects []

SeeAlso []

Definition at line 48 of file rwtMan.c.

00049 { 
00050     if ( s_puCanons == NULL )
00051         Extra_Truth4VarNPN( &s_puCanons, &s_pPhases, &s_pPerms, &s_pMap );
00052 }

void Rwt_ManGlobalStop (  ) 

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

Synopsis [Starts residual rewriting manager.]

Description []

SideEffects []

SeeAlso []

Definition at line 65 of file rwtMan.c.

00066 { 
00067     FREE( s_puCanons );
00068     FREE( s_pPhases );
00069     FREE( s_pPerms );
00070     FREE( s_pMap );
00071 } 

void Rwt_ManPrintStats ( Rwt_Man_t p  ) 

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

Synopsis [Stops the resynthesis manager.]

Description []

SideEffects []

SeeAlso []

Definition at line 180 of file rwtMan.c.

00181 {
00182     int i, Counter = 0;
00183     for ( i = 0; i < 222; i++ )
00184         Counter += (p->nScores[i] > 0);
00185 
00186     printf( "Rewriting statistics:\n" );
00187     printf( "Total cuts tries  = %8d.\n", p->nCutsGood );
00188     printf( "Bad cuts found    = %8d.\n", p->nCutsBad );
00189     printf( "Total subgraphs   = %8d.\n", p->nSubgraphs );
00190     printf( "Used NPN classes  = %8d.\n", Counter );
00191     printf( "Nodes considered  = %8d.\n", p->nNodesConsidered );
00192     printf( "Nodes rewritten   = %8d.\n", p->nNodesRewritten );
00193     printf( "Calculated gain   = %8d.\n", p->nNodesGained     );
00194     PRT( "Start       ", p->timeStart );
00195     PRT( "Cuts        ", p->timeCut );
00196     PRT( "Truth       ", p->timeTruth );
00197     PRT( "Resynthesis ", p->timeRes );
00198     PRT( "    Mffc    ", p->timeMffc );
00199     PRT( "    Eval    ", p->timeEval );
00200     PRT( "Update      ", p->timeUpdate );
00201     PRT( "TOTAL       ", p->timeTotal );
00202 
00203 /*
00204     printf( "The scores are:\n" );
00205     for ( i = 0; i < 222; i++ )
00206         if ( p->nScores[i] > 0 )
00207         {
00208             extern void Ivy_TruthDsdComputePrint( unsigned uTruth );
00209             printf( "%3d = %8d  canon = %5d  ", i, p->nScores[i], p->pMapInv[i] );
00210             Ivy_TruthDsdComputePrint( (unsigned)p->pMapInv[i] | ((unsigned)p->pMapInv[i] << 16) );
00211         }
00212     printf( "\n" );
00213 */
00214 }

void Rwt_ManPrintStatsFile ( Rwt_Man_t p  ) 

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

Synopsis [Stops the resynthesis manager.]

Description []

SideEffects []

SeeAlso []

Definition at line 227 of file rwtMan.c.

00228 {
00229     FILE * pTable;
00230     pTable = fopen( "stats.txt", "a+" );
00231     fprintf( pTable, "%d ", p->nCutsGood );
00232     fprintf( pTable, "%d ", p->nSubgraphs );
00233     fprintf( pTable, "%d ", p->nNodesRewritten );
00234     fprintf( pTable, "%d", p->nNodesGained );
00235     fprintf( pTable, "\n" );
00236     fclose( pTable );
00237 }

int Rwt_ManReadCompl ( Rwt_Man_t p  ) 

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

Synopsis [Stops the resynthesis manager.]

Description []

SideEffects []

SeeAlso []

Definition at line 282 of file rwtMan.c.

00283 {
00284     return p->fCompl;
00285 }

void* Rwt_ManReadDecs ( Rwt_Man_t p  ) 

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

Synopsis [Stops the resynthesis manager.]

Description []

SideEffects []

SeeAlso []

Definition at line 250 of file rwtMan.c.

00251 {
00252     return p->pGraph;
00253 }

Vec_Ptr_t* Rwt_ManReadLeaves ( Rwt_Man_t p  ) 

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

Synopsis [Stops the resynthesis manager.]

Description []

SideEffects []

SeeAlso []

Definition at line 266 of file rwtMan.c.

00267 {
00268     return p->vFanins;
00269 }

Rwt_Man_t* Rwt_ManStart ( int  fPrecompute  ) 

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

Synopsis [Starts rewriting manager.]

Description []

SideEffects []

SeeAlso []

Definition at line 84 of file rwtMan.c.

00085 {
00086     Rwt_Man_t * p;
00087     int clk = clock();
00088 clk = clock();
00089     p = ALLOC( Rwt_Man_t, 1 );
00090     memset( p, 0, sizeof(Rwt_Man_t) );
00091     p->nFuncs = (1<<16);
00092     // copy the global tables
00093     Rwt_ManGlobalStart();
00094     p->puCanons = s_puCanons; 
00095     p->pPhases  = s_pPhases; 
00096     p->pPerms   = s_pPerms; 
00097     p->pMap     = s_pMap; 
00098     // initialize practical NPN classes
00099     p->pPractical  = Rwt_ManGetPractical( p );
00100     // create the table
00101     p->pTable = ALLOC( Rwt_Node_t *, p->nFuncs );
00102     memset( p->pTable, 0, sizeof(Rwt_Node_t *) * p->nFuncs );
00103     // create the elementary nodes
00104     p->pMmNode  = Mem_FixedStart( sizeof(Rwt_Node_t) );
00105     p->vForest  = Vec_PtrAlloc( 100 );
00106     Rwt_ManAddVar( p, 0x0000, fPrecompute ); // constant 0
00107     Rwt_ManAddVar( p, 0xAAAA, fPrecompute ); // var A
00108     Rwt_ManAddVar( p, 0xCCCC, fPrecompute ); // var B
00109     Rwt_ManAddVar( p, 0xF0F0, fPrecompute ); // var C
00110     Rwt_ManAddVar( p, 0xFF00, fPrecompute ); // var D
00111     p->nClasses = 5;
00112     // other stuff
00113     p->nTravIds   = 1;
00114     p->pPerms4    = Extra_Permutations( 4 );
00115     p->vLevNums   = Vec_IntAlloc( 50 );
00116     p->vFanins    = Vec_PtrAlloc( 50 );
00117     p->vFaninsCur = Vec_PtrAlloc( 50 );
00118     p->vNodesTemp = Vec_PtrAlloc( 50 );
00119     if ( fPrecompute )
00120     {   // precompute subgraphs
00121 //        Rwt_ManPrecompute( p );
00122 //        Rwt_ManPrint( p );
00123 //        Rwt_ManWriteToArray( p );
00124     }
00125     else
00126     {   // load saved subgraphs
00127         Rwt_ManLoadFromArray( p, 0 );
00128 //        Rwt_ManPrint( p );
00129         Rwt_ManPreprocess( p );
00130     }
00131 p->timeStart = clock() - clk;
00132     return p;
00133 }

void Rwt_ManStop ( Rwt_Man_t p  ) 

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

Synopsis [Stops rewriting manager.]

Description []

SideEffects []

SeeAlso []

Definition at line 146 of file rwtMan.c.

00147 {
00148     if ( p->vClasses )
00149     {
00150         Rwt_Node_t * pNode;
00151         int i, k;
00152         Vec_VecForEachEntry( p->vClasses, pNode, i, k )
00153             Dec_GraphFree( (Dec_Graph_t *)pNode->pNext );
00154     }
00155     if ( p->vClasses )  Vec_VecFree( p->vClasses );
00156     Vec_PtrFree( p->vNodesTemp );
00157     Vec_PtrFree( p->vForest );
00158     Vec_IntFree( p->vLevNums );
00159     Vec_PtrFree( p->vFanins );
00160     Vec_PtrFree( p->vFaninsCur );
00161     Mem_FixedStop( p->pMmNode, 0 );
00162     FREE( p->pMapInv );
00163     free( p->pTable );
00164     free( p->pPractical );
00165     free( p->pPerms4 );
00166     free( p );
00167 }

void Rwt_Precompute (  ) 

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

Synopsis [Precomputes AIG subgraphs.]

Description []

SideEffects []

SeeAlso []

Definition at line 347 of file rwtMan.c.

00348 {
00349     Rwt_Man_t * p;
00350     p = Rwt_ManStart( 1 );
00351     Rwt_ManStop( p );
00352 }


Variable Documentation

unsigned char* s_pMap = NULL [static]

Definition at line 31 of file rwtMan.c.

char* s_pPerms = NULL [static]

Definition at line 30 of file rwtMan.c.

char* s_pPhases = NULL [static]

Definition at line 29 of file rwtMan.c.

unsigned short* s_puCanons = NULL [static]

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

FileName [rwtMan.c]

SystemName [ABC: Logic synthesis and verification system.]

PackageName [DAG-aware AIG rewriting package.]

Synopsis [Rewriting manager.]

Author [Alan Mishchenko]

Affiliation [UC Berkeley]

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

Revision [

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

] DECLARATIONS ///

Definition at line 28 of file rwtMan.c.


Generated on Tue Jan 5 12:18:29 2010 for abc70930 by  doxygen 1.6.1