diff options
author | Alan Mishchenko <alanmi@berkeley.edu> | 2012-11-06 20:27:31 -0800 |
---|---|---|
committer | Alan Mishchenko <alanmi@berkeley.edu> | 2012-11-06 20:27:31 -0800 |
commit | 2fbb4b18269240ae36b972f797ea436736c422ce (patch) | |
tree | 66a5642bc29073c4cbf1bc8c9382471138e9409f /src/misc | |
parent | db7852bba7cb9e7236b4963985eee1fbbe4c5eb5 (diff) | |
download | abc-2fbb4b18269240ae36b972f797ea436736c422ce.tar.gz abc-2fbb4b18269240ae36b972f797ea436736c422ce.tar.bz2 abc-2fbb4b18269240ae36b972f797ea436736c422ce.zip |
Improved DSD.
Diffstat (limited to 'src/misc')
-rw-r--r-- | src/misc/util/utilTruth.h | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/src/misc/util/utilTruth.h b/src/misc/util/utilTruth.h index f7f250ce..9281d6f8 100644 --- a/src/misc/util/utilTruth.h +++ b/src/misc/util/utilTruth.h @@ -142,6 +142,22 @@ 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_TtXor( 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_TtMux( word * pOut, word * pCtrl, word * pIn1, word * pIn0, int nWords ) +{ + int w; + for ( w = 0; w < nWords; w++ ) + pOut[w] = (pCtrl[w] & pIn1[w]) | (~pCtrl[w] & pIn0[w]); +} static inline int Abc_TtEqual( word * pIn1, word * pIn2, int nWords ) { int w; @@ -182,6 +198,42 @@ static inline int Abc_TtIsConst1( word * pIn1, int nWords ) return 0; return 1; } +static inline void Abc_TtConst0( word * pIn1, int nWords ) +{ + int w; + for ( w = 0; w < nWords; w++ ) + pIn1[w] = 0; +} +static inline void Abc_TtConst1( word * pIn1, int nWords ) +{ + int w; + for ( w = 0; w < nWords; w++ ) + pIn1[w] = ~(word)0; +} + +/**Function************************************************************* + + Synopsis [Compute elementary truth tables.] + + Description [] + + SideEffects [] + + SeeAlso [] + +***********************************************************************/ +static inline void Abc_TtElemInit( word ** pTtElems, int nVars ) +{ + int i, k, nWords = Abc_TtWordNum( nVars ); + for ( i = 0; i < nVars; i++ ) + if ( i < 6 ) + for ( k = 0; k < nWords; k++ ) + pTtElems[i][k] = s_Truths6[i]; + else + for ( k = 0; k < nWords; k++ ) + pTtElems[i][k] = (k & (1 << (i-6))) ? ~(word)0 : 0; +} + /**Function************************************************************* |