diff options
author | Alan Mishchenko <alanmi@berkeley.edu> | 2014-06-26 09:51:53 -0700 |
---|---|---|
committer | Alan Mishchenko <alanmi@berkeley.edu> | 2014-06-26 09:51:53 -0700 |
commit | a68ec38df1cbe557a46d53cf28bbe74a00bc979a (patch) | |
tree | 57c4dd063b078d355df8a55ba62780157cf896d2 | |
parent | 2edf2a970ee3663ef0725f22972a10083ed81fbf (diff) | |
download | abc-a68ec38df1cbe557a46d53cf28bbe74a00bc979a.tar.gz abc-a68ec38df1cbe557a46d53cf28bbe74a00bc979a.tar.bz2 abc-a68ec38df1cbe557a46d53cf28bbe74a00bc979a.zip |
Changes and improvements to different packages.
-rw-r--r-- | abclib.dsp | 4 | ||||
-rw-r--r-- | src/aig/gia/gia.h | 49 | ||||
-rw-r--r-- | src/base/abci/abc.c | 3 | ||||
-rw-r--r-- | src/misc/util/utilNam.h | 3 | ||||
-rw-r--r-- | src/misc/vec/vecInt.h | 19 |
5 files changed, 60 insertions, 18 deletions
@@ -3895,6 +3895,10 @@ SOURCE=.\src\aig\gia\giaStg.c # End Source File # Begin Source File +SOURCE=.\src\aig\gia\giaStr.c +# End Source File +# Begin Source File + SOURCE=.\src\aig\gia\giaSupMin.c # End Source File # Begin Source File diff --git a/src/aig/gia/gia.h b/src/aig/gia/gia.h index 0dd657aa..46e20a5b 100644 --- a/src/aig/gia/gia.h +++ b/src/aig/gia/gia.h @@ -609,11 +609,20 @@ static inline int Gia_ManAppendXorReal( Gia_Man_t * p, int iLit0, int iLit1 ) assert( Abc_Lit2Var(iLit0) != Abc_Lit2Var(iLit1) ); assert( !Abc_LitIsCompl(iLit0) ); assert( !Abc_LitIsCompl(iLit1) ); - assert( Abc_Lit2Var(iLit0) > Abc_Lit2Var(iLit1) ); - pObj->iDiff0 = Gia_ObjId(p, pObj) - Abc_Lit2Var(iLit0); - pObj->fCompl0 = Abc_LitIsCompl(iLit0); - pObj->iDiff1 = Gia_ObjId(p, pObj) - Abc_Lit2Var(iLit1); - pObj->fCompl1 = Abc_LitIsCompl(iLit1); + if ( Abc_Lit2Var(iLit0) > Abc_Lit2Var(iLit1) ) + { + pObj->iDiff0 = Gia_ObjId(p, pObj) - Abc_Lit2Var(iLit0); + pObj->fCompl0 = Abc_LitIsCompl(iLit0); + pObj->iDiff1 = Gia_ObjId(p, pObj) - Abc_Lit2Var(iLit1); + pObj->fCompl1 = Abc_LitIsCompl(iLit1); + } + else + { + pObj->iDiff1 = Gia_ObjId(p, pObj) - Abc_Lit2Var(iLit0); + pObj->fCompl1 = Abc_LitIsCompl(iLit0); + pObj->iDiff0 = Gia_ObjId(p, pObj) - Abc_Lit2Var(iLit1); + pObj->fCompl0 = Abc_LitIsCompl(iLit1); + } p->nXors++; return Gia_ObjId( p, pObj ) << 1; } @@ -627,13 +636,23 @@ static inline int Gia_ManAppendMuxReal( Gia_Man_t * p, int iLitC, int iLit1, int assert( Abc_Lit2Var(iLit0) != Abc_Lit2Var(iLit1) ); assert( Abc_Lit2Var(iLitC) != Abc_Lit2Var(iLit0) ); assert( Abc_Lit2Var(iLitC) != Abc_Lit2Var(iLit1) ); - assert( Abc_Lit2Var(iLit0) < Abc_Lit2Var(iLit1) ); - assert( !Abc_LitIsCompl(iLit1) ); - pObj->iDiff0 = Gia_ObjId(p, pObj) - Abc_Lit2Var(iLit0); - pObj->fCompl0 = Abc_LitIsCompl(iLit0); - pObj->iDiff1 = Gia_ObjId(p, pObj) - Abc_Lit2Var(iLit1); - pObj->fCompl1 = Abc_LitIsCompl(iLit1); - p->pMuxes[Gia_ObjId(p, pObj)] = iLitC; + assert( !p->pHTable || !Abc_LitIsCompl(iLit1) ); + if ( Abc_Lit2Var(iLit0) < Abc_Lit2Var(iLit1) ) + { + pObj->iDiff0 = Gia_ObjId(p, pObj) - Abc_Lit2Var(iLit0); + pObj->fCompl0 = Abc_LitIsCompl(iLit0); + pObj->iDiff1 = Gia_ObjId(p, pObj) - Abc_Lit2Var(iLit1); + pObj->fCompl1 = Abc_LitIsCompl(iLit1); + p->pMuxes[Gia_ObjId(p, pObj)] = iLitC; + } + else + { + pObj->iDiff1 = Gia_ObjId(p, pObj) - Abc_Lit2Var(iLit0); + pObj->fCompl1 = Abc_LitIsCompl(iLit0); + pObj->iDiff0 = Gia_ObjId(p, pObj) - Abc_Lit2Var(iLit1); + pObj->fCompl0 = Abc_LitIsCompl(iLit1); + p->pMuxes[Gia_ObjId(p, pObj)] = Abc_LitNot(iLitC); + } p->nMuxes++; return Gia_ObjId( p, pObj ) << 1; } @@ -916,13 +935,15 @@ static inline int Gia_ObjLutFanin( Gia_Man_t * p, int Id, int i ) { re for ( i = 0; (i < Vec_IntSize(vVec)) && ((pObj) = Gia_ManObj(p, Abc_Lit2Var(Vec_IntEntry(vVec,i)))) && (((fCompl) = Abc_LitIsCompl(Vec_IntEntry(vVec,i))),1); i++ ) #define Gia_ManForEachObjReverse( p, pObj, i ) \ for ( i = p->nObjs - 1; (i >= 0) && ((pObj) = Gia_ManObj(p, i)); i-- ) -#define Gia_ManForEachObjReverse1( p, pObj, i ) \ +#define Gia_ManForEachObjReverse1( p, pObj, i ) \ for ( i = p->nObjs - 1; (i > 0) && ((pObj) = Gia_ManObj(p, i)); i-- ) #define Gia_ManForEachAnd( p, pObj, i ) \ for ( i = 0; (i < p->nObjs) && ((pObj) = Gia_ManObj(p, i)); i++ ) if ( !Gia_ObjIsAnd(pObj) ) {} else #define Gia_ManForEachAndId( p, i ) \ for ( i = 0; (i < p->nObjs); i++ ) if ( !Gia_ObjIsAnd(Gia_ManObj(p, i)) ) {} else -#define Gia_ManForEachCand( p, pObj, i ) \ +#define Gia_ManForEachMuxId( p, i ) \ + for ( i = 0; (i < p->nObjs); i++ ) if ( !Gia_ObjIsMuxId(p, i) ) {} else +#define Gia_ManForEachCand( p, pObj, i ) \ for ( i = 0; (i < p->nObjs) && ((pObj) = Gia_ManObj(p, i)); i++ ) if ( !Gia_ObjIsCand(pObj) ) {} else #define Gia_ManForEachAndReverse( p, pObj, i ) \ for ( i = p->nObjs - 1; (i > 0) && ((pObj) = Gia_ManObj(p, i)); i-- ) if ( !Gia_ObjIsAnd(pObj) ) {} else diff --git a/src/base/abci/abc.c b/src/base/abci/abc.c index 9b6a9076..c08b23fd 100644 --- a/src/base/abci/abc.c +++ b/src/base/abci/abc.c @@ -35937,6 +35937,7 @@ int Abc_CommandAbc9Test( Abc_Frame_t * pAbc, int argc, char ** argv ) // extern void Gia_ParTest( Gia_Man_t * p, int nWords, int nProcs ); // extern void Gia_ManTisTest( Gia_Man_t * pInit ); extern void Gia_Iso3Test( Gia_Man_t * p ); +// extern Gia_Man_t * Str_NormalizeTest( Gia_Man_t * p ); Extra_UtilGetoptReset(); while ( ( c = Extra_UtilGetopt( argc, argv, "WPFsvh" ) ) != EOF ) @@ -36041,6 +36042,8 @@ int Abc_CommandAbc9Test( Abc_Frame_t * pAbc, int argc, char ** argv ) // Gia_ManCheckFalseTest( pAbc->pGia, nFrames ); // Gia_ParTest( pAbc->pGia, nWords, nProcs ); Gia_Iso3Test( pAbc->pGia ); +// pTemp = Str_NormalizeTest( pAbc->pGia ); +// Abc_FrameUpdateGia( pAbc, pTemp ); // printf( "\nThis command is currently disabled.\n\n" ); return 0; diff --git a/src/misc/util/utilNam.h b/src/misc/util/utilNam.h index be8067a9..9f3048f3 100644 --- a/src/misc/util/utilNam.h +++ b/src/misc/util/utilNam.h @@ -42,6 +42,9 @@ typedef struct Abc_Nam_t_ Abc_Nam_t; /// MACRO DEFINITIONS /// //////////////////////////////////////////////////////////////////////// +#define Abc_NamManForEachObj( p, pStr, i ) \ + for ( i = 1; (i < Abc_NamObjNumMax(p)) && ((pStr) = Abc_NamStr(p, i)); i++ ) + //////////////////////////////////////////////////////////////////////// /// FUNCTION DECLARATIONS /// //////////////////////////////////////////////////////////////////////// diff --git a/src/misc/vec/vecInt.h b/src/misc/vec/vecInt.h index 535a15ef..6d015bcc 100644 --- a/src/misc/vec/vecInt.h +++ b/src/misc/vec/vecInt.h @@ -1715,16 +1715,27 @@ static inline void Vec_IntSelectSort( int * pArray, int nSize ) ***********************************************************************/ static inline void Vec_IntSelectSortCost( int * pArray, int nSize, Vec_Int_t * vCosts ) { - int temp, i, j, best_i; + int i, j, best_i; for ( i = 0; i < nSize-1; i++ ) { best_i = i; for ( j = i+1; j < nSize; j++ ) if ( Vec_IntEntry(vCosts, pArray[j]) < Vec_IntEntry(vCosts, pArray[best_i]) ) best_i = j; - temp = pArray[i]; - pArray[i] = pArray[best_i]; - pArray[best_i] = temp; + ABC_SWAP( int, pArray[i], pArray[best_i] ); + } +} +static inline void Vec_IntSelectSortCost2( int * pArray, int nSize, int * pCosts ) +{ + int i, j, best_i; + for ( i = 0; i < nSize-1; i++ ) + { + best_i = i; + for ( j = i+1; j < nSize; j++ ) + if ( pCosts[j] < pCosts[best_i] ) + best_i = j; + ABC_SWAP( int, pArray[i], pArray[best_i] ); + ABC_SWAP( int, pCosts[i], pCosts[best_i] ); } } |