ABC: A System for Sequential Synthesis and Verification
 
Loading...
Searching...
No Matches
rwrMan.c File Reference
#include "rwr.h"
#include "base/main/main.h"
#include "bool/dec/dec.h"
Include dependency graph for rwrMan.c:

Go to the source code of this file.

Functions

ABC_NAMESPACE_IMPL_START Rwr_Man_tRwr_ManStart (int fPrecompute)
 DECLARATIONS ///.
 
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_tRwr_ManReadLeaves (Rwr_Man_t *p)
 
int Rwr_ManReadCompl (Rwr_Man_t *p)
 
void Rwr_ManAddTimeCuts (Rwr_Man_t *p, abctime Time)
 
void Rwr_ManAddTimeUpdate (Rwr_Man_t *p, abctime Time)
 
void Rwr_ManAddTimeTotal (Rwr_Man_t *p, abctime Time)
 
void Rwr_Precompute ()
 

Function Documentation

◆ Rwr_ManAddTimeCuts()

void Rwr_ManAddTimeCuts ( Rwr_Man_t * p,
abctime Time )

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

Synopsis [Stops the resynthesis manager.]

Description []

SideEffects []

SeeAlso []

Definition at line 261 of file rwrMan.c.

262{
263 p->timeCut += Time;
264}
Cube * p
Definition exorList.c:222
Here is the caller graph for this function:

◆ Rwr_ManAddTimeTotal()

void Rwr_ManAddTimeTotal ( Rwr_Man_t * p,
abctime Time )

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

Synopsis [Stops the resynthesis manager.]

Description []

SideEffects []

SeeAlso []

Definition at line 293 of file rwrMan.c.

294{
295 p->timeTotal += Time;
296}
Here is the caller graph for this function:

◆ Rwr_ManAddTimeUpdate()

void Rwr_ManAddTimeUpdate ( Rwr_Man_t * p,
abctime Time )

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

Synopsis [Stops the resynthesis manager.]

Description []

SideEffects []

SeeAlso []

Definition at line 277 of file rwrMan.c.

278{
279 p->timeUpdate += Time;
280}
Here is the caller graph for this function:

◆ Rwr_ManPrintStats()

void Rwr_ManPrintStats ( Rwr_Man_t * p)

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

Synopsis [Stops the resynthesis manager.]

Description []

SideEffects []

SeeAlso []

Definition at line 143 of file rwrMan.c.

144{
145 int i, Counter = 0;
146 for ( i = 0; i < 222; i++ )
147 Counter += (p->nScores[i] > 0);
148
149 printf( "Rewriting statistics:\n" );
150 printf( "Total cuts tries = %8d.\n", p->nCutsGood );
151 printf( "Bad cuts found = %8d.\n", p->nCutsBad );
152 printf( "Total subgraphs = %8d.\n", p->nSubgraphs );
153 printf( "Used NPN classes = %8d.\n", Counter );
154 printf( "Nodes considered = %8d.\n", p->nNodesConsidered );
155 printf( "Nodes rewritten = %8d.\n", p->nNodesRewritten );
156 printf( "Gain = %8d. (%6.2f %%).\n", p->nNodesBeg-p->nNodesEnd, 100.0*(p->nNodesBeg-p->nNodesEnd)/p->nNodesBeg );
157 ABC_PRT( "Start ", p->timeStart );
158 ABC_PRT( "Cuts ", p->timeCut );
159 ABC_PRT( "Resynthesis ", p->timeRes );
160 ABC_PRT( " Mffc ", p->timeMffc );
161 ABC_PRT( " Eval ", p->timeEval );
162 ABC_PRT( "Update ", p->timeUpdate );
163 ABC_PRT( "TOTAL ", p->timeTotal );
164
165/*
166 printf( "The scores are:\n" );
167 for ( i = 0; i < 222; i++ )
168 if ( p->nScores[i] > 0 )
169 {
170 extern void Ivy_TruthDsdComputePrint( unsigned uTruth );
171 printf( "%3d = %8d canon = %5d ", i, p->nScores[i], p->pMapInv[i] );
172 Ivy_TruthDsdComputePrint( (unsigned)p->pMapInv[i] | ((unsigned)p->pMapInv[i] << 16) );
173 }
174*/
175 printf( "\n" );
176
177}
#define ABC_PRT(a, t)
Definition abc_global.h:255
Here is the caller graph for this function:

◆ Rwr_ManPrintStatsFile()

void Rwr_ManPrintStatsFile ( Rwr_Man_t * p)

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

Synopsis [Stops the resynthesis manager.]

Description []

SideEffects []

SeeAlso []

Definition at line 190 of file rwrMan.c.

191{
192 FILE * pTable;
193 pTable = fopen( "stats.txt", "a+" );
194 fprintf( pTable, "%d ", p->nCutsGood );
195 fprintf( pTable, "%d ", p->nSubgraphs );
196 fprintf( pTable, "%d ", p->nNodesRewritten );
197 fprintf( pTable, "%d", p->nNodesGained );
198 fprintf( pTable, "\n" );
199 fclose( pTable );
200}

◆ Rwr_ManReadCompl()

int Rwr_ManReadCompl ( Rwr_Man_t * p)

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

Synopsis [Stops the resynthesis manager.]

Description []

SideEffects []

SeeAlso []

Definition at line 245 of file rwrMan.c.

246{
247 return p->fCompl;
248}
Here is the caller graph for this function:

◆ Rwr_ManReadDecs()

void * Rwr_ManReadDecs ( Rwr_Man_t * p)

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

Synopsis [Stops the resynthesis manager.]

Description []

SideEffects []

SeeAlso []

Definition at line 213 of file rwrMan.c.

214{
215 return p->pGraph;
216}
Here is the caller graph for this function:

◆ Rwr_ManReadLeaves()

Vec_Ptr_t * Rwr_ManReadLeaves ( Rwr_Man_t * p)

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

Synopsis [Stops the resynthesis manager.]

Description []

SideEffects []

SeeAlso []

Definition at line 229 of file rwrMan.c.

230{
231 return p->vFanins;
232}

◆ Rwr_ManStart()

ABC_NAMESPACE_IMPL_START Rwr_Man_t * Rwr_ManStart ( int fPrecompute)

DECLARATIONS ///.

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 [

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

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

Synopsis [Starts rewriting manager.]

Description []

SideEffects []

SeeAlso []

Definition at line 47 of file rwrMan.c.

48{
49 Dec_Man_t * pManDec;
50 Rwr_Man_t * p;
51 abctime clk = Abc_Clock();
52clk = Abc_Clock();
53 p = ABC_ALLOC( Rwr_Man_t, 1 );
54 memset( p, 0, sizeof(Rwr_Man_t) );
55 p->nFuncs = (1<<16);
56 pManDec = (Dec_Man_t *)Abc_FrameReadManDec();
57 p->puCanons = pManDec->puCanons;
58 p->pPhases = pManDec->pPhases;
59 p->pPerms = pManDec->pPerms;
60 p->pMap = pManDec->pMap;
61 // initialize practical NPN classes
62 p->pPractical = Rwr_ManGetPractical( p );
63 // create the table
64 p->pTable = ABC_ALLOC( Rwr_Node_t *, p->nFuncs );
65 memset( p->pTable, 0, sizeof(Rwr_Node_t *) * p->nFuncs );
66 // create the elementary nodes
67 p->pMmNode = Extra_MmFixedStart( sizeof(Rwr_Node_t) );
68 p->vForest = Vec_PtrAlloc( 100 );
69 Rwr_ManAddVar( p, 0x0000, fPrecompute ); // constant 0
70 Rwr_ManAddVar( p, 0xAAAA, fPrecompute ); // var A
71 Rwr_ManAddVar( p, 0xCCCC, fPrecompute ); // var B
72 Rwr_ManAddVar( p, 0xF0F0, fPrecompute ); // var C
73 Rwr_ManAddVar( p, 0xFF00, fPrecompute ); // var D
74 p->nClasses = 5;
75 // other stuff
76 p->nTravIds = 1;
77 p->pPerms4 = Extra_Permutations( 4 );
78 p->vLevNums = Vec_IntAlloc( 50 );
79 p->vFanins = Vec_PtrAlloc( 50 );
80 p->vFaninsCur = Vec_PtrAlloc( 50 );
81 p->vNodesTemp = Vec_PtrAlloc( 50 );
82 if ( fPrecompute )
83 { // precompute subgraphs
85// Rwr_ManPrint( p );
87 }
88 else
89 { // load saved subgraphs
91// Rwr_ManPrint( p );
93 }
94p->timeStart = Abc_Clock() - clk;
95 return p;
96}
ABC_INT64_T abctime
Definition abc_global.h:332
#define ABC_ALLOC(type, num)
Definition abc_global.h:264
ABC_DLL void * Abc_FrameReadManDec()
Definition mainFrame.c:66
struct Dec_Man_t_ Dec_Man_t
Definition dec.h:79
char ** Extra_Permutations(int n)
Extra_MmFixed_t * Extra_MmFixedStart(int nEntrySize)
Rwr_Node_t * Rwr_ManAddVar(Rwr_Man_t *p, unsigned uTruth, int fPrecompute)
Definition rwrLib.c:253
char * Rwr_ManGetPractical(Rwr_Man_t *p)
Definition rwrUtil.c:640
void Rwr_ManPreprocess(Rwr_Man_t *p)
MACRO DEFINITIONS ///.
Definition rwrDec.c:49
struct Rwr_Man_t_ Rwr_Man_t
Definition rwr.h:47
void Rwr_ManWriteToArray(Rwr_Man_t *p)
FUNCTION DEFINITIONS ///.
Definition rwrUtil.c:426
void Rwr_ManPrecompute(Rwr_Man_t *p)
FUNCTION DEFINITIONS ///.
Definition rwrLib.c:48
struct Rwr_Node_t_ Rwr_Node_t
Definition rwr.h:48
void Rwr_ManLoadFromArray(Rwr_Man_t *p, int fVerbose)
Definition rwrUtil.c:472
char * pPerms
Definition dec.h:88
char * pPhases
Definition dec.h:87
unsigned char * pMap
Definition dec.h:89
unsigned short * puCanons
Definition dec.h:86
char * memset()
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Rwr_ManStop()

void Rwr_ManStop ( Rwr_Man_t * p)

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

Synopsis [Stops rewriting manager.]

Description []

SideEffects []

SeeAlso []

Definition at line 109 of file rwrMan.c.

110{
111 if ( p->vClasses )
112 {
113 Rwr_Node_t * pNode;
114 int i, k;
115 Vec_VecForEachEntry( Rwr_Node_t *, p->vClasses, pNode, i, k )
116 Dec_GraphFree( (Dec_Graph_t *)pNode->pNext );
117 }
118 if ( p->vClasses ) Vec_VecFree( p->vClasses );
119 Vec_PtrFree( p->vNodesTemp );
120 Vec_PtrFree( p->vForest );
121 Vec_IntFree( p->vLevNums );
122 Vec_PtrFree( p->vFanins );
123 Vec_PtrFree( p->vFaninsCur );
124 Extra_MmFixedStop( p->pMmNode );
125 ABC_FREE( p->pMapInv );
126 ABC_FREE( p->pTable );
127 ABC_FREE( p->pPractical );
128 ABC_FREE( p->pPerms4 );
129 ABC_FREE( p );
130}
#define ABC_FREE(obj)
Definition abc_global.h:267
struct Dec_Graph_t_ Dec_Graph_t
Definition dec.h:68
void Extra_MmFixedStop(Extra_MmFixed_t *p)
Rwr_Node_t * pNext
Definition rwr.h:112
#define Vec_VecForEachEntry(Type, vGlob, pEntry, i, k)
Definition vecVec.h:87
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Rwr_Precompute()

void Rwr_Precompute ( )

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

Synopsis [Precomputes AIG subgraphs.]

Description []

SideEffects []

SeeAlso []

Definition at line 310 of file rwrMan.c.

311{
312 Rwr_Man_t * p;
313 p = Rwr_ManStart( 1 );
314 Rwr_ManStop( p );
315}
ABC_NAMESPACE_IMPL_START Rwr_Man_t * Rwr_ManStart(int fPrecompute)
DECLARATIONS ///.
Definition rwrMan.c:47
void Rwr_ManStop(Rwr_Man_t *p)
Definition rwrMan.c:109
Here is the call graph for this function: