diff options
author | Alan Mishchenko <alanmi@berkeley.edu> | 2007-03-28 08:01:00 -0700 |
---|---|---|
committer | Alan Mishchenko <alanmi@berkeley.edu> | 2007-03-28 08:01:00 -0700 |
commit | 4da784c049b79b76d8c1b82297bd27f45ead9377 (patch) | |
tree | 8e69de9f95a13f1ef6ec9f3624be997ef080dc0d /src/misc/extra/extraUtilTruth.c | |
parent | dd5531caf916d526551049b59151990adaef575d (diff) | |
download | abc-4da784c049b79b76d8c1b82297bd27f45ead9377.tar.gz abc-4da784c049b79b76d8c1b82297bd27f45ead9377.tar.bz2 abc-4da784c049b79b76d8c1b82297bd27f45ead9377.zip |
Version abc70328
Diffstat (limited to 'src/misc/extra/extraUtilTruth.c')
-rw-r--r-- | src/misc/extra/extraUtilTruth.c | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/src/misc/extra/extraUtilTruth.c b/src/misc/extra/extraUtilTruth.c index 7a22545b..3b0b16eb 100644 --- a/src/misc/extra/extraUtilTruth.c +++ b/src/misc/extra/extraUtilTruth.c @@ -62,6 +62,42 @@ static unsigned s_VarMasks[5][2] = { /**Function************************************************************* + Synopsis [Derive elementary truth tables.] + + Description [] + + SideEffects [] + + SeeAlso [] + +***********************************************************************/ +unsigned ** Extra_TruthElementary( int nVars ) +{ + unsigned ** pRes; + int i, k, nWords; + nWords = Extra_TruthWordNum(nVars); + pRes = (unsigned **)Extra_ArrayAlloc( nVars, nWords, 4 ); + for ( i = 0; i < nVars; i++ ) + { + if ( i < 5 ) + { + for ( k = 0; k < nWords; k++ ) + pRes[i][k] = s_VarMasks[i][1]; + } + else + { + for ( k = 0; k < nWords; k++ ) + if ( k & (1 << (i-5)) ) + pRes[i][k] = ~(unsigned)0; + else + pRes[i][k] = 0; + } + } + return pRes; +} + +/**Function************************************************************* + Synopsis [Swaps two adjacent variables in the truth table.] Description [Swaps var number Start and var number Start+1 (0-based numbers). |