diff options
Diffstat (limited to 'src/base/abci/abc.c')
-rw-r--r-- | src/base/abci/abc.c | 99 |
1 files changed, 97 insertions, 2 deletions
diff --git a/src/base/abci/abc.c b/src/base/abci/abc.c index 09e1c94e..7618c164 100644 --- a/src/base/abci/abc.c +++ b/src/base/abci/abc.c @@ -365,6 +365,7 @@ static int Abc_CommandAbc9ReachY ( Abc_Frame_t * pAbc, int argc, cha static int Abc_CommandAbc9Undo ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandAbc9Iso ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandAbc9CexCut ( Abc_Frame_t * pAbc, int argc, char ** argv ); +static int Abc_CommandAbc9CexMerge ( Abc_Frame_t * pAbc, int argc, char ** argv ); //static int Abc_CommandAbc9CexMin ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandAbc9AbsDerive ( Abc_Frame_t * pAbc, int argc, char ** argv ); @@ -820,6 +821,7 @@ void Abc_Init( Abc_Frame_t * pAbc ) Cmd_CommandAdd( pAbc, "ABC9", "&undo", Abc_CommandAbc9Undo, 0 ); Cmd_CommandAdd( pAbc, "ABC9", "&iso", Abc_CommandAbc9Iso, 0 ); Cmd_CommandAdd( pAbc, "ABC9", "&cexcut", Abc_CommandAbc9CexCut, 0 ); + Cmd_CommandAdd( pAbc, "ABC9", "&cexmerge", Abc_CommandAbc9CexMerge, 0 ); // Cmd_CommandAdd( pAbc, "ABC9", "&cexmin", Abc_CommandAbc9CexMin, 0 ); Cmd_CommandAdd( pAbc, "Abstraction", "&abs_derive", Abc_CommandAbc9AbsDerive, 0 ); @@ -28661,7 +28663,7 @@ int Abc_CommandAbc9CexCut( Abc_Frame_t * pAbc, int argc, char ** argv ) } if ( !Gia_ManVerifyCex( pAbc->pGia, pAbc->pCex, 0 ) ) { - Abc_Print( 1, "Current counter-example is not a valid counter-example for &-space AIG \"%s\".\n", Gia_ManName(pAbc->pGia) ); + Abc_Print( 1, "Current CEX does not fail AIG \"%s\" in the &-space.\n", Gia_ManName(pAbc->pGia) ); return 0; } if ( iFrStop == ABC_INFINITY ) @@ -28681,7 +28683,100 @@ usage: Abc_Print( -2, "\t extract logic representation of bad states\n" ); Abc_Print( -2, "\t-F num : 0-based number of the starting frame [default = %d]\n", iFrStart ); Abc_Print( -2, "\t-G num : 0-based number of the ending frame [default = %d]\n", iFrStop ); - Abc_Print( -2, "\t-v : toggle printing optimization summary [default = %s]\n", fVerbose? "yes": "no" ); + Abc_Print( -2, "\t-v : toggle printing verbose information [default = %s]\n", fVerbose? "yes": "no" ); + Abc_Print( -2, "\t-h : print the command usage\n"); + return 1; +} + +/**Function************************************************************* + + Synopsis [] + + Description [] + + SideEffects [] + + SeeAlso [] + +***********************************************************************/ +int Abc_CommandAbc9CexMerge( Abc_Frame_t * pAbc, int argc, char ** argv ) +{ + Abc_Cex_t * pCexNew; + int c; + int iFrStart = 0; + int iFrStop = ABC_INFINITY; + int fVerbose = 0; + Extra_UtilGetoptReset(); + while ( ( c = Extra_UtilGetopt( argc, argv, "FGvh" ) ) != EOF ) + { + switch ( c ) + { + case 'F': + if ( globalUtilOptind >= argc ) + { + Abc_Print( -1, "Command line switch \"-F\" should be followed by an integer.\n" ); + goto usage; + } + iFrStart = atoi(argv[globalUtilOptind]); + globalUtilOptind++; + if ( iFrStart < 0 ) + goto usage; + break; + case 'G': + if ( globalUtilOptind >= argc ) + { + Abc_Print( -1, "Command line switch \"-G\" should be followed by an integer.\n" ); + goto usage; + } + iFrStop = atoi(argv[globalUtilOptind]); + globalUtilOptind++; + if ( iFrStop < 0 ) + goto usage; + break; + case 'v': + fVerbose ^= 1; + break; + case 'h': + goto usage; + default: + Abc_Print( -2, "Unknown switch.\n"); + goto usage; + } + } + + if ( pAbc->pCex == NULL ) + { + Abc_Print( 1, "There is no current cex.\n"); + return 0; + } + if ( pAbc->pCex2 == NULL ) + { + Abc_Print( 1, "There is no saved cex.\n"); + return 0; + } + if ( iFrStop - iFrStart > pAbc->pCex->iFrame ) + { + Abc_Print( 1, "Current CEX does not allow to shorten the saved CEX.\n"); + return 0; + } + pCexNew = Abc_CexMerge( pAbc->pCex2, pAbc->pCex, iFrStart, iFrStop ); + if ( pCexNew == NULL ) + { + Abc_Print( 1, "Merging CEXes has failed.\n"); + return 0; + } + // replace the saved CEX + ABC_FREE( pAbc->pCex2 ); + pAbc->pCex2 = pCexNew; + return 0; + +usage: + Abc_Print( -2, "usage: &cexmerge [-FG num] [-vh]\n" ); + Abc_Print( -2, "\t merges the current CEX into the saved one\n" ); + Abc_Print( -2, "\t and sets the resulting CEX as the saved one\n" ); + Abc_Print( -2, "\t-F num : 0-based number of the starting frame [default = %d]\n", iFrStart ); + Abc_Print( -2, "\t-G num : 0-based number of the ending frame [default = %d]\n", iFrStop ); + Abc_Print( -2, "\t-v : toggle printing verbose information [default = %s]\n", fVerbose? "yes": "no" ); Abc_Print( -2, "\t-h : print the command usage\n"); return 1; } |