diff options
author | Alan Mishchenko <alanmi@berkeley.edu> | 2011-07-25 20:33:55 +0700 |
---|---|---|
committer | Alan Mishchenko <alanmi@berkeley.edu> | 2011-07-25 20:33:55 +0700 |
commit | 67e84b719d02fe65bf9fee61f27fbd7c12da4003 (patch) | |
tree | c85e120ce278f20e277b30af72ecaf162bb5eac5 /src/misc | |
parent | c4dd8067fd49b8e4aea245f6b5587c959dfe1a2a (diff) | |
download | abc-67e84b719d02fe65bf9fee61f27fbd7c12da4003.tar.gz abc-67e84b719d02fe65bf9fee61f27fbd7c12da4003.tar.bz2 abc-67e84b719d02fe65bf9fee61f27fbd7c12da4003.zip |
Enhancing printing of counter-examples.
Diffstat (limited to 'src/misc')
-rw-r--r-- | src/misc/util/utilCex.c | 35 | ||||
-rw-r--r-- | src/misc/util/utilCex.h | 1 |
2 files changed, 33 insertions, 3 deletions
diff --git a/src/misc/util/utilCex.c b/src/misc/util/utilCex.c index 69cd37cf..72989535 100644 --- a/src/misc/util/utilCex.c +++ b/src/misc/util/utilCex.c @@ -185,18 +185,47 @@ Abc_Cex_t * Abc_CexDeriveFromCombModel( int * pModel, int nPis, int nRegs, int i SeeAlso [] ***********************************************************************/ +void Abc_CexPrintStats( Abc_Cex_t * p ) +{ + int k, Counter = 0; + if ( p == NULL ) + { + printf( "The counter example is NULL.\n" ); + return; + } + for ( k = 0; k < p->nBits; k++ ) + Counter += Abc_InfoHasBit(p->pData, k); + printf( "CEX: iPo = %d iFrame = %d nRegs = %d nPis = %d nBits = %d nOnes = %5d (%5.2f %%)\n", + p->iPo, p->iFrame, p->nRegs, p->nPis, p->nBits, Counter, 100.0 * Counter / p->nBits ); +} + +/**Function************************************************************* + + Synopsis [Prints out the counter-example.] + + Description [] + + SideEffects [] + + SeeAlso [] + +***********************************************************************/ void Abc_CexPrint( Abc_Cex_t * p ) { int i, f, k; - printf( "Counter-example: iPo = %d iFrame = %d nRegs = %d nPis = %d nBits = %d\n", - p->iPo, p->iFrame, p->nRegs, p->nPis, p->nBits ); + if ( p == NULL ) + { + printf( "The counter example is NULL.\n" ); + return; + } + Abc_CexPrintStats( p ); printf( "State : " ); for ( k = 0; k < p->nRegs; k++ ) printf( "%d", Abc_InfoHasBit(p->pData, k) ); printf( "\n" ); for ( f = 0; f <= p->iFrame; f++ ) { - printf( "Frame %2d : ", f ); + printf( "Frame %3d : ", f ); for ( i = 0; i < p->nPis; i++ ) printf( "%d", Abc_InfoHasBit(p->pData, k++) ); printf( "\n" ); diff --git a/src/misc/util/utilCex.h b/src/misc/util/utilCex.h index dfe5050a..c52806fc 100644 --- a/src/misc/util/utilCex.h +++ b/src/misc/util/utilCex.h @@ -61,6 +61,7 @@ extern Abc_Cex_t * Abc_CexMakeTriv( int nRegs, int nTruePis, int nTruePos, int extern Abc_Cex_t * Abc_CexCreate( int nRegs, int nTruePis, int * pArray, int iFrame, int iPo, int fSkipRegs ); extern Abc_Cex_t * Abc_CexDup( Abc_Cex_t * p, int nRegsNew ); extern Abc_Cex_t * Abc_CexDeriveFromCombModel( int * pModel, int nPis, int nRegs, int iPo ); +extern void Abc_CexPrintStats( Abc_Cex_t * p ); extern void Abc_CexPrint( Abc_Cex_t * p ); extern void Abc_CexFree( Abc_Cex_t * p ); |