diff options
author | Alan Mishchenko <alanmi@berkeley.edu> | 2019-05-30 19:27:31 -0700 |
---|---|---|
committer | Alan Mishchenko <alanmi@berkeley.edu> | 2019-05-30 19:27:31 -0700 |
commit | 38e2f41655d4d44ccfa935b5b8d687596124c169 (patch) | |
tree | 0b3638a364e510dfb1dea42caf938bc60ae2d54d /src/misc/util | |
parent | 62487de97bd3fc2f0b72cdb20763e1d542dffe71 (diff) | |
download | abc-38e2f41655d4d44ccfa935b5b8d687596124c169.tar.gz abc-38e2f41655d4d44ccfa935b5b8d687596124c169.tar.bz2 abc-38e2f41655d4d44ccfa935b5b8d687596124c169.zip |
Updating command 'symfun' to generate symmetric functions and their NPN classes.
Diffstat (limited to 'src/misc/util')
-rw-r--r-- | src/misc/util/utilTruth.h | 27 |
1 files changed, 26 insertions, 1 deletions
diff --git a/src/misc/util/utilTruth.h b/src/misc/util/utilTruth.h index 8d28d33e..6fa5e0a3 100644 --- a/src/misc/util/utilTruth.h +++ b/src/misc/util/utilTruth.h @@ -3191,7 +3191,32 @@ static inline void Abc_TtTestFullySymmetric() } -/*=== utilTruth.c ===========================================================*/ +/**Function************************************************************* + + Synopsis [Generates truth table of a symmetric function.] + + Description [] + + SideEffects [] + + SeeAlso [] + +***********************************************************************/ +static inline word * Abc_TtSymFunGenerate( char * pOnes, int nVars ) +{ + int m, k, Count; + word * pTruth = ABC_CALLOC( word, Abc_TtWordNum(nVars) ); + assert( (int)strlen(pOnes) == nVars + 1 ); + for ( m = 0; m < (1 << nVars); m++ ) + { + Count = 0; + for ( k = 0; k < nVars; k++ ) + Count += (m >> k) & 1; + if ( pOnes[Count] == '1' ) + Abc_TtXorBit( pTruth, m ); + } + return pTruth; +} ABC_NAMESPACE_HEADER_END |