#include "rwr.h"
#include "main.h"
#include "dec.h"
Go to the source code of this file.
Functions | |
Rwr_Man_t * | Rwr_ManStart (bool fPrecompute) |
void | Rwr_ManStop (Rwr_Man_t *p) |
void | Rwr_ManPrintStats (Rwr_Man_t *p) |
void | Rwr_ManPrintStatsFile (Rwr_Man_t *p) |
void * | Rwr_ManReadDecs (Rwr_Man_t *p) |
Vec_Ptr_t * | Rwr_ManReadLeaves (Rwr_Man_t *p) |
int | Rwr_ManReadCompl (Rwr_Man_t *p) |
void | Rwr_ManAddTimeCuts (Rwr_Man_t *p, int Time) |
void | Rwr_ManAddTimeUpdate (Rwr_Man_t *p, int Time) |
void | Rwr_ManAddTimeTotal (Rwr_Man_t *p, int Time) |
void | Rwr_Precompute () |
void Rwr_ManAddTimeCuts | ( | Rwr_Man_t * | p, | |
int | Time | |||
) |
void Rwr_ManAddTimeTotal | ( | Rwr_Man_t * | p, | |
int | Time | |||
) |
void Rwr_ManAddTimeUpdate | ( | Rwr_Man_t * | p, | |
int | Time | |||
) |
Function*************************************************************
Synopsis [Stops the resynthesis manager.]
Description []
SideEffects []
SeeAlso []
Definition at line 274 of file rwrMan.c.
00275 { 00276 p->timeUpdate += Time; 00277 }
void Rwr_ManPrintStats | ( | Rwr_Man_t * | p | ) |
Function*************************************************************
Synopsis [Stops the resynthesis manager.]
Description []
SideEffects []
SeeAlso []
Definition at line 140 of file rwrMan.c.
00141 { 00142 int i, Counter = 0; 00143 for ( i = 0; i < 222; i++ ) 00144 Counter += (p->nScores[i] > 0); 00145 00146 printf( "Rewriting statistics:\n" ); 00147 printf( "Total cuts tries = %8d.\n", p->nCutsGood ); 00148 printf( "Bad cuts found = %8d.\n", p->nCutsBad ); 00149 printf( "Total subgraphs = %8d.\n", p->nSubgraphs ); 00150 printf( "Used NPN classes = %8d.\n", Counter ); 00151 printf( "Nodes considered = %8d.\n", p->nNodesConsidered ); 00152 printf( "Nodes rewritten = %8d.\n", p->nNodesRewritten ); 00153 printf( "Gain = %8d. (%6.2f %%).\n", p->nNodesBeg-p->nNodesEnd, 100.0*(p->nNodesBeg-p->nNodesEnd)/p->nNodesBeg ); 00154 PRT( "Start ", p->timeStart ); 00155 PRT( "Cuts ", p->timeCut ); 00156 PRT( "Resynthesis ", p->timeRes ); 00157 PRT( " Mffc ", p->timeMffc ); 00158 PRT( " Eval ", p->timeEval ); 00159 PRT( "Update ", p->timeUpdate ); 00160 PRT( "TOTAL ", p->timeTotal ); 00161 00162 /* 00163 printf( "The scores are:\n" ); 00164 for ( i = 0; i < 222; i++ ) 00165 if ( p->nScores[i] > 0 ) 00166 { 00167 extern void Ivy_TruthDsdComputePrint( unsigned uTruth ); 00168 printf( "%3d = %8d canon = %5d ", i, p->nScores[i], p->pMapInv[i] ); 00169 Ivy_TruthDsdComputePrint( (unsigned)p->pMapInv[i] | ((unsigned)p->pMapInv[i] << 16) ); 00170 } 00171 */ 00172 printf( "\n" ); 00173 00174 }
void Rwr_ManPrintStatsFile | ( | Rwr_Man_t * | p | ) |
Function*************************************************************
Synopsis [Stops the resynthesis manager.]
Description []
SideEffects []
SeeAlso []
Definition at line 187 of file rwrMan.c.
00188 { 00189 FILE * pTable; 00190 pTable = fopen( "stats.txt", "a+" ); 00191 fprintf( pTable, "%d ", p->nCutsGood ); 00192 fprintf( pTable, "%d ", p->nSubgraphs ); 00193 fprintf( pTable, "%d ", p->nNodesRewritten ); 00194 fprintf( pTable, "%d", p->nNodesGained ); 00195 fprintf( pTable, "\n" ); 00196 fclose( pTable ); 00197 }
int Rwr_ManReadCompl | ( | Rwr_Man_t * | p | ) |
void* Rwr_ManReadDecs | ( | Rwr_Man_t * | p | ) |
CFile****************************************************************
FileName [rwrMan.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 [
] DECLARATIONS /// FUNCTION DEFINITIONS ///Function*************************************************************
Synopsis [Starts rewriting manager.]
Description []
SideEffects []
SeeAlso []
Definition at line 44 of file rwrMan.c.
00045 { 00046 Dec_Man_t * pManDec; 00047 Rwr_Man_t * p; 00048 int clk = clock(); 00049 clk = clock(); 00050 p = ALLOC( Rwr_Man_t, 1 ); 00051 memset( p, 0, sizeof(Rwr_Man_t) ); 00052 p->nFuncs = (1<<16); 00053 pManDec = Abc_FrameReadManDec(); 00054 p->puCanons = pManDec->puCanons; 00055 p->pPhases = pManDec->pPhases; 00056 p->pPerms = pManDec->pPerms; 00057 p->pMap = pManDec->pMap; 00058 // initialize practical NPN classes 00059 p->pPractical = Rwr_ManGetPractical( p ); 00060 // create the table 00061 p->pTable = ALLOC( Rwr_Node_t *, p->nFuncs ); 00062 memset( p->pTable, 0, sizeof(Rwr_Node_t *) * p->nFuncs ); 00063 // create the elementary nodes 00064 p->pMmNode = Extra_MmFixedStart( sizeof(Rwr_Node_t) ); 00065 p->vForest = Vec_PtrAlloc( 100 ); 00066 Rwr_ManAddVar( p, 0x0000, fPrecompute ); // constant 0 00067 Rwr_ManAddVar( p, 0xAAAA, fPrecompute ); // var A 00068 Rwr_ManAddVar( p, 0xCCCC, fPrecompute ); // var B 00069 Rwr_ManAddVar( p, 0xF0F0, fPrecompute ); // var C 00070 Rwr_ManAddVar( p, 0xFF00, fPrecompute ); // var D 00071 p->nClasses = 5; 00072 // other stuff 00073 p->nTravIds = 1; 00074 p->pPerms4 = Extra_Permutations( 4 ); 00075 p->vLevNums = Vec_IntAlloc( 50 ); 00076 p->vFanins = Vec_PtrAlloc( 50 ); 00077 p->vFaninsCur = Vec_PtrAlloc( 50 ); 00078 p->vNodesTemp = Vec_PtrAlloc( 50 ); 00079 if ( fPrecompute ) 00080 { // precompute subgraphs 00081 Rwr_ManPrecompute( p ); 00082 // Rwr_ManPrint( p ); 00083 Rwr_ManWriteToArray( p ); 00084 } 00085 else 00086 { // load saved subgraphs 00087 Rwr_ManLoadFromArray( p, 0 ); 00088 // Rwr_ManPrint( p ); 00089 Rwr_ManPreprocess( p ); 00090 } 00091 p->timeStart = clock() - clk; 00092 return p; 00093 }
void Rwr_ManStop | ( | Rwr_Man_t * | p | ) |
Function*************************************************************
Synopsis [Stops rewriting manager.]
Description []
SideEffects []
SeeAlso []
Definition at line 106 of file rwrMan.c.
00107 { 00108 if ( p->vClasses ) 00109 { 00110 Rwr_Node_t * pNode; 00111 int i, k; 00112 Vec_VecForEachEntry( p->vClasses, pNode, i, k ) 00113 Dec_GraphFree( (Dec_Graph_t *)pNode->pNext ); 00114 } 00115 if ( p->vClasses ) Vec_VecFree( p->vClasses ); 00116 Vec_PtrFree( p->vNodesTemp ); 00117 Vec_PtrFree( p->vForest ); 00118 Vec_IntFree( p->vLevNums ); 00119 Vec_PtrFree( p->vFanins ); 00120 Vec_PtrFree( p->vFaninsCur ); 00121 Extra_MmFixedStop( p->pMmNode ); 00122 FREE( p->pMapInv ); 00123 free( p->pTable ); 00124 free( p->pPractical ); 00125 free( p->pPerms4 ); 00126 free( p ); 00127 }
void Rwr_Precompute | ( | ) |
Function*************************************************************
Synopsis [Precomputes AIG subgraphs.]
Description []
SideEffects []
SeeAlso []
Definition at line 307 of file rwrMan.c.
00308 { 00309 Rwr_Man_t * p; 00310 p = Rwr_ManStart( 1 ); 00311 Rwr_ManStop( p ); 00312 }