diff options
author | Alan Mishchenko <alanmi@berkeley.edu> | 2012-10-30 22:25:45 -0700 |
---|---|---|
committer | Alan Mishchenko <alanmi@berkeley.edu> | 2012-10-30 22:25:45 -0700 |
commit | 0fafe786aed1f5977b204cc3ca490659a5c182fb (patch) | |
tree | 0fcdc74b55233adb4dc1b3030618cd746068c189 /src/misc/extra | |
parent | 77fde55b1b87e7e8f92edde61d25f951a9b40c33 (diff) | |
download | abc-0fafe786aed1f5977b204cc3ca490659a5c182fb.tar.gz abc-0fafe786aed1f5977b204cc3ca490659a5c182fb.tar.bz2 abc-0fafe786aed1f5977b204cc3ca490659a5c182fb.zip |
Improvements to the truth table computations.
Diffstat (limited to 'src/misc/extra')
-rw-r--r-- | src/misc/extra/extra.h | 1 | ||||
-rw-r--r-- | src/misc/extra/extraUtilFile.c | 18 |
2 files changed, 19 insertions, 0 deletions
diff --git a/src/misc/extra/extra.h b/src/misc/extra/extra.h index bb31dc1f..78a0fa99 100644 --- a/src/misc/extra/extra.h +++ b/src/misc/extra/extra.h @@ -119,6 +119,7 @@ extern int Extra_ReadHexadecimal( unsigned Sign[], char * pString, int extern void Extra_PrintHexadecimal( FILE * pFile, unsigned Sign[], int nVars ); extern void Extra_PrintHexadecimalString( char * pString, unsigned Sign[], int nVars ); extern void Extra_PrintHex( FILE * pFile, unsigned * pTruth, int nVars ); +extern void Extra_PrintHexReverse( FILE * pFile, unsigned * pTruth, int nVars ); extern void Extra_PrintSymbols( FILE * pFile, char Char, int nTimes, int fPrintNewLine ); /*=== extraUtilReader.c ========================================================*/ diff --git a/src/misc/extra/extraUtilFile.c b/src/misc/extra/extraUtilFile.c index c0810e4b..721cbb12 100644 --- a/src/misc/extra/extraUtilFile.c +++ b/src/misc/extra/extraUtilFile.c @@ -561,6 +561,24 @@ void Extra_PrintHex( FILE * pFile, unsigned * pTruth, int nVars ) } // fprintf( pFile, "\n" ); } +void Extra_PrintHexReverse( FILE * pFile, unsigned * pTruth, int nVars ) +{ + int nMints, nDigits, Digit, k; + + // write the number into the file + fprintf( pFile, "0x" ); + nMints = (1 << nVars); + nDigits = nMints / 4; + for ( k = 0; k < nDigits; k++ ) + { + Digit = ((pTruth[k/8] >> (k * 4)) & 15); + if ( Digit < 10 ) + fprintf( pFile, "%d", Digit ); + else + fprintf( pFile, "%c", 'A' + Digit-10 ); + } +// fprintf( pFile, "\n" ); +} /**Function************************************************************* |