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

Go to the source code of this file.

Functions

static ABC_NAMESPACE_IMPL_START int Gia_ObjDom (Gia_Man_t *p, Gia_Obj_t *pObj)
 DECLARATIONS ///. More...
 
static void Gia_ObjSetDom (Gia_Man_t *p, Gia_Obj_t *pObj, int d)
 
static int Abs_ManSupport2 (Gia_Man_t *p, Gia_Obj_t *pObj, Vec_Int_t *vSupp)
 
static int Abs_GiaObjDeref_rec (Gia_Man_t *p, Gia_Obj_t *pNode)
 
static int Abs_GiaObjRef_rec (Gia_Man_t *p, Gia_Obj_t *pNode)
 
void Gia_ManAddDom (Gia_Man_t *p, Gia_Obj_t *pObj, int iDom0)
 FUNCTION DEFINITIONS ///. More...
 
void Gia_ManComputeDoms (Gia_Man_t *p)
 
void Gia_ManTestDoms2 (Gia_Man_t *p)
 
Vec_Int_tGia_ManCollectDoms (Gia_Man_t *p)
 
Vec_Int_tGia_ManComputePiDoms (Gia_Man_t *p)
 
void Gia_ManTestDoms (Gia_Man_t *p)
 
void Gia_ManCountFanoutlessFlops (Gia_Man_t *p)
 
void Gia_ManCountPisNodes_rec (Gia_Man_t *p, Gia_Obj_t *pObj, Vec_Int_t *vPis, Vec_Int_t *vAnds)
 
void Gia_ManCountPisNodes (Gia_Man_t *p, Vec_Int_t *vPis, Vec_Int_t *vAnds)
 
int Abs_GiaSortNodes (Gia_Man_t *p, Vec_Int_t *vSupp)
 
void Abs_ManSupport1_rec (Gia_Man_t *p, Gia_Obj_t *pObj, Vec_Int_t *vSupp)
 
int Abs_ManSupport1 (Gia_Man_t *p, Gia_Obj_t *pObj, Vec_Int_t *vSupp)
 
void Abs_ManSupport2_rec (Gia_Man_t *p, Gia_Obj_t *pObj, Vec_Int_t *vSupp)
 
int Abs_ManSupport3 (Gia_Man_t *p, Gia_Obj_t *pObj, Vec_Int_t *vSupp)
 
int Abs_GiaCofPrint (word *pTruth, int nSize, int nSize0, int Res)
 
int Abs_GiaCheckTruth (word *pTruth, int nSize, int nSize0)
 
void Abs_RpmPerformMark (Gia_Man_t *p, int nCutMax, int fVerbose, int fVeryVerbose)
 
Gia_Man_tGia_ManDupRpm (Gia_Man_t *p)
 
Gia_Man_tAbs_RpmPerform (Gia_Man_t *p, int nCutMax, int fVerbose, int fVeryVerbose)
 

Function Documentation

int Abs_GiaCheckTruth ( word pTruth,
int  nSize,
int  nSize0 
)

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

Synopsis [Returns 1 if truth table has no const cofactors.]

Description [The cofactoring variables are the (nSize-nSize0) most significant vars. Each cofactor depends on nSize0 vars.]

SideEffects []

SeeAlso []

Definition at line 548 of file absRpm.c.

549 {
550  unsigned char * pStr = (unsigned char *)pTruth;
551  int nStr = (nSize >= 3 ? (1 << (nSize - 3)) : 1);
552  int i, k, nSteps;
553  assert( nSize0 > 0 && nSize0 <= nSize );
554  if ( nSize0 == 1 )
555  {
556  for ( i = 0; i < nStr; i++ )
557  if ( (((unsigned)pStr[i] ^ ((unsigned)pStr[i] >> 1)) & 0x55) != 0x55 )
558  return 0;
559  return 1;
560  }
561  if ( nSize0 == 2 )
562  {
563  for ( i = 0; i < nStr; i++ )
564  if ( ((unsigned)pStr[i] & 0xF) == 0x0 || (((unsigned)pStr[i] >> 4) & 0xF) == 0x0 ||
565  ((unsigned)pStr[i] & 0xF) == 0xF || (((unsigned)pStr[i] >> 4) & 0xF) == 0xF )
566  return 0;
567  return 1;
568  }
569  assert( nSize0 >= 3 );
570  nSteps = (1 << (nSize0 - 3));
571  for ( i = 0; i < nStr; i += nSteps )
572  {
573  for ( k = 0; k < nSteps; k++ )
574  if ( ((unsigned)pStr[i+k] & 0xFF) != 0x00 )
575  break;
576  if ( k == nSteps )
577  break;
578  for ( k = 0; k < nSteps; k++ )
579  if ( ((unsigned)pStr[i+k] & 0xFF) != 0xFF )
580  break;
581  if ( k == nSteps )
582  break;
583  }
584  assert( i <= nStr );
585  return (int)( i == nStr );
586 }
#define assert(ex)
Definition: util_old.h:213
int Abs_GiaCofPrint ( word pTruth,
int  nSize,
int  nSize0,
int  Res 
)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 513 of file absRpm.c.

514 {
515  int i, Bit;
516  int nBits = (1 << nSize);
517  int nStep = (1 << nSize0);
518  int Mark[2] = {1,1};
519  for ( i = 0; i < nBits; i++ )
520  {
521  if ( i % nStep == 0 )
522  {
523  printf( " " );
524  assert( Res || (Mark[0] && Mark[1]) );
525  Mark[0] = Mark[1] = 0;
526  }
527  Bit = Abc_InfoHasBit((unsigned *)pTruth, i);
528  Mark[Bit] = 1;
529  printf( "%d", Bit );
530  }
531  printf( "\n" );
532  assert( Res || (Mark[0] && Mark[1]) );
533  return 1;
534 }
static int Abc_InfoHasBit(unsigned *p, int i)
Definition: abc_global.h:258
#define assert(ex)
Definition: util_old.h:213
int Abs_GiaObjDeref_rec ( Gia_Man_t p,
Gia_Obj_t pNode 
)
static

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 300 of file absRpm.c.

301 {
302  Gia_Obj_t * pFanin;
303  int Counter = 0;
304  if ( pNode->fMark1 || Gia_ObjIsRo(p, pNode) )
305  return 0;
306  assert( Gia_ObjIsAnd(pNode) );
307  pFanin = Gia_ObjFanin0(pNode);
308  assert( Gia_ObjRefNum(p, pFanin) > 0 );
309  if ( Gia_ObjRefDec(p, pFanin) == 0 )
310  Counter += Abs_GiaObjDeref_rec( p, pFanin );
311  pFanin = Gia_ObjFanin1(pNode);
312  assert( Gia_ObjRefNum(p, pFanin) > 0 );
313  if ( Gia_ObjRefDec(p, pFanin) == 0 )
314  Counter += Abs_GiaObjDeref_rec( p, pFanin );
315  return Counter + 1;
316 }
static int Abs_GiaObjDeref_rec(Gia_Man_t *p, Gia_Obj_t *pNode)
Definition: absRpm.c:300
static int Gia_ObjRefNum(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:521
unsigned fMark1
Definition: gia.h:84
Definition: gia.h:75
static Gia_Obj_t * Gia_ObjFanin0(Gia_Obj_t *pObj)
Definition: gia.h:454
static int Gia_ObjIsRo(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:443
static int Counter
static int Gia_ObjRefDec(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:523
static int Gia_ObjIsAnd(Gia_Obj_t *pObj)
Definition: gia.h:422
static Gia_Obj_t * Gia_ObjFanin1(Gia_Obj_t *pObj)
Definition: gia.h:455
#define assert(ex)
Definition: util_old.h:213
int Abs_GiaObjRef_rec ( Gia_Man_t p,
Gia_Obj_t pNode 
)
static

Definition at line 317 of file absRpm.c.

318 {
319  Gia_Obj_t * pFanin;
320  int Counter = 0;
321  if ( pNode->fMark1 || Gia_ObjIsRo(p, pNode) )
322  return 0;
323  assert( Gia_ObjIsAnd(pNode) );
324  pFanin = Gia_ObjFanin0(pNode);
325  if ( Gia_ObjRefInc(p, pFanin) == 0 )
326  Counter += Abs_GiaObjRef_rec( p, pFanin );
327  pFanin = Gia_ObjFanin1(pNode);
328  if ( Gia_ObjRefInc(p, pFanin) == 0 )
329  Counter += Abs_GiaObjRef_rec( p, pFanin );
330  return Counter + 1;
331 }
static int Abs_GiaObjRef_rec(Gia_Man_t *p, Gia_Obj_t *pNode)
Definition: absRpm.c:317
unsigned fMark1
Definition: gia.h:84
Definition: gia.h:75
static Gia_Obj_t * Gia_ObjFanin0(Gia_Obj_t *pObj)
Definition: gia.h:454
static int Gia_ObjIsRo(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:443
static int Gia_ObjRefInc(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:522
static int Counter
static int Gia_ObjIsAnd(Gia_Obj_t *pObj)
Definition: gia.h:422
static Gia_Obj_t * Gia_ObjFanin1(Gia_Obj_t *pObj)
Definition: gia.h:455
#define assert(ex)
Definition: util_old.h:213
int Abs_GiaSortNodes ( Gia_Man_t p,
Vec_Int_t vSupp 
)

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

Synopsis [Returns the number of nodes with zero refs.]

Description []

SideEffects []

SeeAlso []

Definition at line 344 of file absRpm.c.

345 {
346  Gia_Obj_t * pObj;
347  int nSize = Vec_IntSize(vSupp);
348  int i, RetValue;
349  Gia_ManForEachObjVec( vSupp, p, pObj, i )
350  if ( i < nSize && Gia_ObjRefNum(p, pObj) == 0 && !Gia_ObjIsRo(p, pObj) ) // add removable leaves
351  {
352  assert( pObj->fMark1 );
353  Vec_IntPush( vSupp, Gia_ObjId(p, pObj) );
354  }
355  RetValue = Vec_IntSize(vSupp) - nSize;
356  Gia_ManForEachObjVec( vSupp, p, pObj, i )
357  if ( i < nSize && !(Gia_ObjRefNum(p, pObj) == 0 && !Gia_ObjIsRo(p, pObj)) ) // add non-removable leaves
358  Vec_IntPush( vSupp, Gia_ObjId(p, pObj) );
359  assert( Vec_IntSize(vSupp) == 2 * nSize );
360  memmove( Vec_IntArray(vSupp), Vec_IntArray(vSupp) + nSize, sizeof(int) * nSize );
361  Vec_IntShrink( vSupp, nSize );
362  return RetValue;
363 }
static int * Vec_IntArray(Vec_Int_t *p)
Definition: vecInt.h:328
static int Gia_ObjRefNum(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:521
Definition: gia.h:75
char * memmove()
static int Gia_ObjIsRo(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:443
if(last==0)
Definition: sparse_int.h:34
static void Vec_IntPush(Vec_Int_t *p, int Entry)
Definition: bblif.c:468
static int Gia_ObjId(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:410
#define Gia_ManForEachObjVec(vVec, p, pObj, i)
Definition: gia.h:988
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
int Abs_ManSupport1 ( Gia_Man_t p,
Gia_Obj_t pObj,
Vec_Int_t vSupp 
)

Definition at line 391 of file absRpm.c.

392 {
393  assert( Gia_ObjIsAnd(pObj) );
394  Vec_IntClear( vSupp );
396  Abs_ManSupport1_rec( p, pObj, vSupp );
397  return Vec_IntSize(vSupp);
398 }
void Abs_ManSupport1_rec(Gia_Man_t *p, Gia_Obj_t *pObj, Vec_Int_t *vSupp)
Definition: absRpm.c:377
static int Vec_IntSize(Vec_Int_t *p)
Definition: bblif.c:252
static int Gia_ObjIsAnd(Gia_Obj_t *pObj)
Definition: gia.h:422
#define assert(ex)
Definition: util_old.h:213
void Gia_ManIncrementTravId(Gia_Man_t *p)
Definition: giaUtil.c:149
static void Vec_IntClear(Vec_Int_t *p)
Definition: bblif.c:452
void Abs_ManSupport1_rec ( Gia_Man_t p,
Gia_Obj_t pObj,
Vec_Int_t vSupp 
)

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

Synopsis [Computes support in terms of PIs and flops.]

Description []

SideEffects []

SeeAlso []

Definition at line 377 of file absRpm.c.

378 {
379  if ( Gia_ObjIsTravIdCurrent(p, pObj) )
380  return;
381  Gia_ObjSetTravIdCurrent(p, pObj);
382  if ( pObj->fMark1 || Gia_ObjIsRo(p, pObj) )
383  {
384  Vec_IntPush( vSupp, Gia_ObjId(p, pObj) );
385  return;
386  }
387  assert( Gia_ObjIsAnd(pObj) );
388  Abs_ManSupport1_rec( p, Gia_ObjFanin0(pObj), vSupp );
389  Abs_ManSupport1_rec( p, Gia_ObjFanin1(pObj), vSupp );
390 }
static int Gia_ObjIsTravIdCurrent(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:533
void Abs_ManSupport1_rec(Gia_Man_t *p, Gia_Obj_t *pObj, Vec_Int_t *vSupp)
Definition: absRpm.c:377
unsigned fMark1
Definition: gia.h:84
static Gia_Obj_t * Gia_ObjFanin0(Gia_Obj_t *pObj)
Definition: gia.h:454
static int Gia_ObjIsRo(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:443
static void Gia_ObjSetTravIdCurrent(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:531
static void Vec_IntPush(Vec_Int_t *p, int Entry)
Definition: bblif.c:468
static int Gia_ObjId(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:410
static int Gia_ObjIsAnd(Gia_Obj_t *pObj)
Definition: gia.h:422
static Gia_Obj_t * Gia_ObjFanin1(Gia_Obj_t *pObj)
Definition: gia.h:455
#define assert(ex)
Definition: util_old.h:213
int Abs_ManSupport2 ( Gia_Man_t p,
Gia_Obj_t pObj,
Vec_Int_t vSupp 
)
static

Definition at line 425 of file absRpm.c.

426 {
427  assert( Gia_ObjIsAnd(pObj) );
428  Vec_IntClear( vSupp );
430  Abs_ManSupport2_rec( p, Gia_ObjFanin0(pObj), vSupp );
431  Abs_ManSupport2_rec( p, Gia_ObjFanin1(pObj), vSupp );
432  Gia_ObjSetTravIdCurrent(p, pObj);
433  return Vec_IntSize(vSupp);
434 }
static Gia_Obj_t * Gia_ObjFanin0(Gia_Obj_t *pObj)
Definition: gia.h:454
static void Gia_ObjSetTravIdCurrent(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:531
static int Vec_IntSize(Vec_Int_t *p)
Definition: bblif.c:252
void Abs_ManSupport2_rec(Gia_Man_t *p, Gia_Obj_t *pObj, Vec_Int_t *vSupp)
Definition: absRpm.c:411
static int Gia_ObjIsAnd(Gia_Obj_t *pObj)
Definition: gia.h:422
static Gia_Obj_t * Gia_ObjFanin1(Gia_Obj_t *pObj)
Definition: gia.h:455
#define assert(ex)
Definition: util_old.h:213
void Gia_ManIncrementTravId(Gia_Man_t *p)
Definition: giaUtil.c:149
static void Vec_IntClear(Vec_Int_t *p)
Definition: bblif.c:452
void Abs_ManSupport2_rec ( Gia_Man_t p,
Gia_Obj_t pObj,
Vec_Int_t vSupp 
)

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

Synopsis [Computes support of the MFFC.]

Description [Should be called when pObj's cone is dereferenced.]

SideEffects []

SeeAlso []

Definition at line 411 of file absRpm.c.

412 {
413  if ( Gia_ObjIsTravIdCurrent(p, pObj) )
414  return;
415  Gia_ObjSetTravIdCurrent(p, pObj);
416  if ( pObj->fMark1 || Gia_ObjIsRo(p, pObj) || Gia_ObjRefNum(p, pObj) > 0 )
417  {
418  Vec_IntPush( vSupp, Gia_ObjId(p, pObj) );
419  return;
420  }
421  assert( Gia_ObjIsAnd(pObj) );
422  Abs_ManSupport2_rec( p, Gia_ObjFanin0(pObj), vSupp );
423  Abs_ManSupport2_rec( p, Gia_ObjFanin1(pObj), vSupp );
424 }
static int Gia_ObjIsTravIdCurrent(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:533
static int Gia_ObjRefNum(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:521
unsigned fMark1
Definition: gia.h:84
static Gia_Obj_t * Gia_ObjFanin0(Gia_Obj_t *pObj)
Definition: gia.h:454
static int Gia_ObjIsRo(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:443
static void Gia_ObjSetTravIdCurrent(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:531
static void Vec_IntPush(Vec_Int_t *p, int Entry)
Definition: bblif.c:468
static int Gia_ObjId(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:410
void Abs_ManSupport2_rec(Gia_Man_t *p, Gia_Obj_t *pObj, Vec_Int_t *vSupp)
Definition: absRpm.c:411
static int Gia_ObjIsAnd(Gia_Obj_t *pObj)
Definition: gia.h:422
static Gia_Obj_t * Gia_ObjFanin1(Gia_Obj_t *pObj)
Definition: gia.h:455
#define assert(ex)
Definition: util_old.h:213
int Abs_ManSupport3 ( Gia_Man_t p,
Gia_Obj_t pObj,
Vec_Int_t vSupp 
)

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

Synopsis [Computes support of the extended MFFC.]

Description []

SideEffects []

SeeAlso []

Definition at line 447 of file absRpm.c.

448 {
449  Gia_Obj_t * pTemp, * pFan0, * pFan1;
450  int i, nSize0;
451  // collect MFFC
452  Abs_ManSupport2( p, pObj, vSupp );
453  // move dominated to the front
454  nSize0 = Abs_GiaSortNodes( p, vSupp );
455  assert( nSize0 > 0 );
456  // consider remaining nodes
457  while ( 1 )
458  {
459  int fChanges = 0;
460  Gia_ManForEachObjVec( vSupp, p, pTemp, i )
461  {
462  if ( i < nSize0 )
463  continue;
464  if ( !Gia_ObjIsAnd(pTemp) )
465  continue;
466  assert( !pTemp->fMark1 );
467  assert( Gia_ObjRefNum(p, pTemp) > 0 );
468  pFan0 = Gia_ObjFanin0(pTemp);
469  pFan1 = Gia_ObjFanin1(pTemp);
470  if ( Gia_ObjIsTravIdCurrent(p, pFan0) && Gia_ObjIsTravIdCurrent(p, pFan1) )
471  {
472  Vec_IntRemove( vSupp, Gia_ObjId(p, pTemp) );
473  fChanges = 1;
474  break;
475  }
476  if ( Gia_ObjIsTravIdCurrent(p, pFan0) )
477  {
478  Vec_IntRemove( vSupp, Gia_ObjId(p, pTemp) );
479  Vec_IntPush( vSupp, Gia_ObjId(p, pFan1) );
480  assert( !Gia_ObjIsTravIdCurrent(p, pFan1) );
481  Gia_ObjSetTravIdCurrent(p, pFan1);
482  fChanges = 1;
483  break;
484  }
485  if ( Gia_ObjIsTravIdCurrent(p, pFan1) )
486  {
487  Vec_IntRemove( vSupp, Gia_ObjId(p, pTemp) );
488  Vec_IntPush( vSupp, Gia_ObjId(p, pFan0) );
489  assert( !Gia_ObjIsTravIdCurrent(p, pFan0) );
490  Gia_ObjSetTravIdCurrent(p, pFan0);
491  fChanges = 1;
492  break;
493  }
494  }
495  if ( !fChanges )
496  break;
497  }
498  return Vec_IntSize(vSupp);
499 }
static int Gia_ObjIsTravIdCurrent(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:533
static int Abs_ManSupport2(Gia_Man_t *p, Gia_Obj_t *pObj, Vec_Int_t *vSupp)
Definition: absRpm.c:425
static int Gia_ObjRefNum(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:521
unsigned fMark1
Definition: gia.h:84
Definition: gia.h:75
static Gia_Obj_t * Gia_ObjFanin0(Gia_Obj_t *pObj)
Definition: gia.h:454
static void Gia_ObjSetTravIdCurrent(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:531
static void Vec_IntPush(Vec_Int_t *p, int Entry)
Definition: bblif.c:468
static int Gia_ObjId(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:410
static int Vec_IntRemove(Vec_Int_t *p, int Entry)
Definition: vecInt.h:915
#define Gia_ManForEachObjVec(vVec, p, pObj, i)
Definition: gia.h:988
int Abs_GiaSortNodes(Gia_Man_t *p, Vec_Int_t *vSupp)
Definition: absRpm.c:344
static int Vec_IntSize(Vec_Int_t *p)
Definition: bblif.c:252
static int Gia_ObjIsAnd(Gia_Obj_t *pObj)
Definition: gia.h:422
static Gia_Obj_t * Gia_ObjFanin1(Gia_Obj_t *pObj)
Definition: gia.h:455
#define assert(ex)
Definition: util_old.h:213
Gia_Man_t* Abs_RpmPerform ( Gia_Man_t p,
int  nCutMax,
int  fVerbose,
int  fVeryVerbose 
)

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

Synopsis [Performs structural reparametrization.]

Description []

SideEffects []

SeeAlso []

Definition at line 772 of file absRpm.c.

773 {
774  Gia_Man_t * pNew;
775 // Gia_ManTestDoms( p );
776 // return NULL;
777  // perform structural analysis
778  Gia_ObjComputeTruthTableStart( p, nCutMax );
779  Abs_RpmPerformMark( p, nCutMax, fVerbose, fVeryVerbose );
781  // derive new AIG
782  pNew = Gia_ManDupRpm( p );
783  Gia_ManCleanMark1( p );
784  return pNew;
785 }
void Abs_RpmPerformMark(Gia_Man_t *p, int nCutMax, int fVerbose, int fVeryVerbose)
Definition: absRpm.c:599
void Gia_ObjComputeTruthTableStart(Gia_Man_t *p, int nVarsMax)
Definition: giaTruth.c:282
void Gia_ObjComputeTruthTableStop(Gia_Man_t *p)
Definition: giaTruth.c:293
void Gia_ManCleanMark1(Gia_Man_t *p)
Definition: giaUtil.c:272
Gia_Man_t * Gia_ManDupRpm(Gia_Man_t *p)
Definition: absRpm.c:724
Definition: gia.h:95
void Abs_RpmPerformMark ( Gia_Man_t p,
int  nCutMax,
int  fVerbose,
int  fVeryVerbose 
)

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

Synopsis [Returns 1 if truth table has const cofactors.]

Description []

SideEffects []

SeeAlso []

Definition at line 599 of file absRpm.c.

600 {
601  Vec_Int_t * vPis, * vAnds, * vDoms;
602  Vec_Int_t * vSupp, * vSupp1, * vSupp2;
603  Gia_Obj_t * pObj;
604  word * pTruth;
605  int Iter, i, nSize0, nNodes;
606  int fHasConst, fChanges = 1;
607  Gia_ManCreateRefs( p );
608  Gia_ManCleanMark1( p );
609  Gia_ManForEachPi( p, pObj, i )
610  pObj->fMark1 = 1;
611  vPis = Vec_IntAlloc( 100 );
612  vAnds = Vec_IntAlloc( 100 );
613  vSupp1 = Vec_IntAlloc( 100 );
614  vSupp2 = Vec_IntAlloc( 100 );
615  for ( Iter = 0; fChanges; Iter++ )
616  {
617  fChanges = 0;
618  vDoms = Gia_ManComputePiDoms( p );
619  // count the number of PIs and internal nodes
620  if ( fVerbose || fVeryVerbose )
621  {
622  Gia_ManCountPisNodes( p, vPis, vAnds );
623  printf( "Iter %3d : ", Iter );
624  printf( "PI = %5d (%6.2f %%) ", Vec_IntSize(vPis), 100.0 * Vec_IntSize(vPis) / Gia_ManPiNum(p) );
625  printf( "And = %6d (%6.2f %%) ", Vec_IntSize(vAnds), 100.0 * Vec_IntSize(vAnds) / Gia_ManAndNum(p) );
626  printf( "Dom = %5d (%6.2f %%) ", Vec_IntSize(vDoms), 100.0 * Vec_IntSize(vDoms) / Gia_ManAndNum(p) );
627  printf( "\n" );
628  }
629 // pObj = Gia_ObjFanin0( Gia_ManPo(p, 1) );
630  Gia_ManForEachObjVec( vDoms, p, pObj, i )
631  {
632  assert( !pObj->fMark1 );
633  assert( Gia_ObjRefNum( p, pObj ) > 0 );
634  // dereference root node
635  nNodes = Abs_GiaObjDeref_rec( p, pObj );
636 /*
637  // compute support of full cone
638  if ( Abs_ManSupport1(p, pObj, vSupp1) > nCutMax )
639 // if ( 1 )
640  {
641  // check support of MFFC
642  if ( Abs_ManSupport2(p, pObj, vSupp2) > nCutMax )
643 // if ( 1 )
644  {
645  Abs_GiaObjRef_rec( p, pObj );
646  continue;
647  }
648  vSupp = vSupp2;
649 // printf( "-" );
650  }
651  else
652  {
653  vSupp = vSupp1;
654 // printf( "+" );
655  }
656 */
657  if ( Abs_ManSupport2(p, pObj, vSupp2) > nCutMax )
658  {
659  Abs_GiaObjRef_rec( p, pObj );
660  continue;
661  }
662  vSupp = vSupp2;
663 
664  // order nodes by their ref counts
665  nSize0 = Abs_GiaSortNodes( p, vSupp );
666  assert( nSize0 > 0 && nSize0 <= nCutMax );
667  // check if truth table has const cofs
668  pTruth = Gia_ObjComputeTruthTableCut( p, pObj, vSupp );
669  if ( pTruth == NULL )
670  {
671  Abs_GiaObjRef_rec( p, pObj );
672  continue;
673  }
674  fHasConst = !Abs_GiaCheckTruth( pTruth, Vec_IntSize(vSupp), nSize0 );
675  if ( fVeryVerbose )
676  {
677  printf( "Nodes =%3d ", nNodes );
678  printf( "Size =%3d ", Vec_IntSize(vSupp) );
679  printf( "Size0 =%3d ", nSize0 );
680  printf( "%3s", fHasConst ? "yes" : "no" );
681  Abs_GiaCofPrint( pTruth, Vec_IntSize(vSupp), nSize0, fHasConst );
682  }
683  if ( fHasConst )
684  {
685  Abs_GiaObjRef_rec( p, pObj );
686  continue;
687  }
688  // pObj can be reparamed
689  pObj->fMark1 = 1;
690  fChanges = 1;
691  }
692  Vec_IntFree( vDoms );
693  }
694  // count the number of PIs and internal nodes
695  if ( fVeryVerbose )
696  {
697  Gia_ManCountPisNodes( p, vPis, vAnds );
698  printf( "Iter %3d : ", Iter );
699  printf( "PI = %5d (%6.2f %%) ", Vec_IntSize(vPis), 100.0 * Vec_IntSize(vPis) / Gia_ManPiNum(p) );
700  printf( "And = %6d (%6.2f %%) ", Vec_IntSize(vAnds), 100.0 * Vec_IntSize(vAnds) / Gia_ManAndNum(p) );
701 // printf( "Dom = %5d (%6.2f %%) ", Vec_IntSize(vDoms), 100.0 * Vec_IntSize(vDoms) / Gia_ManAndNum(p) );
702  printf( "\n" );
703  }
704  // cleanup
705  Vec_IntFree( vPis );
706  Vec_IntFree( vAnds );
707  Vec_IntFree( vSupp1 );
708  Vec_IntFree( vSupp2 );
709 // Gia_ManCleanMark1( p ); // this will erase markings
710  ABC_FREE( p->pRefs );
711 }
void Gia_ManCreateRefs(Gia_Man_t *p)
Definition: giaUtil.c:715
static int Abs_GiaObjDeref_rec(Gia_Man_t *p, Gia_Obj_t *pNode)
Definition: absRpm.c:300
void Gia_ManCountPisNodes(Gia_Man_t *p, Vec_Int_t *vPis, Vec_Int_t *vAnds)
Definition: absRpm.c:273
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition: bblif.c:37
word * Gia_ObjComputeTruthTableCut(Gia_Man_t *p, Gia_Obj_t *pObj, Vec_Int_t *vLeaves)
Definition: giaTruth.c:351
static int Abs_GiaObjRef_rec(Gia_Man_t *p, Gia_Obj_t *pNode)
Definition: absRpm.c:317
static int Abs_ManSupport2(Gia_Man_t *p, Gia_Obj_t *pObj, Vec_Int_t *vSupp)
Definition: absRpm.c:425
static int Gia_ObjRefNum(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:521
unsigned fMark1
Definition: gia.h:84
int Abs_GiaCheckTruth(word *pTruth, int nSize, int nSize0)
Definition: absRpm.c:548
for(p=first;p->value< newval;p=p->next)
int * pRefs
Definition: gia.h:114
Definition: gia.h:75
void Gia_ManCleanMark1(Gia_Man_t *p)
Definition: giaUtil.c:272
static int Gia_ManAndNum(Gia_Man_t *p)
Definition: gia.h:389
static Vec_Int_t * Vec_IntAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: bblif.c:149
int Abs_GiaCofPrint(word *pTruth, int nSize, int nSize0, int Res)
Definition: absRpm.c:513
unsigned __int64 word
DECLARATIONS ///.
Definition: kitPerm.c:36
Vec_Int_t * Gia_ManComputePiDoms(Gia_Man_t *p)
Definition: absRpm.c:195
#define Gia_ManForEachPi(p, pObj, i)
Definition: gia.h:1034
#define Gia_ManForEachObjVec(vVec, p, pObj, i)
Definition: gia.h:988
int Abs_GiaSortNodes(Gia_Man_t *p, Vec_Int_t *vSupp)
Definition: absRpm.c:344
static int Vec_IntSize(Vec_Int_t *p)
Definition: bblif.c:252
#define ABC_FREE(obj)
Definition: abc_global.h:232
#define assert(ex)
Definition: util_old.h:213
static void Vec_IntFree(Vec_Int_t *p)
Definition: bblif.c:235
static int Gia_ManPiNum(Gia_Man_t *p)
Definition: gia.h:385
void Gia_ManAddDom ( Gia_Man_t p,
Gia_Obj_t pObj,
int  iDom0 
)

FUNCTION DEFINITIONS ///.

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

Synopsis [Computes one-node dominators.]

Description [For each node, computes the closest one-node dominator, which can be the node itself if the node has no other dominators.]

SideEffects []

SeeAlso []

Definition at line 52 of file absRpm.c.

53 {
54  int iDom1, iDomNext;
55  if ( Gia_ObjDom(p, pObj) == -1 )
56  {
57  Gia_ObjSetDom( p, pObj, iDom0 );
58  return;
59  }
60  iDom1 = Gia_ObjDom( p, pObj );
61  while ( 1 )
62  {
63  if ( iDom0 > iDom1 )
64  {
65  iDomNext = Gia_ObjDom( p, Gia_ManObj(p, iDom1) );
66  if ( iDomNext == iDom1 )
67  break;
68  iDom1 = iDomNext;
69  continue;
70  }
71  if ( iDom1 > iDom0 )
72  {
73  iDomNext = Gia_ObjDom( p, Gia_ManObj(p, iDom0) );
74  if ( iDomNext == iDom0 )
75  break;
76  iDom0 = iDomNext;
77  continue;
78  }
79  assert( iDom0 == iDom1 );
80  Gia_ObjSetDom( p, pObj, iDom0 );
81  return;
82  }
83  Gia_ObjSetDom( p, pObj, Gia_ObjId(p, pObj) );
84 }
static void Gia_ObjSetDom(Gia_Man_t *p, Gia_Obj_t *pObj, int d)
Definition: absRpm.c:30
static Gia_Obj_t * Gia_ManObj(Gia_Man_t *p, int v)
Definition: gia.h:402
static ABC_NAMESPACE_IMPL_START int Gia_ObjDom(Gia_Man_t *p, Gia_Obj_t *pObj)
DECLARATIONS ///.
Definition: absRpm.c:29
static int Gia_ObjId(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:410
#define assert(ex)
Definition: util_old.h:213
Vec_Int_t* Gia_ManCollectDoms ( Gia_Man_t p)

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

Synopsis [Collect PI doms.]

Description [Assumes that some PIs and ANDs are marked with fMark1.]

SideEffects []

SeeAlso []

Definition at line 165 of file absRpm.c.

166 {
167  Vec_Int_t * vNodes;
168  Gia_Obj_t * pObj;
169  int Lev, LevMax = ABC_INFINITY;
170  int i, iDom, iDomNext;
171  vNodes = Vec_IntAlloc( 100 );
172  Gia_ManForEachObj( p, pObj, i )
173  {
174  if ( !pObj->fMark1 )
175  continue;
176  if ( p->pRefs && Gia_ObjRefNum(p, pObj) == 0 )
177  continue;
178  iDom = Gia_ObjDom(p, pObj);
179  if ( iDom == -1 )
180  continue;
181  if ( iDom == i )
182  continue;
183  for ( Lev = 0; Lev < LevMax && Gia_ObjIsAnd( Gia_ManObj(p, iDom) ); Lev++ )
184  {
185  Vec_IntPush( vNodes, iDom );
186  iDomNext = Gia_ObjDom( p, Gia_ManObj(p, iDom) );
187  if ( iDomNext == iDom )
188  break;
189  iDom = iDomNext;
190  }
191  }
192  Vec_IntUniqify( vNodes );
193  return vNodes;
194 }
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition: bblif.c:37
static int Gia_ObjRefNum(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:521
unsigned fMark1
Definition: gia.h:84
static Gia_Obj_t * Gia_ManObj(Gia_Man_t *p, int v)
Definition: gia.h:402
int * pRefs
Definition: gia.h:114
Definition: gia.h:75
static ABC_NAMESPACE_IMPL_START int Gia_ObjDom(Gia_Man_t *p, Gia_Obj_t *pObj)
DECLARATIONS ///.
Definition: absRpm.c:29
static Vec_Int_t * Vec_IntAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: bblif.c:149
static int Vec_IntUniqify(Vec_Int_t *p)
Definition: vecInt.h:1314
static void Vec_IntPush(Vec_Int_t *p, int Entry)
Definition: bblif.c:468
static int Gia_ObjIsAnd(Gia_Obj_t *pObj)
Definition: gia.h:422
#define Gia_ManForEachObj(p, pObj, i)
MACRO DEFINITIONS ///.
Definition: gia.h:984
#define ABC_INFINITY
MACRO DEFINITIONS ///.
Definition: abc_global.h:216
void Gia_ManComputeDoms ( Gia_Man_t p)

Definition at line 85 of file absRpm.c.

86 {
87  Gia_Obj_t * pObj;
88  int i;
89  if ( p->vDoms == NULL )
90  p->vDoms = Vec_IntAlloc( 0 );
91  Vec_IntFill( p->vDoms, Gia_ManObjNum(p), -1 );
92  Gia_ManForEachObjReverse( p, pObj, i )
93  {
94  if ( i == 0 || Gia_ObjIsCi(pObj) )
95  continue;
96  if ( pObj->fMark1 || (p->pRefs && Gia_ObjIsAnd(pObj) && Gia_ObjRefNum(p, pObj) == 0) )
97  continue;
98  if ( Gia_ObjIsCo(pObj) )
99  {
100  Gia_ObjSetDom( p, pObj, i );
101  Gia_ManAddDom( p, Gia_ObjFanin0(pObj), i );
102  continue;
103  }
104  assert( Gia_ObjIsAnd(pObj) );
105  Gia_ManAddDom( p, Gia_ObjFanin0(pObj), i );
106  Gia_ManAddDom( p, Gia_ObjFanin1(pObj), i );
107  }
108 }
static void Gia_ObjSetDom(Gia_Man_t *p, Gia_Obj_t *pObj, int d)
Definition: absRpm.c:30
static int Gia_ObjRefNum(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:521
#define Gia_ManForEachObjReverse(p, pObj, i)
Definition: gia.h:994
unsigned fMark1
Definition: gia.h:84
int * pRefs
Definition: gia.h:114
Definition: gia.h:75
static Gia_Obj_t * Gia_ObjFanin0(Gia_Obj_t *pObj)
Definition: gia.h:454
static Vec_Int_t * Vec_IntAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: bblif.c:149
Vec_Int_t * vDoms
Definition: gia.h:145
static void Vec_IntFill(Vec_Int_t *p, int nSize, int Fill)
Definition: bblif.c:356
static int Gia_ObjIsCo(Gia_Obj_t *pObj)
Definition: gia.h:421
static int Gia_ObjIsAnd(Gia_Obj_t *pObj)
Definition: gia.h:422
static Gia_Obj_t * Gia_ObjFanin1(Gia_Obj_t *pObj)
Definition: gia.h:455
void Gia_ManAddDom(Gia_Man_t *p, Gia_Obj_t *pObj, int iDom0)
FUNCTION DEFINITIONS ///.
Definition: absRpm.c:52
#define assert(ex)
Definition: util_old.h:213
static int Gia_ObjIsCi(Gia_Obj_t *pObj)
Definition: gia.h:420
static int Gia_ManObjNum(Gia_Man_t *p)
Definition: gia.h:388
Vec_Int_t* Gia_ManComputePiDoms ( Gia_Man_t p)

Definition at line 195 of file absRpm.c.

196 {
197  Vec_Int_t * vNodes;
198  Gia_ManComputeDoms( p );
199  vNodes = Gia_ManCollectDoms( p );
200 // Vec_IntPrint( vNodes );
201  return vNodes;
202 }
void Gia_ManComputeDoms(Gia_Man_t *p)
Definition: absRpm.c:85
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition: bblif.c:37
Vec_Int_t * Gia_ManCollectDoms(Gia_Man_t *p)
Definition: absRpm.c:165
void Gia_ManCountFanoutlessFlops ( Gia_Man_t p)

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

Synopsis [Counts flops without fanout.]

Description []

SideEffects []

SeeAlso []

Definition at line 234 of file absRpm.c.

235 {
236  Gia_Obj_t * pObj;
237  int i;
238  int Counter = 0;
239  Gia_ManCreateRefs( p );
240  Gia_ManForEachRo( p, pObj, i )
241  if ( Gia_ObjRefNum(p, pObj) == 0 )
242  Counter++;
243  printf( "Fanoutless flops = %d.\n", Counter );
244  ABC_FREE( p->pRefs );
245 }
void Gia_ManCreateRefs(Gia_Man_t *p)
Definition: giaUtil.c:715
static int Gia_ObjRefNum(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:521
Definition: gia.h:75
if(last==0)
Definition: sparse_int.h:34
static int Counter
#define ABC_FREE(obj)
Definition: abc_global.h:232
#define Gia_ManForEachRo(p, pObj, i)
Definition: gia.h:1038
void Gia_ManCountPisNodes ( Gia_Man_t p,
Vec_Int_t vPis,
Vec_Int_t vAnds 
)

Definition at line 273 of file absRpm.c.

274 {
275  Gia_Obj_t * pObj;
276  int i;
277  // mark const0 and flop output
280  Gia_ManForEachRo( p, pObj, i )
281  Gia_ObjSetTravIdCurrent( p, pObj );
282  // count PIs and internal nodes reachable from COs
283  Vec_IntClear( vPis );
284  Vec_IntClear( vAnds );
285  Gia_ManForEachCo( p, pObj, i )
286  Gia_ManCountPisNodes_rec( p, Gia_ObjFanin0(pObj), vPis, vAnds );
287 }
#define Gia_ManForEachCo(p, pObj, i)
Definition: gia.h:1022
void Gia_ManCountPisNodes_rec(Gia_Man_t *p, Gia_Obj_t *pObj, Vec_Int_t *vPis, Vec_Int_t *vAnds)
Definition: absRpm.c:258
Definition: gia.h:75
static Gia_Obj_t * Gia_ObjFanin0(Gia_Obj_t *pObj)
Definition: gia.h:454
static void Gia_ObjSetTravIdCurrent(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:531
static Gia_Obj_t * Gia_ManConst0(Gia_Man_t *p)
Definition: gia.h:400
#define Gia_ManForEachRo(p, pObj, i)
Definition: gia.h:1038
void Gia_ManIncrementTravId(Gia_Man_t *p)
Definition: giaUtil.c:149
static void Vec_IntClear(Vec_Int_t *p)
Definition: bblif.c:452
void Gia_ManCountPisNodes_rec ( Gia_Man_t p,
Gia_Obj_t pObj,
Vec_Int_t vPis,
Vec_Int_t vAnds 
)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 258 of file absRpm.c.

259 {
260  if ( Gia_ObjIsTravIdCurrent(p, pObj) )
261  return;
262  Gia_ObjSetTravIdCurrent(p, pObj);
263  if ( pObj->fMark1 )
264  {
265  Vec_IntPush( vPis, Gia_ObjId(p, pObj) );
266  return;
267  }
268  assert( Gia_ObjIsAnd(pObj) );
269  Gia_ManCountPisNodes_rec( p, Gia_ObjFanin0(pObj), vPis, vAnds );
270  Gia_ManCountPisNodes_rec( p, Gia_ObjFanin1(pObj), vPis, vAnds );
271  Vec_IntPush( vAnds, Gia_ObjId(p, pObj) );
272 }
static int Gia_ObjIsTravIdCurrent(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:533
unsigned fMark1
Definition: gia.h:84
void Gia_ManCountPisNodes_rec(Gia_Man_t *p, Gia_Obj_t *pObj, Vec_Int_t *vPis, Vec_Int_t *vAnds)
Definition: absRpm.c:258
static Gia_Obj_t * Gia_ObjFanin0(Gia_Obj_t *pObj)
Definition: gia.h:454
static void Gia_ObjSetTravIdCurrent(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:531
static void Vec_IntPush(Vec_Int_t *p, int Entry)
Definition: bblif.c:468
static int Gia_ObjId(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:410
static int Gia_ObjIsAnd(Gia_Obj_t *pObj)
Definition: gia.h:422
static Gia_Obj_t * Gia_ObjFanin1(Gia_Obj_t *pObj)
Definition: gia.h:455
#define assert(ex)
Definition: util_old.h:213
Gia_Man_t* Gia_ManDupRpm ( Gia_Man_t p)

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

Synopsis [Assumed that fMark1 marks the internal PIs.]

Description []

SideEffects []

SeeAlso []

Definition at line 724 of file absRpm.c.

725 {
726  Vec_Int_t * vPis, * vAnds;
727  Gia_Man_t * pNew;
728  Gia_Obj_t * pObj;
729  int i;
730  // derive PIs and internal nodes
731  vPis = Vec_IntAlloc( 100 );
732  vAnds = Vec_IntAlloc( 100 );
733  Gia_ManCountPisNodes( p, vPis, vAnds );
734 
735  // duplicate AIG
736  Gia_ManFillValue( p );
737  pNew = Gia_ManStart( Gia_ManObjNum(p) );
738  pNew->pName = Abc_UtilStrsav( p->pName );
739  pNew->pSpec = Abc_UtilStrsav( p->pSpec );
740  Gia_ManConst0(p)->Value = 0;
741  // create PIs
742  Gia_ManForEachObjVec( vPis, p, pObj, i )
743  pObj->Value = Gia_ManAppendCi(pNew);
744  // create flops
745  Gia_ManForEachRo( p, pObj, i )
746  pObj->Value = Gia_ManAppendCi( pNew );
747  // create internal nodes
748  Gia_ManForEachObjVec( vAnds, p, pObj, i )
749  pObj->Value = Gia_ManAppendAnd( pNew, Gia_ObjFanin0Copy(pObj), Gia_ObjFanin1Copy(pObj) );
750  // create COs
751  Gia_ManForEachCo( p, pObj, i )
752  Gia_ManAppendCo( pNew, Gia_ObjFanin0Copy(pObj) );
753  Gia_ManSetRegNum( pNew, Gia_ManRegNum(p) );
754 
755  // cleanup
756  Vec_IntFree( vPis );
757  Vec_IntFree( vAnds );
758  return pNew;
759 }
static int Gia_ManAppendAnd(Gia_Man_t *p, int iLit0, int iLit1)
Definition: gia.h:592
#define Gia_ManForEachCo(p, pObj, i)
Definition: gia.h:1022
void Gia_ManCountPisNodes(Gia_Man_t *p, Vec_Int_t *vPis, Vec_Int_t *vAnds)
Definition: absRpm.c:273
static int Gia_ManAppendCo(Gia_Man_t *p, int iLit0)
Definition: gia.h:703
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition: bblif.c:37
static int Gia_ManAppendCi(Gia_Man_t *p)
Definition: gia.h:583
void Gia_ManSetRegNum(Gia_Man_t *p, int nRegs)
Definition: giaMan.c:628
Definition: gia.h:75
char * pName
Definition: gia.h:97
static Vec_Int_t * Vec_IntAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: bblif.c:149
static int Gia_ObjFanin1Copy(Gia_Obj_t *pObj)
Definition: gia.h:482
char * pSpec
Definition: gia.h:98
Gia_Man_t * Gia_ManStart(int nObjsMax)
DECLARATIONS ///.
Definition: giaMan.c:52
void Gia_ManFillValue(Gia_Man_t *p)
Definition: giaUtil.c:328
static int Gia_ObjFanin0Copy(Gia_Obj_t *pObj)
Definition: gia.h:481
#define Gia_ManForEachObjVec(vVec, p, pObj, i)
Definition: gia.h:988
Definition: gia.h:95
static Gia_Obj_t * Gia_ManConst0(Gia_Man_t *p)
Definition: gia.h:400
#define Gia_ManForEachRo(p, pObj, i)
Definition: gia.h:1038
unsigned Value
Definition: gia.h:87
static void Vec_IntFree(Vec_Int_t *p)
Definition: bblif.c:235
char * Abc_UtilStrsav(char *s)
Definition: starter.c:47
static int Gia_ManObjNum(Gia_Man_t *p)
Definition: gia.h:388
static int Gia_ManRegNum(Gia_Man_t *p)
Definition: gia.h:387
void Gia_ManTestDoms ( Gia_Man_t p)

Definition at line 203 of file absRpm.c.

204 {
205  Vec_Int_t * vNodes;
206  Gia_Obj_t * pObj;
207  int i;
208  // mark PIs
209 // Gia_ManCreateRefs( p );
210  Gia_ManCleanMark1( p );
211  Gia_ManForEachPi( p, pObj, i )
212  pObj->fMark1 = 1;
213  // compute dominators
214  assert( p->vDoms == NULL );
215  vNodes = Gia_ManComputePiDoms( p );
216 // printf( "Nodes = %d. Doms = %d.\n", Gia_ManAndNum(p), Vec_IntSize(vNodes) );
217  Vec_IntFree( vNodes );
218  // unmark PIs
219  Gia_ManCleanMark1( p );
220 }
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition: bblif.c:37
Definition: gia.h:75
void Gia_ManCleanMark1(Gia_Man_t *p)
Definition: giaUtil.c:272
Vec_Int_t * Gia_ManComputePiDoms(Gia_Man_t *p)
Definition: absRpm.c:195
#define Gia_ManForEachPi(p, pObj, i)
Definition: gia.h:1034
#define assert(ex)
Definition: util_old.h:213
static void Vec_IntFree(Vec_Int_t *p)
Definition: bblif.c:235
void Gia_ManTestDoms2 ( Gia_Man_t p)

Definition at line 109 of file absRpm.c.

110 {
111  Vec_Int_t * vNodes;
112  Gia_Obj_t * pObj, * pDom;
113  abctime clk = Abc_Clock();
114  int i;
115  assert( p->vDoms == NULL );
116  Gia_ManComputeDoms( p );
117 /*
118  Gia_ManForEachPi( p, pObj, i )
119  if ( Gia_ObjId(p, pObj) != Gia_ObjDom(p, pObj) )
120  printf( "PI =%6d Id =%8d. Dom =%8d.\n", i, Gia_ObjId(p, pObj), Gia_ObjDom(p, pObj) );
121 */
122  Abc_PrintTime( 1, "Time", Abc_Clock() - clk );
123  // for each dominated PI, when if the PIs is in a leaf of the MFFC of the dominator
124  Gia_ManCleanMark1( p );
125  Gia_ManForEachPi( p, pObj, i )
126  pObj->fMark1 = 1;
127  vNodes = Vec_IntAlloc( 100 );
128  Gia_ManCreateRefs( p );
129  Gia_ManForEachPi( p, pObj, i )
130  {
131  if ( Gia_ObjId(p, pObj) == Gia_ObjDom(p, pObj) )
132  continue;
133 
134  pDom = Gia_ManObj(p, Gia_ObjDom(p, pObj));
135  if ( Gia_ObjIsCo(pDom) )
136  {
137  assert( Gia_ObjFanin0(pDom) == pObj );
138  continue;
139  }
140  assert( Gia_ObjIsAnd(pDom) );
141  Abs_GiaObjDeref_rec( p, pDom );
142  Abs_ManSupport2( p, pDom, vNodes );
143  Abs_GiaObjRef_rec( p, pDom );
144 
145  if ( Vec_IntFind(vNodes, Gia_ObjId(p, pObj)) == -1 )
146  printf( "FAILURE.\n" );
147 // else
148 // printf( "Success.\n" );
149  }
150  Vec_IntFree( vNodes );
151  Gia_ManCleanMark1( p );
152 }
void Gia_ManComputeDoms(Gia_Man_t *p)
Definition: absRpm.c:85
void Gia_ManCreateRefs(Gia_Man_t *p)
Definition: giaUtil.c:715
static int Abs_GiaObjDeref_rec(Gia_Man_t *p, Gia_Obj_t *pNode)
Definition: absRpm.c:300
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition: bblif.c:37
static int Abs_GiaObjRef_rec(Gia_Man_t *p, Gia_Obj_t *pNode)
Definition: absRpm.c:317
static int Vec_IntFind(Vec_Int_t *p, int Entry)
Definition: vecInt.h:895
static int Abs_ManSupport2(Gia_Man_t *p, Gia_Obj_t *pObj, Vec_Int_t *vSupp)
Definition: absRpm.c:425
static abctime Abc_Clock()
Definition: abc_global.h:279
static Gia_Obj_t * Gia_ManObj(Gia_Man_t *p, int v)
Definition: gia.h:402
Definition: gia.h:75
void Gia_ManCleanMark1(Gia_Man_t *p)
Definition: giaUtil.c:272
static ABC_NAMESPACE_IMPL_START int Gia_ObjDom(Gia_Man_t *p, Gia_Obj_t *pObj)
DECLARATIONS ///.
Definition: absRpm.c:29
static void Abc_PrintTime(int level, const char *pStr, abctime time)
Definition: abc_global.h:367
static Gia_Obj_t * Gia_ObjFanin0(Gia_Obj_t *pObj)
Definition: gia.h:454
static Vec_Int_t * Vec_IntAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: bblif.c:149
Vec_Int_t * vDoms
Definition: gia.h:145
static int Gia_ObjId(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:410
#define Gia_ManForEachPi(p, pObj, i)
Definition: gia.h:1034
static int Gia_ObjIsCo(Gia_Obj_t *pObj)
Definition: gia.h:421
static int Gia_ObjIsAnd(Gia_Obj_t *pObj)
Definition: gia.h:422
#define assert(ex)
Definition: util_old.h:213
static void Vec_IntFree(Vec_Int_t *p)
Definition: bblif.c:235
ABC_INT64_T abctime
Definition: abc_global.h:278
static ABC_NAMESPACE_IMPL_START int Gia_ObjDom ( Gia_Man_t p,
Gia_Obj_t pObj 
)
inlinestatic

DECLARATIONS ///.

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

FileName [absRpm.c]

SystemName [ABC: Logic synthesis and verification system.]

PackageName [Abstraction package.]

Synopsis [Structural reparameterization.]

Author [Alan Mishchenko]

Affiliation [UC Berkeley]

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

Revision [

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

]

Definition at line 29 of file absRpm.c.

29 { return Vec_IntEntry(p->vDoms, Gia_ObjId(p, pObj)); }
static int Vec_IntEntry(Vec_Int_t *p, int i)
Definition: bblif.c:268
Vec_Int_t * vDoms
Definition: gia.h:145
static int Gia_ObjId(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:410
static void Gia_ObjSetDom ( Gia_Man_t p,
Gia_Obj_t pObj,
int  d 
)
inlinestatic

Definition at line 30 of file absRpm.c.

30 { Vec_IntWriteEntry(p->vDoms, Gia_ObjId(p, pObj), d); }
static void Vec_IntWriteEntry(Vec_Int_t *p, int i, int Entry)
Definition: bblif.c:285
Vec_Int_t * vDoms
Definition: gia.h:145
static int Gia_ObjId(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:410