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

Go to the source code of this file.

Data Structures

struct  Iso_Obj_t_
 
struct  Iso_Man_t_
 

Macros

#define ISO_MASK   0x3FF
 
#define ISO_NUM_INTS   3
 DECLARATIONS ///. More...
 
#define Iso_ManForEachObj(p, pObj, i)   for ( i = 1; (i < p->nObjs) && ((pObj) = Iso_ManObj(p, i)); i++ ) if ( pIso->Level == -1 ) {} else
 

Typedefs

typedef struct Iso_Obj_t_ Iso_Obj_t
 
typedef struct Iso_Man_t_ Iso_Man_t
 

Functions

static Iso_Obj_tIso_ManObj (Iso_Man_t *p, int i)
 
static int Iso_ObjId (Iso_Man_t *p, Iso_Obj_t *pObj)
 
static Aig_Obj_tIso_AigObj (Iso_Man_t *p, Iso_Obj_t *q)
 
void Iso_ReadPrimes (char *pFileName)
 FUNCTION DEFINITIONS ///. More...
 
void Iso_FindNumbers ()
 
void Iso_ManObjCount_rec (Aig_Man_t *p, Aig_Obj_t *pObj, int *pnNodes, int *pnEdges)
 
void Iso_ManObjCount (Aig_Man_t *p, Aig_Obj_t *pObj, int *pnNodes, int *pnEdges)
 
Iso_Man_tIso_ManStart (Aig_Man_t *pAig)
 
void Iso_ManStop (Iso_Man_t *p, int fVerbose)
 
int Iso_ObjCompare (Iso_Obj_t **pp1, Iso_Obj_t **pp2)
 
int Iso_ObjCompareByData (Aig_Obj_t **pp1, Aig_Obj_t **pp2)
 
static int Iso_ObjHash (Iso_Obj_t *pIso, int nBins)
 
static int Iso_ObjHashAdd (Iso_Man_t *p, Iso_Obj_t *pIso)
 
void Iso_ManCollectClasses (Iso_Man_t *p)
 
Iso_Man_tIso_ManCreate (Aig_Man_t *pAig)
 
void Iso_ManAssignAdjacency (Iso_Man_t *p)
 
void Iso_ManPrintClasseSizes (Iso_Man_t *p)
 
void Iso_ManPrintClasses (Iso_Man_t *p, int fVerbose, int fVeryVerbose)
 
void Iso_ManRehashClassNodes (Iso_Man_t *p)
 
Iso_Obj_tIso_ManFindBestObj (Iso_Man_t *p, Iso_Obj_t *pIso)
 
void Iso_ManBreakTies (Iso_Man_t *p, int fVerbose)
 
Vec_Int_tIso_ManFinalize (Iso_Man_t *p)
 
void Iso_ManDumpOneClass (Iso_Man_t *p)
 
Vec_Int_tSaig_ManFindIsoPerm (Aig_Man_t *pAig, int fVerbose)
 

Variables

static int s_1kPrimes [ISO_MASK+1]
 

Macro Definition Documentation

#define Iso_ManForEachObj (   p,
  pObj,
 
)    for ( i = 1; (i < p->nObjs) && ((pObj) = Iso_ManObj(p, i)); i++ ) if ( pIso->Level == -1 ) {} else

Definition at line 304 of file saigIsoSlow.c.

#define ISO_MASK   0x3FF

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

FileName [aigIso.c]

SystemName [ABC: Logic synthesis and verification system.]

PackageName [AIG package.]

Synopsis [Graph isomorphism package.]

Author [Alan Mishchenko]

Affiliation [UC Berkeley]

Date [Ver. 1.0. Started - April 28, 2007.]

Revision [

Id:
aigIso.c,v 1.00 2007/04/28 00:00:00 alanmi Exp

]

Definition at line 122 of file saigIsoSlow.c.

#define ISO_NUM_INTS   3

DECLARATIONS ///.

Definition at line 261 of file saigIsoSlow.c.

Typedef Documentation

typedef struct Iso_Man_t_ Iso_Man_t

Definition at line 277 of file saigIsoSlow.c.

typedef struct Iso_Obj_t_ Iso_Obj_t

Definition at line 263 of file saigIsoSlow.c.

Function Documentation

static Aig_Obj_t* Iso_AigObj ( Iso_Man_t p,
Iso_Obj_t q 
)
inlinestatic

Definition at line 302 of file saigIsoSlow.c.

302 { return Aig_ManObj( p->pAig, Iso_ObjId(p, q) ); }
static int Iso_ObjId(Iso_Man_t *p, Iso_Obj_t *pObj)
Definition: saigIsoSlow.c:301
static Aig_Obj_t * Aig_ManObj(Aig_Man_t *p, int i)
Definition: aig.h:270
Aig_Man_t * pAig
Definition: saigIsoSlow.c:280
void Iso_FindNumbers ( )

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

Synopsis [Read primes from file.]

Description []

SideEffects []

SeeAlso []

Definition at line 365 of file saigIsoSlow.c.

366 {
367  unsigned Nums[1024];
368  unsigned char * pNums = (unsigned char *)Nums;
369  int i, j;
370  srand( 111 );
371  for ( i = 0; i < 1024 * 4; i++ )
372  pNums[i] = (unsigned char)rand();
373  // write out
374  for ( i = 0; i < 128; i++ )
375  {
376  printf( " " );
377  for ( j = 0; j < 8; j++ )
378  printf( "0x%08x,", Nums[i*8+j] );
379  printf( "\n" );
380  }
381 }
void Iso_ManAssignAdjacency ( Iso_Man_t p)

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

Synopsis [Creates adjacency lists.]

Description []

SideEffects []

SeeAlso []

Definition at line 738 of file saigIsoSlow.c.

739 {
740  int fUseXor = 0;
741  Iso_Obj_t * pIso, * pIsoF;
742  Aig_Obj_t * pObj, * pObjLi;
743  int i;
744 
745  // create TFI signatures
746  Aig_ManForEachObj( p->pAig, pObj, i )
747  {
748  pIso = p->pObjs + i;
749  pIso->FaninSig = 0;
750  pIso->FanoutSig = 0;
751 
752  if ( Aig_ObjIsCo(pObj) )
753  continue;
754  if ( fUseXor )
755  {
756  if ( Aig_ObjIsNode(pObj) )
757  {
758  pIsoF = p->pObjs + Aig_ObjFaninId0(pObj);
759  pIso->FaninSig ^= pIsoF->FaninSig;
760  if ( pIsoF->Id )
761  pIso->FaninSig ^= s_1kPrimes[Abc_Var2Lit(pIsoF->Id, Aig_ObjFaninC0(pObj)) & ISO_MASK];
762 
763  pIsoF = p->pObjs + Aig_ObjFaninId1(pObj);
764  pIso->FaninSig ^= pIsoF->FaninSig;
765  if ( pIsoF->Id )
766  pIso->FaninSig ^= s_1kPrimes[Abc_Var2Lit(pIsoF->Id, Aig_ObjFaninC1(pObj)) & ISO_MASK];
767  }
768  }
769  else
770  {
771  if ( Aig_ObjIsNode(pObj) )
772  {
773  pIsoF = p->pObjs + Aig_ObjFaninId0(pObj);
774  pIso->FaninSig += pIsoF->FaninSig;
775  if ( pIsoF->Id )
776  pIso->FaninSig += pIsoF->Id * s_1kPrimes[Abc_Var2Lit(pIsoF->Id, Aig_ObjFaninC0(pObj)) & ISO_MASK];
777 
778  pIsoF = p->pObjs + Aig_ObjFaninId1(pObj);
779  pIso->FaninSig += pIsoF->FaninSig;
780  if ( pIsoF->Id )
781  pIso->FaninSig += pIsoF->Id * s_1kPrimes[Abc_Var2Lit(pIsoF->Id, Aig_ObjFaninC1(pObj)) & ISO_MASK];
782  }
783  }
784  }
785  // create TFO signatures
786  Aig_ManForEachObjReverse( p->pAig, pObj, i )
787  {
788  if ( Aig_ObjIsCi(pObj) || Aig_ObjIsConst1(pObj) )
789  continue;
790  pIso = p->pObjs + i;
791  assert( !Aig_ObjIsCo(pObj) || pIso->Id == 0 );
792  if ( fUseXor )
793  {
794  if ( Aig_ObjIsNode(pObj) )
795  {
796  pIsoF = p->pObjs + Aig_ObjFaninId0(pObj);
797  pIsoF->FanoutSig ^= pIso->FanoutSig;
798  if ( pIso->Id )
799  pIsoF->FanoutSig ^= s_1kPrimes[Abc_Var2Lit(pIso->Id, Aig_ObjFaninC0(pObj)) & ISO_MASK];
800 
801  pIsoF = p->pObjs + Aig_ObjFaninId1(pObj);
802  pIsoF->FanoutSig ^= pIso->FanoutSig;
803  if ( pIso->Id )
804  pIsoF->FanoutSig ^= s_1kPrimes[Abc_Var2Lit(pIso->Id, Aig_ObjFaninC1(pObj)) & ISO_MASK];
805  }
806  else if ( Aig_ObjIsCo(pObj) )
807  {
808  pIsoF = p->pObjs + Aig_ObjFaninId0(pObj);
809  pIsoF->FanoutSig ^= pIso->FanoutSig;
810  if ( pIso->Id )
811  pIsoF->FanoutSig ^= s_1kPrimes[Abc_Var2Lit(pIso->Id, Aig_ObjFaninC0(pObj)) & ISO_MASK];
812  }
813  }
814  else
815  {
816  if ( Aig_ObjIsNode(pObj) )
817  {
818  pIsoF = p->pObjs + Aig_ObjFaninId0(pObj);
819  pIsoF->FanoutSig += pIso->FanoutSig;
820  if ( pIso->Id )
821  pIsoF->FanoutSig += pIso->Id * s_1kPrimes[Abc_Var2Lit(pIso->Id, Aig_ObjFaninC0(pObj)) & ISO_MASK];
822 
823  pIsoF = p->pObjs + Aig_ObjFaninId1(pObj);
824  pIsoF->FanoutSig += pIso->FanoutSig;
825  if ( pIso->Id )
826  pIsoF->FanoutSig += pIso->Id * s_1kPrimes[Abc_Var2Lit(pIso->Id, Aig_ObjFaninC1(pObj)) & ISO_MASK];
827  }
828  else if ( Aig_ObjIsCo(pObj) )
829  {
830  pIsoF = p->pObjs + Aig_ObjFaninId0(pObj);
831  pIsoF->FanoutSig += pIso->FanoutSig;
832  if ( pIso->Id )
833  pIsoF->FanoutSig += pIso->Id * s_1kPrimes[Abc_Var2Lit(pIso->Id, Aig_ObjFaninC0(pObj)) & ISO_MASK];
834  }
835  }
836  }
837 
838  // consider flops
839  Aig_ManForEachLiLoSeq( p->pAig, pObjLi, pObj, i )
840  {
841  if ( Aig_ObjFaninId0(pObjLi) == 0 ) // ignore constant!
842  continue;
843  pIso = Iso_ManObj( p, Aig_ObjId(pObj) );
844  pIsoF = Iso_ManObj( p, Aig_ObjFaninId0(pObjLi) );
845  assert( pIso->FaninSig == 0 );
846 // assert( pIsoF->FanoutSig == 0 );
847 
848  if ( fUseXor )
849  {
850  pIso->FaninSig = pIsoF->FaninSig;
851  if ( pIsoF->Id )
852  pIso->FaninSig ^= s_1kPrimes[Abc_Var2Lit(pIsoF->Id, Aig_ObjFaninC0(pObjLi)) & ISO_MASK];
853 
854  pIsoF->FanoutSig += pIso->FanoutSig;
855  if ( pIso->Id )
856  pIsoF->FanoutSig ^= s_1kPrimes[Abc_Var2Lit(pIso->Id, Aig_ObjFaninC0(pObjLi)) & ISO_MASK];
857  }
858  else
859  {
860  pIso->FaninSig = pIsoF->FaninSig;
861  if ( pIsoF->Id )
862  pIso->FaninSig += pIsoF->Id * s_1kPrimes[Abc_Var2Lit(pIsoF->Id, Aig_ObjFaninC0(pObjLi)) & ISO_MASK];
863 
864  pIsoF->FanoutSig += pIso->FanoutSig;
865  if ( pIso->Id )
866  pIsoF->FanoutSig += pIso->Id * s_1kPrimes[Abc_Var2Lit(pIso->Id, Aig_ObjFaninC0(pObjLi)) & ISO_MASK];
867  }
868  }
869 }
unsigned FanoutSig
Definition: saigIsoSlow.c:270
static int Aig_ObjFaninId0(Aig_Obj_t *pObj)
Definition: aig.h:304
static int Abc_Var2Lit(int Var, int fCompl)
Definition: abc_global.h:263
static int s_1kPrimes[ISO_MASK+1]
Definition: saigIsoSlow.c:123
unsigned FaninSig
Definition: saigIsoSlow.c:269
static int Aig_ObjFaninId1(Aig_Obj_t *pObj)
Definition: aig.h:305
static int Aig_ObjIsNode(Aig_Obj_t *pObj)
Definition: aig.h:280
static Iso_Obj_t * Iso_ManObj(Iso_Man_t *p, int i)
Definition: saigIsoSlow.c:300
#define Aig_ManForEachLiLoSeq(p, pObjLi, pObjLo, k)
Definition: aig.h:450
static int Aig_ObjIsConst1(Aig_Obj_t *pObj)
Definition: aig.h:274
Definition: aig.h:69
static int Aig_ObjFaninC0(Aig_Obj_t *pObj)
Definition: aig.h:306
#define ISO_MASK
Definition: saigIsoSlow.c:122
#define Aig_ManForEachObj(p, pObj, i)
Definition: aig.h:403
Aig_Man_t * pAig
Definition: saigIsoSlow.c:280
static int Aig_ObjFaninC1(Aig_Obj_t *pObj)
Definition: aig.h:307
static int Aig_ObjId(Aig_Obj_t *pObj)
Definition: aig.h:286
#define Aig_ManForEachObjReverse(p, pObj, i)
Definition: aig.h:405
#define assert(ex)
Definition: util_old.h:213
Iso_Obj_t * pObjs
Definition: saigIsoSlow.c:281
static int Aig_ObjIsCi(Aig_Obj_t *pObj)
Definition: aig.h:275
static int Aig_ObjIsCo(Aig_Obj_t *pObj)
Definition: aig.h:276
void Iso_ManBreakTies ( Iso_Man_t p,
int  fVerbose 
)

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

Synopsis [Find nodes with the min number of edges.]

Description []

SideEffects []

SeeAlso []

Definition at line 1043 of file saigIsoSlow.c.

1044 {
1045  int fUseOneBest = 0;
1046  Iso_Obj_t * pIso, * pTemp;
1047  int i, LevelStart = 0;
1048  pIso = (Iso_Obj_t *)Vec_PtrEntry( p->vClasses, 0 );
1049  LevelStart = pIso->Level;
1050  if ( fVerbose )
1051  printf( "Best level %d\n", LevelStart );
1052  Vec_PtrForEachEntry( Iso_Obj_t *, p->vClasses, pIso, i )
1053  {
1054  if ( (int)pIso->Level < LevelStart )
1055  break;
1056  if ( !fUseOneBest )
1057  {
1058  for ( pTemp = pIso; pTemp; pTemp = Iso_ManObj(p, pTemp->iClass) )
1059  {
1060  assert( pTemp->Id == 0 );
1061  pTemp->Id = p->nObjIds++;
1062  }
1063  continue;
1064  }
1065  if ( pIso->Level == 0 )//&& pIso->nFoutPos + pIso->nFoutNeg == 0 )
1066  {
1067  for ( pTemp = pIso; pTemp; pTemp = Iso_ManObj(p, pTemp->iClass) )
1068  pTemp->Id = p->nObjIds++;
1069  continue;
1070  }
1071  pIso = Iso_ManFindBestObj( p, pIso );
1072  pIso->Id = p->nObjIds++;
1073  }
1074 }
Vec_Ptr_t * vClasses
Definition: saigIsoSlow.c:290
Iso_Obj_t * Iso_ManFindBestObj(Iso_Man_t *p, Iso_Obj_t *pIso)
Definition: saigIsoSlow.c:1008
static Iso_Obj_t * Iso_ManObj(Iso_Man_t *p, int i)
Definition: saigIsoSlow.c:300
static void * Vec_PtrEntry(Vec_Ptr_t *p, int i)
Definition: vecPtr.h:362
unsigned Level
Definition: saigIsoSlow.c:267
#define assert(ex)
Definition: util_old.h:213
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.
Definition: vecPtr.h:55
void Iso_ManCollectClasses ( Iso_Man_t p)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 556 of file saigIsoSlow.c.

557 {
558  Iso_Obj_t * pIso;
559  int i;
560  abctime clk = Abc_Clock();
561  Vec_PtrClear( p->vSingles );
562  Vec_PtrClear( p->vClasses );
563  for ( i = 0; i < p->nBins; i++ )
564  {
565  for ( pIso = Iso_ManObj(p, p->pBins[i]); pIso; pIso = Iso_ManObj(p, pIso->iNext) )
566  {
567  assert( pIso->Id == 0 );
568  if ( pIso->iClass )
569  Vec_PtrPush( p->vClasses, pIso );
570  else
571  Vec_PtrPush( p->vSingles, pIso );
572  }
573  }
574  clk = Abc_Clock();
575  Vec_PtrSort( p->vSingles, (int (*)(void))Iso_ObjCompare );
576  Vec_PtrSort( p->vClasses, (int (*)(void))Iso_ObjCompare );
577  p->timeSort += Abc_Clock() - clk;
578  assert( Vec_PtrSize(p->vSingles) == p->nSingles );
579  assert( Vec_PtrSize(p->vClasses) == p->nClasses );
580  // assign IDs to singletons
581  Vec_PtrForEachEntry( Iso_Obj_t *, p->vSingles, pIso, i )
582  if ( pIso->Id == 0 )
583  pIso->Id = p->nObjIds++;
584 }
Vec_Ptr_t * vClasses
Definition: saigIsoSlow.c:290
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
static abctime Abc_Clock()
Definition: abc_global.h:279
static int Vec_PtrSize(Vec_Ptr_t *p)
Definition: vecPtr.h:295
static Iso_Obj_t * Iso_ManObj(Iso_Man_t *p, int i)
Definition: saigIsoSlow.c:300
Vec_Ptr_t * vSingles
Definition: saigIsoSlow.c:289
if(last==0)
Definition: sparse_int.h:34
int * pBins
Definition: saigIsoSlow.c:288
abctime timeSort
Definition: saigIsoSlow.c:295
#define assert(ex)
Definition: util_old.h:213
static void Vec_PtrClear(Vec_Ptr_t *p)
Definition: vecPtr.h:545
int Iso_ObjCompare(Iso_Obj_t **pp1, Iso_Obj_t **pp2)
Definition: saigIsoSlow.c:473
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.
Definition: vecPtr.h:55
ABC_INT64_T abctime
Definition: abc_global.h:278
Iso_Man_t* Iso_ManCreate ( Aig_Man_t pAig)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 597 of file saigIsoSlow.c.

598 {
599  int fUseXor = 0;
600  Iso_Man_t * p;
601  Iso_Obj_t * pIso, * pIsoF;
602  Aig_Obj_t * pObj, * pObjLi;
603  int i;
604  p = Iso_ManStart( pAig );
605 
606  // create TFI signatures
607  Aig_ManForEachObj( pAig, pObj, i )
608  {
609  if ( Aig_ObjIsCo(pObj) )
610  continue;
611  pIso = p->pObjs + i;
612  pIso->Level = pObj->Level;
613 // pIso->nFinNeg = Aig_ObjFaninC0(pObj) + Aig_ObjFaninC1(pObj);
614 
615  assert( pIso->FaninSig == 0 );
616  assert( pIso->FanoutSig == 0 );
617  if ( fUseXor )
618  {
619  if ( Aig_ObjIsNode(pObj) )
620  {
621  pIsoF = p->pObjs + Aig_ObjFaninId0(pObj);
622  pIso->FaninSig ^= pIsoF->FaninSig;
623  pIso->FaninSig ^= s_1kPrimes[Abc_Var2Lit(pIso->Level, Aig_ObjFaninC0(pObj)) & ISO_MASK];
624 
625  pIsoF = p->pObjs + Aig_ObjFaninId1(pObj);
626  pIso->FaninSig ^= pIsoF->FaninSig;
627  pIso->FaninSig ^= s_1kPrimes[Abc_Var2Lit(pIso->Level, Aig_ObjFaninC1(pObj)) & ISO_MASK];
628  }
629  }
630  else
631  {
632  if ( Aig_ObjIsNode(pObj) )
633  {
634  pIsoF = p->pObjs + Aig_ObjFaninId0(pObj);
635  pIso->FaninSig += pIsoF->FaninSig;
636  pIso->FaninSig += pIso->Level * s_1kPrimes[Abc_Var2Lit(pIso->Level, Aig_ObjFaninC0(pObj)) & ISO_MASK];
637 
638  pIsoF = p->pObjs + Aig_ObjFaninId1(pObj);
639  pIso->FaninSig += pIsoF->FaninSig;
640  pIso->FaninSig += pIso->Level * s_1kPrimes[Abc_Var2Lit(pIso->Level, Aig_ObjFaninC1(pObj)) & ISO_MASK];
641  }
642  }
643  }
644 
645  // create TFO signatures
646  Aig_ManForEachObjReverse( pAig, pObj, i )
647  {
648  if ( Aig_ObjIsCi(pObj) || Aig_ObjIsConst1(pObj) )
649  continue;
650  pIso = p->pObjs + i;
651  if ( fUseXor )
652  {
653  if ( Aig_ObjIsNode(pObj) )
654  {
655  pIsoF = p->pObjs + Aig_ObjFaninId0(pObj);
656  pIsoF->FanoutSig ^= pIso->FanoutSig;
657  pIsoF->FanoutSig ^= s_1kPrimes[Abc_Var2Lit(pIso->Level, Aig_ObjFaninC0(pObj)) & ISO_MASK];
658 
659  pIsoF = p->pObjs + Aig_ObjFaninId1(pObj);
660  pIsoF->FanoutSig ^= pIso->FanoutSig;
661  pIsoF->FanoutSig ^= s_1kPrimes[Abc_Var2Lit(pIso->Level, Aig_ObjFaninC1(pObj)) & ISO_MASK];
662  }
663  else if ( Aig_ObjIsCo(pObj) )
664  {
665  pIsoF = p->pObjs + Aig_ObjFaninId0(pObj);
666  pIsoF->FanoutSig ^= pIso->FanoutSig;
667  pIsoF->FanoutSig ^= s_1kPrimes[Abc_Var2Lit(pIso->Level, Aig_ObjFaninC0(pObj)) & ISO_MASK];
668  }
669  }
670  else
671  {
672  if ( Aig_ObjIsNode(pObj) )
673  {
674  pIsoF = p->pObjs + Aig_ObjFaninId0(pObj);
675  pIsoF->FanoutSig += pIso->FanoutSig;
676  pIsoF->FanoutSig += pIso->Level * s_1kPrimes[Abc_Var2Lit(pIso->Level, Aig_ObjFaninC0(pObj)) & ISO_MASK];
677 
678  pIsoF = p->pObjs + Aig_ObjFaninId1(pObj);
679  pIsoF->FanoutSig += pIso->FanoutSig;
680  pIsoF->FanoutSig += pIso->Level * s_1kPrimes[Abc_Var2Lit(pIso->Level, Aig_ObjFaninC1(pObj)) & ISO_MASK];
681  }
682  else if ( Aig_ObjIsCo(pObj) )
683  {
684  pIsoF = p->pObjs + Aig_ObjFaninId0(pObj);
685  pIsoF->FanoutSig += pIso->FanoutSig;
686  pIsoF->FanoutSig += pIso->Level * s_1kPrimes[Abc_Var2Lit(pIso->Level, Aig_ObjFaninC0(pObj)) & ISO_MASK];
687  }
688  }
689  }
690 
691  // consider flops
692  Aig_ManForEachLiLoSeq( p->pAig, pObjLi, pObj, i )
693  {
694  if ( Aig_ObjFaninId0(pObjLi) == 0 ) // ignore constant!
695  continue;
696  pIso = Iso_ManObj( p, Aig_ObjId(pObj) );
697  pIsoF = Iso_ManObj( p, Aig_ObjFaninId0(pObjLi) );
698 
699  assert( pIso->FaninSig == 0 );
700  pIso->FaninSig = pIsoF->FaninSig;
701 
702 // assert( pIsoF->FanoutSig == 0 );
703  pIsoF->FanoutSig += pIso->FanoutSig;
704  }
705 /*
706  Aig_ManForEachObj( pAig, pObj, i )
707  {
708  pIso = p->pObjs + i;
709  Aig_ObjPrint( pAig, pObj );
710  printf( "Lev = %4d. Pos = %4d. FaninSig = %10d. FanoutSig = %10d.\n",
711  pIso->Level, pIso->nFinNeg, pIso->FaninSig, pIso->FanoutSig );
712  }
713 */
714  // add to the hash table
715  Aig_ManForEachObj( pAig, pObj, i )
716  {
717  if ( !Aig_ObjIsCi(pObj) && !Aig_ObjIsNode(pObj) )
718  continue;
719  pIso = p->pObjs + i;
720  Iso_ObjHashAdd( p, pIso );
721  }
722  // derive classes for the first time
724  return p;
725 }
unsigned FanoutSig
Definition: saigIsoSlow.c:270
unsigned Level
Definition: aig.h:82
static int Aig_ObjFaninId0(Aig_Obj_t *pObj)
Definition: aig.h:304
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static int Iso_ObjHashAdd(Iso_Man_t *p, Iso_Obj_t *pIso)
Definition: saigIsoSlow.c:519
static int Abc_Var2Lit(int Var, int fCompl)
Definition: abc_global.h:263
void Iso_ManCollectClasses(Iso_Man_t *p)
Definition: saigIsoSlow.c:556
static int s_1kPrimes[ISO_MASK+1]
Definition: saigIsoSlow.c:123
unsigned FaninSig
Definition: saigIsoSlow.c:269
static int Aig_ObjFaninId1(Aig_Obj_t *pObj)
Definition: aig.h:305
static int Aig_ObjIsNode(Aig_Obj_t *pObj)
Definition: aig.h:280
Iso_Man_t * Iso_ManStart(Aig_Man_t *pAig)
Definition: saigIsoSlow.c:425
static Iso_Obj_t * Iso_ManObj(Iso_Man_t *p, int i)
Definition: saigIsoSlow.c:300
#define Aig_ManForEachLiLoSeq(p, pObjLi, pObjLo, k)
Definition: aig.h:450
static int Aig_ObjIsConst1(Aig_Obj_t *pObj)
Definition: aig.h:274
Definition: aig.h:69
static int Aig_ObjFaninC0(Aig_Obj_t *pObj)
Definition: aig.h:306
#define ISO_MASK
Definition: saigIsoSlow.c:122
#define Aig_ManForEachObj(p, pObj, i)
Definition: aig.h:403
Aig_Man_t * pAig
Definition: saigIsoSlow.c:280
static int Aig_ObjFaninC1(Aig_Obj_t *pObj)
Definition: aig.h:307
unsigned Level
Definition: saigIsoSlow.c:267
static int Aig_ObjId(Aig_Obj_t *pObj)
Definition: aig.h:286
#define Aig_ManForEachObjReverse(p, pObj, i)
Definition: aig.h:405
#define assert(ex)
Definition: util_old.h:213
Iso_Obj_t * pObjs
Definition: saigIsoSlow.c:281
static int Aig_ObjIsCi(Aig_Obj_t *pObj)
Definition: aig.h:275
static int Aig_ObjIsCo(Aig_Obj_t *pObj)
Definition: aig.h:276
void Iso_ManDumpOneClass ( Iso_Man_t p)

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

Synopsis [Find nodes with the min number of edges.]

Description []

SideEffects []

SeeAlso []

Definition at line 1140 of file saigIsoSlow.c.

1141 {
1142  Vec_Ptr_t * vNodes = Vec_PtrAlloc( 100 );
1143  Iso_Obj_t * pIso, * pTemp;
1144  Aig_Man_t * pNew = NULL;
1145  assert( p->nClasses > 0 );
1146  pIso = (Iso_Obj_t *)Vec_PtrEntry( p->vClasses, 0 );
1147  assert( pIso->Id == 0 );
1148  for ( pTemp = pIso; pTemp; pTemp = Iso_ManObj(p, pTemp->iClass) )
1149  {
1150  assert( pTemp->Id == 0 );
1151  Vec_PtrPush( vNodes, Iso_AigObj(p, pTemp) );
1152  }
1153  pNew = Aig_ManDupNodes( p->pAig, vNodes );
1154  Vec_PtrFree( vNodes );
1155  Aig_ManShow( pNew, 0, NULL );
1156  Aig_ManStopP( &pNew );
1157 }
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition: vecPtr.h:42
void Aig_ManShow(Aig_Man_t *pMan, int fHaig, Vec_Ptr_t *vBold)
Definition: aigShow.c:340
typedefABC_NAMESPACE_HEADER_START struct Aig_Man_t_ Aig_Man_t
INCLUDES ///.
Definition: aig.h:50
Vec_Ptr_t * vClasses
Definition: saigIsoSlow.c:290
static void Vec_PtrPush(Vec_Ptr_t *p, void *Entry)
Definition: vecPtr.h:606
void Aig_ManStopP(Aig_Man_t **p)
Definition: aigMan.c:246
static Iso_Obj_t * Iso_ManObj(Iso_Man_t *p, int i)
Definition: saigIsoSlow.c:300
Aig_Man_t * Aig_ManDupNodes(Aig_Man_t *pMan, Vec_Ptr_t *vArray)
Definition: aigDup.c:1302
static Aig_Obj_t * Iso_AigObj(Iso_Man_t *p, Iso_Obj_t *q)
Definition: saigIsoSlow.c:302
static void * Vec_PtrEntry(Vec_Ptr_t *p, int i)
Definition: vecPtr.h:362
Aig_Man_t * pAig
Definition: saigIsoSlow.c:280
static Vec_Ptr_t * Vec_PtrAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: vecPtr.h:83
#define assert(ex)
Definition: util_old.h:213
static void Vec_PtrFree(Vec_Ptr_t *p)
Definition: vecPtr.h:223
Vec_Int_t* Iso_ManFinalize ( Iso_Man_t p)

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

Synopsis [Finalizes unification of combinational outputs.]

Description [Assigns IDs to the unclassified CIs in the order of obj IDs.]

SideEffects []

SeeAlso []

Definition at line 1087 of file saigIsoSlow.c.

1088 {
1089  Vec_Int_t * vRes;
1090  Aig_Obj_t * pObj;
1091  int i;
1092  assert( p->nClasses == 0 );
1093  assert( Vec_PtrSize(p->vClasses) == 0 );
1094  // set canonical numbers
1095  Aig_ManForEachObj( p->pAig, pObj, i )
1096  {
1097  if ( !Aig_ObjIsCi(pObj) && !Aig_ObjIsNode(pObj) )
1098  {
1099  pObj->iData = -1;
1100  continue;
1101  }
1102  pObj->iData = Iso_ManObj(p, Aig_ObjId(pObj))->Id;
1103  assert( pObj->iData > 0 );
1104  }
1105  Aig_ManConst1(p->pAig)->iData = 0;
1106  // assign unique IDs to the CIs
1107  Vec_PtrClear( p->vTemp1 );
1108  Vec_PtrClear( p->vTemp2 );
1109  Aig_ManForEachCi( p->pAig, pObj, i )
1110  {
1111  assert( pObj->iData > 0 );
1112  if ( Aig_ObjCioId(pObj) >= Aig_ManCiNum(p->pAig) - Aig_ManRegNum(p->pAig) ) // flop
1113  Vec_PtrPush( p->vTemp2, pObj );
1114  else // PI
1115  Vec_PtrPush( p->vTemp1, pObj );
1116  }
1117  // sort CIs by their IDs
1118  Vec_PtrSort( p->vTemp1, (int (*)(void))Iso_ObjCompareByData );
1119  Vec_PtrSort( p->vTemp2, (int (*)(void))Iso_ObjCompareByData );
1120  // create the result
1121  vRes = Vec_IntAlloc( Aig_ManCiNum(p->pAig) );
1122  Vec_PtrForEachEntry( Aig_Obj_t *, p->vTemp1, pObj, i )
1123  Vec_IntPush( vRes, Aig_ObjCioId(pObj) );
1124  Vec_PtrForEachEntry( Aig_Obj_t *, p->vTemp2, pObj, i )
1125  Vec_IntPush( vRes, Aig_ObjCioId(pObj) );
1126  return vRes;
1127 }
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition: bblif.c:37
Vec_Ptr_t * vClasses
Definition: saigIsoSlow.c:290
#define Aig_ManForEachCi(p, pObj, i)
ITERATORS ///.
Definition: aig.h:393
static void Vec_PtrSort(Vec_Ptr_t *p, int(*Vec_PtrSortCompare)()) ___unused
Definition: vecPtr.h:851
Vec_Ptr_t * vTemp2
Definition: saigIsoSlow.c:292
static void Vec_PtrPush(Vec_Ptr_t *p, void *Entry)
Definition: vecPtr.h:606
static int Vec_PtrSize(Vec_Ptr_t *p)
Definition: vecPtr.h:295
int Iso_ObjCompareByData(Aig_Obj_t **pp1, Aig_Obj_t **pp2)
Definition: saigIsoSlow.c:489
static int Aig_ObjIsNode(Aig_Obj_t *pObj)
Definition: aig.h:280
static Vec_Int_t * Vec_IntAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: bblif.c:149
static Iso_Obj_t * Iso_ManObj(Iso_Man_t *p, int i)
Definition: saigIsoSlow.c:300
static int Aig_ManCiNum(Aig_Man_t *p)
Definition: aig.h:251
Definition: aig.h:69
static void Vec_IntPush(Vec_Int_t *p, int Entry)
Definition: bblif.c:468
static Aig_Obj_t * Aig_ManConst1(Aig_Man_t *p)
Definition: aig.h:264
Vec_Ptr_t * vTemp1
Definition: saigIsoSlow.c:291
int iData
Definition: aig.h:88
static int Aig_ManRegNum(Aig_Man_t *p)
Definition: aig.h:260
#define Aig_ManForEachObj(p, pObj, i)
Definition: aig.h:403
Aig_Man_t * pAig
Definition: saigIsoSlow.c:280
static int Aig_ObjId(Aig_Obj_t *pObj)
Definition: aig.h:286
#define assert(ex)
Definition: util_old.h:213
static void Vec_PtrClear(Vec_Ptr_t *p)
Definition: vecPtr.h:545
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.
Definition: vecPtr.h:55
static int Aig_ObjIsCi(Aig_Obj_t *pObj)
Definition: aig.h:275
static int Aig_ObjCioId(Aig_Obj_t *pObj)
Definition: aig.h:285
Iso_Obj_t* Iso_ManFindBestObj ( Iso_Man_t p,
Iso_Obj_t pIso 
)

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

Synopsis [Find nodes with the min number of edges.]

Description []

SideEffects []

SeeAlso []

Definition at line 1008 of file saigIsoSlow.c.

1009 {
1010  Iso_Obj_t * pTemp, * pBest = NULL;
1011  int nNodesBest = -1, nNodes;
1012  int nEdgesBest = -1, nEdges;
1013  assert( pIso->Id == 0 );
1014  if ( pIso->Level == 0 )
1015  return pIso;
1016  for ( pTemp = pIso; pTemp; pTemp = Iso_ManObj(p, pTemp->iClass) )
1017  {
1018  assert( pTemp->Id == 0 );
1019  Iso_ManObjCount( p->pAig, Iso_AigObj(p, pTemp), &nNodes, &nEdges );
1020 // printf( "%d,%d ", nNodes, nEdges );
1021  if ( nNodesBest < nNodes || (nNodesBest == nNodes && nEdgesBest < nEdges) )
1022  {
1023  nNodesBest = nNodes;
1024  nEdgesBest = nEdges;
1025  pBest = pTemp;
1026  }
1027  }
1028 // printf( "\n" );
1029  return pBest;
1030 }
void Iso_ManObjCount(Aig_Man_t *p, Aig_Obj_t *pObj, int *pnNodes, int *pnEdges)
Definition: saigIsoSlow.c:406
static Iso_Obj_t * Iso_ManObj(Iso_Man_t *p, int i)
Definition: saigIsoSlow.c:300
static Aig_Obj_t * Iso_AigObj(Iso_Man_t *p, Iso_Obj_t *q)
Definition: saigIsoSlow.c:302
Aig_Man_t * pAig
Definition: saigIsoSlow.c:280
unsigned Level
Definition: saigIsoSlow.c:267
#define assert(ex)
Definition: util_old.h:213
static Iso_Obj_t* Iso_ManObj ( Iso_Man_t p,
int  i 
)
inlinestatic

Definition at line 300 of file saigIsoSlow.c.

300 { assert( i >= 0 && i < p->nObjs ); return i ? p->pObjs + i : NULL; }
#define assert(ex)
Definition: util_old.h:213
Iso_Obj_t * pObjs
Definition: saigIsoSlow.c:281
void Iso_ManObjCount ( Aig_Man_t p,
Aig_Obj_t pObj,
int *  pnNodes,
int *  pnEdges 
)

Definition at line 406 of file saigIsoSlow.c.

407 {
408  assert( Aig_ObjIsNode(pObj) );
409  *pnNodes = *pnEdges = 0;
411  Iso_ManObjCount_rec( p, pObj, pnNodes, pnEdges );
412 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
void Aig_ManIncrementTravId(Aig_Man_t *p)
DECLARATIONS ///.
Definition: aigUtil.c:44
static int Aig_ObjIsNode(Aig_Obj_t *pObj)
Definition: aig.h:280
void Iso_ManObjCount_rec(Aig_Man_t *p, Aig_Obj_t *pObj, int *pnNodes, int *pnEdges)
Definition: saigIsoSlow.c:394
#define assert(ex)
Definition: util_old.h:213
void Iso_ManObjCount_rec ( Aig_Man_t p,
Aig_Obj_t pObj,
int *  pnNodes,
int *  pnEdges 
)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 394 of file saigIsoSlow.c.

395 {
396  if ( Aig_ObjIsCi(pObj) )
397  return;
398  if ( Aig_ObjIsTravIdCurrent(p, pObj) )
399  return;
400  Aig_ObjSetTravIdCurrent(p, pObj);
401  Iso_ManObjCount_rec( p, Aig_ObjFanin0(pObj), pnNodes, pnEdges );
402  Iso_ManObjCount_rec( p, Aig_ObjFanin1(pObj), pnNodes, pnEdges );
403  (*pnEdges) += Aig_ObjFaninC0(pObj) + Aig_ObjFaninC1(pObj);
404  (*pnNodes)++;
405 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static int Aig_ObjIsTravIdCurrent(Aig_Man_t *p, Aig_Obj_t *pObj)
Definition: aig.h:295
static Aig_Obj_t * Aig_ObjFanin0(Aig_Obj_t *pObj)
Definition: aig.h:308
static Aig_Obj_t * Aig_ObjFanin1(Aig_Obj_t *pObj)
Definition: aig.h:309
static void Aig_ObjSetTravIdCurrent(Aig_Man_t *p, Aig_Obj_t *pObj)
Definition: aig.h:293
void Iso_ManObjCount_rec(Aig_Man_t *p, Aig_Obj_t *pObj, int *pnNodes, int *pnEdges)
Definition: saigIsoSlow.c:394
static int Aig_ObjFaninC0(Aig_Obj_t *pObj)
Definition: aig.h:306
static int Aig_ObjFaninC1(Aig_Obj_t *pObj)
Definition: aig.h:307
static int Aig_ObjIsCi(Aig_Obj_t *pObj)
Definition: aig.h:275
void Iso_ManPrintClasses ( Iso_Man_t p,
int  fVerbose,
int  fVeryVerbose 
)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 909 of file saigIsoSlow.c.

910 {
911  int fOnlyCis = 0;
912  Iso_Obj_t * pIso, * pTemp;
913  int i;
914 
915  // count unique objects
916  if ( fVerbose )
917  printf( "Total objects =%7d. Entries =%7d. Classes =%7d. Singles =%7d.\n",
918  p->nObjs, p->nEntries, p->nClasses, p->nSingles );
919 
920  if ( !fVeryVerbose )
921  return;
922 
923  printf( "Non-trivial classes:\n" );
924  Vec_PtrForEachEntry( Iso_Obj_t *, p->vClasses, pIso, i )
925  {
926  if ( fOnlyCis && pIso->Level > 0 )
927  continue;
928 
929  printf( "%5d : {", i );
930  for ( pTemp = pIso; pTemp; pTemp = Iso_ManObj(p, pTemp->iClass) )
931  {
932  if ( fOnlyCis )
933  printf( " %d", Aig_ObjCioId( Iso_AigObj(p, pTemp) ) );
934  else
935  {
936  Aig_Obj_t * pObj = Iso_AigObj(p, pTemp);
937  if ( Aig_ObjIsNode(pObj) )
938  printf( " %d{%s%d(%d),%s%d(%d)}", Iso_ObjId(p, pTemp),
939  Aig_ObjFaninC0(pObj)? "-": "+", Aig_ObjFaninId0(pObj), Aig_ObjLevel(Aig_ObjFanin0(pObj)),
940  Aig_ObjFaninC1(pObj)? "-": "+", Aig_ObjFaninId1(pObj), Aig_ObjLevel(Aig_ObjFanin1(pObj)) );
941  else
942  printf( " %d", Iso_ObjId(p, pTemp) );
943  }
944  printf( "(%d)", pTemp->Level );
945  }
946  printf( " }\n" );
947  }
948 }
static int Aig_ObjFaninId0(Aig_Obj_t *pObj)
Definition: aig.h:304
static int Iso_ObjId(Iso_Man_t *p, Iso_Obj_t *pObj)
Definition: saigIsoSlow.c:301
static Aig_Obj_t * Aig_ObjFanin0(Aig_Obj_t *pObj)
Definition: aig.h:308
Vec_Ptr_t * vClasses
Definition: saigIsoSlow.c:290
static int Aig_ObjFaninId1(Aig_Obj_t *pObj)
Definition: aig.h:305
static Aig_Obj_t * Aig_ObjFanin1(Aig_Obj_t *pObj)
Definition: aig.h:309
static int Aig_ObjIsNode(Aig_Obj_t *pObj)
Definition: aig.h:280
static Iso_Obj_t * Iso_ManObj(Iso_Man_t *p, int i)
Definition: saigIsoSlow.c:300
Definition: aig.h:69
static Aig_Obj_t * Iso_AigObj(Iso_Man_t *p, Iso_Obj_t *q)
Definition: saigIsoSlow.c:302
static int Aig_ObjFaninC0(Aig_Obj_t *pObj)
Definition: aig.h:306
static int Aig_ObjFaninC1(Aig_Obj_t *pObj)
Definition: aig.h:307
static int Aig_ObjLevel(Aig_Obj_t *pObj)
Definition: aig.h:323
unsigned Level
Definition: saigIsoSlow.c:267
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.
Definition: vecPtr.h:55
static int Aig_ObjCioId(Aig_Obj_t *pObj)
Definition: aig.h:285
void Iso_ManPrintClasseSizes ( Iso_Man_t p)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 884 of file saigIsoSlow.c.

885 {
886  Iso_Obj_t * pIso, * pTemp;
887  int i, Counter;
888  Vec_PtrForEachEntry( Iso_Obj_t *, p->vClasses, pIso, i )
889  {
890  Counter = 0;
891  for ( pTemp = pIso; pTemp; pTemp = Iso_ManObj(p, pTemp->iClass) )
892  Counter++;
893  printf( "%d ", Counter );
894  }
895  printf( "\n" );
896 }
Vec_Ptr_t * vClasses
Definition: saigIsoSlow.c:290
static Iso_Obj_t * Iso_ManObj(Iso_Man_t *p, int i)
Definition: saigIsoSlow.c:300
static int Counter
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.
Definition: vecPtr.h:55
void Iso_ManRehashClassNodes ( Iso_Man_t p)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 962 of file saigIsoSlow.c.

963 {
964  Iso_Obj_t * pIso, * pTemp;
965  int i;
966  // collect nodes
967  Vec_PtrClear( p->vTemp1 );
968  Vec_PtrClear( p->vTemp2 );
969  Vec_PtrForEachEntry( Iso_Obj_t *, p->vClasses, pIso, i )
970  {
971  for ( pTemp = pIso; pTemp; pTemp = Iso_ManObj(p, pTemp->iClass) )
972  if ( pTemp->Id == 0 )
973  Vec_PtrPush( p->vTemp1, pTemp );
974  else
975  Vec_PtrPush( p->vTemp2, pTemp );
976  }
977  // clean and add nodes
978  p->nClasses = 0; // total number of classes
979  p->nEntries = 0; // total number of entries
980  p->nSingles = 0; // total number of singletons
981  memset( p->pBins, 0, sizeof(int) * p->nBins );
982  Vec_PtrForEachEntry( Iso_Obj_t *, p->vTemp1, pTemp, i )
983  {
984  assert( pTemp->Id == 0 );
985  pTemp->iClass = pTemp->iNext = 0;
986  Iso_ObjHashAdd( p, pTemp );
987  }
988  Vec_PtrForEachEntry( Iso_Obj_t *, p->vTemp2, pTemp, i )
989  {
990  assert( pTemp->Id != 0 );
991  pTemp->iClass = pTemp->iNext = 0;
992  }
993  // collect new classes
995 }
char * memset()
static int Iso_ObjHashAdd(Iso_Man_t *p, Iso_Obj_t *pIso)
Definition: saigIsoSlow.c:519
Vec_Ptr_t * vClasses
Definition: saigIsoSlow.c:290
void Iso_ManCollectClasses(Iso_Man_t *p)
Definition: saigIsoSlow.c:556
Vec_Ptr_t * vTemp2
Definition: saigIsoSlow.c:292
static void Vec_PtrPush(Vec_Ptr_t *p, void *Entry)
Definition: vecPtr.h:606
static Iso_Obj_t * Iso_ManObj(Iso_Man_t *p, int i)
Definition: saigIsoSlow.c:300
Vec_Ptr_t * vTemp1
Definition: saigIsoSlow.c:291
int * pBins
Definition: saigIsoSlow.c:288
#define assert(ex)
Definition: util_old.h:213
static void Vec_PtrClear(Vec_Ptr_t *p)
Definition: vecPtr.h:545
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.
Definition: vecPtr.h:55
Iso_Man_t* Iso_ManStart ( Aig_Man_t pAig)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 425 of file saigIsoSlow.c.

426 {
427  Iso_Man_t * p;
428  p = ABC_CALLOC( Iso_Man_t, 1 );
429  p->pAig = pAig;
430  p->nObjs = Aig_ManObjNumMax( pAig );
431  p->pObjs = ABC_CALLOC( Iso_Obj_t, p->nObjs );
432  p->nBins = Abc_PrimeCudd( p->nObjs );
433  p->pBins = ABC_CALLOC( int, p->nBins );
434  p->vSingles = Vec_PtrAlloc( 1000 );
435  p->vClasses = Vec_PtrAlloc( 1000 );
436  p->vTemp1 = Vec_PtrAlloc( 1000 );
437  p->vTemp2 = Vec_PtrAlloc( 1000 );
438  p->nObjIds = 1;
439  return p;
440 }
static int Abc_PrimeCudd(unsigned int p)
Definition: abc_global.h:383
static Llb_Mgr_t * p
Definition: llb3Image.c:950
Vec_Ptr_t * vClasses
Definition: saigIsoSlow.c:290
Vec_Ptr_t * vTemp2
Definition: saigIsoSlow.c:292
Vec_Ptr_t * vSingles
Definition: saigIsoSlow.c:289
static int Aig_ManObjNumMax(Aig_Man_t *p)
Definition: aig.h:259
Vec_Ptr_t * vTemp1
Definition: saigIsoSlow.c:291
Aig_Man_t * pAig
Definition: saigIsoSlow.c:280
static Vec_Ptr_t * Vec_PtrAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: vecPtr.h:83
int * pBins
Definition: saigIsoSlow.c:288
#define ABC_CALLOC(type, num)
Definition: abc_global.h:230
Iso_Obj_t * pObjs
Definition: saigIsoSlow.c:281
void Iso_ManStop ( Iso_Man_t p,
int  fVerbose 
)

Definition at line 441 of file saigIsoSlow.c.

442 {
443  if ( fVerbose )
444  {
445  p->timeOther = p->timeTotal - p->timeHash - p->timeFout;
446  ABC_PRTP( "Building ", p->timeFout, p->timeTotal );
447  ABC_PRTP( "Hashing ", p->timeHash-p->timeSort, p->timeTotal );
448  ABC_PRTP( "Sorting ", p->timeSort, p->timeTotal );
449  ABC_PRTP( "Other ", p->timeOther, p->timeTotal );
450  ABC_PRTP( "TOTAL ", p->timeTotal, p->timeTotal );
451  }
452  Vec_PtrFree( p->vTemp1 );
453  Vec_PtrFree( p->vTemp2 );
454  Vec_PtrFree( p->vClasses );
455  Vec_PtrFree( p->vSingles );
456  ABC_FREE( p->pBins );
457  ABC_FREE( p->pObjs );
458  ABC_FREE( p );
459 }
Vec_Ptr_t * vClasses
Definition: saigIsoSlow.c:290
Vec_Ptr_t * vTemp2
Definition: saigIsoSlow.c:292
#define ABC_PRTP(a, t, T)
Definition: abc_global.h:223
abctime timeTotal
Definition: saigIsoSlow.c:297
abctime timeFout
Definition: saigIsoSlow.c:294
Vec_Ptr_t * vSingles
Definition: saigIsoSlow.c:289
Vec_Ptr_t * vTemp1
Definition: saigIsoSlow.c:291
abctime timeHash
Definition: saigIsoSlow.c:293
abctime timeOther
Definition: saigIsoSlow.c:296
int * pBins
Definition: saigIsoSlow.c:288
abctime timeSort
Definition: saigIsoSlow.c:295
#define ABC_FREE(obj)
Definition: abc_global.h:232
Iso_Obj_t * pObjs
Definition: saigIsoSlow.c:281
static void Vec_PtrFree(Vec_Ptr_t *p)
Definition: vecPtr.h:223
int Iso_ObjCompare ( Iso_Obj_t **  pp1,
Iso_Obj_t **  pp2 
)

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

Synopsis [Compares two objects by their signature.]

Description []

SideEffects []

SeeAlso []

Definition at line 473 of file saigIsoSlow.c.

474 {
475  return -memcmp( *pp1, *pp2, sizeof(int) * ISO_NUM_INTS );
476 }
int memcmp()
#define ISO_NUM_INTS
DECLARATIONS ///.
Definition: saigIsoSlow.c:261
int Iso_ObjCompareByData ( Aig_Obj_t **  pp1,
Aig_Obj_t **  pp2 
)

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

Synopsis [Compares two objects by their ID.]

Description []

SideEffects []

SeeAlso []

Definition at line 489 of file saigIsoSlow.c.

490 {
491  Aig_Obj_t * pIso1 = *pp1;
492  Aig_Obj_t * pIso2 = *pp2;
493  assert( Aig_ObjIsCi(pIso1) || Aig_ObjIsCo(pIso1) );
494  assert( Aig_ObjIsCi(pIso2) || Aig_ObjIsCo(pIso2) );
495  return pIso1->iData - pIso2->iData;
496 }
Definition: aig.h:69
int iData
Definition: aig.h:88
#define assert(ex)
Definition: util_old.h:213
static int Aig_ObjIsCi(Aig_Obj_t *pObj)
Definition: aig.h:275
static int Aig_ObjIsCo(Aig_Obj_t *pObj)
Definition: aig.h:276
static int Iso_ObjHash ( Iso_Obj_t pIso,
int  nBins 
)
inlinestatic

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 509 of file saigIsoSlow.c.

510 {
511  static unsigned BigPrimes[8] = {12582917, 25165843, 50331653, 100663319, 201326611, 402653189, 805306457, 1610612741};
512  unsigned * pArray = (unsigned *)pIso;
513  unsigned i, Value = 0;
514  assert( ISO_NUM_INTS < 8 );
515  for ( i = 0; i < ISO_NUM_INTS; i++ )
516  Value ^= BigPrimes[i] * pArray[i];
517  return Value % nBins;
518 }
#define assert(ex)
Definition: util_old.h:213
#define ISO_NUM_INTS
DECLARATIONS ///.
Definition: saigIsoSlow.c:261
static int Iso_ObjHashAdd ( Iso_Man_t p,
Iso_Obj_t pIso 
)
inlinestatic

Definition at line 519 of file saigIsoSlow.c.

520 {
521  Iso_Obj_t * pThis;
522  int * pPlace = p->pBins + Iso_ObjHash( pIso, p->nBins );
523  p->nEntries++;
524  for ( pThis = Iso_ManObj(p, *pPlace);
525  pThis; pPlace = &pThis->iNext,
526  pThis = Iso_ManObj(p, *pPlace) )
527  if ( Iso_ObjCompare( &pThis, &pIso ) == 0 ) // equal signatures
528  {
529  if ( pThis->iClass == 0 )
530  {
531  p->nClasses++;
532  p->nSingles--;
533  }
534  // add to the list
535  pIso->iClass = pThis->iClass;
536  pThis->iClass = Iso_ObjId( p, pIso );
537  return 1;
538  }
539  // create new list
540  *pPlace = Iso_ObjId( p, pIso );
541  p->nSingles++;
542  return 0;
543 }
static int Iso_ObjId(Iso_Man_t *p, Iso_Obj_t *pObj)
Definition: saigIsoSlow.c:301
static Iso_Obj_t * Iso_ManObj(Iso_Man_t *p, int i)
Definition: saigIsoSlow.c:300
int * pBins
Definition: saigIsoSlow.c:288
static int Iso_ObjHash(Iso_Obj_t *pIso, int nBins)
Definition: saigIsoSlow.c:509
int Iso_ObjCompare(Iso_Obj_t **pp1, Iso_Obj_t **pp2)
Definition: saigIsoSlow.c:473
static int Iso_ObjId ( Iso_Man_t p,
Iso_Obj_t pObj 
)
inlinestatic

Definition at line 301 of file saigIsoSlow.c.

301 { assert( pObj > p->pObjs && pObj < p->pObjs + p->nObjs ); return pObj - p->pObjs; }
#define assert(ex)
Definition: util_old.h:213
Iso_Obj_t * pObjs
Definition: saigIsoSlow.c:281
void Iso_ReadPrimes ( char *  pFileName)

FUNCTION DEFINITIONS ///.

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

Synopsis [Read primes from file.]

Description []

SideEffects []

SeeAlso []

Definition at line 325 of file saigIsoSlow.c.

326 {
327  FILE * pFile;
328  int Nums[10000];
329  int i, j, Temp, nSize = 0;
330  // read the numbers
331  pFile = fopen( pFileName, "rb" );
332  while ( fscanf( pFile, "%d", Nums + nSize++ ) == 1 );
333  fclose( pFile );
334  assert( nSize >= (1<<10) );
335  // randomly permute
336  srand( 111 );
337  for ( i = 0; i < nSize; i++ )
338  {
339  j = rand() % nSize;
340  Temp = Nums[i];
341  Nums[i] = Nums[j];
342  Nums[j] = Temp;
343  }
344  // write out
345  for ( i = 0; i < 64; i++ )
346  {
347  printf( " " );
348  for ( j = 0; j < 16; j++ )
349  printf( "%d,", Nums[i*16+j] );
350  printf( "\n" );
351  }
352 }
#define assert(ex)
Definition: util_old.h:213
Vec_Int_t* Saig_ManFindIsoPerm ( Aig_Man_t pAig,
int  fVerbose 
)

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

Synopsis [Finds canonical permutation of CIs and assigns unique IDs.]

Description []

SideEffects []

SeeAlso []

Definition at line 1170 of file saigIsoSlow.c.

1171 {
1172  int fVeryVerbose = 0;
1173  Vec_Int_t * vRes;
1174  Iso_Man_t * p;
1175  abctime clk = Abc_Clock(), clk2 = Abc_Clock();
1176  p = Iso_ManCreate( pAig );
1177  p->timeFout += Abc_Clock() - clk;
1178  Iso_ManPrintClasses( p, fVerbose, fVeryVerbose );
1179  while ( p->nClasses )
1180  {
1181  // assign adjacency to classes
1182  clk = Abc_Clock();
1184  p->timeFout += Abc_Clock() - clk;
1185  // rehash the class nodes
1186  clk = Abc_Clock();
1188  p->timeHash += Abc_Clock() - clk;
1189  Iso_ManPrintClasses( p, fVerbose, fVeryVerbose );
1190  // force refinement
1191  while ( p->nSingles == 0 && p->nClasses )
1192  {
1193 // Iso_ManPrintClasseSizes( p );
1194  // assign IDs to the topmost level of classes
1195  Iso_ManBreakTies( p, fVerbose );
1196  // assign adjacency to classes
1197  clk = Abc_Clock();
1199  p->timeFout += Abc_Clock() - clk;
1200  // rehash the class nodes
1201  clk = Abc_Clock();
1203  p->timeHash += Abc_Clock() - clk;
1204  Iso_ManPrintClasses( p, fVerbose, fVeryVerbose );
1205  }
1206  }
1207  p->timeTotal = Abc_Clock() - clk2;
1208 // printf( "IDs assigned = %d. Objects = %d.\n", p->nObjIds, 1+Aig_ManCiNum(p->pAig)+Aig_ManNodeNum(p->pAig) );
1209  assert( p->nObjIds == 1+Aig_ManCiNum(p->pAig)+Aig_ManNodeNum(p->pAig) );
1210 // if ( p->nClasses )
1211 // Iso_ManDumpOneClass( p );
1212  vRes = Iso_ManFinalize( p );
1213  Iso_ManStop( p, fVerbose );
1214  return vRes;
1215 }
void Iso_ManBreakTies(Iso_Man_t *p, int fVerbose)
Definition: saigIsoSlow.c:1043
void Iso_ManStop(Iso_Man_t *p, int fVerbose)
Definition: saigIsoSlow.c:441
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 abctime Abc_Clock()
Definition: abc_global.h:279
static int Aig_ManNodeNum(Aig_Man_t *p)
Definition: aig.h:256
abctime timeTotal
Definition: saigIsoSlow.c:297
abctime timeFout
Definition: saigIsoSlow.c:294
void Iso_ManPrintClasses(Iso_Man_t *p, int fVerbose, int fVeryVerbose)
Definition: saigIsoSlow.c:909
Vec_Int_t * Iso_ManFinalize(Iso_Man_t *p)
Definition: saigIsoSlow.c:1087
static int Aig_ManCiNum(Aig_Man_t *p)
Definition: aig.h:251
Iso_Man_t * Iso_ManCreate(Aig_Man_t *pAig)
Definition: saigIsoSlow.c:597
abctime timeHash
Definition: saigIsoSlow.c:293
Aig_Man_t * pAig
Definition: saigIsoSlow.c:280
#define assert(ex)
Definition: util_old.h:213
ABC_INT64_T abctime
Definition: abc_global.h:278
void Iso_ManAssignAdjacency(Iso_Man_t *p)
Definition: saigIsoSlow.c:738
void Iso_ManRehashClassNodes(Iso_Man_t *p)
Definition: saigIsoSlow.c:962

Variable Documentation

int s_1kPrimes[ISO_MASK+1]
static

Definition at line 123 of file saigIsoSlow.c.