diff options
author | Alan Mishchenko <alanmi@berkeley.edu> | 2015-11-05 15:27:33 -0800 |
---|---|---|
committer | Alan Mishchenko <alanmi@berkeley.edu> | 2015-11-05 15:27:33 -0800 |
commit | 6b7aa389a67e4b2de33360f150cac27690226b65 (patch) | |
tree | c591349c1470b6caabd52dc045495ea01899008a /src/misc/util | |
parent | c610c036616d0b06e9036c4d17be6168619a6332 (diff) | |
download | abc-6b7aa389a67e4b2de33360f150cac27690226b65.tar.gz abc-6b7aa389a67e4b2de33360f150cac27690226b65.tar.bz2 abc-6b7aa389a67e4b2de33360f150cac27690226b65.zip |
Improvements to storing and reusing simulation info.
Diffstat (limited to 'src/misc/util')
-rw-r--r-- | src/misc/util/utilIsop.c | 4 | ||||
-rw-r--r-- | src/misc/util/utilTruth.h | 57 |
2 files changed, 59 insertions, 2 deletions
diff --git a/src/misc/util/utilIsop.c b/src/misc/util/utilIsop.c index 292faf61..849c09ee 100644 --- a/src/misc/util/utilIsop.c +++ b/src/misc/util/utilIsop.c @@ -790,7 +790,7 @@ word Abc_EsopCheck( word * pOn, int nVars, word CostLim, int * pCover ) SeeAlso [] ***********************************************************************/ -static inline int Abc_TtIntersect( word * pIn1, word * pIn2, int nWords ) +static inline int Abc_TtIntersect2( word * pIn1, word * pIn2, int nWords ) { int w; for ( w = 0; w < nWords; w++ ) @@ -963,7 +963,7 @@ word Abc_IsopNew( word * pOn, word * pOnDc, word * pRes, int nVars, word CostLim Abc_TtSetBit( pCube, iMint ^ (1 << uTwo) ); Abc_TtSetBit( pCube, iMint ^ (1 << vTwo) ^ (1 << uTwo) ); Cube &= ~(3 << Abc_Var2Lit(vTwo, 0)) & ~(3 << Abc_Var2Lit(uTwo, 0)); - assert( !Abc_TtIntersect(pCube, pOffset, nWords) ); + assert( !Abc_TtIntersect2(pCube, pOffset, nWords) ); // expand against offset for ( v = 0; v < nVars; v++ ) if ( v != vTwo && v != uTwo ) diff --git a/src/misc/util/utilTruth.h b/src/misc/util/utilTruth.h index 88d52a4d..9628ae5d 100644 --- a/src/misc/util/utilTruth.h +++ b/src/misc/util/utilTruth.h @@ -192,6 +192,18 @@ static inline int Abc_TtHexDigitNum( int nVars ) { return nVars <= 2 ? 1 : 1 << ***********************************************************************/ static inline word Abc_Tt6Mask( int nBits ) { assert( nBits >= 0 && nBits <= 64 ); return (~(word)0) >> (64-nBits); } +static inline void Abc_TtMask( word * pTruth, int nWords, int nBits ) +{ + int w; + assert( nBits >= 0 && nBits <= nWords * 64 ); + for ( w = 0; w < nWords; w++ ) + if ( nBits >= (w + 1) * 64 ) + pTruth[w] = ~(word)0; + else if ( nBits > w * 64 ) + pTruth[w] = Abc_Tt6Mask( nBits - w * 64 ); + else + pTruth[w] = 0; +} /**Function************************************************************* @@ -254,6 +266,16 @@ static inline void Abc_TtAnd( word * pOut, word * pIn1, word * pIn2, int nWords, for ( w = 0; w < nWords; w++ ) pOut[w] = pIn1[w] & pIn2[w]; } +static inline void Abc_TtAndSharp( word * pOut, word * pIn1, word * pIn2, int nWords, int fCompl ) +{ + int w; + if ( fCompl ) + for ( w = 0; w < nWords; w++ ) + pOut[w] = pIn1[w] & ~pIn2[w]; + else + for ( w = 0; w < nWords; w++ ) + pOut[w] = pIn1[w] & pIn2[w]; +} static inline void Abc_TtSharp( word * pOut, word * pIn1, word * pIn2, int nWords ) { int w; @@ -282,6 +304,23 @@ static inline void Abc_TtMux( word * pOut, word * pCtrl, word * pIn1, word * pIn for ( w = 0; w < nWords; w++ ) pOut[w] = (pCtrl[w] & pIn1[w]) | (~pCtrl[w] & pIn0[w]); } +static inline int Abc_TtIntersect( word * pIn1, word * pIn2, int nWords, int fCompl ) +{ + int w; + if ( fCompl ) + { + for ( w = 0; w < nWords; w++ ) + if ( ~pIn1[w] & pIn2[w] ) + return 1; + } + else + { + for ( w = 0; w < nWords; w++ ) + if ( pIn1[w] & pIn2[w] ) + return 1; + } + return 0; +} static inline int Abc_TtEqual( word * pIn1, word * pIn2, int nWords ) { int w; @@ -1509,6 +1548,24 @@ static inline int Abc_TtCountOnes( word x ) x = x + (x >> 32); return (int)(x & 0xFF); } +static inline int Abc_TtCountOnesVec( word * x, int nWords ) +{ + int w, Count = 0; + for ( w = 0; w < nWords; w++ ) + Count += Abc_TtCountOnes( x[w] ); + return Count; +} +static inline int Abc_TtCountOnesVecMask( word * x, word * pMask, int nWords, int fCompl ) +{ + int w, Count = 0; + if ( fCompl ) + for ( w = 0; w < nWords; w++ ) + Count += Abc_TtCountOnes( pMask[w] & ~x[w] ); + else + for ( w = 0; w < nWords; w++ ) + Count += Abc_TtCountOnes( pMask[w] & x[w] ); + return Count; +} /**Function************************************************************* |