abc-master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
rwrPrint.c File Reference
#include "rwr.h"

Go to the source code of this file.

Functions

ABC_NAMESPACE_IMPL_START void Rwr_Trav2_rec (Rwr_Man_t *p, Rwr_Node_t *pNode, int *pVolume)
 DECLARATIONS ///. More...
 
void Rwr_GetBushVolume (Rwr_Man_t *p, int Entry, int *pVolume, int *pnFuncs)
 
int Rwr_GetBushSumOfVolumes (Rwr_Man_t *p, int Entry)
 
void Rwr_NodePrint_rec (FILE *pFile, Rwr_Node_t *pNode)
 
void Rwr_NodePrint (FILE *pFile, Rwr_Man_t *p, Rwr_Node_t *pNode)
 
void Rwr_ManPrint (Rwr_Man_t *p)
 

Function Documentation

int Rwr_GetBushSumOfVolumes ( Rwr_Man_t p,
int  Entry 
)

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

Synopsis [Adds the node to the end of the list.]

Description []

SideEffects []

SeeAlso []

Definition at line 94 of file rwrPrint.c.

95 {
96  Rwr_Node_t * pNode;
97  int Volume, VolumeTotal = 0;
98  for ( pNode = p->pTable[Entry]; pNode; pNode = pNode->pNext )
99  {
100  if ( pNode->uTruth != p->puCanons[pNode->uTruth] )
101  continue;
102  Volume = 0;
103  Rwr_ManIncTravId( p );
104  Rwr_Trav2_rec( p, pNode, &Volume );
105  VolumeTotal += Volume;
106  }
107  return VolumeTotal;
108 }
unsigned short * puCanons
Definition: rwr.h:54
unsigned uTruth
Definition: rwr.h:105
void Rwr_ManIncTravId(Rwr_Man_t *p)
Definition: rwrLib.c:350
ABC_NAMESPACE_IMPL_START void Rwr_Trav2_rec(Rwr_Man_t *p, Rwr_Node_t *pNode, int *pVolume)
DECLARATIONS ///.
Definition: rwrPrint.c:45
Rwr_Node_t ** pTable
Definition: rwr.h:63
Rwr_Node_t * pNext
Definition: rwr.h:112
void Rwr_GetBushVolume ( Rwr_Man_t p,
int  Entry,
int *  pVolume,
int *  pnFuncs 
)

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

Synopsis [Adds the node to the end of the list.]

Description []

SideEffects []

SeeAlso []

Definition at line 66 of file rwrPrint.c.

67 {
68  Rwr_Node_t * pNode;
69  int Volume = 0;
70  int nFuncs = 0;
71  Rwr_ManIncTravId( p );
72  for ( pNode = p->pTable[Entry]; pNode; pNode = pNode->pNext )
73  {
74  if ( pNode->uTruth != p->puCanons[pNode->uTruth] )
75  continue;
76  nFuncs++;
77  Rwr_Trav2_rec( p, pNode, &Volume );
78  }
79  *pVolume = Volume;
80  *pnFuncs = nFuncs;
81 }
unsigned short * puCanons
Definition: rwr.h:54
unsigned uTruth
Definition: rwr.h:105
void Rwr_ManIncTravId(Rwr_Man_t *p)
Definition: rwrLib.c:350
ABC_NAMESPACE_IMPL_START void Rwr_Trav2_rec(Rwr_Man_t *p, Rwr_Node_t *pNode, int *pVolume)
DECLARATIONS ///.
Definition: rwrPrint.c:45
Rwr_Node_t ** pTable
Definition: rwr.h:63
Rwr_Node_t * pNext
Definition: rwr.h:112
void Rwr_ManPrint ( Rwr_Man_t p)

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

Synopsis [Prints one rwr node.]

Description []

SideEffects []

SeeAlso []

Definition at line 237 of file rwrPrint.c.

238 {
239  FILE * pFile;
240  Rwr_Node_t * pNode;
241  unsigned uTruth;
242  int Limit, Counter, Volume, nFuncs, i;
243  pFile = fopen( "graph_lib.txt", "w" );
244  Counter = 0;
245  Limit = (1 << 16);
246  for ( i = 0; i < Limit; i++ )
247  {
248  if ( p->pTable[i] == NULL )
249  continue;
250  if ( i != p->puCanons[i] )
251  continue;
252  fprintf( pFile, "\nClass %3d. Func %6d. ", p->pMap[i], Counter++ );
253  Rwr_GetBushVolume( p, i, &Volume, &nFuncs );
254  fprintf( pFile, "Roots = %3d. Vol = %3d. Sum = %3d. ", nFuncs, Volume, Rwr_GetBushSumOfVolumes(p, i) );
255  uTruth = i;
256  Extra_PrintBinary( pFile, &uTruth, 16 );
257  fprintf( pFile, "\n" );
258  for ( pNode = p->pTable[i]; pNode; pNode = pNode->pNext )
259  if ( pNode->uTruth == p->puCanons[pNode->uTruth] )
260  Rwr_NodePrint( pFile, p, pNode );
261  }
262  fclose( pFile );
263 }
unsigned char * pMap
Definition: rwr.h:57
unsigned short * puCanons
Definition: rwr.h:54
void Rwr_NodePrint(FILE *pFile, Rwr_Man_t *p, Rwr_Node_t *pNode)
Definition: rwrPrint.c:208
unsigned uTruth
Definition: rwr.h:105
void Rwr_GetBushVolume(Rwr_Man_t *p, int Entry, int *pVolume, int *pnFuncs)
Definition: rwrPrint.c:66
static int Counter
int Rwr_GetBushSumOfVolumes(Rwr_Man_t *p, int Entry)
Definition: rwrPrint.c:94
void Extra_PrintBinary(FILE *pFile, unsigned Sign[], int nBits)
Rwr_Node_t ** pTable
Definition: rwr.h:63
Rwr_Node_t * pNext
Definition: rwr.h:112
void Rwr_NodePrint ( FILE *  pFile,
Rwr_Man_t p,
Rwr_Node_t pNode 
)

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

Synopsis [Prints one rwr node.]

Description []

SideEffects []

SeeAlso []

Definition at line 208 of file rwrPrint.c.

209 {
210  unsigned uTruth;
211  fprintf( pFile, "%5d : ", pNode->Id );
212  uTruth = pNode->uTruth;
213  Extra_PrintHex( pFile, &uTruth, 4 );
214  fprintf( pFile, " tt=" );
215  Extra_PrintBinary( pFile, &uTruth, 16 );
216 // fprintf( pFile, " cn=", pNode->Id );
217 // uTruth = p->puCanons[pNode->uTruth];
218 // Extra_PrintBinary( pFile, &uTruth, 16 );
219  fprintf( pFile, " lev=%d", pNode->Level );
220  fprintf( pFile, " vol=%d", pNode->Volume );
221  fprintf( pFile, " " );
222  Rwr_NodePrint_rec( pFile, pNode );
223  fprintf( pFile, "\n" );
224 }
int Id
Definition: rwr.h:100
unsigned Level
Definition: rwr.h:107
unsigned uTruth
Definition: rwr.h:105
void Extra_PrintHex(FILE *pFile, unsigned *pTruth, int nVars)
void Extra_PrintBinary(FILE *pFile, unsigned Sign[], int nBits)
unsigned Volume
Definition: rwr.h:106
void Rwr_NodePrint_rec(FILE *pFile, Rwr_Node_t *pNode)
Definition: rwrPrint.c:121
void Rwr_NodePrint_rec ( FILE *  pFile,
Rwr_Node_t pNode 
)

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

Synopsis [Prints one rwr node.]

Description []

SideEffects []

SeeAlso []

Definition at line 121 of file rwrPrint.c.

122 {
123  assert( !Rwr_IsComplement(pNode) );
124 
125  if ( pNode->Id == 0 )
126  {
127  fprintf( pFile, "Const1" );
128  return;
129  }
130 
131  if ( pNode->Id < 5 )
132  {
133  fprintf( pFile, "%c", 'a' + pNode->Id - 1 );
134  return;
135  }
136 
137  if ( Rwr_IsComplement(pNode->p0) )
138  {
139  if ( Rwr_Regular(pNode->p0)->Id < 5 )
140  {
141  Rwr_NodePrint_rec( pFile, Rwr_Regular(pNode->p0) );
142  fprintf( pFile, "\'" );
143  }
144  else
145  {
146  fprintf( pFile, "(" );
147  Rwr_NodePrint_rec( pFile, Rwr_Regular(pNode->p0) );
148  fprintf( pFile, ")\'" );
149  }
150  }
151  else
152  {
153  if ( Rwr_Regular(pNode->p0)->Id < 5 )
154  {
155  Rwr_NodePrint_rec( pFile, Rwr_Regular(pNode->p0) );
156  }
157  else
158  {
159  fprintf( pFile, "(" );
160  Rwr_NodePrint_rec( pFile, Rwr_Regular(pNode->p0) );
161  fprintf( pFile, ")" );
162  }
163  }
164 
165  if ( pNode->fExor )
166  fprintf( pFile, "+" );
167 
168  if ( Rwr_IsComplement(pNode->p1) )
169  {
170  if ( Rwr_Regular(pNode->p1)->Id < 5 )
171  {
172  Rwr_NodePrint_rec( pFile, Rwr_Regular(pNode->p1) );
173  fprintf( pFile, "\'" );
174  }
175  else
176  {
177  fprintf( pFile, "(" );
178  Rwr_NodePrint_rec( pFile, Rwr_Regular(pNode->p1) );
179  fprintf( pFile, ")\'" );
180  }
181  }
182  else
183  {
184  if ( Rwr_Regular(pNode->p1)->Id < 5 )
185  {
186  Rwr_NodePrint_rec( pFile, Rwr_Regular(pNode->p1) );
187  }
188  else
189  {
190  fprintf( pFile, "(" );
191  Rwr_NodePrint_rec( pFile, Rwr_Regular(pNode->p1) );
192  fprintf( pFile, ")" );
193  }
194  }
195 }
int Id
Definition: rwr.h:100
static int Rwr_IsComplement(Rwr_Node_t *p)
Definition: rwr.h:116
Rwr_Node_t * p0
Definition: rwr.h:110
unsigned fExor
Definition: rwr.h:109
Rwr_Node_t * p1
Definition: rwr.h:111
#define assert(ex)
Definition: util_old.h:213
static Rwr_Node_t * Rwr_Regular(Rwr_Node_t *p)
Definition: rwr.h:117
void Rwr_NodePrint_rec(FILE *pFile, Rwr_Node_t *pNode)
Definition: rwrPrint.c:121
ABC_NAMESPACE_IMPL_START void Rwr_Trav2_rec ( Rwr_Man_t p,
Rwr_Node_t pNode,
int *  pVolume 
)

DECLARATIONS ///.

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

FileName [rwrCut.c]

SystemName [ABC: Logic synthesis and verification system.]

PackageName [DAG-aware AIG rewriting package.]

Synopsis [Cut computation.]

Author [Alan Mishchenko]

Affiliation [UC Berkeley]

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

Revision [

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

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

Synopsis [Adds one node.]

Description []

SideEffects []

SeeAlso []

Definition at line 45 of file rwrPrint.c.

46 {
47  if ( pNode->fUsed || pNode->TravId == p->nTravIds )
48  return;
49  pNode->TravId = p->nTravIds;
50  (*pVolume)++;
51  Rwr_Trav2_rec( p, Rwr_Regular(pNode->p0), pVolume );
52  Rwr_Trav2_rec( p, Rwr_Regular(pNode->p1), pVolume );
53 }
unsigned fUsed
Definition: rwr.h:108
Rwr_Node_t * p0
Definition: rwr.h:110
int nTravIds
Definition: rwr.h:67
ABC_NAMESPACE_IMPL_START void Rwr_Trav2_rec(Rwr_Man_t *p, Rwr_Node_t *pNode, int *pVolume)
DECLARATIONS ///.
Definition: rwrPrint.c:45
int TravId
Definition: rwr.h:101
Rwr_Node_t * p1
Definition: rwr.h:111
static Rwr_Node_t * Rwr_Regular(Rwr_Node_t *p)
Definition: rwr.h:117