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

Go to the source code of this file.

Functions

ABC_NAMESPACE_IMPL_START int Sfm_ObjRef_rec (Sfm_Ntk_t *p, int iObj)
 DECLARATIONS ///. More...
 
int Sfm_ObjRef (Sfm_Ntk_t *p, int iObj)
 
int Sfm_ObjDeref_rec (Sfm_Ntk_t *p, int iObj)
 
int Sfm_ObjDeref (Sfm_Ntk_t *p, int iObj)
 
int Sfm_ObjMffcSize (Sfm_Ntk_t *p, int iObj)
 
static void Sfm_NtkIncrementTravId (Sfm_Ntk_t *p)
 
static void Sfm_ObjSetTravIdCurrent (Sfm_Ntk_t *p, int Id)
 
static int Sfm_ObjIsTravIdCurrent (Sfm_Ntk_t *p, int Id)
 
static int Sfm_ObjIsTravIdPrevious (Sfm_Ntk_t *p, int Id)
 
static void Sfm_NtkIncrementTravId2 (Sfm_Ntk_t *p)
 
static void Sfm_ObjSetTravIdCurrent2 (Sfm_Ntk_t *p, int Id)
 
static int Sfm_ObjIsTravIdCurrent2 (Sfm_Ntk_t *p, int Id)
 
void Sfm_NtkDfs_rec (Sfm_Ntk_t *p, int iNode, Vec_Int_t *vNodes, Vec_Wec_t *vGroups, Vec_Int_t *vGroupMap, Vec_Int_t *vBoxesLeft)
 
Vec_Int_tSfm_NtkDfs (Sfm_Ntk_t *p, Vec_Wec_t *vGroups, Vec_Int_t *vGroupMap, Vec_Int_t *vBoxesLeft)
 
int Sfm_NtkCheckOverlap_rec (Sfm_Ntk_t *p, int iThis, int iNode)
 
int Sfm_NtkCheckOverlap (Sfm_Ntk_t *p, int iFan, int iNode)
 
static int Sfm_NtkCheckRoot (Sfm_Ntk_t *p, int iNode, int nLevelMax)
 
void Sfm_NtkComputeRoots_rec (Sfm_Ntk_t *p, int iNode, int nLevelMax, Vec_Int_t *vRoots, Vec_Int_t *vTfo)
 
void Sfm_NtkAddDivisors (Sfm_Ntk_t *p, int iNode, int nLevelMax)
 
static int Sfm_ObjIsUseful (Sfm_Ntk_t *p, int iNode)
 
int Sfm_NtkCollectTfi_rec (Sfm_Ntk_t *p, int iNode, Vec_Int_t *vNodes)
 
int Sfm_NtkCreateWindow (Sfm_Ntk_t *p, int iNode, int fVerbose)
 
void Sfm_NtkWindowTest (Sfm_Ntk_t *p, int iNode)
 

Function Documentation

void Sfm_NtkAddDivisors ( Sfm_Ntk_t p,
int  iNode,
int  nLevelMax 
)

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

Synopsis [Collects divisors of the node.]

Description []

SideEffects []

SeeAlso []

Definition at line 262 of file sfmWin.c.

263 {
264  int i, iFanout;
265  Sfm_ObjForEachFanout( p, iNode, iFanout, i )
266  {
267  // skip some of the fanouts if the number is large
268  if ( p->pPars->nFanoutMax && i > p->pPars->nFanoutMax )
269  return;
270  // skip TFI nodes, PO nodes, or nodes with high logic level
271  if ( Sfm_ObjIsTravIdCurrent(p, iFanout) || Sfm_ObjIsPo(p, iFanout) || Sfm_ObjLevel(p, iFanout) > nLevelMax )
272  continue;
273  // handle single-input nodes
274  if ( Sfm_ObjFaninNum(p, iFanout) == 1 )
275  Vec_IntPush( p->vDivs, iFanout );
276  // visit node for the first time
277  else if ( !Sfm_ObjIsTravIdCurrent2(p, iFanout) )
278  {
279  assert( Sfm_ObjFaninNum(p, iFanout) > 1 );
280  Sfm_ObjSetTravIdCurrent2( p, iFanout );
281  Sfm_ObjResetFaninCount( p, iFanout );
282  }
283  // visit node again
284  else if ( Sfm_ObjUpdateFaninCount(p, iFanout) == 0 )
285  Vec_IntPush( p->vDivs, iFanout );
286  }
287 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static int Sfm_ObjIsTravIdCurrent2(Sfm_Ntk_t *p, int Id)
Definition: sfmWin.c:121
static int Sfm_ObjFaninNum(Sfm_Ntk_t *p, int i)
Definition: sfmInt.h:139
static int Sfm_ObjUpdateFaninCount(Sfm_Ntk_t *p, int iObj)
Definition: sfmInt.h:159
static int Sfm_ObjIsTravIdCurrent(Sfm_Ntk_t *p, int Id)
Definition: sfmWin.c:116
static int Sfm_ObjLevel(Sfm_Ntk_t *p, int iObj)
Definition: sfmInt.h:153
#define Sfm_ObjForEachFanout(p, Node, Fan, i)
Definition: sfmInt.h:173
static int Sfm_ObjIsPo(Sfm_Ntk_t *p, int i)
Definition: sfmInt.h:130
static void Vec_IntPush(Vec_Int_t *p, int Entry)
Definition: bblif.c:468
static void Sfm_ObjResetFaninCount(Sfm_Ntk_t *p, int iObj)
Definition: sfmInt.h:160
#define assert(ex)
Definition: util_old.h:213
static void Sfm_ObjSetTravIdCurrent2(Sfm_Ntk_t *p, int Id)
Definition: sfmWin.c:120
int Sfm_NtkCheckOverlap ( Sfm_Ntk_t p,
int  iFan,
int  iNode 
)

Definition at line 203 of file sfmWin.c.

204 {
206  return Sfm_NtkCheckOverlap_rec( p, iFan, iNode );
207 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static void Sfm_NtkIncrementTravId2(Sfm_Ntk_t *p)
Definition: sfmWin.c:119
int Sfm_NtkCheckOverlap_rec(Sfm_Ntk_t *p, int iThis, int iNode)
Definition: sfmWin.c:189
int Sfm_NtkCheckOverlap_rec ( Sfm_Ntk_t p,
int  iThis,
int  iNode 
)

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

Synopsis [Check if this fanout overlaps with TFI cone of the node.]

Description []

SideEffects []

SeeAlso []

Definition at line 189 of file sfmWin.c.

190 {
191  int i, iFanin;
192  if ( Sfm_ObjIsTravIdCurrent2(p, iThis) || iThis == iNode )
193  return 0;
194 // if ( Sfm_ObjIsTravIdCurrent(p, iThis) )
195  if ( Sfm_ObjIsTravIdPrevious(p, iThis) )
196  return 1;
197  Sfm_ObjSetTravIdCurrent2(p, iThis);
198  Sfm_ObjForEachFanin( p, iThis, iFanin, i )
199  if ( Sfm_NtkCheckOverlap_rec(p, iFanin, iNode) )
200  return 1;
201  return 0;
202 }
#define Sfm_ObjForEachFanin(p, Node, Fan, i)
Definition: sfmInt.h:172
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static int Sfm_ObjIsTravIdCurrent2(Sfm_Ntk_t *p, int Id)
Definition: sfmWin.c:121
if(last==0)
Definition: sparse_int.h:34
int Sfm_NtkCheckOverlap_rec(Sfm_Ntk_t *p, int iThis, int iNode)
Definition: sfmWin.c:189
static int Sfm_ObjIsTravIdPrevious(Sfm_Ntk_t *p, int Id)
Definition: sfmWin.c:117
static void Sfm_ObjSetTravIdCurrent2(Sfm_Ntk_t *p, int Id)
Definition: sfmWin.c:120
static int Sfm_NtkCheckRoot ( Sfm_Ntk_t p,
int  iNode,
int  nLevelMax 
)
inlinestatic

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

Synopsis [Recursively collects roots of the window.]

Description []

SideEffects []

SeeAlso []

Definition at line 220 of file sfmWin.c.

221 {
222  int i, iFanout;
223  // the node is the root if one of the following is true:
224  // (1) the node has more than fanouts than the limit or has no fanouts (should not happen in general)
225  if ( Sfm_ObjFanoutNum(p, iNode) == 0 || Sfm_ObjFanoutNum(p, iNode) > p->pPars->nFanoutMax )
226  return 1;
227  // (2) the node has CO fanouts
228  // (3) the node has fanouts above the cutoff level
229  Sfm_ObjForEachFanout( p, iNode, iFanout, i )
230  if ( Sfm_ObjIsPo(p, iFanout) || Sfm_ObjLevel(p, iFanout) > nLevelMax )//|| !Sfm_NtkCheckOverlap(p, iFanout, iNode) )
231  return 1;
232  return 0;
233 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static int Sfm_ObjLevel(Sfm_Ntk_t *p, int iObj)
Definition: sfmInt.h:153
#define Sfm_ObjForEachFanout(p, Node, Fan, i)
Definition: sfmInt.h:173
static int Sfm_ObjIsPo(Sfm_Ntk_t *p, int i)
Definition: sfmInt.h:130
if(last==0)
Definition: sparse_int.h:34
static int Sfm_ObjFanoutNum(Sfm_Ntk_t *p, int i)
Definition: sfmInt.h:140
int Sfm_NtkCollectTfi_rec ( Sfm_Ntk_t p,
int  iNode,
Vec_Int_t vNodes 
)

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

Synopsis [Computes structural window.]

Description []

SideEffects []

SeeAlso []

Definition at line 322 of file sfmWin.c.

323 {
324  int i, iFanin;
325  if ( Sfm_ObjIsTravIdCurrent( p, iNode ) )
326  return 0;
327  Sfm_ObjSetTravIdCurrent( p, iNode );
328  Sfm_ObjForEachFanin( p, iNode, iFanin, i )
329  if ( Sfm_NtkCollectTfi_rec( p, iFanin, vNodes ) )
330  return 1;
331  Vec_IntPush( vNodes, iNode );
332  return p->pPars->nWinSizeMax && (Vec_IntSize(vNodes) > p->pPars->nWinSizeMax);
333 }
#define Sfm_ObjForEachFanin(p, Node, Fan, i)
Definition: sfmInt.h:172
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static int Sfm_ObjIsTravIdCurrent(Sfm_Ntk_t *p, int Id)
Definition: sfmWin.c:116
static void Sfm_ObjSetTravIdCurrent(Sfm_Ntk_t *p, int Id)
Definition: sfmWin.c:115
if(last==0)
Definition: sparse_int.h:34
static void Vec_IntPush(Vec_Int_t *p, int Entry)
Definition: bblif.c:468
static int Vec_IntSize(Vec_Int_t *p)
Definition: bblif.c:252
int Sfm_NtkCollectTfi_rec(Sfm_Ntk_t *p, int iNode, Vec_Int_t *vNodes)
Definition: sfmWin.c:322
void Sfm_NtkComputeRoots_rec ( Sfm_Ntk_t p,
int  iNode,
int  nLevelMax,
Vec_Int_t vRoots,
Vec_Int_t vTfo 
)

Definition at line 234 of file sfmWin.c.

235 {
236  int i, iFanout;
237  assert( Sfm_ObjIsNode(p, iNode) );
238  if ( Sfm_ObjIsTravIdCurrent(p, iNode) )
239  return;
240  Sfm_ObjSetTravIdCurrent(p, iNode);
241  if ( iNode != p->iPivotNode )
242  Vec_IntPush( vTfo, iNode );
243  // check if the node should be the root
244  if ( Sfm_NtkCheckRoot( p, iNode, nLevelMax ) )
245  Vec_IntPush( vRoots, iNode );
246  else // if not, explore its fanouts
247  Sfm_ObjForEachFanout( p, iNode, iFanout, i )
248  Sfm_NtkComputeRoots_rec( p, iFanout, nLevelMax, vRoots, vTfo );
249 }
void Sfm_NtkComputeRoots_rec(Sfm_Ntk_t *p, int iNode, int nLevelMax, Vec_Int_t *vRoots, Vec_Int_t *vTfo)
Definition: sfmWin.c:234
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static int Sfm_ObjIsTravIdCurrent(Sfm_Ntk_t *p, int Id)
Definition: sfmWin.c:116
static int Sfm_ObjIsNode(Sfm_Ntk_t *p, int i)
Definition: sfmInt.h:131
static void Sfm_ObjSetTravIdCurrent(Sfm_Ntk_t *p, int Id)
Definition: sfmWin.c:115
static int Sfm_NtkCheckRoot(Sfm_Ntk_t *p, int iNode, int nLevelMax)
Definition: sfmWin.c:220
#define Sfm_ObjForEachFanout(p, Node, Fan, i)
Definition: sfmInt.h:173
static void Vec_IntPush(Vec_Int_t *p, int Entry)
Definition: bblif.c:468
#define assert(ex)
Definition: util_old.h:213
int Sfm_NtkCreateWindow ( Sfm_Ntk_t p,
int  iNode,
int  fVerbose 
)

Definition at line 334 of file sfmWin.c.

335 {
336  int i, k, iTemp;
337  abctime clkDiv, clkWin = Abc_Clock();
338 
339  assert( Sfm_ObjIsNode( p, iNode ) );
340  p->iPivotNode = iNode;
341  Vec_IntClear( p->vNodes ); // internal
342  Vec_IntClear( p->vDivs ); // divisors
343  Vec_IntClear( p->vRoots ); // roots
344  Vec_IntClear( p->vTfo ); // roots
345  Vec_IntClear( p->vOrder ); // variable order
346 
347  // collect transitive fanin
349  if ( Sfm_NtkCollectTfi_rec( p, iNode, p->vNodes ) )
350  {
351  p->nMaxDivs++;
352  p->timeWin += Abc_Clock() - clkWin;
353  return 0;
354  }
355 
356  // create divisors
357  clkDiv = Abc_Clock();
358  Vec_IntClear( p->vDivs );
359  Vec_IntAppend( p->vDivs, p->vNodes );
360  Vec_IntPop( p->vDivs );
361  // add non-topological divisors
362  if ( Vec_IntSize(p->vDivs) < p->pPars->nWinSizeMax + 0 )
363  {
365  Vec_IntForEachEntry( p->vDivs, iTemp, i )
366  if ( Vec_IntSize(p->vDivs) < p->pPars->nWinSizeMax + 0 )
367 // Sfm_NtkAddDivisors( p, iTemp, Sfm_ObjLevel(p, iNode) - 1 );
368  Sfm_NtkAddDivisors( p, iTemp, p->nLevelMax - Sfm_ObjLevelR(p, iNode) );
369  }
370  if ( Vec_IntSize(p->vDivs) > p->pPars->nWinSizeMax )
371  {
372 /*
373  k = 0;
374  Vec_IntForEachEntryStart( p->vDivs, iTemp, i, Vec_IntSize(p->vDivs) - p->pPars->nWinSizeMax )
375  Vec_IntWriteEntry( p->vDivs, k++, iTemp );
376  assert( k == p->pPars->nWinSizeMax );
377 */
378  Vec_IntShrink( p->vDivs, p->pPars->nWinSizeMax );
379  }
380  assert( Vec_IntSize(p->vDivs) <= p->pPars->nWinSizeMax );
381  p->nMaxDivs += (int)(Vec_IntSize(p->vDivs) == p->pPars->nWinSizeMax);
382  // remove node/fanins from divisors
383  // mark fanins
385  Sfm_ObjSetTravIdCurrent2( p, iNode );
386  Sfm_ObjForEachFanin( p, iNode, iTemp, i )
387  Sfm_ObjSetTravIdCurrent2( p, iTemp );
388  // compact divisors
389  k = 0;
390  Vec_IntForEachEntry( p->vDivs, iTemp, i )
391  if ( !Sfm_ObjIsTravIdCurrent2(p, iTemp) && Sfm_ObjIsUseful(p, iTemp) )
392  Vec_IntWriteEntry( p->vDivs, k++, iTemp );
393  Vec_IntShrink( p->vDivs, k );
394  assert( Vec_IntSize(p->vDivs) <= p->pPars->nWinSizeMax );
395  clkDiv = Abc_Clock() - clkDiv;
396  p->timeDiv += clkDiv;
397  p->nTotalDivs += Vec_IntSize(p->vDivs);
398 
399  // collect TFO and window roots
400  if ( p->pPars->nTfoLevMax > 0 && !Sfm_NtkCheckRoot(p, iNode, Sfm_ObjLevel(p, iNode) + p->pPars->nTfoLevMax) )
401  {
402  // explore transitive fanout
404  Sfm_NtkComputeRoots_rec( p, iNode, Sfm_ObjLevel(p, iNode) + p->pPars->nTfoLevMax, p->vRoots, p->vTfo );
405  assert( Vec_IntSize(p->vRoots) > 0 );
406  assert( Vec_IntSize(p->vTfo) > 0 );
407  // compute new leaves and nodes
409  Vec_IntForEachEntry( p->vRoots, iTemp, i )
410  if ( Sfm_NtkCollectTfi_rec( p, iTemp, p->vOrder ) )
411  {
412  Vec_IntClear( p->vRoots );
413  Vec_IntClear( p->vTfo );
414  Vec_IntClear( p->vOrder );
415  break;
416  }
417  if ( Vec_IntSize(p->vRoots) > 0 )
418  Vec_IntForEachEntry( p->vTfo, iTemp, i )
419  if ( Sfm_NtkCollectTfi_rec( p, iTemp, p->vOrder ) )
420  {
421  Vec_IntClear( p->vRoots );
422  Vec_IntClear( p->vTfo );
423  Vec_IntClear( p->vOrder );
424  break;
425  }
426  if ( Vec_IntSize(p->vRoots) > 0 )
427  Vec_IntForEachEntry( p->vDivs, iTemp, i )
428  if ( Sfm_NtkCollectTfi_rec( p, iTemp, p->vOrder ) )
429  {
430  Vec_IntClear( p->vRoots );
431  Vec_IntClear( p->vTfo );
432  Vec_IntClear( p->vOrder );
433  break;
434  }
435  }
436 
437  if ( Vec_IntSize(p->vOrder) == 0 )
438  {
439  int Temp = p->pPars->nWinSizeMax;
440  p->pPars->nWinSizeMax = 0;
442  Sfm_NtkCollectTfi_rec( p, iNode, p->vOrder );
443  Vec_IntForEachEntry( p->vDivs, iTemp, i )
444  Sfm_NtkCollectTfi_rec( p, iTemp, p->vOrder );
445  p->pPars->nWinSizeMax = Temp;
446  }
447 
448  // statistics
449  p->timeWin += Abc_Clock() - clkWin - clkDiv;
450  if ( !fVerbose )
451  return 1;
452 
453  // print stats about the window
454  printf( "%6d : ", iNode );
455  printf( "Leaves = %5d. ", 0 );
456  printf( "Nodes = %5d. ", Vec_IntSize(p->vNodes) );
457  printf( "Roots = %5d. ", Vec_IntSize(p->vRoots) );
458  printf( "Divs = %5d. ", Vec_IntSize(p->vDivs) );
459  printf( "\n" );
460  return 1;
461 }
static int Sfm_ObjIsUseful(Sfm_Ntk_t *p, int iNode)
Definition: sfmWin.c:300
#define Sfm_ObjForEachFanin(p, Node, Fan, i)
Definition: sfmInt.h:172
void Sfm_NtkComputeRoots_rec(Sfm_Ntk_t *p, int iNode, int nLevelMax, Vec_Int_t *vRoots, Vec_Int_t *vTfo)
Definition: sfmWin.c:234
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static int Sfm_ObjIsTravIdCurrent2(Sfm_Ntk_t *p, int Id)
Definition: sfmWin.c:121
Vec_Ptr_t * vRoots
Definition: llb3Image.c:51
void Sfm_NtkAddDivisors(Sfm_Ntk_t *p, int iNode, int nLevelMax)
Definition: sfmWin.c:262
static abctime Abc_Clock()
Definition: abc_global.h:279
static int Sfm_ObjIsNode(Sfm_Ntk_t *p, int i)
Definition: sfmInt.h:131
static void Sfm_NtkIncrementTravId2(Sfm_Ntk_t *p)
Definition: sfmWin.c:119
static int Sfm_ObjLevel(Sfm_Ntk_t *p, int iObj)
Definition: sfmInt.h:153
static int Sfm_NtkCheckRoot(Sfm_Ntk_t *p, int iNode, int nLevelMax)
Definition: sfmWin.c:220
static void Vec_IntWriteEntry(Vec_Int_t *p, int i, int Entry)
Definition: bblif.c:285
if(last==0)
Definition: sparse_int.h:34
static int Vec_IntPop(Vec_Int_t *p)
static void Vec_IntAppend(Vec_Int_t *vVec1, Vec_Int_t *vVec2)
static void Sfm_NtkIncrementTravId(Sfm_Ntk_t *p)
Definition: sfmWin.c:114
static int Sfm_ObjLevelR(Sfm_Ntk_t *p, int iObj)
Definition: sfmInt.h:156
static int Vec_IntSize(Vec_Int_t *p)
Definition: bblif.c:252
static void Vec_IntShrink(Vec_Int_t *p, int nSizeNew)
Definition: bblif.c:435
#define assert(ex)
Definition: util_old.h:213
static void Vec_IntClear(Vec_Int_t *p)
Definition: bblif.c:452
ABC_INT64_T abctime
Definition: abc_global.h:278
#define Vec_IntForEachEntry(vVec, Entry, i)
MACRO DEFINITIONS ///.
Definition: vecInt.h:54
int Sfm_NtkCollectTfi_rec(Sfm_Ntk_t *p, int iNode, Vec_Int_t *vNodes)
Definition: sfmWin.c:322
static void Sfm_ObjSetTravIdCurrent2(Sfm_Ntk_t *p, int Id)
Definition: sfmWin.c:120
Vec_Int_t* Sfm_NtkDfs ( Sfm_Ntk_t p,
Vec_Wec_t vGroups,
Vec_Int_t vGroupMap,
Vec_Int_t vBoxesLeft 
)

Definition at line 166 of file sfmWin.c.

167 {
168  Vec_Int_t * vNodes;
169  int i;
170  Vec_IntClear( vBoxesLeft );
171  vNodes = Vec_IntAlloc( p->nObjs );
173  Sfm_NtkForEachPo( p, i )
174  Sfm_NtkDfs_rec( p, Sfm_ObjFanin(p, i, 0), vNodes, vGroups, vGroupMap, vBoxesLeft );
175  return vNodes;
176 }
void Sfm_NtkDfs_rec(Sfm_Ntk_t *p, int iNode, Vec_Int_t *vNodes, Vec_Wec_t *vGroups, Vec_Int_t *vGroupMap, Vec_Int_t *vBoxesLeft)
Definition: sfmWin.c:136
static Llb_Mgr_t * p
Definition: llb3Image.c:950
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition: bblif.c:37
#define Sfm_NtkForEachPo(p, i)
Definition: sfmInt.h:169
static int Sfm_ObjFanin(Sfm_Ntk_t *p, int i, int k)
Definition: sfmInt.h:145
static Vec_Int_t * Vec_IntAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: bblif.c:149
static void Sfm_NtkIncrementTravId(Sfm_Ntk_t *p)
Definition: sfmWin.c:114
static void Vec_IntClear(Vec_Int_t *p)
Definition: bblif.c:452
void Sfm_NtkDfs_rec ( Sfm_Ntk_t p,
int  iNode,
Vec_Int_t vNodes,
Vec_Wec_t vGroups,
Vec_Int_t vGroupMap,
Vec_Int_t vBoxesLeft 
)

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

Synopsis [Collects used internal nodes in a topological order.]

Description [Additionally considers objects in groups as a single object and collects them in a topological order together as single entity.]

SideEffects []

SeeAlso []

Definition at line 136 of file sfmWin.c.

137 {
138  int i, iFanin;
139  if ( Sfm_ObjIsPi(p, iNode) )
140  return;
141  if ( Sfm_ObjIsTravIdCurrent(p, iNode) )
142  return;
143  if ( Vec_IntEntry(vGroupMap, iNode) >= 0 )
144  {
145  int k, iGroup = Abc_Lit2Var( Vec_IntEntry(vGroupMap, iNode) );
146  Vec_Int_t * vGroup = Vec_WecEntry( vGroups, iGroup );
147  Vec_IntForEachEntry( vGroup, iNode, i )
148  assert( Sfm_ObjIsNode(p, iNode) );
149  Vec_IntForEachEntry( vGroup, iNode, i )
150  Sfm_ObjSetTravIdCurrent( p, iNode );
151  Vec_IntForEachEntry( vGroup, iNode, i )
152  Sfm_ObjForEachFanin( p, iNode, iFanin, k )
153  Sfm_NtkDfs_rec( p, iFanin, vNodes, vGroups, vGroupMap, vBoxesLeft );
154  Vec_IntForEachEntry( vGroup, iNode, i )
155  Vec_IntPush( vNodes, iNode );
156  Vec_IntPush( vBoxesLeft, iGroup );
157  }
158  else
159  {
160  Sfm_ObjSetTravIdCurrent(p, iNode);
161  Sfm_ObjForEachFanin( p, iNode, iFanin, i )
162  Sfm_NtkDfs_rec( p, iFanin, vNodes, vGroups, vGroupMap, vBoxesLeft );
163  Vec_IntPush( vNodes, iNode );
164  }
165 }
#define Sfm_ObjForEachFanin(p, Node, Fan, i)
Definition: sfmInt.h:172
void Sfm_NtkDfs_rec(Sfm_Ntk_t *p, int iNode, Vec_Int_t *vNodes, Vec_Wec_t *vGroups, Vec_Int_t *vGroupMap, Vec_Int_t *vBoxesLeft)
Definition: sfmWin.c:136
static Llb_Mgr_t * p
Definition: llb3Image.c:950
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition: bblif.c:37
static int Sfm_ObjIsTravIdCurrent(Sfm_Ntk_t *p, int Id)
Definition: sfmWin.c:116
static int Sfm_ObjIsNode(Sfm_Ntk_t *p, int i)
Definition: sfmInt.h:131
static void Sfm_ObjSetTravIdCurrent(Sfm_Ntk_t *p, int Id)
Definition: sfmWin.c:115
static int Sfm_ObjIsPi(Sfm_Ntk_t *p, int i)
Definition: sfmInt.h:129
static int Vec_IntEntry(Vec_Int_t *p, int i)
Definition: bblif.c:268
else
Definition: sparse_int.h:55
static void Vec_IntPush(Vec_Int_t *p, int Entry)
Definition: bblif.c:468
static Vec_Int_t * Vec_WecEntry(Vec_Wec_t *p, int i)
Definition: vecWec.h:142
static int Abc_Lit2Var(int Lit)
Definition: abc_global.h:264
#define assert(ex)
Definition: util_old.h:213
#define Vec_IntForEachEntry(vVec, Entry, i)
MACRO DEFINITIONS ///.
Definition: vecInt.h:54
static void Sfm_NtkIncrementTravId ( Sfm_Ntk_t p)
inlinestatic

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

Synopsis [Working with traversal IDs.]

Description []

SideEffects []

SeeAlso []

Definition at line 114 of file sfmWin.c.

114 { p->nTravIds++; }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static void Sfm_NtkIncrementTravId2 ( Sfm_Ntk_t p)
inlinestatic

Definition at line 119 of file sfmWin.c.

119 { p->nTravIds2++; }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
void Sfm_NtkWindowTest ( Sfm_Ntk_t p,
int  iNode 
)

Definition at line 462 of file sfmWin.c.

463 {
464  int i;
465  Sfm_NtkForEachNode( p, i )
466  Sfm_NtkCreateWindow( p, i, 1 );
467 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
int Sfm_NtkCreateWindow(Sfm_Ntk_t *p, int iNode, int fVerbose)
Definition: sfmWin.c:334
#define Sfm_NtkForEachNode(p, i)
Definition: sfmInt.h:170
int Sfm_ObjDeref ( Sfm_Ntk_t p,
int  iObj 
)

Definition at line 82 of file sfmWin.c.

83 {
84  int i, iFanin, Count = 1;
85  Sfm_ObjForEachFanin( p, iObj, iFanin, i )
86  Count += Sfm_ObjDeref_rec( p, iFanin );
87  return Count;
88 }
#define Sfm_ObjForEachFanin(p, Node, Fan, i)
Definition: sfmInt.h:172
static Llb_Mgr_t * p
Definition: llb3Image.c:950
int Sfm_ObjDeref_rec(Sfm_Ntk_t *p, int iObj)
Definition: sfmWin.c:67
int Sfm_ObjDeref_rec ( Sfm_Ntk_t p,
int  iObj 
)

Definition at line 67 of file sfmWin.c.

68 {
69  int i, iFanin, Value, Count;
70  if ( Sfm_ObjIsPi(p, iObj) )
71  return 0;
72  assert( Sfm_ObjIsNode(p, iObj) );
73  Value = Sfm_ObjRefDecrement(p, iObj);
74  if ( Value > 0 )
75  return 0;
76  assert( Value == 0 );
77  Count = 1;
78  Sfm_ObjForEachFanin( p, iObj, iFanin, i )
79  Count += Sfm_ObjDeref_rec( p, iFanin );
80  return Count;
81 }
#define Sfm_ObjForEachFanin(p, Node, Fan, i)
Definition: sfmInt.h:172
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static int Sfm_ObjIsNode(Sfm_Ntk_t *p, int i)
Definition: sfmInt.h:131
static int Sfm_ObjIsPi(Sfm_Ntk_t *p, int i)
Definition: sfmInt.h:129
int Sfm_ObjDeref_rec(Sfm_Ntk_t *p, int iObj)
Definition: sfmWin.c:67
static int Sfm_ObjRefDecrement(Sfm_Ntk_t *p, int iObj)
Definition: sfmInt.h:143
#define assert(ex)
Definition: util_old.h:213
static int Sfm_ObjIsTravIdCurrent ( Sfm_Ntk_t p,
int  Id 
)
inlinestatic

Definition at line 116 of file sfmWin.c.

116 { return (Vec_IntEntry(&p->vTravIds, Id) == p->nTravIds); }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static int Vec_IntEntry(Vec_Int_t *p, int i)
Definition: bblif.c:268
static int Sfm_ObjIsTravIdCurrent2 ( Sfm_Ntk_t p,
int  Id 
)
inlinestatic

Definition at line 121 of file sfmWin.c.

121 { return (Vec_IntEntry(&p->vTravIds2, Id) == p->nTravIds2); }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static int Vec_IntEntry(Vec_Int_t *p, int i)
Definition: bblif.c:268
static int Sfm_ObjIsTravIdPrevious ( Sfm_Ntk_t p,
int  Id 
)
inlinestatic

Definition at line 117 of file sfmWin.c.

117 { return (Vec_IntEntry(&p->vTravIds, Id) == p->nTravIds-1); }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static int Vec_IntEntry(Vec_Int_t *p, int i)
Definition: bblif.c:268
static int Sfm_ObjIsUseful ( Sfm_Ntk_t p,
int  iNode 
)
inlinestatic

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

Synopsis [Fixed object is useful when it has a non-fixed fanout.]

Description []

SideEffects []

SeeAlso []

Definition at line 300 of file sfmWin.c.

301 {
302  int i, iFanout;
303  if ( !Sfm_ObjIsFixed(p, iNode) )
304  return 1;
305  Sfm_ObjForEachFanout( p, iNode, iFanout, i )
306  if ( !Sfm_ObjIsFixed(p, iFanout) )
307  return 1;
308  return 0;
309 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
#define Sfm_ObjForEachFanout(p, Node, Fan, i)
Definition: sfmInt.h:173
if(last==0)
Definition: sparse_int.h:34
static int Sfm_ObjIsFixed(Sfm_Ntk_t *p, int i)
Definition: sfmInt.h:132
int Sfm_ObjMffcSize ( Sfm_Ntk_t p,
int  iObj 
)

Definition at line 89 of file sfmWin.c.

90 {
91  int Count1, Count2;
92  if ( Sfm_ObjIsPi(p, iObj) )
93  return 0;
94  if ( Sfm_ObjFanoutNum(p, iObj) != 1 )
95  return 0;
96  assert( Sfm_ObjIsNode( p, iObj ) );
97  Count1 = Sfm_ObjDeref( p, iObj );
98  Count2 = Sfm_ObjRef( p, iObj );
99  assert( Count1 == Count2 );
100  return Count1;
101 }
int Sfm_ObjDeref(Sfm_Ntk_t *p, int iObj)
Definition: sfmWin.c:82
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static int Sfm_ObjIsNode(Sfm_Ntk_t *p, int i)
Definition: sfmInt.h:131
static int Sfm_ObjIsPi(Sfm_Ntk_t *p, int i)
Definition: sfmInt.h:129
int Sfm_ObjRef(Sfm_Ntk_t *p, int iObj)
Definition: sfmWin.c:60
static int Sfm_ObjFanoutNum(Sfm_Ntk_t *p, int i)
Definition: sfmInt.h:140
#define assert(ex)
Definition: util_old.h:213
int Sfm_ObjRef ( Sfm_Ntk_t p,
int  iObj 
)

Definition at line 60 of file sfmWin.c.

61 {
62  int i, iFanin, Count = 1;
63  Sfm_ObjForEachFanin( p, iObj, iFanin, i )
64  Count += Sfm_ObjRef_rec( p, iFanin );
65  return Count;
66 }
#define Sfm_ObjForEachFanin(p, Node, Fan, i)
Definition: sfmInt.h:172
static Llb_Mgr_t * p
Definition: llb3Image.c:950
ABC_NAMESPACE_IMPL_START int Sfm_ObjRef_rec(Sfm_Ntk_t *p, int iObj)
DECLARATIONS ///.
Definition: sfmWin.c:45
ABC_NAMESPACE_IMPL_START int Sfm_ObjRef_rec ( Sfm_Ntk_t p,
int  iObj 
)

DECLARATIONS ///.

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

FileName [sfmWin.c]

SystemName [ABC: Logic synthesis and verification system.]

PackageName [SAT-based optimization using internal don't-cares.]

Synopsis [Structural window computation.]

Author [Alan Mishchenko]

Affiliation [UC Berkeley]

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

Revision [

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

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

Synopsis [Returns the MFFC size.]

Description []

SideEffects []

SeeAlso []

Definition at line 45 of file sfmWin.c.

46 {
47  int i, iFanin, Value, Count;
48  if ( Sfm_ObjIsPi(p, iObj) )
49  return 0;
50  assert( Sfm_ObjIsNode(p, iObj) );
51  Value = Sfm_ObjRefIncrement(p, iObj);
52  if ( Value > 1 )
53  return 0;
54  assert( Value == 1 );
55  Count = 1;
56  Sfm_ObjForEachFanin( p, iObj, iFanin, i )
57  Count += Sfm_ObjRef_rec( p, iFanin );
58  return Count;
59 }
#define Sfm_ObjForEachFanin(p, Node, Fan, i)
Definition: sfmInt.h:172
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static int Sfm_ObjIsNode(Sfm_Ntk_t *p, int i)
Definition: sfmInt.h:131
ABC_NAMESPACE_IMPL_START int Sfm_ObjRef_rec(Sfm_Ntk_t *p, int iObj)
DECLARATIONS ///.
Definition: sfmWin.c:45
static int Sfm_ObjIsPi(Sfm_Ntk_t *p, int i)
Definition: sfmInt.h:129
#define assert(ex)
Definition: util_old.h:213
static int Sfm_ObjRefIncrement(Sfm_Ntk_t *p, int iObj)
Definition: sfmInt.h:142
static void Sfm_ObjSetTravIdCurrent ( Sfm_Ntk_t p,
int  Id 
)
inlinestatic

Definition at line 115 of file sfmWin.c.

115 { Vec_IntWriteEntry( &p->vTravIds, Id, p->nTravIds ); }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static void Vec_IntWriteEntry(Vec_Int_t *p, int i, int Entry)
Definition: bblif.c:285
static void Sfm_ObjSetTravIdCurrent2 ( Sfm_Ntk_t p,
int  Id 
)
inlinestatic

Definition at line 120 of file sfmWin.c.

120 { Vec_IntWriteEntry( &p->vTravIds2, Id, p->nTravIds2 ); }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static void Vec_IntWriteEntry(Vec_Int_t *p, int i, int Entry)
Definition: bblif.c:285