From 8c8f39ad7603362c7e16598d1888313f2e6ca0a0 Mon Sep 17 00:00:00 2001 From: Alan Mishchenko Date: Mon, 27 Jan 2020 10:32:07 -0800 Subject: Adding several new utilities. --- src/misc/util/utilTruth.h | 102 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 102 insertions(+) (limited to 'src/misc/util') diff --git a/src/misc/util/utilTruth.h b/src/misc/util/utilTruth.h index 6fa5e0a3..10196959 100644 --- a/src/misc/util/utilTruth.h +++ b/src/misc/util/utilTruth.h @@ -441,6 +441,108 @@ static inline void Abc_TtIthVar( word * pOut, int iVar, int nVars ) } } +/**Function************************************************************* + + Synopsis [] + + Description [] + + SideEffects [] + + SeeAlso [] + +***********************************************************************/ +static inline int Abc_TtIsAndCompl( word * pOut, int fCompl, word * pIn1, int fCompl1, word * pIn2, int fCompl2, word * pCare, int nWords ) +{ + int w; + if ( fCompl ) + { + if ( fCompl1 ) + { + if ( fCompl2 ) + { + for ( w = 0; w < nWords; w++ ) + if ( (~pOut[w] & pCare[w]) != (~pIn1[w] & ~pIn2[w] & pCare[w]) ) + return 0; + } + else + { + for ( w = 0; w < nWords; w++ ) + if ( (~pOut[w] & pCare[w]) != (~pIn1[w] & pIn2[w] & pCare[w]) ) + return 0; + } + } + else + { + if ( fCompl2 ) + { + for ( w = 0; w < nWords; w++ ) + if ( (~pOut[w] & pCare[w]) != (pIn1[w] & ~pIn2[w] & pCare[w]) ) + return 0; + } + else + { + for ( w = 0; w < nWords; w++ ) + if ( (~pOut[w] & pCare[w]) != (pIn1[w] & pIn2[w] & pCare[w]) ) + return 0; + } + } + } + else + { + if ( fCompl1 ) + { + if ( fCompl2 ) + { + for ( w = 0; w < nWords; w++ ) + if ( (pOut[w] & pCare[w]) != (~pIn1[w] & ~pIn2[w] & pCare[w]) ) + return 0; + } + else + { + for ( w = 0; w < nWords; w++ ) + if ( (pOut[w] & pCare[w]) != (~pIn1[w] & pIn2[w] & pCare[w]) ) + return 0; + } + } + else + { + if ( fCompl2 ) + { + for ( w = 0; w < nWords; w++ ) + if ( (pOut[w] & pCare[w]) != (pIn1[w] & ~pIn2[w] & pCare[w]) ) + return 0; + } + else + { + for ( w = 0; w < nWords; w++ ) + if ( (pOut[w] & pCare[w]) != (pIn1[w] & pIn2[w] & pCare[w]) ) + return 0; + } + } + } + return 1; +} + +static inline int Abc_TtIsXorCompl( word * pOut, int fCompl, word * pIn1, word * pIn2, word * pCare, int nWords ) +{ + int w; + if ( fCompl ) + { + for ( w = 0; w < nWords; w++ ) + if ( (~pOut[w] & pCare[w]) != ((pIn1[w] ^ pIn2[w]) & pCare[w]) ) + return 0; + } + else + { + for ( w = 0; w < nWords; w++ ) + if ( ( pOut[w] & pCare[w]) != ((pIn1[w] ^ pIn2[w]) & pCare[w]) ) + return 0; + } + return 1; +} + + /**Function************************************************************* Synopsis [Compares Cof0 and Cof1.] -- cgit v1.2.3