From 3814121784af2250e2d5f17173b209e74cb7ae45 Mon Sep 17 00:00:00 2001 From: Alan Mishchenko Date: Wed, 14 Jun 2006 08:01:00 -0700 Subject: Version abc60614 --- src/misc/extra/extra.h | 40 ++++++++++++++++++++++++++++++++++++++++ src/misc/extra/extraUtilTruth.c | 8 ++++---- 2 files changed, 44 insertions(+), 4 deletions(-) (limited to 'src/misc') diff --git a/src/misc/extra/extra.h b/src/misc/extra/extra.h index d404dbc6..9f3b4cc7 100644 --- a/src/misc/extra/extra.h +++ b/src/misc/extra/extra.h @@ -417,12 +417,40 @@ static inline int Extra_TruthIsEqual( unsigned * pIn0, unsigned * pIn1, int nVar return 0; return 1; } +static inline int Extra_TruthIsConst0( unsigned * pIn, int nVars ) +{ + int w; + for ( w = Extra_TruthWordNum(nVars)-1; w >= 0; w-- ) + if ( pIn[w] ) + return 0; + return 1; +} +static inline int Extra_TruthIsConst1( unsigned * pIn, int nVars ) +{ + int w; + for ( w = Extra_TruthWordNum(nVars)-1; w >= 0; w-- ) + if ( pIn[w] != ~(unsigned)0 ) + return 0; + return 1; +} static inline void Extra_TruthCopy( unsigned * pOut, unsigned * pIn, int nVars ) { int w; for ( w = Extra_TruthWordNum(nVars)-1; w >= 0; w-- ) pOut[w] = pIn[w]; } +static inline void Extra_TruthClear( unsigned * pOut, int nVars ) +{ + int w; + for ( w = Extra_TruthWordNum(nVars)-1; w >= 0; w-- ) + pOut[w] = 0; +} +static inline void Extra_TruthFill( unsigned * pOut, int nVars ) +{ + int w; + for ( w = Extra_TruthWordNum(nVars)-1; w >= 0; w-- ) + pOut[w] = ~(unsigned)0; +} static inline void Extra_TruthNot( unsigned * pOut, unsigned * pIn, int nVars ) { int w; @@ -435,6 +463,18 @@ static inline void Extra_TruthAnd( unsigned * pOut, unsigned * pIn0, unsigned * for ( w = Extra_TruthWordNum(nVars)-1; w >= 0; w-- ) pOut[w] = pIn0[w] & pIn1[w]; } +static inline void Extra_TruthOr( unsigned * pOut, unsigned * pIn0, unsigned * pIn1, int nVars ) +{ + int w; + for ( w = Extra_TruthWordNum(nVars)-1; w >= 0; w-- ) + pOut[w] = pIn0[w] | pIn1[w]; +} +static inline void Extra_TruthSharp( unsigned * pOut, unsigned * pIn0, unsigned * pIn1, int nVars ) +{ + int w; + for ( w = Extra_TruthWordNum(nVars)-1; w >= 0; w-- ) + pOut[w] = pIn0[w] & ~pIn1[w]; +} static inline void Extra_TruthNand( unsigned * pOut, unsigned * pIn0, unsigned * pIn1, int nVars ) { int w; diff --git a/src/misc/extra/extraUtilTruth.c b/src/misc/extra/extraUtilTruth.c index a0c58025..a80c0d3d 100644 --- a/src/misc/extra/extraUtilTruth.c +++ b/src/misc/extra/extraUtilTruth.c @@ -184,8 +184,8 @@ void Extra_TruthSwapAdjacentVars2( unsigned * pIn, unsigned * pOut, int nVars, i Synopsis [Expands the truth table according to the phase.] Description [The input and output truth tables are in pIn/pOut. The current number - of variables is nVars. The total number of variables in nVarsAll. The last variable - (Phase) contains shows how the variables should be moved.] + of variables is nVars. The total number of variables in nVarsAll. The last argument + (Phase) contains shows where the variables should go.] SideEffects [] @@ -218,8 +218,8 @@ void Extra_TruthStretch( unsigned * pOut, unsigned * pIn, int nVars, int nVarsAl Synopsis [Shrinks the truth table according to the phase.] Description [The input and output truth tables are in pIn/pOut. The current number - of variables is nVars. The total number of variables in nVarsAll. The last variable - (Phase) contains shows how the variables should be moved.] + of variables is nVars. The total number of variables in nVarsAll. The last argument + (Phase) contains shows what variables should remain.] SideEffects [] -- cgit v1.2.3