ABC: A System for Sequential Synthesis and Verification
 
Loading...
Searching...
No Matches
saigIsoSlow.c File Reference
#include "saig.h"
Include dependency graph for saigIsoSlow.c:

Go to the source code of this file.

Classes

struct  Iso_Obj_t_
 
struct  Iso_Man_t_
 

Macros

#define ISO_MASK   0x3FF
 
#define ISO_NUM_INTS   3
 DECLARATIONS ///.
 
#define Iso_ManForEachObj(p, pObj, i)
 

Typedefs

typedef struct Iso_Obj_t_ Iso_Obj_t
 
typedef struct Iso_Man_t_ Iso_Man_t
 

Functions

void Iso_ReadPrimes (char *pFileName)
 FUNCTION DEFINITIONS ///.
 
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)
 
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)
 

Macro Definition Documentation

◆ Iso_ManForEachObj

#define Iso_ManForEachObj ( p,
pObj,
i )
Value:
for ( i = 1; (i < p->nObjs) && ((pObj) = Iso_ManObj(p, i)); i++ ) if ( pIso->Level == -1 ) {} else
Cube * p
Definition exorList.c:222

Definition at line 304 of file saigIsoSlow.c.

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

◆ ISO_MASK

#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.

◆ ISO_NUM_INTS

#define ISO_NUM_INTS   3

DECLARATIONS ///.

Definition at line 261 of file saigIsoSlow.c.

Typedef Documentation

◆ Iso_Man_t

typedef struct Iso_Man_t_ Iso_Man_t

Definition at line 277 of file saigIsoSlow.c.

◆ Iso_Obj_t

typedef struct Iso_Obj_t_ Iso_Obj_t

Definition at line 263 of file saigIsoSlow.c.

Function Documentation

◆ Iso_FindNumbers()

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}

◆ Iso_ManAssignAdjacency()

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}
#define Aig_ManForEachObj(p, pObj, i)
Definition aig.h:403
struct Aig_Obj_t_ Aig_Obj_t
Definition aig.h:51
#define Aig_ManForEachObjReverse(p, pObj, i)
Definition aig.h:405
#define Aig_ManForEachLiLoSeq(p, pObjLi, pObjLo, k)
Definition aig.h:450
#define ISO_MASK
Definition giaIso.c:26
struct Iso_Obj_t_ Iso_Obj_t
unsigned FanoutSig
unsigned FaninSig
#define assert(ex)
Definition util_old.h:213
Here is the caller graph for this function:

◆ Iso_ManBreakTies()

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}
Iso_Obj_t * Iso_ManFindBestObj(Iso_Man_t *p, Iso_Obj_t *pIso)
unsigned Level
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.
Definition vecPtr.h:55
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Iso_ManCollectClasses()

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 (*)(const void *, const void *))Iso_ObjCompare );
576 Vec_PtrSort( p->vClasses, (int (*)(const void *, const 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}
ABC_INT64_T abctime
Definition abc_global.h:332
int Iso_ObjCompare(Iso_Obj_t **pp1, Iso_Obj_t **pp2)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Iso_ManCreate()

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}
void Iso_ManCollectClasses(Iso_Man_t *p)
Iso_Man_t * Iso_ManStart(Aig_Man_t *pAig)
struct Iso_Man_t_ Iso_Man_t
unsigned Level
Definition aig.h:82
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Iso_ManDumpOneClass()

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}
void Aig_ManStopP(Aig_Man_t **p)
Definition aigMan.c:246
typedefABC_NAMESPACE_HEADER_START struct Aig_Man_t_ Aig_Man_t
INCLUDES ///.
Definition aig.h:50
Aig_Man_t * Aig_ManDupNodes(Aig_Man_t *pMan, Vec_Ptr_t *vArray)
Definition aigDup.c:1302
void Aig_ManShow(Aig_Man_t *pMan, int fHaig, Vec_Ptr_t *vBold)
Definition aigShow.c:341
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition vecPtr.h:42
Here is the call graph for this function:

◆ Iso_ManFinalize()

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 (*)(const void *, const void *))Iso_ObjCompareByData );
1119 Vec_PtrSort( p->vTemp2, (int (*)(const void *, const 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}
#define Aig_ManForEachCi(p, pObj, i)
ITERATORS ///.
Definition aig.h:393
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition bblif.c:37
int Iso_ObjCompareByData(Aig_Obj_t **pp1, Aig_Obj_t **pp2)
int iData
Definition aig.h:88
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Iso_ManFindBestObj()

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)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Iso_ManObjCount()

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}
void Aig_ManIncrementTravId(Aig_Man_t *p)
DECLARATIONS ///.
Definition aigUtil.c:44
void Iso_ManObjCount_rec(Aig_Man_t *p, Aig_Obj_t *pObj, int *pnNodes, int *pnEdges)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Iso_ManObjCount_rec()

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}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Iso_ManPrintClasses()

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}
Here is the caller graph for this function:

◆ Iso_ManPrintClasseSizes()

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}

◆ Iso_ManRehashClassNodes()

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()
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Iso_ManStart()

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}
#define ABC_CALLOC(type, num)
Definition abc_global.h:265
Here is the caller graph for this function:

◆ Iso_ManStop()

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}
#define ABC_PRTP(a, t, T)
Definition abc_global.h:258
#define ABC_FREE(obj)
Definition abc_global.h:267
Here is the caller graph for this function:

◆ Iso_ObjCompare()

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}
#define ISO_NUM_INTS
DECLARATIONS ///.
int memcmp()
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Iso_ObjCompareByData()

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}
Here is the caller graph for this function:

◆ Iso_ReadPrimes()

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}

◆ Saig_ManFindIsoPerm()

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}
Vec_Int_t * Iso_ManFinalize(Iso_Man_t *p)
void Iso_ManPrintClasses(Iso_Man_t *p, int fVerbose, int fVeryVerbose)
void Iso_ManStop(Iso_Man_t *p, int fVerbose)
void Iso_ManBreakTies(Iso_Man_t *p, int fVerbose)
void Iso_ManRehashClassNodes(Iso_Man_t *p)
void Iso_ManAssignAdjacency(Iso_Man_t *p)
Iso_Man_t * Iso_ManCreate(Aig_Man_t *pAig)
Here is the call graph for this function:
Here is the caller graph for this function: