ABC: A System for Sequential Synthesis and Verification
 
Loading...
Searching...
No Matches
rwtMan.c File Reference
#include "rwt.h"
#include "bool/deco/deco.h"
Include dependency graph for rwtMan.c:

Go to the source code of this file.

Functions

void Rwt_ManGlobalStart ()
 FUNCTION DEFINITIONS ///.
 
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, abctime Time)
 
void Rwt_ManAddTimeUpdate (Rwt_Man_t *p, abctime Time)
 
void Rwt_ManAddTimeTotal (Rwt_Man_t *p, abctime Time)
 
void Rwt_Precompute ()
 

Function Documentation

◆ Rwt_ManAddTimeCuts()

void Rwt_ManAddTimeCuts ( Rwt_Man_t * p,
abctime Time )

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

Synopsis [Stops the resynthesis manager.]

Description []

SideEffects []

SeeAlso []

Definition at line 301 of file rwtMan.c.

302{
303 p->timeCut += Time;
304}
Cube * p
Definition exorList.c:222

◆ Rwt_ManAddTimeTotal()

void Rwt_ManAddTimeTotal ( Rwt_Man_t * p,
abctime Time )

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

Synopsis [Stops the resynthesis manager.]

Description []

SideEffects []

SeeAlso []

Definition at line 333 of file rwtMan.c.

334{
335 p->timeTotal += Time;
336}
Here is the caller graph for this function:

◆ Rwt_ManAddTimeUpdate()

void Rwt_ManAddTimeUpdate ( Rwt_Man_t * p,
abctime Time )

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

Synopsis [Stops the resynthesis manager.]

Description []

SideEffects []

SeeAlso []

Definition at line 317 of file rwtMan.c.

318{
319 p->timeUpdate += Time;
320}
Here is the caller graph for this function:

◆ Rwt_ManGlobalStart()

void Rwt_ManGlobalStart ( )

FUNCTION DEFINITIONS ///.

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

Synopsis [Starts residual rewriting manager.]

Description []

SideEffects []

SeeAlso []

Definition at line 51 of file rwtMan.c.

52{
53 if ( s_puCanons == NULL )
54 Extra_Truth4VarNPN( &s_puCanons, &s_pPhases, &s_pPerms, &s_pMap );
55}
void Extra_Truth4VarNPN(unsigned short **puCanons, char **puPhases, char **puPerms, unsigned char **puMap)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Rwt_ManGlobalStop()

void Rwt_ManGlobalStop ( )

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

Synopsis [Starts residual rewriting manager.]

Description []

SideEffects []

SeeAlso []

Definition at line 68 of file rwtMan.c.

69{
70 ABC_FREE( s_puCanons );
71 ABC_FREE( s_pPhases );
72 ABC_FREE( s_pPerms );
73 ABC_FREE( s_pMap );
74}
#define ABC_FREE(obj)
Definition abc_global.h:267
Here is the caller graph for this function:

◆ Rwt_ManPrintStats()

void Rwt_ManPrintStats ( Rwt_Man_t * p)

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

Synopsis [Stops the resynthesis manager.]

Description []

SideEffects []

SeeAlso []

Definition at line 183 of file rwtMan.c.

184{
185 int i, Counter = 0;
186 for ( i = 0; i < 222; i++ )
187 Counter += (p->nScores[i] > 0);
188
189 printf( "Rewriting statistics:\n" );
190 printf( "Total cuts tries = %8d.\n", p->nCutsGood );
191 printf( "Bad cuts found = %8d.\n", p->nCutsBad );
192 printf( "Total subgraphs = %8d.\n", p->nSubgraphs );
193 printf( "Used NPN classes = %8d.\n", Counter );
194 printf( "Nodes considered = %8d.\n", p->nNodesConsidered );
195 printf( "Nodes rewritten = %8d.\n", p->nNodesRewritten );
196 printf( "Calculated gain = %8d.\n", p->nNodesGained );
197 ABC_PRT( "Start ", p->timeStart );
198 ABC_PRT( "Cuts ", p->timeCut );
199 ABC_PRT( "Truth ", p->timeTruth );
200 ABC_PRT( "Resynthesis ", p->timeRes );
201 ABC_PRT( " Mffc ", p->timeMffc );
202 ABC_PRT( " Eval ", p->timeEval );
203 ABC_PRT( "Update ", p->timeUpdate );
204 ABC_PRT( "TOTAL ", p->timeTotal );
205
206/*
207 printf( "The scores are:\n" );
208 for ( i = 0; i < 222; i++ )
209 if ( p->nScores[i] > 0 )
210 {
211 extern void Ivy_TruthDsdComputePrint( unsigned uTruth );
212 printf( "%3d = %8d canon = %5d ", i, p->nScores[i], p->pMapInv[i] );
213 Ivy_TruthDsdComputePrint( (unsigned)p->pMapInv[i] | ((unsigned)p->pMapInv[i] << 16) );
214 }
215 printf( "\n" );
216*/
217}
#define ABC_PRT(a, t)
Definition abc_global.h:255
Here is the caller graph for this function:

◆ Rwt_ManPrintStatsFile()

void Rwt_ManPrintStatsFile ( Rwt_Man_t * p)

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

Synopsis [Stops the resynthesis manager.]

Description []

SideEffects []

SeeAlso []

Definition at line 230 of file rwtMan.c.

231{
232 FILE * pTable;
233 pTable = fopen( "stats.txt", "a+" );
234 fprintf( pTable, "%d ", p->nCutsGood );
235 fprintf( pTable, "%d ", p->nSubgraphs );
236 fprintf( pTable, "%d ", p->nNodesRewritten );
237 fprintf( pTable, "%d", p->nNodesGained );
238 fprintf( pTable, "\n" );
239 fclose( pTable );
240}

◆ Rwt_ManReadCompl()

int Rwt_ManReadCompl ( Rwt_Man_t * p)

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

Synopsis [Stops the resynthesis manager.]

Description []

SideEffects []

SeeAlso []

Definition at line 285 of file rwtMan.c.

286{
287 return p->fCompl;
288}
Here is the caller graph for this function:

◆ Rwt_ManReadDecs()

void * Rwt_ManReadDecs ( Rwt_Man_t * p)

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

Synopsis [Stops the resynthesis manager.]

Description []

SideEffects []

SeeAlso []

Definition at line 253 of file rwtMan.c.

254{
255 return p->pGraph;
256}
Here is the caller graph for this function:

◆ Rwt_ManReadLeaves()

Vec_Ptr_t * Rwt_ManReadLeaves ( Rwt_Man_t * p)

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

Synopsis [Stops the resynthesis manager.]

Description []

SideEffects []

SeeAlso []

Definition at line 269 of file rwtMan.c.

270{
271 return p->vFanins;
272}

◆ Rwt_ManStart()

Rwt_Man_t * Rwt_ManStart ( int fPrecompute)

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

Synopsis [Starts rewriting manager.]

Description []

SideEffects []

SeeAlso []

Definition at line 87 of file rwtMan.c.

88{
89 Rwt_Man_t * p;
90 abctime clk = Abc_Clock();
91clk = Abc_Clock();
92 p = ABC_ALLOC( Rwt_Man_t, 1 );
93 memset( p, 0, sizeof(Rwt_Man_t) );
94 p->nFuncs = (1<<16);
95 // copy the global tables
97 p->puCanons = s_puCanons;
98 p->pPhases = s_pPhases;
99 p->pPerms = s_pPerms;
100 p->pMap = s_pMap;
101 // initialize practical NPN classes
102 p->pPractical = Rwt_ManGetPractical( p );
103 // create the table
104 p->pTable = ABC_ALLOC( Rwt_Node_t *, p->nFuncs );
105 memset( p->pTable, 0, sizeof(Rwt_Node_t *) * p->nFuncs );
106 // create the elementary nodes
107 p->pMmNode = Mem_FixedStart( sizeof(Rwt_Node_t) );
108 p->vForest = Vec_PtrAlloc( 100 );
109 Rwt_ManAddVar( p, 0x0000, fPrecompute ); // constant 0
110 Rwt_ManAddVar( p, 0xAAAA, fPrecompute ); // var A
111 Rwt_ManAddVar( p, 0xCCCC, fPrecompute ); // var B
112 Rwt_ManAddVar( p, 0xF0F0, fPrecompute ); // var C
113 Rwt_ManAddVar( p, 0xFF00, fPrecompute ); // var D
114 p->nClasses = 5;
115 // other stuff
116 p->nTravIds = 1;
117 p->pPerms4 = Extra_Permutations( 4 );
118 p->vLevNums = Vec_IntAlloc( 50 );
119 p->vFanins = Vec_PtrAlloc( 50 );
120 p->vFaninsCur = Vec_PtrAlloc( 50 );
121 p->vNodesTemp = Vec_PtrAlloc( 50 );
122 if ( fPrecompute )
123 { // precompute subgraphs
124// Rwt_ManPrecompute( p );
125// Rwt_ManPrint( p );
126// Rwt_ManWriteToArray( p );
127 }
128 else
129 { // load saved subgraphs
131// Rwt_ManPrint( p );
133 }
134p->timeStart = Abc_Clock() - clk;
135 return p;
136}
ABC_INT64_T abctime
Definition abc_global.h:332
#define ABC_ALLOC(type, num)
Definition abc_global.h:264
char ** Extra_Permutations(int n)
Mem_Fixed_t * Mem_FixedStart(int nEntrySize)
FUNCTION DEFINITIONS ///.
Definition mem.c:100
void Rwt_ManGlobalStart()
FUNCTION DEFINITIONS ///.
Definition rwtMan.c:51
void Rwt_ManLoadFromArray(Rwt_Man_t *p, int fVerbose)
Definition rwtUtil.c:589
struct Rwt_Man_t_ Rwt_Man_t
Definition rwt.h:55
Rwt_Node_t * Rwt_ManAddVar(Rwt_Man_t *p, unsigned uTruth, int fPrecompute)
Definition rwtUtil.c:446
struct Rwt_Node_t_ Rwt_Node_t
Definition rwt.h:56
char * Rwt_ManGetPractical(Rwt_Man_t *p)
Definition rwtUtil.c:640
void Rwt_ManPreprocess(Rwt_Man_t *p)
MACRO DEFINITIONS ///.
Definition rwtDec.c:49
char * memset()
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Rwt_ManStop()

void Rwt_ManStop ( Rwt_Man_t * p)

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

Synopsis [Stops rewriting manager.]

Description []

SideEffects []

SeeAlso []

Definition at line 149 of file rwtMan.c.

150{
151 if ( p->vClasses )
152 {
153 Rwt_Node_t * pNode;
154 int i, k;
155 Vec_VecForEachEntry( Rwt_Node_t *, p->vClasses, pNode, i, k )
156 Dec_GraphFree( (Dec_Graph_t *)pNode->pNext );
157 }
158 if ( p->vClasses ) Vec_VecFree( p->vClasses );
159 Vec_PtrFree( p->vNodesTemp );
160 Vec_PtrFree( p->vForest );
161 Vec_IntFree( p->vLevNums );
162 Vec_PtrFree( p->vFanins );
163 Vec_PtrFree( p->vFaninsCur );
164 Mem_FixedStop( p->pMmNode, 0 );
165 ABC_FREE( p->pMapInv );
166 ABC_FREE( p->pTable );
167 ABC_FREE( p->pPractical );
168 ABC_FREE( p->pPerms4 );
169 ABC_FREE( p );
170}
struct Dec_Graph_t_ Dec_Graph_t
Definition dec.h:68
void Mem_FixedStop(Mem_Fixed_t *p, int fVerbose)
Definition mem.c:139
Rwt_Node_t * pNext
Definition rwt.h:118
#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:

◆ Rwt_Precompute()

void Rwt_Precompute ( )

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

Synopsis [Precomputes AIG subgraphs.]

Description []

SideEffects []

SeeAlso []

Definition at line 350 of file rwtMan.c.

351{
352 Rwt_Man_t * p;
353 p = Rwt_ManStart( 1 );
354 Rwt_ManStop( p );
355}
void Rwt_ManStop(Rwt_Man_t *p)
Definition rwtMan.c:149
Rwt_Man_t * Rwt_ManStart(int fPrecompute)
Definition rwtMan.c:87
Here is the call graph for this function: