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

Go to the source code of this file.

Functions

ABC_NAMESPACE_IMPL_START void Npn_StartTruth8 (uint8 uTruths[][32])
 DECLARATIONS ///. More...
 
Cut_Man_tCut_ManStart (Cut_Params_t *pParams)
 FUNCTION DEFINITIONS ///. More...
 
void Cut_ManStop (Cut_Man_t *p)
 
void Cut_ManPrintStats (Cut_Man_t *p)
 
void Cut_ManPrintStatsToFile (Cut_Man_t *p, char *pFileName, abctime TimeTotal)
 
void Cut_ManSetFanoutCounts (Cut_Man_t *p, Vec_Int_t *vFanCounts)
 
void Cut_ManSetNodeAttrs (Cut_Man_t *p, Vec_Int_t *vNodeAttrs)
 
int Cut_ManReadVarsMax (Cut_Man_t *p)
 
Cut_Params_tCut_ManReadParams (Cut_Man_t *p)
 
Vec_Int_tCut_ManReadNodeAttrs (Cut_Man_t *p)
 
void Cut_ManIncrementDagNodes (Cut_Man_t *p)
 

Function Documentation

void Cut_ManIncrementDagNodes ( Cut_Man_t p)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 309 of file cutMan.c.

310 {
311  p->nNodesDag++;
312 }
void Cut_ManPrintStats ( Cut_Man_t p)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 155 of file cutMan.c.

156 {
157  if ( p->pReady )
158  {
159  Cut_CutRecycle( p, p->pReady );
160  p->pReady = NULL;
161  }
162  printf( "Cut computation statistics:\n" );
163  printf( "Current cuts = %8d. (Trivial = %d.)\n", p->nCutsCur-p->nCutsTriv, p->nCutsTriv );
164  printf( "Peak cuts = %8d.\n", p->nCutsPeak );
165  printf( "Total allocated = %8d.\n", p->nCutsAlloc );
166  printf( "Total deallocated = %8d.\n", p->nCutsDealloc );
167  printf( "Cuts filtered = %8d.\n", p->nCutsFilter );
168  printf( "Nodes saturated = %8d. (Max cuts = %d.)\n", p->nCutsLimit, p->pParams->nKeepMax );
169  printf( "Cuts per node = %8.1f\n", ((float)(p->nCutsCur-p->nCutsTriv))/p->nNodes );
170  printf( "The cut size = %8d bytes.\n", p->EntrySize );
171  printf( "Peak memory = %8.2f MB.\n", (float)p->nCutsPeak * p->EntrySize / (1<<20) );
172  printf( "Total nodes = %8d.\n", p->nNodes );
173  if ( p->pParams->fDag || p->pParams->fTree )
174  {
175  printf( "DAG nodes = %8d.\n", p->nNodesDag );
176  printf( "Tree nodes = %8d.\n", p->nNodes - p->nNodesDag );
177  }
178  printf( "Nodes w/o cuts = %8d.\n", p->nNodesNoCuts );
179  if ( p->pParams->fMap && !p->pParams->fSeq )
180  printf( "Mapping delay = %8d.\n", p->nDelayMin );
181 
182  ABC_PRT( "Merge ", p->timeMerge );
183  ABC_PRT( "Union ", p->timeUnion );
184  ABC_PRT( "Filter", p->timeFilter );
185  ABC_PRT( "Truth ", p->timeTruth );
186  ABC_PRT( "Map ", p->timeMap );
187 // printf( "Nodes = %d. Multi = %d. Cuts = %d. Multi = %d.\n",
188 // p->nNodes, p->nNodesMulti, p->nCutsCur-p->nCutsTriv, p->nCutsMulti );
189 // printf( "Count0 = %d. Count1 = %d. Count2 = %d.\n\n", p->Count0, p->Count1, p->Count2 );
190 }
abctime timeTruth
Definition: cutInt.h:97
int nCutsDealloc
Definition: cutInt.h:86
int nNodesNoCuts
Definition: cutInt.h:93
abctime timeMerge
Definition: cutInt.h:95
Cut_Cut_t * pReady
Definition: cutInt.h:63
int nCutsAlloc
Definition: cutInt.h:85
abctime timeFilter
Definition: cutInt.h:98
void Cut_CutRecycle(Cut_Man_t *p, Cut_Cut_t *pCut)
Definition: cutCut.c:72
#define ABC_PRT(a, t)
Definition: abc_global.h:220
abctime timeUnion
Definition: cutInt.h:96
Cut_Params_t * pParams
Definition: cutInt.h:51
int nCutsFilter
Definition: cutInt.h:89
abctime timeMap
Definition: cutInt.h:100
int nCutsLimit
Definition: cutInt.h:90
void Cut_ManPrintStatsToFile ( Cut_Man_t p,
char *  pFileName,
abctime  TimeTotal 
)

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

Synopsis [Prints some interesting stats.]

Description []

SideEffects []

SeeAlso []

Definition at line 204 of file cutMan.c.

205 {
206  FILE * pTable;
207  pTable = fopen( "cut_stats.txt", "a+" );
208  fprintf( pTable, "%-20s ", pFileName );
209  fprintf( pTable, "%8d ", p->nNodes );
210  fprintf( pTable, "%6.1f ", ((float)(p->nCutsCur))/p->nNodes );
211  fprintf( pTable, "%6.2f ", ((float)(100.0 * p->nCutsLimit))/p->nNodes );
212  fprintf( pTable, "%6.2f ", (float)p->nCutsPeak * p->EntrySize / (1<<20) );
213  fprintf( pTable, "%6.2f ", (float)(TimeTotal)/(float)(CLOCKS_PER_SEC) );
214  fprintf( pTable, "\n" );
215  fclose( pTable );
216 }
int nCutsLimit
Definition: cutInt.h:90
Vec_Int_t* Cut_ManReadNodeAttrs ( Cut_Man_t p)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 293 of file cutMan.c.

294 {
295  return p->vNodeAttrs;
296 }
Vec_Int_t * vNodeAttrs
Definition: cutInt.h:53
Cut_Params_t* Cut_ManReadParams ( Cut_Man_t p)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 277 of file cutMan.c.

278 {
279  return p->pParams;
280 }
Cut_Params_t * pParams
Definition: cutInt.h:51
int Cut_ManReadVarsMax ( Cut_Man_t p)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 261 of file cutMan.c.

262 {
263  return p->pParams->nVarsMax;
264 }
Cut_Params_t * pParams
Definition: cutInt.h:51
void Cut_ManSetFanoutCounts ( Cut_Man_t p,
Vec_Int_t vFanCounts 
)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 229 of file cutMan.c.

230 {
231  p->vFanCounts = vFanCounts;
232 }
Vec_Int_t * vFanCounts
Definition: cutInt.h:52
void Cut_ManSetNodeAttrs ( Cut_Man_t p,
Vec_Int_t vNodeAttrs 
)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 245 of file cutMan.c.

246 {
247  p->vNodeAttrs = vNodeAttrs;
248 }
Vec_Int_t * vNodeAttrs
Definition: cutInt.h:53
Cut_Man_t* Cut_ManStart ( Cut_Params_t pParams)

FUNCTION DEFINITIONS ///.

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

Synopsis [Starts the cut manager.]

Description []

SideEffects []

SeeAlso []

Definition at line 47 of file cutMan.c.

48 {
49  Cut_Man_t * p;
50 // extern int nTruthDsd;
51 // nTruthDsd = 0;
52  assert( pParams->nVarsMax >= 3 && pParams->nVarsMax <= CUT_SIZE_MAX );
53  p = ABC_ALLOC( Cut_Man_t, 1 );
54  memset( p, 0, sizeof(Cut_Man_t) );
55  // set and correct parameters
56  p->pParams = pParams;
57  // prepare storage for cuts
58  p->vCutsNew = Vec_PtrAlloc( pParams->nIdsMax );
59  Vec_PtrFill( p->vCutsNew, pParams->nIdsMax, NULL );
60  // prepare storage for sequential cuts
61  if ( pParams->fSeq )
62  {
63  p->pParams->fFilter = 1;
64  p->vCutsOld = Vec_PtrAlloc( pParams->nIdsMax );
65  Vec_PtrFill( p->vCutsOld, pParams->nIdsMax, NULL );
66  p->vCutsTemp = Vec_PtrAlloc( pParams->nCutSet );
67  Vec_PtrFill( p->vCutsTemp, pParams->nCutSet, NULL );
68  if ( pParams->fTruth && pParams->nVarsMax > 5 )
69  {
70  pParams->fTruth = 0;
71  printf( "Skipping computation of truth tables for sequential cuts with more than 5 inputs.\n" );
72  }
73  }
74  // entry size
75  p->EntrySize = sizeof(Cut_Cut_t) + pParams->nVarsMax * sizeof(int);
76  if ( pParams->fTruth )
77  {
78  if ( pParams->nVarsMax > 14 )
79  {
80  pParams->fTruth = 0;
81  printf( "Skipping computation of truth table for more than %d inputs.\n", 14 );
82  }
83  else
84  {
85  p->nTruthWords = Cut_TruthWords( pParams->nVarsMax );
86  p->EntrySize += p->nTruthWords * sizeof(unsigned);
87  }
88  p->puTemp[0] = ABC_ALLOC( unsigned, 4 * p->nTruthWords );
89  p->puTemp[1] = p->puTemp[0] + p->nTruthWords;
90  p->puTemp[2] = p->puTemp[1] + p->nTruthWords;
91  p->puTemp[3] = p->puTemp[2] + p->nTruthWords;
92  }
93  // enable cut computation recording
94  if ( pParams->fRecord )
95  {
96  p->vNodeCuts = Vec_IntStart( pParams->nIdsMax );
97  p->vNodeStarts = Vec_IntStart( pParams->nIdsMax );
98  p->vCutPairs = Vec_IntAlloc( 0 );
99  }
100  // allocate storage for delays
101  if ( pParams->fMap && !p->pParams->fSeq )
102  {
103  p->vDelays = Vec_IntStart( pParams->nIdsMax );
104  p->vDelays2 = Vec_IntStart( pParams->nIdsMax );
105  p->vCutsMax = Vec_PtrStart( pParams->nIdsMax );
106  }
107  // memory for cuts
109  p->vTemp = Vec_PtrAlloc( 100 );
110  return p;
111 }
char * memset()
static Vec_Ptr_t * Vec_PtrStart(int nSize)
Definition: vecPtr.h:106
Vec_Ptr_t * vCutsMax
Definition: cutInt.h:79
Vec_Ptr_t * vTemp
Definition: cutInt.h:64
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static void Vec_PtrFill(Vec_Ptr_t *p, int nSize, void *Entry)
Definition: vecPtr.h:449
static int Cut_TruthWords(int nVarsMax)
Definition: cutInt.h:125
int nTruthWords
Definition: cutInt.h:61
#define ABC_ALLOC(type, num)
Definition: abc_global.h:229
Vec_Int_t * vNodeStarts
Definition: cutInt.h:76
#define CUT_SIZE_MAX
Definition: cut.h:39
struct Cut_CutStruct_t_ Cut_Cut_t
Definition: cut.h:50
static Vec_Int_t * Vec_IntStart(int nSize)
Definition: bblif.c:172
Extra_MmFixed_t * pMmCuts
Definition: cutInt.h:59
static Vec_Int_t * Vec_IntAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: bblif.c:149
Vec_Int_t * vCutPairs
Definition: cutInt.h:77
Vec_Int_t * vDelays
Definition: cutInt.h:80
Extra_MmFixed_t * Extra_MmFixedStart(int nEntrySize)
Vec_Ptr_t * vCutsTemp
Definition: cutInt.h:57
Vec_Ptr_t * vCutsOld
Definition: cutInt.h:56
Vec_Int_t * vDelays2
Definition: cutInt.h:81
static Vec_Ptr_t * Vec_PtrAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: vecPtr.h:83
Vec_Int_t * vNodeCuts
Definition: cutInt.h:75
Cut_Params_t * pParams
Definition: cutInt.h:51
#define assert(ex)
Definition: util_old.h:213
unsigned * puTemp[4]
Definition: cutInt.h:73
Vec_Ptr_t * vCutsNew
Definition: cutInt.h:55
void Cut_ManStop ( Cut_Man_t p)

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

Synopsis [Stops the cut manager.]

Description []

SideEffects []

SeeAlso []

Definition at line 124 of file cutMan.c.

125 {
126  if ( p->vCutsNew ) Vec_PtrFree( p->vCutsNew );
127  if ( p->vCutsOld ) Vec_PtrFree( p->vCutsOld );
128  if ( p->vCutsTemp ) Vec_PtrFree( p->vCutsTemp );
129  if ( p->vFanCounts ) Vec_IntFree( p->vFanCounts );
130  if ( p->vTemp ) Vec_PtrFree( p->vTemp );
131 
132  if ( p->vCutsMax ) Vec_PtrFree( p->vCutsMax );
133  if ( p->vDelays ) Vec_IntFree( p->vDelays );
134  if ( p->vDelays2 ) Vec_IntFree( p->vDelays2 );
135  if ( p->vNodeCuts ) Vec_IntFree( p->vNodeCuts );
136  if ( p->vNodeStarts ) Vec_IntFree( p->vNodeStarts );
137  if ( p->vCutPairs ) Vec_IntFree( p->vCutPairs );
138  if ( p->puTemp[0] ) ABC_FREE( p->puTemp[0] );
139 
141  ABC_FREE( p );
142 }
Vec_Int_t * vFanCounts
Definition: cutInt.h:52
Vec_Ptr_t * vCutsMax
Definition: cutInt.h:79
Vec_Ptr_t * vTemp
Definition: cutInt.h:64
void Extra_MmFixedStop(Extra_MmFixed_t *p)
Vec_Int_t * vNodeStarts
Definition: cutInt.h:76
Extra_MmFixed_t * pMmCuts
Definition: cutInt.h:59
Vec_Int_t * vCutPairs
Definition: cutInt.h:77
Vec_Int_t * vDelays
Definition: cutInt.h:80
Vec_Ptr_t * vCutsTemp
Definition: cutInt.h:57
Vec_Ptr_t * vCutsOld
Definition: cutInt.h:56
Vec_Int_t * vDelays2
Definition: cutInt.h:81
#define ABC_FREE(obj)
Definition: abc_global.h:232
Vec_Int_t * vNodeCuts
Definition: cutInt.h:75
unsigned * puTemp[4]
Definition: cutInt.h:73
static void Vec_IntFree(Vec_Int_t *p)
Definition: bblif.c:235
Vec_Ptr_t * vCutsNew
Definition: cutInt.h:55
static void Vec_PtrFree(Vec_Ptr_t *p)
Definition: vecPtr.h:223
ABC_NAMESPACE_IMPL_START void Npn_StartTruth8 ( uint8  uTruths[][32])

DECLARATIONS ///.

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

FileName [cutMan.c]

SystemName [ABC: Logic synthesis and verification system.]

PackageName [K-feasible cut computation package.]

Synopsis [Cut manager.]

Author [Alan Mishchenko]

Affiliation [UC Berkeley]

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

Revision [

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

]