diff options
author | Alan Mishchenko <alanmi@berkeley.edu> | 2014-04-04 13:14:16 -0700 |
---|---|---|
committer | Alan Mishchenko <alanmi@berkeley.edu> | 2014-04-04 13:14:16 -0700 |
commit | f6ae0e41f338a109ad2c973ace13b728f4947e14 (patch) | |
tree | 7092fea7145cfce4a903d8e8878fe9ec547ae2f1 /src/misc | |
parent | 11bab8caf92416c6e9bf9dc7fb187a0d49d756b0 (diff) | |
download | abc-f6ae0e41f338a109ad2c973ace13b728f4947e14.tar.gz abc-f6ae0e41f338a109ad2c973ace13b728f4947e14.tar.bz2 abc-f6ae0e41f338a109ad2c973ace13b728f4947e14.zip |
Better CEX minimization and renaming of write_counter into write_cex.
Diffstat (limited to 'src/misc')
-rw-r--r-- | src/misc/util/utilCex.c | 27 | ||||
-rw-r--r-- | src/misc/util/utilCex.h | 1 |
2 files changed, 28 insertions, 0 deletions
diff --git a/src/misc/util/utilCex.c b/src/misc/util/utilCex.c index 1399f55d..2f2901e0 100644 --- a/src/misc/util/utilCex.c +++ b/src/misc/util/utilCex.c @@ -488,6 +488,33 @@ Abc_Cex_t * Abc_CexPermuteTwo( Abc_Cex_t * p, Vec_Int_t * vPermOld, Vec_Int_t * return pCex; } +/**Function************************************************************* + + Synopsis [Count the number of 1s in the CEX.] + + Description [] + + SideEffects [] + + SeeAlso [] + +***********************************************************************/ +static inline int Abc_CexOnes32( unsigned i ) +{ + i = i - ((i >> 1) & 0x55555555); + i = (i & 0x33333333) + ((i >> 2) & 0x33333333); + i = ((i + (i >> 4)) & 0x0F0F0F0F); + return (i*(0x01010101))>>24; +} +int Abc_CexCountOnes( Abc_Cex_t * p ) +{ + int nWords = Abc_BitWordNum( p->nBits ); + int i, Count = 0; + for ( i = 0; i < nWords; i++ ) + Count += Abc_CexOnes32( p->pData[i] ); + return Count; +} + //////////////////////////////////////////////////////////////////////// /// END OF FILE /// //////////////////////////////////////////////////////////////////////// diff --git a/src/misc/util/utilCex.h b/src/misc/util/utilCex.h index 98463410..c6904a60 100644 --- a/src/misc/util/utilCex.h +++ b/src/misc/util/utilCex.h @@ -72,6 +72,7 @@ extern Abc_Cex_t * Abc_CexTransformPhase( Abc_Cex_t * p, int nPisOld, int nPos extern Abc_Cex_t * Abc_CexTransformTempor( Abc_Cex_t * p, int nPisOld, int nPosOld, int nRegsOld ); extern Abc_Cex_t * Abc_CexPermute( Abc_Cex_t * p, Vec_Int_t * vMapOld2New ); extern Abc_Cex_t * Abc_CexPermuteTwo( Abc_Cex_t * p, Vec_Int_t * vPermOld, Vec_Int_t * vPermNew ); +extern int Abc_CexCountOnes( Abc_Cex_t * p ); ABC_NAMESPACE_HEADER_END |