abc-master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
giaIso2.c File Reference
#include "gia.h"
#include "misc/vec/vecHsh.h"
#include "misc/vec/vecWec.h"

Go to the source code of this file.

Data Structures

struct  Gia_Iso2Man_t_
 

Macros

#define ISO_MASK   0xFF
 

Typedefs

typedef struct Gia_Iso2Man_t_ Gia_Iso2Man_t
 DECLARATIONS ///. More...
 

Functions

Vec_Int_tGia_Iso2ManCollectTies (Gia_Man_t *p)
 FUNCTION DEFINITIONS ///. More...
 
void Gia_Iso2ManPrepare (Gia_Man_t *p)
 
void Gia_Iso2ManPropagate (Gia_Man_t *p)
 
unsigned Gia_Iso2ManCone_rec (Gia_Man_t *p, int Id, int Level)
 
unsigned Gia_Iso2ManCone (Gia_Man_t *p, int Id, int Level)
 
void Gia_Iso2ManUpdate (Gia_Iso2Man_t *p, int Level)
 
Gia_Iso2Man_tGia_Iso2ManStart (Gia_Man_t *pGia)
 
void Gia_Iso2ManStop (Gia_Iso2Man_t *p)
 
void Gia_Iso2ManPrint (Gia_Iso2Man_t *p, abctime Time, int fVerbose)
 
int Gia_ObjCompareByValue2 (Gia_Obj_t **pp1, Gia_Obj_t **pp2)
 
int Gia_Iso2ManUniqify (Gia_Iso2Man_t *p)
 
Vec_Wec_tGia_Iso2ManDerivePoClasses (Gia_Man_t *pGia)
 
void Gia_Iso2ManCollectOrder2_rec (Gia_Man_t *p, int Id, Vec_Int_t *vVec)
 
Vec_Int_tGia_Iso2ManCollectOrder2 (Gia_Man_t *pGia, int *pPos, int nPos)
 
void Gia_Iso2ManCollectOrder_rec (Gia_Man_t *p, int Id, Vec_Int_t *vRoots, Vec_Int_t *vVec, Vec_Int_t *vMap)
 
void Gia_Iso2ManCollectOrder (Gia_Man_t *pGia, int *pPos, int nPos, Vec_Int_t *vRoots, Vec_Int_t *vVec, Vec_Int_t *vMap)
 
int Gia_Iso2ManCheckIsoPair (Gia_Man_t *p, Vec_Int_t *vVec0, Vec_Int_t *vVec1, Vec_Int_t *vMap0, Vec_Int_t *vMap1)
 
int Gia_Iso2ManCheckIsoClassOneSkip (Gia_Man_t *p, Vec_Int_t *vClass, Vec_Int_t *vRoots, Vec_Int_t *vVec0, Vec_Int_t *vVec1, Vec_Int_t *vMap0, Vec_Int_t *vMap1)
 
Vec_Wec_tGia_Iso2ManCheckIsoClassesSkip (Gia_Man_t *p, Vec_Wec_t *vEquivs)
 
void Gia_Iso2ManCheckIsoClassOne (Gia_Man_t *p, Vec_Int_t *vClass, Vec_Int_t *vRoots, Vec_Int_t *vVec0, Vec_Int_t *vVec1, Vec_Int_t *vMap0, Vec_Int_t *vMap1, Vec_Int_t *vNewClass)
 
Vec_Wec_tGia_Iso2ManCheckIsoClasses (Gia_Man_t *p, Vec_Wec_t *vEquivs)
 
Vec_Wec_tGia_Iso2ManPerform (Gia_Man_t *pGia, int fVerbose)
 
Gia_Man_tGia_ManIsoReduce2 (Gia_Man_t *pGia, Vec_Ptr_t **pvPosEquivs, Vec_Ptr_t **pvPiPerms, int fEstimate, int fBetterQual, int fDualOut, int fVerbose, int fVeryVerbose)
 

Variables

static int s_256Primes [ISO_MASK+1]
 
static int s_PrimeC = 49
 

Macro Definition Documentation

#define ISO_MASK   0xFF

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

FileName [gia.c]

SystemName [ABC: Logic synthesis and verification system.]

PackageName [Scalable AIG package.]

Synopsis []

Author [Alan Mishchenko]

Affiliation [UC Berkeley]

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

Revision [

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

]

Definition at line 29 of file giaIso2.c.

Typedef Documentation

typedef struct Gia_Iso2Man_t_ Gia_Iso2Man_t

DECLARATIONS ///.

Definition at line 73 of file giaIso2.c.

Function Documentation

Vec_Wec_t* Gia_Iso2ManCheckIsoClasses ( Gia_Man_t p,
Vec_Wec_t vEquivs 
)

Definition at line 628 of file giaIso2.c.

629 {
630  Vec_Wec_t * vEquivs2;
631  Vec_Int_t * vRoots = Vec_IntAlloc( 10000 );
632  Vec_Int_t * vVec0 = Vec_IntAlloc( 10000 );
633  Vec_Int_t * vVec1 = Vec_IntAlloc( 10000 );
634  Vec_Int_t * vMap0 = Vec_IntStart( Gia_ManObjNum(p) );
635  Vec_Int_t * vMap1 = Vec_IntStart( Gia_ManObjNum(p) );
636  Vec_Int_t * vClass, * vClass2, * vNewClass;
637  int i, Counter = 0;
638  vNewClass = Vec_IntAlloc( 100 );
639  vEquivs2 = Vec_WecAlloc( 2 * Vec_WecSize(vEquivs) );
640  Vec_WecForEachLevel( vEquivs, vClass, i )
641  {
642  if ( i % 50 == 0 )
643  printf( "Finished %8d outputs (out of %8d)...\r", Counter, Gia_ManPoNum(p) ), fflush(stdout);
644  // split this class
645  Gia_Iso2ManCheckIsoClassOne( p, vClass, vRoots, vVec0, vVec1, vMap0, vMap1, vNewClass );
646  Counter += Vec_IntSize(vClass);
647  // add remaining class
648  vClass2 = Vec_WecPushLevel( vEquivs2 );
649  *vClass2 = *vClass;
650  vClass->pArray = NULL;
651  vClass->nSize = vClass->nCap = 0;
652  // add new class
653  if ( Vec_IntSize(vNewClass) == 0 )
654  continue;
655  vClass = Vec_WecPushLevel( vEquivs );
656  Vec_IntAppend( vClass, vNewClass );
657  }
658  Vec_IntFree( vNewClass );
659  Vec_IntFree( vRoots );
660  Vec_IntFree( vVec0 );
661  Vec_IntFree( vVec1 );
662  Vec_IntFree( vMap0 );
663  Vec_IntFree( vMap1 );
664  return vEquivs2;
665 }
static Vec_Wec_t * Vec_WecAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: vecWec.h:87
typedefABC_NAMESPACE_HEADER_START struct Vec_Wec_t_ Vec_Wec_t
INCLUDES ///.
Definition: vecWec.h:42
static int Gia_ManPoNum(Gia_Man_t *p)
Definition: gia.h:386
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition: bblif.c:37
static Vec_Int_t * Vec_WecPushLevel(Vec_Wec_t *p)
Definition: vecWec.h:284
static int Vec_WecSize(Vec_Wec_t *p)
Definition: vecWec.h:193
static Vec_Int_t * Vec_IntStart(int nSize)
Definition: bblif.c:172
#define Vec_WecForEachLevel(vGlob, vVec, i)
MACRO DEFINITIONS ///.
Definition: vecWec.h:55
static Vec_Int_t * Vec_IntAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: bblif.c:149
static void Vec_IntAppend(Vec_Int_t *vVec1, Vec_Int_t *vVec2)
static int Counter
static int Vec_IntSize(Vec_Int_t *p)
Definition: bblif.c:252
void Gia_Iso2ManCheckIsoClassOne(Gia_Man_t *p, Vec_Int_t *vClass, Vec_Int_t *vRoots, Vec_Int_t *vVec0, Vec_Int_t *vVec1, Vec_Int_t *vMap0, Vec_Int_t *vMap1, Vec_Int_t *vNewClass)
Definition: giaIso2.c:609
static void Vec_IntFree(Vec_Int_t *p)
Definition: bblif.c:235
static int Gia_ManObjNum(Gia_Man_t *p)
Definition: gia.h:388
Vec_Wec_t* Gia_Iso2ManCheckIsoClassesSkip ( Gia_Man_t p,
Vec_Wec_t vEquivs 
)

Definition at line 569 of file giaIso2.c.

570 {
571  Vec_Wec_t * vEquivs2;
572  Vec_Int_t * vRoots = Vec_IntAlloc( 10000 );
573  Vec_Int_t * vVec0 = Vec_IntAlloc( 10000 );
574  Vec_Int_t * vVec1 = Vec_IntAlloc( 10000 );
575  Vec_Int_t * vMap0 = Vec_IntStart( Gia_ManObjNum(p) );
576  Vec_Int_t * vMap1 = Vec_IntStart( Gia_ManObjNum(p) );
577  Vec_Int_t * vClass, * vClass2;
578  int i, k, Entry, Counter = 0;
579  vEquivs2 = Vec_WecAlloc( 2 * Vec_WecSize(vEquivs) );
580  Vec_WecForEachLevel( vEquivs, vClass, i )
581  {
582  if ( i % 50 == 0 )
583  printf( "Finished %8d outputs (out of %8d)...\r", Counter, Gia_ManPoNum(p) ), fflush(stdout);
584  Counter += Vec_IntSize(vClass);
585  if ( Vec_IntSize(vClass) < 2 || Gia_Iso2ManCheckIsoClassOneSkip(p, vClass, vRoots, vVec0, vVec1, vMap0, vMap1) )
586  {
587  vClass2 = Vec_WecPushLevel( vEquivs2 );
588  *vClass2 = *vClass;
589  vClass->pArray = NULL;
590  vClass->nSize = vClass->nCap = 0;
591  }
592  else
593  {
594  Vec_IntForEachEntry( vClass, Entry, k )
595  {
596  vClass2 = Vec_WecPushLevel( vEquivs2 );
597  Vec_IntPush( vClass2, Entry );
598  }
599  }
600  }
601  Vec_IntFree( vRoots );
602  Vec_IntFree( vVec0 );
603  Vec_IntFree( vVec1 );
604  Vec_IntFree( vMap0 );
605  Vec_IntFree( vMap1 );
606  return vEquivs2;
607 }
static Vec_Wec_t * Vec_WecAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: vecWec.h:87
typedefABC_NAMESPACE_HEADER_START struct Vec_Wec_t_ Vec_Wec_t
INCLUDES ///.
Definition: vecWec.h:42
static int Gia_ManPoNum(Gia_Man_t *p)
Definition: gia.h:386
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition: bblif.c:37
static Vec_Int_t * Vec_WecPushLevel(Vec_Wec_t *p)
Definition: vecWec.h:284
static int Vec_WecSize(Vec_Wec_t *p)
Definition: vecWec.h:193
static Vec_Int_t * Vec_IntStart(int nSize)
Definition: bblif.c:172
#define Vec_WecForEachLevel(vGlob, vVec, i)
MACRO DEFINITIONS ///.
Definition: vecWec.h:55
static Vec_Int_t * Vec_IntAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: bblif.c:149
static void Vec_IntPush(Vec_Int_t *p, int Entry)
Definition: bblif.c:468
static int Counter
static int Vec_IntSize(Vec_Int_t *p)
Definition: bblif.c:252
int Gia_Iso2ManCheckIsoClassOneSkip(Gia_Man_t *p, Vec_Int_t *vClass, Vec_Int_t *vRoots, Vec_Int_t *vVec0, Vec_Int_t *vVec1, Vec_Int_t *vMap0, Vec_Int_t *vMap1)
Definition: giaIso2.c:553
static void Vec_IntFree(Vec_Int_t *p)
Definition: bblif.c:235
#define Vec_IntForEachEntry(vVec, Entry, i)
MACRO DEFINITIONS ///.
Definition: vecInt.h:54
static int Gia_ManObjNum(Gia_Man_t *p)
Definition: gia.h:388
void Gia_Iso2ManCheckIsoClassOne ( Gia_Man_t p,
Vec_Int_t vClass,
Vec_Int_t vRoots,
Vec_Int_t vVec0,
Vec_Int_t vVec1,
Vec_Int_t vMap0,
Vec_Int_t vMap1,
Vec_Int_t vNewClass 
)

Definition at line 609 of file giaIso2.c.

610 {
611  int i, k = 1, iPo;
612  Vec_IntClear( vNewClass );
613  if ( Vec_IntSize(vClass) <= 1 )
614  return;
615  assert( Vec_IntSize(vClass) > 1 );
616  iPo = Vec_IntEntry( vClass, 0 );
617  Gia_Iso2ManCollectOrder( p, &iPo, 1, vRoots, vVec0, vMap0 );
618  Vec_IntForEachEntryStart( vClass, iPo, i, 1 )
619  {
620  Gia_Iso2ManCollectOrder( p, &iPo, 1, vRoots, vVec1, vMap1 );
621  if ( Vec_IntSize(vVec0) == Vec_IntSize(vVec1) && Gia_Iso2ManCheckIsoPair(p, vVec0, vVec1, vMap0, vMap1) )
622  Vec_IntWriteEntry( vClass, k++, iPo );
623  else
624  Vec_IntPush( vNewClass, iPo );
625  }
626  Vec_IntShrink( vClass, k );
627 }
void Gia_Iso2ManCollectOrder(Gia_Man_t *pGia, int *pPos, int nPos, Vec_Int_t *vRoots, Vec_Int_t *vVec, Vec_Int_t *vMap)
Definition: giaIso2.c:466
static void Vec_IntWriteEntry(Vec_Int_t *p, int i, int Entry)
Definition: bblif.c:285
static int Vec_IntEntry(Vec_Int_t *p, int i)
Definition: bblif.c:268
static void Vec_IntPush(Vec_Int_t *p, int Entry)
Definition: bblif.c:468
#define Vec_IntForEachEntryStart(vVec, Entry, i, Start)
Definition: vecInt.h:56
int Gia_Iso2ManCheckIsoPair(Gia_Man_t *p, Vec_Int_t *vVec0, Vec_Int_t *vVec1, Vec_Int_t *vMap0, Vec_Int_t *vMap1)
Definition: giaIso2.c:489
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
int Gia_Iso2ManCheckIsoClassOneSkip ( Gia_Man_t p,
Vec_Int_t vClass,
Vec_Int_t vRoots,
Vec_Int_t vVec0,
Vec_Int_t vVec1,
Vec_Int_t vMap0,
Vec_Int_t vMap1 
)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 553 of file giaIso2.c.

554 {
555  int i, iPo;
556  assert( Vec_IntSize(vClass) > 1 );
557  iPo = Vec_IntEntry( vClass, 0 );
558  Gia_Iso2ManCollectOrder( p, &iPo, 1, vRoots, vVec0, vMap0 );
559  Vec_IntForEachEntryStart( vClass, iPo, i, 1 )
560  {
561  Gia_Iso2ManCollectOrder( p, &iPo, 1, vRoots, vVec1, vMap1 );
562  if ( Vec_IntSize(vVec0) != Vec_IntSize(vVec1) )
563  return 0;
564  if ( !Gia_Iso2ManCheckIsoPair( p, vVec0, vVec1, vMap0, vMap1 ) )
565  return 0;
566  }
567  return 1;
568 }
void Gia_Iso2ManCollectOrder(Gia_Man_t *pGia, int *pPos, int nPos, Vec_Int_t *vRoots, Vec_Int_t *vVec, Vec_Int_t *vMap)
Definition: giaIso2.c:466
static int Vec_IntEntry(Vec_Int_t *p, int i)
Definition: bblif.c:268
#define Vec_IntForEachEntryStart(vVec, Entry, i, Start)
Definition: vecInt.h:56
int Gia_Iso2ManCheckIsoPair(Gia_Man_t *p, Vec_Int_t *vVec0, Vec_Int_t *vVec1, Vec_Int_t *vMap0, Vec_Int_t *vMap1)
Definition: giaIso2.c:489
static int Vec_IntSize(Vec_Int_t *p)
Definition: bblif.c:252
#define assert(ex)
Definition: util_old.h:213
int Gia_Iso2ManCheckIsoPair ( Gia_Man_t p,
Vec_Int_t vVec0,
Vec_Int_t vVec1,
Vec_Int_t vMap0,
Vec_Int_t vMap1 
)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 489 of file giaIso2.c.

490 {
491  Gia_Obj_t * pObj0, * pObj1;
492  int k, iObj0, iObj1;
493  Vec_IntForEachEntryTwo( vVec0, vVec1, iObj0, iObj1, k )
494  {
495  if ( iObj0 == iObj1 )
496  continue;
497  pObj0 = Gia_ManObj(p, iObj0);
498  pObj1 = Gia_ManObj(p, iObj1);
499  if ( pObj0->Value != pObj1->Value )
500  return 0;
501  assert( pObj0->Value == pObj1->Value );
502  if ( !Gia_ObjIsAnd(pObj0) )
503  continue;
504  if ( Gia_ObjFanin0(pObj0)->Value <= Gia_ObjFanin1(pObj0)->Value )
505  {
506  if ( Gia_ObjFanin0(pObj1)->Value <= Gia_ObjFanin1(pObj1)->Value )
507  {
508  if ( Gia_ObjFaninC0(pObj0) != Gia_ObjFaninC0(pObj1) || Gia_ObjFaninC1(pObj0) != Gia_ObjFaninC1(pObj1) ||
509  Vec_IntEntry(vMap0, Gia_ObjFaninId0p(p, pObj0)) != Vec_IntEntry( vMap1, Gia_ObjFaninId0p(p, pObj1)) ||
510  Vec_IntEntry(vMap0, Gia_ObjFaninId1p(p, pObj0)) != Vec_IntEntry( vMap1, Gia_ObjFaninId1p(p, pObj1)) )
511  return 0;
512  }
513  else
514  {
515  if ( Gia_ObjFaninC0(pObj0) != Gia_ObjFaninC1(pObj1) || Gia_ObjFaninC1(pObj0) != Gia_ObjFaninC0(pObj1) ||
516  Vec_IntEntry(vMap0, Gia_ObjFaninId0p(p, pObj0)) != Vec_IntEntry( vMap1, Gia_ObjFaninId1p(p, pObj1)) ||
517  Vec_IntEntry(vMap0, Gia_ObjFaninId1p(p, pObj0)) != Vec_IntEntry( vMap1, Gia_ObjFaninId0p(p, pObj1)) )
518  return 0;
519  }
520  }
521  else
522  {
523  if ( Gia_ObjFanin0(pObj1)->Value <= Gia_ObjFanin1(pObj1)->Value )
524  {
525  if ( Gia_ObjFaninC1(pObj0) != Gia_ObjFaninC0(pObj1) || Gia_ObjFaninC0(pObj0) != Gia_ObjFaninC1(pObj1) ||
526  Vec_IntEntry(vMap0, Gia_ObjFaninId1p(p, pObj0)) != Vec_IntEntry( vMap1, Gia_ObjFaninId0p(p, pObj1)) ||
527  Vec_IntEntry(vMap0, Gia_ObjFaninId0p(p, pObj0)) != Vec_IntEntry( vMap1, Gia_ObjFaninId1p(p, pObj1)) )
528  return 0;
529  }
530  else
531  {
532  if ( Gia_ObjFaninC1(pObj0) != Gia_ObjFaninC1(pObj1) || Gia_ObjFaninC0(pObj0) != Gia_ObjFaninC0(pObj1) ||
533  Vec_IntEntry(vMap0, Gia_ObjFaninId1p(p, pObj0)) != Vec_IntEntry( vMap1, Gia_ObjFaninId1p(p, pObj1)) ||
534  Vec_IntEntry(vMap0, Gia_ObjFaninId0p(p, pObj0)) != Vec_IntEntry( vMap1, Gia_ObjFaninId0p(p, pObj1)) )
535  return 0;
536  }
537  }
538  }
539  return 1;
540 }
static int Gia_ObjFaninC1(Gia_Obj_t *pObj)
Definition: gia.h:452
static int Gia_ObjFaninId1p(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:464
static Gia_Obj_t * Gia_ManObj(Gia_Man_t *p, int v)
Definition: gia.h:402
Definition: gia.h:75
static Gia_Obj_t * Gia_ObjFanin0(Gia_Obj_t *pObj)
Definition: gia.h:454
static int Vec_IntEntry(Vec_Int_t *p, int i)
Definition: bblif.c:268
#define Vec_IntForEachEntryTwo(vVec1, vVec2, Entry1, Entry2, i)
Definition: vecInt.h:64
static int Gia_ObjIsAnd(Gia_Obj_t *pObj)
Definition: gia.h:422
static int Gia_ObjFaninId0p(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:463
static Gia_Obj_t * Gia_ObjFanin1(Gia_Obj_t *pObj)
Definition: gia.h:455
#define assert(ex)
Definition: util_old.h:213
unsigned Value
Definition: gia.h:87
static int Gia_ObjFaninC0(Gia_Obj_t *pObj)
Definition: gia.h:451
void Gia_Iso2ManCollectOrder ( Gia_Man_t pGia,
int *  pPos,
int  nPos,
Vec_Int_t vRoots,
Vec_Int_t vVec,
Vec_Int_t vMap 
)

Definition at line 466 of file giaIso2.c.

467 {
468  int i, iRoot;
469  Vec_IntClear( vRoots );
470  for ( i = 0; i < nPos; i++ )
471  Vec_IntPush( vRoots, Gia_ObjId(pGia, Gia_ManPo(pGia, pPos[i])) );
472  Vec_IntClear( vVec );
473  Gia_ManIncrementTravId( pGia );
474  Vec_IntForEachEntry( vRoots, iRoot, i )
475  Gia_Iso2ManCollectOrder_rec( pGia, iRoot, vRoots, vVec, vMap );
476 }
void Gia_Iso2ManCollectOrder_rec(Gia_Man_t *p, int Id, Vec_Int_t *vRoots, Vec_Int_t *vVec, Vec_Int_t *vMap)
Definition: giaIso2.c:433
static Gia_Obj_t * Gia_ManPo(Gia_Man_t *p, int v)
Definition: gia.h:406
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 Gia_ManIncrementTravId(Gia_Man_t *p)
Definition: giaUtil.c:149
static void Vec_IntClear(Vec_Int_t *p)
Definition: bblif.c:452
#define Vec_IntForEachEntry(vVec, Entry, i)
MACRO DEFINITIONS ///.
Definition: vecInt.h:54
Vec_Int_t* Gia_Iso2ManCollectOrder2 ( Gia_Man_t pGia,
int *  pPos,
int  nPos 
)

Definition at line 411 of file giaIso2.c.

412 {
413  Vec_Int_t * vVec;
414  int i;
415  vVec = Vec_IntAlloc( 1000 );
416  Gia_ManIncrementTravId( pGia );
417  for ( i = 0; i < nPos; i++ )
418  Gia_Iso2ManCollectOrder2_rec( pGia, Gia_ObjId(pGia, Gia_ManPo(pGia, pPos[i])), vVec );
419  return vVec;
420 }
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition: bblif.c:37
static Gia_Obj_t * Gia_ManPo(Gia_Man_t *p, int v)
Definition: gia.h:406
static Vec_Int_t * Vec_IntAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: bblif.c:149
static int Gia_ObjId(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:410
void Gia_Iso2ManCollectOrder2_rec(Gia_Man_t *p, int Id, Vec_Int_t *vVec)
Definition: giaIso2.c:381
void Gia_ManIncrementTravId(Gia_Man_t *p)
Definition: giaUtil.c:149
void Gia_Iso2ManCollectOrder2_rec ( Gia_Man_t p,
int  Id,
Vec_Int_t vVec 
)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 381 of file giaIso2.c.

382 {
383  Gia_Obj_t * pObj;
384  if ( Gia_ObjIsTravIdCurrentId(p, Id) )
385  return;
387  pObj = Gia_ManObj( p, Id );
388  if ( Gia_ObjIsAnd(pObj) )
389  {
390  if ( Gia_ObjFanin0(pObj)->Value <= Gia_ObjFanin1(pObj)->Value )
391  {
392  Gia_Iso2ManCollectOrder2_rec( p, Gia_ObjFaninId0(pObj, Id), vVec );
393  Gia_Iso2ManCollectOrder2_rec( p, Gia_ObjFaninId1(pObj, Id), vVec );
394  }
395  else
396  {
397  Gia_Iso2ManCollectOrder2_rec( p, Gia_ObjFaninId1(pObj, Id), vVec );
398  Gia_Iso2ManCollectOrder2_rec( p, Gia_ObjFaninId0(pObj, Id), vVec );
399  }
400  }
401  else if ( Gia_ObjIsCo(pObj) )
402  {
403  Gia_Iso2ManCollectOrder2_rec( p, Gia_ObjFaninId0(pObj, Id), vVec );
404  }
405  else if ( Gia_ObjIsPi(p, pObj) )
406  {
407  }
408  else assert( Gia_ObjIsConst0(pObj) );
409  Vec_IntPush( vVec, Id );
410 }
static int Gia_ObjIsConst0(Gia_Obj_t *pObj)
Definition: gia.h:430
static Gia_Obj_t * Gia_ManObj(Gia_Man_t *p, int v)
Definition: gia.h:402
Definition: gia.h:75
static Gia_Obj_t * Gia_ObjFanin0(Gia_Obj_t *pObj)
Definition: gia.h:454
static void Vec_IntPush(Vec_Int_t *p, int Entry)
Definition: bblif.c:468
void Gia_Iso2ManCollectOrder2_rec(Gia_Man_t *p, int Id, Vec_Int_t *vVec)
Definition: giaIso2.c:381
static int Gia_ObjIsTravIdCurrentId(Gia_Man_t *p, int Id)
Definition: gia.h:536
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
#define assert(ex)
Definition: util_old.h:213
static void Gia_ObjSetTravIdCurrentId(Gia_Man_t *p, int Id)
Definition: gia.h:535
static int Gia_ObjFaninId1(Gia_Obj_t *pObj, int ObjId)
Definition: gia.h:461
static int Gia_ObjFaninId0(Gia_Obj_t *pObj, int ObjId)
Definition: gia.h:460
static int Gia_ObjIsPi(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:441
void Gia_Iso2ManCollectOrder_rec ( Gia_Man_t p,
int  Id,
Vec_Int_t vRoots,
Vec_Int_t vVec,
Vec_Int_t vMap 
)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 433 of file giaIso2.c.

434 {
435  Gia_Obj_t * pObj;
436  if ( Gia_ObjIsTravIdCurrentId(p, Id) )
437  return;
439  pObj = Gia_ManObj( p, Id );
440  if ( Gia_ObjIsAnd(pObj) )
441  {
442  if ( Gia_ObjFanin0(pObj)->Value <= Gia_ObjFanin1(pObj)->Value )
443  {
444  Gia_Iso2ManCollectOrder_rec( p, Gia_ObjFaninId0(pObj, Id), vRoots, vVec, vMap );
445  Gia_Iso2ManCollectOrder_rec( p, Gia_ObjFaninId1(pObj, Id), vRoots, vVec, vMap );
446  }
447  else
448  {
449  Gia_Iso2ManCollectOrder_rec( p, Gia_ObjFaninId1(pObj, Id), vRoots, vVec, vMap );
450  Gia_Iso2ManCollectOrder_rec( p, Gia_ObjFaninId0(pObj, Id), vRoots, vVec, vMap );
451  }
452  }
453  else if ( Gia_ObjIsCo(pObj) )
454  {
455  Gia_Iso2ManCollectOrder_rec( p, Gia_ObjFaninId0(pObj, Id), vRoots, vVec, vMap );
456  }
457  else if ( Gia_ObjIsCi(pObj) )
458  {
459  if ( Gia_ObjIsRo(p, pObj) )
460  Vec_IntPush( vRoots, Gia_ObjId(p, Gia_ObjRoToRi(p, pObj)) );
461  }
462  else assert( Gia_ObjIsConst0(pObj) );
463  Vec_IntWriteEntry( vMap, Id, Vec_IntSize(vVec) );
464  Vec_IntPush( vVec, Id );
465 }
void Gia_Iso2ManCollectOrder_rec(Gia_Man_t *p, int Id, Vec_Int_t *vRoots, Vec_Int_t *vVec, Vec_Int_t *vMap)
Definition: giaIso2.c:433
static int Gia_ObjIsConst0(Gia_Obj_t *pObj)
Definition: gia.h:430
static Gia_Obj_t * Gia_ManObj(Gia_Man_t *p, int v)
Definition: gia.h:402
Definition: gia.h:75
static void Vec_IntWriteEntry(Vec_Int_t *p, int i, int Entry)
Definition: bblif.c:285
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 Gia_Obj_t * Gia_ObjRoToRi(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:446
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_ObjIsTravIdCurrentId(Gia_Man_t *p, int Id)
Definition: gia.h:536
static int Gia_ObjIsCo(Gia_Obj_t *pObj)
Definition: gia.h:421
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
static int Gia_ObjIsCi(Gia_Obj_t *pObj)
Definition: gia.h:420
static void Gia_ObjSetTravIdCurrentId(Gia_Man_t *p, int Id)
Definition: gia.h:535
static int Gia_ObjFaninId1(Gia_Obj_t *pObj, int ObjId)
Definition: gia.h:461
static int Gia_ObjFaninId0(Gia_Obj_t *pObj, int ObjId)
Definition: gia.h:460
Vec_Int_t* Gia_Iso2ManCollectTies ( Gia_Man_t p)

FUNCTION DEFINITIONS ///.

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 115 of file giaIso2.c.

116 {
117  Vec_Int_t * vTies;
118  Gia_Obj_t * pObj;
119  int i;
120  vTies = Vec_IntAlloc( Gia_ManCandNum(p) );
121  Gia_ManForEachCand( p, pObj, i )
122  Vec_IntPush( vTies, i );
123  return vTies;
124 }
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition: bblif.c:37
Definition: gia.h:75
static Vec_Int_t * Vec_IntAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: bblif.c:149
static void Vec_IntPush(Vec_Int_t *p, int Entry)
Definition: bblif.c:468
static int Gia_ManCandNum(Gia_Man_t *p)
Definition: gia.h:394
#define Gia_ManForEachCand(p, pObj, i)
Definition: gia.h:1008
unsigned Gia_Iso2ManCone ( Gia_Man_t p,
int  Id,
int  Level 
)

Definition at line 190 of file giaIso2.c.

191 {
193  return Gia_Iso2ManCone_rec( p, Id, Level );
194 }
unsigned Gia_Iso2ManCone_rec(Gia_Man_t *p, int Id, int Level)
Definition: giaIso2.c:172
void Gia_ManIncrementTravId(Gia_Man_t *p)
Definition: giaUtil.c:149
unsigned Gia_Iso2ManCone_rec ( Gia_Man_t p,
int  Id,
int  Level 
)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 172 of file giaIso2.c.

173 {
174  Gia_Obj_t * pObj;
175  if ( Level == 0 )
176  return 0;
177  if ( Gia_ObjIsTravIdCurrentId(p, Id) )
178  return 0;
180  pObj = Gia_ManObj( p, Id );
181  if ( Gia_ObjIsAnd(pObj) )
182  return pObj->Value + Gia_Iso2ManCone_rec( p, Gia_ObjFaninId0(pObj, Id), Level-1 ) + Gia_Iso2ManCone_rec( p, Gia_ObjFaninId1(pObj, Id), Level-1 );
183  if ( Gia_ObjIsPi(p, pObj) )
184  return pObj->Value;
185  if ( Gia_ObjIsRo(p, pObj) )
186  return pObj->Value + Gia_Iso2ManCone_rec( p, Gia_ObjId(p, Gia_ObjFanin0(Gia_ObjRoToRi(p, pObj))), Level );
187  assert( Gia_ObjIsConst0(pObj) );
188  return pObj->Value;
189 }
unsigned Gia_Iso2ManCone_rec(Gia_Man_t *p, int Id, int Level)
Definition: giaIso2.c:172
static int Gia_ObjIsConst0(Gia_Obj_t *pObj)
Definition: gia.h:430
static Gia_Obj_t * Gia_ManObj(Gia_Man_t *p, int v)
Definition: gia.h:402
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 Gia_Obj_t * Gia_ObjRoToRi(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:446
static int Gia_ObjId(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:410
static int Gia_ObjIsTravIdCurrentId(Gia_Man_t *p, int Id)
Definition: gia.h:536
static int Gia_ObjIsAnd(Gia_Obj_t *pObj)
Definition: gia.h:422
#define assert(ex)
Definition: util_old.h:213
unsigned Value
Definition: gia.h:87
static void Gia_ObjSetTravIdCurrentId(Gia_Man_t *p, int Id)
Definition: gia.h:535
static int Gia_ObjFaninId1(Gia_Obj_t *pObj, int ObjId)
Definition: gia.h:461
static int Gia_ObjFaninId0(Gia_Obj_t *pObj, int ObjId)
Definition: gia.h:460
static int Gia_ObjIsPi(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:441
Vec_Wec_t* Gia_Iso2ManDerivePoClasses ( Gia_Man_t pGia)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 353 of file giaIso2.c.

354 {
355  Vec_Wec_t * vEquivs;
356  Vec_Int_t * vValues;
357  Vec_Int_t * vMap;
358  Gia_Obj_t * pObj;
359  int i;
360  vValues = Vec_IntAlloc( Gia_ManPoNum(pGia) );
361  Gia_ManForEachPo( pGia, pObj, i )
362  Vec_IntPush( vValues, pObj->Value );
363  vMap = Hsh_IntManHashArray( vValues, 1 );
364  Vec_IntFree( vValues );
365  vEquivs = Vec_WecCreateClasses( vMap );
366  Vec_IntFree( vMap );
367  return vEquivs;
368 }
typedefABC_NAMESPACE_HEADER_START struct Vec_Wec_t_ Vec_Wec_t
INCLUDES ///.
Definition: vecWec.h:42
static int Gia_ManPoNum(Gia_Man_t *p)
Definition: gia.h:386
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition: bblif.c:37
static Vec_Int_t * Hsh_IntManHashArray(Vec_Int_t *vData, int nSize)
Definition: vecHsh.h:191
Definition: gia.h:75
static Vec_Int_t * Vec_IntAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: bblif.c:149
static void Vec_IntPush(Vec_Int_t *p, int Entry)
Definition: bblif.c:468
static void Vec_IntFree(Vec_Int_t *p)
Definition: bblif.c:235
#define Gia_ManForEachPo(p, pObj, i)
Definition: gia.h:1036
static Vec_Wec_t * Vec_WecCreateClasses(Vec_Int_t *vMap)
Definition: vecWec.h:549
Vec_Wec_t* Gia_Iso2ManPerform ( Gia_Man_t pGia,
int  fVerbose 
)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 680 of file giaIso2.c.

681 {
682  Gia_Iso2Man_t * p;
683  abctime clk = Abc_Clock();
684  p = Gia_Iso2ManStart( pGia );
685  Gia_Iso2ManPrepare( pGia );
686  Gia_Iso2ManPropagate( pGia );
687  Gia_Iso2ManPrint( p, Abc_Clock() - clk, fVerbose );
688  while ( Gia_Iso2ManUniqify( p ) )
689  {
690  Gia_Iso2ManPrint( p, Abc_Clock() - clk, fVerbose );
691  Gia_Iso2ManPropagate( pGia );
692  }
693  Gia_Iso2ManPrint( p, Abc_Clock() - clk, fVerbose );
694 /*
695  Gia_Iso2ManUpdate( p, 20 );
696  while ( Gia_Iso2ManUniqify( p ) )
697  {
698  Gia_Iso2ManPrint( p, Abc_Clock() - clk, fVerbose );
699  Gia_Iso2ManPropagate( pGia );
700  }
701  Gia_Iso2ManPrint( p, Abc_Clock() - clk, fVerbose );
702 */
703  Gia_Iso2ManStop( p );
704  return Gia_Iso2ManDerivePoClasses( pGia );
705 }
void Gia_Iso2ManPrint(Gia_Iso2Man_t *p, abctime Time, int fVerbose)
Definition: giaIso2.c:248
void Gia_Iso2ManPrepare(Gia_Man_t *p)
Definition: giaIso2.c:125
static Llb_Mgr_t * p
Definition: llb3Image.c:950
int Gia_Iso2ManUniqify(Gia_Iso2Man_t *p)
Definition: giaIso2.c:276
Gia_Iso2Man_t * Gia_Iso2ManStart(Gia_Man_t *pGia)
Definition: giaIso2.c:214
static abctime Abc_Clock()
Definition: abc_global.h:279
Vec_Wec_t * Gia_Iso2ManDerivePoClasses(Gia_Man_t *pGia)
Definition: giaIso2.c:353
void Gia_Iso2ManPropagate(Gia_Man_t *p)
Definition: giaIso2.c:140
void Gia_Iso2ManStop(Gia_Iso2Man_t *p)
Definition: giaIso2.c:235
ABC_INT64_T abctime
Definition: abc_global.h:278
void Gia_Iso2ManPrepare ( Gia_Man_t p)

Definition at line 125 of file giaIso2.c.

126 {
127  Gia_Obj_t * pObj;
128  int i;
129  Gia_ManForEachObj( p, pObj, i )
130  pObj->Value = Gia_ObjIsAnd(pObj) ? 1 + Abc_MaxInt(Gia_ObjFanin0(pObj)->Value, Gia_ObjFanin1(pObj)->Value) : 0;
131  Gia_ManConst0(p)->Value = s_256Primes[ISO_MASK];
132  Gia_ManForEachObj1( p, pObj, i )
133  if ( Gia_ObjIsAnd(pObj) )
134  pObj->Value = s_256Primes[pObj->Value & ISO_MASK] + s_256Primes[ISO_MASK - 10 + Gia_ObjFaninC0(pObj) + Gia_ObjFaninC1(pObj)];
135  else if ( Gia_ObjIsPi(p, pObj) )
136  pObj->Value = s_256Primes[ISO_MASK-1];
137  else if ( Gia_ObjIsRo(p, pObj) )
138  pObj->Value = s_256Primes[ISO_MASK-2];
139 }
static int Gia_ObjFaninC1(Gia_Obj_t *pObj)
Definition: gia.h:452
static int s_256Primes[ISO_MASK+1]
Definition: giaIso2.c:30
static int Abc_MaxInt(int a, int b)
Definition: abc_global.h:238
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
if(last==0)
Definition: sparse_int.h:34
else
Definition: sparse_int.h:55
#define ISO_MASK
Definition: giaIso2.c:29
static int Gia_ObjIsAnd(Gia_Obj_t *pObj)
Definition: gia.h:422
#define Gia_ManForEachObj(p, pObj, i)
MACRO DEFINITIONS ///.
Definition: gia.h:984
static Gia_Obj_t * Gia_ManConst0(Gia_Man_t *p)
Definition: gia.h:400
static Gia_Obj_t * Gia_ObjFanin1(Gia_Obj_t *pObj)
Definition: gia.h:455
#define Gia_ManForEachObj1(p, pObj, i)
Definition: gia.h:986
static int Gia_ObjFaninC0(Gia_Obj_t *pObj)
Definition: gia.h:451
static int Gia_ObjIsPi(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:441
void Gia_Iso2ManPrint ( Gia_Iso2Man_t p,
abctime  Time,
int  fVerbose 
)

Definition at line 248 of file giaIso2.c.

249 {
250  if ( !fVerbose )
251  return;
252  printf( "Iter %4d : ", p->nIters++ );
253  printf( "Entries =%8d. ", Vec_IntSize(p->vTied) );
254  printf( "Uniques =%8d. ", p->nUniques );
255  printf( "Singles =%8d. ", Vec_PtrSize(p->vSingles) );
256  printf( "%9.2f sec", (float)(Time)/(float)(CLOCKS_PER_SEC) );
257  printf( "\n" );
258  fflush( stdout );
259 }
static int Vec_PtrSize(Vec_Ptr_t *p)
Definition: vecPtr.h:295
Vec_Ptr_t * vSingles
Definition: giaIso2.c:84
Vec_Int_t * vTied
Definition: giaIso2.c:81
int nUniques
Definition: giaIso2.c:78
static int Vec_IntSize(Vec_Int_t *p)
Definition: bblif.c:252
void Gia_Iso2ManPropagate ( Gia_Man_t p)

Definition at line 140 of file giaIso2.c.

141 {
142  Gia_Obj_t * pObj, * pObjRo;
143  int i;
144  Gia_ManForEachObj1( p, pObj, i )
145  if ( Gia_ObjIsAnd(pObj) )
146  {
147  pObj->Value += (Gia_ObjFaninC0(pObj) + s_PrimeC) * Gia_ObjFanin0(pObj)->Value + (Gia_ObjFaninC1(pObj) + s_PrimeC) * Gia_ObjFanin1(pObj)->Value;
148  if ( Gia_ObjFaninC0(pObj) == Gia_ObjFaninC1(pObj) && Gia_ObjFanin0(pObj)->Value == Gia_ObjFanin1(pObj)->Value )
149  pObj->Value += s_256Primes[ISO_MASK - 11];
150  }
151  else if ( Gia_ObjIsCo(pObj) )
152  pObj->Value += (Gia_ObjFaninC0(pObj) + s_PrimeC) * Gia_ObjFanin0(pObj)->Value;
153  Gia_ManForEachRiRo( p, pObj, pObjRo, i )
154  {
155  pObjRo->Value += pObj->Value;
156  if ( pObjRo == Gia_ObjFanin0(pObj) )
157  pObjRo->Value += s_256Primes[ISO_MASK - 12];
158  }
159 }
static int Gia_ObjFaninC1(Gia_Obj_t *pObj)
Definition: gia.h:452
static int s_256Primes[ISO_MASK+1]
Definition: giaIso2.c:30
static int s_PrimeC
Definition: giaIso2.c:66
Definition: gia.h:75
#define Gia_ManForEachRiRo(p, pObjRi, pObjRo, i)
Definition: gia.h:1042
static Gia_Obj_t * Gia_ObjFanin0(Gia_Obj_t *pObj)
Definition: gia.h:454
if(last==0)
Definition: sparse_int.h:34
#define ISO_MASK
Definition: giaIso2.c:29
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
unsigned Value
Definition: gia.h:87
#define Gia_ManForEachObj1(p, pObj, i)
Definition: gia.h:986
static int Gia_ObjFaninC0(Gia_Obj_t *pObj)
Definition: gia.h:451
Gia_Iso2Man_t* Gia_Iso2ManStart ( Gia_Man_t pGia)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 214 of file giaIso2.c.

215 {
216  Gia_Iso2Man_t * p;
217  p = ABC_CALLOC( Gia_Iso2Man_t, 1 );
218  p->pGia = pGia;
219  p->nObjs = Gia_ManObjNum( pGia );
220  p->nUniques = 0;
221  // internal data
222  p->vUniques = Vec_IntStartFull( p->nObjs );
223  p->vTied = Gia_Iso2ManCollectTies( pGia );
224  p->vTable = Vec_IntStart( Abc_PrimeCudd(1*p->nObjs) );
225  p->vPlaces = Vec_IntAlloc( 1000 );
226  p->vSingles = Vec_PtrAlloc( 1000 );
227  p->vVec0 = Vec_IntAlloc( 10000 );
228  p->vVec1 = Vec_IntAlloc( 10000 );
229  p->vMap0 = Vec_IntStart( p->nObjs );
230  p->vMap1 = Vec_IntStart( p->nObjs );
231  // add constant 0 object
232  Vec_IntWriteEntry( p->vUniques, 0, p->nUniques++ );
233  return p;
234 }
static int Abc_PrimeCudd(unsigned int p)
Definition: abc_global.h:383
static Llb_Mgr_t * p
Definition: llb3Image.c:950
Vec_Int_t * vVec1
Definition: giaIso2.c:87
Vec_Int_t * vPlaces
Definition: giaIso2.c:83
Vec_Int_t * vUniques
Definition: giaIso2.c:80
static Vec_Int_t * Vec_IntStartFull(int nSize)
Definition: vecInt.h:119
Vec_Int_t * vMap0
Definition: giaIso2.c:88
Vec_Int_t * Gia_Iso2ManCollectTies(Gia_Man_t *p)
FUNCTION DEFINITIONS ///.
Definition: giaIso2.c:115
static void Vec_IntWriteEntry(Vec_Int_t *p, int i, int Entry)
Definition: bblif.c:285
static Vec_Int_t * Vec_IntStart(int nSize)
Definition: bblif.c:172
Vec_Int_t * vTable
Definition: giaIso2.c:82
static Vec_Int_t * Vec_IntAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: bblif.c:149
Vec_Ptr_t * vSingles
Definition: giaIso2.c:84
Vec_Int_t * vMap1
Definition: giaIso2.c:89
Gia_Man_t * pGia
Definition: giaIso2.c:76
Vec_Int_t * vTied
Definition: giaIso2.c:81
int nUniques
Definition: giaIso2.c:78
static Vec_Ptr_t * Vec_PtrAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: vecPtr.h:83
#define ABC_CALLOC(type, num)
Definition: abc_global.h:230
Vec_Int_t * vVec0
Definition: giaIso2.c:86
static int Gia_ManObjNum(Gia_Man_t *p)
Definition: gia.h:388
void Gia_Iso2ManStop ( Gia_Iso2Man_t p)

Definition at line 235 of file giaIso2.c.

236 {
237  Vec_IntFree( p->vUniques );
238  Vec_IntFree( p->vTied );
239  Vec_IntFree( p->vTable );
240  Vec_IntFree( p->vPlaces );
241  Vec_PtrFree( p->vSingles );
242  Vec_IntFree( p->vMap0 );
243  Vec_IntFree( p->vMap1 );
244  Vec_IntFree( p->vVec0 );
245  Vec_IntFree( p->vVec1 );
246  ABC_FREE( p );
247 }
Vec_Int_t * vVec1
Definition: giaIso2.c:87
Vec_Int_t * vPlaces
Definition: giaIso2.c:83
Vec_Int_t * vUniques
Definition: giaIso2.c:80
Vec_Int_t * vMap0
Definition: giaIso2.c:88
Vec_Int_t * vTable
Definition: giaIso2.c:82
Vec_Ptr_t * vSingles
Definition: giaIso2.c:84
Vec_Int_t * vMap1
Definition: giaIso2.c:89
Vec_Int_t * vTied
Definition: giaIso2.c:81
#define ABC_FREE(obj)
Definition: abc_global.h:232
Vec_Int_t * vVec0
Definition: giaIso2.c:86
static void Vec_IntFree(Vec_Int_t *p)
Definition: bblif.c:235
static void Vec_PtrFree(Vec_Ptr_t *p)
Definition: vecPtr.h:223
int Gia_Iso2ManUniqify ( Gia_Iso2Man_t p)

Definition at line 276 of file giaIso2.c.

277 {
278  int fVerify = 0;
279  Gia_Obj_t * pObj, * pTemp;
280  int * pTable = Vec_IntArray(p->vTable);
281  int i, k, nSize = Vec_IntSize(p->vTable);
282 
283  if ( fVerify )
284  for ( k = 0; k < nSize; k++ )
285  assert( pTable[k] == 0 );
286  if ( fVerify )
287  Gia_ManForEachObjVec( p->vTied, p->pGia, pObj, i )
288  assert( pObj->fMark0 == 0 );
289 
290 #if 0
291  Gia_ManForEachObjVec( p->vTied, p->pGia, pObj, i )
292  {
293  printf( "%3d : ", Gia_ObjId(p->pGia, pObj) );
294  Extra_PrintBinary( stdout, &pObj->Value, 32 );
295  printf( "\n" );
296  }
297 #endif
298 
299  // add objects to the table
300  Vec_IntClear( p->vPlaces );
301  Gia_ManForEachObjVec( p->vTied, p->pGia, pObj, i )
302  {
303  for ( k = pObj->Value % nSize; (pTemp = pTable[k] ? Gia_ManObj(p->pGia, pTable[k]) : NULL); k = (k + 1) % nSize )
304  if ( pTemp->Value == pObj->Value )
305  {
306  pTemp->fMark0 = 1;
307  pObj->fMark0 = 1;
308  break;
309  }
310  if ( pTemp != NULL )
311  continue;
312  pTable[k] = Gia_ObjId(p->pGia, pObj);
313  Vec_IntPush( p->vPlaces, k );
314  }
315  // clean the table
316  Vec_IntForEachEntry( p->vPlaces, k, i )
317  pTable[k] = 0;
318  // collect singleton objects and compact tied objects
319  k = 0;
320  Vec_PtrClear( p->vSingles );
321  Gia_ManForEachObjVec( p->vTied, p->pGia, pObj, i )
322  if ( pObj->fMark0 == 0 )
323  Vec_PtrPush( p->vSingles, pObj );
324  else
325  {
326  pObj->fMark0 = 0;
327  Vec_IntWriteEntry( p->vTied, k++, Gia_ObjId(p->pGia, pObj) );
328  }
329  Vec_IntShrink( p->vTied, k );
330  // sort singletons
331  Vec_PtrSort( p->vSingles, (int (*)(void))Gia_ObjCompareByValue2 );
332  // add them to unique and increment signature
333  Vec_PtrForEachEntry( Gia_Obj_t *, p->vSingles, pObj, i )
334  {
335  pObj->Value += s_256Primes[p->nUniques & ISO_MASK];
336  assert( Vec_IntEntry(p->vUniques, Gia_ObjId(p->pGia, pObj)) == -1 );
337  Vec_IntWriteEntry( p->vUniques, Gia_ObjId(p->pGia, pObj), p->nUniques++ );
338  }
339  return Vec_PtrSize( p->vSingles );
340 }
static int * Vec_IntArray(Vec_Int_t *p)
Definition: vecInt.h:328
static int s_256Primes[ISO_MASK+1]
Definition: giaIso2.c:30
Vec_Int_t * vPlaces
Definition: giaIso2.c:83
static void Vec_PtrSort(Vec_Ptr_t *p, int(*Vec_PtrSortCompare)()) ___unused
Definition: vecPtr.h:851
static void Vec_PtrPush(Vec_Ptr_t *p, void *Entry)
Definition: vecPtr.h:606
Vec_Int_t * vUniques
Definition: giaIso2.c:80
static int Vec_PtrSize(Vec_Ptr_t *p)
Definition: vecPtr.h:295
static Gia_Obj_t * Gia_ManObj(Gia_Man_t *p, int v)
Definition: gia.h:402
Definition: gia.h:75
int Gia_ObjCompareByValue2(Gia_Obj_t **pp1, Gia_Obj_t **pp2)
Definition: giaIso2.c:275
static void Vec_IntWriteEntry(Vec_Int_t *p, int i, int Entry)
Definition: bblif.c:285
Vec_Int_t * vTable
Definition: giaIso2.c:82
static int Vec_IntEntry(Vec_Int_t *p, int i)
Definition: bblif.c:268
Vec_Ptr_t * vSingles
Definition: giaIso2.c:84
if(last==0)
Definition: sparse_int.h:34
else
Definition: sparse_int.h:55
#define ISO_MASK
Definition: giaIso2.c:29
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
Gia_Man_t * pGia
Definition: giaIso2.c:76
#define Gia_ManForEachObjVec(vVec, p, pObj, i)
Definition: gia.h:988
Vec_Int_t * vTied
Definition: giaIso2.c:81
int nUniques
Definition: giaIso2.c:78
static int Vec_IntSize(Vec_Int_t *p)
Definition: bblif.c:252
void Extra_PrintBinary(FILE *pFile, unsigned Sign[], int nBits)
static void Vec_IntShrink(Vec_Int_t *p, int nSizeNew)
Definition: bblif.c:435
unsigned fMark0
Definition: gia.h:79
#define assert(ex)
Definition: util_old.h:213
static void Vec_PtrClear(Vec_Ptr_t *p)
Definition: vecPtr.h:545
unsigned Value
Definition: gia.h:87
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.
Definition: vecPtr.h:55
static void Vec_IntClear(Vec_Int_t *p)
Definition: bblif.c:452
#define Vec_IntForEachEntry(vVec, Entry, i)
MACRO DEFINITIONS ///.
Definition: vecInt.h:54
void Gia_Iso2ManUpdate ( Gia_Iso2Man_t p,
int  Level 
)

Definition at line 195 of file giaIso2.c.

196 {
197  Gia_Obj_t * pObj;
198  int i;
199  Gia_ManForEachObjVec( p->vTied, p->pGia, pObj, i )
200  pObj->Value += Gia_Iso2ManCone( p->pGia, Gia_ObjId(p->pGia, pObj), Level );
201 }
unsigned Gia_Iso2ManCone(Gia_Man_t *p, int Id, int Level)
Definition: giaIso2.c:190
Definition: gia.h:75
static int Gia_ObjId(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:410
Gia_Man_t * pGia
Definition: giaIso2.c:76
#define Gia_ManForEachObjVec(vVec, p, pObj, i)
Definition: gia.h:988
Vec_Int_t * vTied
Definition: giaIso2.c:81
Gia_Man_t* Gia_ManIsoReduce2 ( Gia_Man_t pGia,
Vec_Ptr_t **  pvPosEquivs,
Vec_Ptr_t **  pvPiPerms,
int  fEstimate,
int  fBetterQual,
int  fDualOut,
int  fVerbose,
int  fVeryVerbose 
)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 718 of file giaIso2.c.

719 {
720  Gia_Man_t * pPart;
721  Vec_Wec_t * vEquivs, * vEquivs2;
722  Vec_Int_t * vRemains;
723  int nClasses, nUsedPos;
724  abctime clk = Abc_Clock();
725  vEquivs = Gia_Iso2ManPerform( pGia, fVeryVerbose );
726  // report class stats
727  nClasses = Vec_WecCountNonTrivial( vEquivs, &nUsedPos );
728  printf( "Reduced %d outputs to %d candidate classes (%d outputs are in %d non-trivial classes). ",
729  Gia_ManPoNum(pGia), Vec_WecSize(vEquivs), nUsedPos, nClasses );
730  Abc_PrintTime( 1, "Time", Abc_Clock() - clk );
731  if ( fEstimate )
732  {
733  Vec_WecFree( vEquivs );
734  return Gia_ManDup(pGia);
735  }
736  // verify classes
737  if ( fBetterQual )
738  vEquivs2 = Gia_Iso2ManCheckIsoClasses( pGia, vEquivs );
739  else
740  vEquivs2 = Gia_Iso2ManCheckIsoClassesSkip( pGia, vEquivs );
741  Vec_WecFree( vEquivs );
742  vEquivs = vEquivs2;
743  // sort equiv classes by the first integer
744  Vec_WecSortByFirstInt( vEquivs, 0 );
745  // find the first outputs
746  vRemains = Vec_WecCollectFirsts( vEquivs );
747  // derive the final GIA
748  pPart = Gia_ManDupCones( pGia, Vec_IntArray(vRemains), Vec_IntSize(vRemains), 0 );
749  Vec_IntFree( vRemains );
750  // report class stats
751  nClasses = Vec_WecCountNonTrivial( vEquivs, &nUsedPos );
752  printf( "Reduced %d outputs to %d equivalence classes (%d outputs are in %d non-trivial classes). ",
753  Gia_ManPoNum(pGia), Vec_WecSize(vEquivs), nUsedPos, nClasses );
754  Abc_PrintTime( 1, "Time", Abc_Clock() - clk );
755  if ( fVerbose )
756  {
757  printf( "Nontrivial classes:\n" );
758  Vec_WecPrint( vEquivs, 1 );
759  }
760  if ( pvPiPerms )
761  *pvPiPerms = NULL;
762  if ( pvPosEquivs )
763  *pvPosEquivs = Vec_WecConvertToVecPtr( vEquivs );
764  Vec_WecFree( vEquivs );
765 // Gia_ManStopP( &pPart );
766  return pPart;
767 }
static int * Vec_IntArray(Vec_Int_t *p)
Definition: vecInt.h:328
Gia_Man_t * Gia_ManDupCones(Gia_Man_t *p, int *pPos, int nPos, int fTrimPis)
Definition: giaDup.c:2691
typedefABC_NAMESPACE_HEADER_START struct Vec_Wec_t_ Vec_Wec_t
INCLUDES ///.
Definition: vecWec.h:42
Gia_Man_t * Gia_ManDup(Gia_Man_t *p)
Definition: giaDup.c:552
static Vec_Int_t * Vec_WecCollectFirsts(Vec_Wec_t *p)
Definition: vecWec.h:596
static int Gia_ManPoNum(Gia_Man_t *p)
Definition: gia.h:386
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition: bblif.c:37
static Vec_Ptr_t * Vec_WecConvertToVecPtr(Vec_Wec_t *p)
Definition: vecWec.h:618
static void Vec_WecFree(Vec_Wec_t *p)
Definition: vecWec.h:345
static abctime Abc_Clock()
Definition: abc_global.h:279
static int Vec_WecSize(Vec_Wec_t *p)
Definition: vecWec.h:193
Vec_Wec_t * Gia_Iso2ManCheckIsoClassesSkip(Gia_Man_t *p, Vec_Wec_t *vEquivs)
Definition: giaIso2.c:569
static void Abc_PrintTime(int level, const char *pStr, abctime time)
Definition: abc_global.h:367
Vec_Wec_t * Gia_Iso2ManPerform(Gia_Man_t *pGia, int fVerbose)
Definition: giaIso2.c:680
static void Vec_WecPrint(Vec_Wec_t *p, int fSkipSingles)
Definition: vecWec.h:523
static int Vec_IntSize(Vec_Int_t *p)
Definition: bblif.c:252
Vec_Wec_t * Gia_Iso2ManCheckIsoClasses(Gia_Man_t *p, Vec_Wec_t *vEquivs)
Definition: giaIso2.c:628
Definition: gia.h:95
static int Vec_WecCountNonTrivial(Vec_Wec_t *p, int *pnUsed)
Definition: vecWec.h:570
static void Vec_IntFree(Vec_Int_t *p)
Definition: bblif.c:235
ABC_INT64_T abctime
Definition: abc_global.h:278
static void Vec_WecSortByFirstInt(Vec_Wec_t *p, int fReverse)
Definition: vecWec.h:465
int Gia_ObjCompareByValue2 ( Gia_Obj_t **  pp1,
Gia_Obj_t **  pp2 
)

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

Synopsis [Uniqifies objects using their signature.]

Description [Assumes the tied objects are in p->vTied. Assumes that updated signature (pObj->Value) is assigned to these objects. Returns the array of unique objects p->vSingles sorted by signature. Compacts the array of tied objects p->vTied.]

SideEffects []

SeeAlso []

Definition at line 275 of file giaIso2.c.

275 { return (int)(*pp1)->Value - (int)(*pp2)->Value; }

Variable Documentation

int s_256Primes[ISO_MASK+1]
static

Definition at line 30 of file giaIso2.c.

int s_PrimeC = 49
static

Definition at line 66 of file giaIso2.c.