diff options
author | Alan Mishchenko <alanmi@berkeley.edu> | 2011-07-22 20:20:19 +0700 |
---|---|---|
committer | Alan Mishchenko <alanmi@berkeley.edu> | 2011-07-22 20:20:19 +0700 |
commit | 76447062ccb56fc8c221942bcd11645ff88d4821 (patch) | |
tree | 4ed984f5ff70e33baf33b90bd54d05c88eb1304b /src/base | |
parent | 5b71a8f849a622160632860c5f5c2c22b3a072cb (diff) | |
download | abc-76447062ccb56fc8c221942bcd11645ff88d4821.tar.gz abc-76447062ccb56fc8c221942bcd11645ff88d4821.tar.bz2 abc-76447062ccb56fc8c221942bcd11645ff88d4821.zip |
Adding &equiv3, a new way of refining equivalence classes.
Diffstat (limited to 'src/base')
-rw-r--r-- | src/base/abci/abc.c | 144 | ||||
-rw-r--r-- | src/base/abci/abcDar.c | 48 |
2 files changed, 190 insertions, 2 deletions
diff --git a/src/base/abci/abc.c b/src/base/abci/abc.c index c7bd3634..1bd53dea 100644 --- a/src/base/abci/abc.c +++ b/src/base/abci/abc.c @@ -343,6 +343,7 @@ static int Abc_CommandAbc9Resim ( Abc_Frame_t * pAbc, int argc, cha static int Abc_CommandAbc9SpecI ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandAbc9Equiv ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandAbc9Equiv2 ( Abc_Frame_t * pAbc, int argc, char ** argv ); +static int Abc_CommandAbc9Equiv3 ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandAbc9Semi ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandAbc9Times ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandAbc9Frames ( Abc_Frame_t * pAbc, int argc, char ** argv ); @@ -763,6 +764,7 @@ void Abc_Init( Abc_Frame_t * pAbc ) Cmd_CommandAdd( pAbc, "ABC9", "&speci", Abc_CommandAbc9SpecI, 0 ); Cmd_CommandAdd( pAbc, "ABC9", "&equiv", Abc_CommandAbc9Equiv, 0 ); Cmd_CommandAdd( pAbc, "ABC9", "&equiv2", Abc_CommandAbc9Equiv2, 0 ); + Cmd_CommandAdd( pAbc, "ABC9", "&equiv3", Abc_CommandAbc9Equiv3, 0 ); Cmd_CommandAdd( pAbc, "ABC9", "&semi", Abc_CommandAbc9Semi, 0 ); Cmd_CommandAdd( pAbc, "ABC9", "×", Abc_CommandAbc9Times, 0 ); Cmd_CommandAdd( pAbc, "ABC9", "&frames", Abc_CommandAbc9Frames, 0 ); @@ -25221,7 +25223,7 @@ int Abc_CommandAbc9Equiv2( Abc_Frame_t * pAbc, int argc, char ** argv ) default: goto usage; } - } + } if ( pAbc->pGia == NULL ) { Abc_Print( -1, "Abc_CommandAbc9Equiv2(): There is no AIG.\n" ); @@ -25273,6 +25275,146 @@ usage: SeeAlso [] ***********************************************************************/ +int Abc_CommandAbc9Equiv3( Abc_Frame_t * pAbc, int argc, char ** argv ) +{ +// extern int Abc_NtkDarSeqEquiv2( Abc_Ntk_t * pNtk, int nFrames, int nWords, int nBinSize, int nRounds, int TimeOut, Abc_Cex_t * pCex, int fLatchOnly, int fVerbose ); + extern int Ssw_RarSignalFilterGia( Gia_Man_t * p, int nFrames, int nWords, int nBinSize, int nRounds, int TimeOut, Abc_Cex_t * pCex, int fLatchOnly, int fVerbose ); + int c; + int nFrames = 20; + int nWords = 50; + int nBinSize = 8; + int nRounds = 80; + int TimeOut = 0; + int fUseCex = 0; + int fLatchOnly = 0; + int fVerbose = 1; + Extra_UtilGetoptReset(); + while ( ( c = Extra_UtilGetopt( argc, argv, "FWBRTxlvh" ) ) != EOF ) + { + switch ( c ) + { + case 'F': + if ( globalUtilOptind >= argc ) + { + Abc_Print( -1, "Command line switch \"-F\" should be followed by an integer.\n" ); + goto usage; + } + nFrames = atoi(argv[globalUtilOptind]); + globalUtilOptind++; + if ( nFrames < 0 ) + goto usage; + break; + case 'W': + if ( globalUtilOptind >= argc ) + { + Abc_Print( -1, "Command line switch \"-W\" should be followed by an integer.\n" ); + goto usage; + } + nWords = atoi(argv[globalUtilOptind]); + globalUtilOptind++; + if ( nWords < 0 ) + goto usage; + break; + case 'B': + if ( globalUtilOptind >= argc ) + { + Abc_Print( -1, "Command line switch \"-B\" should be followed by an integer.\n" ); + goto usage; + } + nBinSize = atoi(argv[globalUtilOptind]); + globalUtilOptind++; + if ( nBinSize < 0 ) + goto usage; + break; + case 'R': + if ( globalUtilOptind >= argc ) + { + Abc_Print( -1, "Command line switch \"-R\" should be followed by an integer.\n" ); + goto usage; + } + nRounds = atoi(argv[globalUtilOptind]); + globalUtilOptind++; + if ( nRounds < 0 ) + goto usage; + break; + case 'T': + if ( globalUtilOptind >= argc ) + { + Abc_Print( -1, "Command line switch \"-T\" should be followed by an integer.\n" ); + goto usage; + } + TimeOut = atoi(argv[globalUtilOptind]); + globalUtilOptind++; + if ( TimeOut < 0 ) + goto usage; + break; + case 'x': + fUseCex ^= 1; + break; + case 'l': + fLatchOnly ^= 1; + break; + case 'v': + fVerbose ^= 1; + break; + case 'h': + goto usage; + default: + goto usage; + } + } + if ( pAbc->pGia == NULL ) + { + Abc_Print( -1, "Abc_CommandAbc9Equiv3(): There is no AIG.\n" ); + return 1; + } + if ( Gia_ManRegNum(pAbc->pGia) == 0 ) + { + Abc_Print( 0, "Abc_CommandAbc9Equiv3(): There is no flops. Nothing is done.\n" ); + return 0; + } + if ( fUseCex ) + { + if ( pAbc->pCex->nPis != Gia_ManPiNum(pAbc->pGia) ) + { + Abc_Print( -1, "Abc_CommandAbc9Equiv3(): The number of PIs differs in cex (%d) and in AIG (%d).\n", + pAbc->pCex->nPis, Gia_ManPiNum(pAbc->pGia) ); + return 1; + } + } +// pAbc->Status = Abc_NtkDarSeqEquiv2( pNtk, nFrames, nWords, nBinSize, nRounds, TimeOut, fUseCex? pAbc->pCex: NULL, fLatchOnly, fVerbose ); + pAbc->Status = Ssw_RarSignalFilterGia( pAbc->pGia, nFrames, nWords, nBinSize, nRounds, TimeOut, fUseCex? pAbc->pCex: NULL, fLatchOnly, fVerbose ); +// pAbc->nFrames = pAbc->pCex->iFrame; +// Abc_FrameReplaceCex( pAbc, &pAbc->pCex ); + return 0; + +usage: + Abc_Print( -2, "usage: &equiv3 [-FWBRT num] [-xlvh]\n" ); + Abc_Print( -2, "\t computes candidate equivalence classes\n" ); + Abc_Print( -2, "\t-F num : the max number of frames for BMC [default = %d]\n", nFrames ); + Abc_Print( -2, "\t-W num : the number of words to simulate [default = %d]\n", nWords ); + Abc_Print( -2, "\t-B num : the number of flops in one bin [default = %d]\n", nBinSize ); + Abc_Print( -2, "\t-R num : the max number of simulation rounds [default = %d]\n", nRounds ); + Abc_Print( -2, "\t-T num : runtime limit in seconds for all rounds [default = %d]\n", TimeOut ); + Abc_Print( -2, "\t-x : toggle using the current cex to perform refinement [default = %s]\n", fUseCex? "yes": "no" ); + Abc_Print( -2, "\t-l : toggle considering only latch output equivalences [default = %s]\n", fLatchOnly? "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_CommandAbc9Semi( Abc_Frame_t * pAbc, int argc, char ** argv ) { Cec_ParSmf_t Pars, * pPars = &Pars; diff --git a/src/base/abci/abcDar.c b/src/base/abci/abcDar.c index ff8aac38..8741b791 100644 --- a/src/base/abci/abcDar.c +++ b/src/base/abci/abcDar.c @@ -3028,7 +3028,53 @@ int Abc_NtkDarSeqSim2( Abc_Ntk_t * pNtk, int nFrames, int nWords, int nBinSize, Abc_AigCleanup((Abc_Aig_t *)pNtk->pManFunc); } pMan = Abc_NtkToDar( pNtk, 0, 1 ); - if ( Ssw_RarSimulate( pMan, nFrames, nWords, nBinSize, nRounds, TimeOut, fVerbose ) ) + if ( Ssw_RarSimulate( pMan, nFrames, nWords, nBinSize, nRounds, TimeOut, fVerbose ) == 0 ) + { + if ( pMan->pSeqModel ) + { + printf( "Simulation of %d frames with %d words asserted output %d in frame %d. ", + nFrames, nWords, pMan->pSeqModel->iPo, pMan->pSeqModel->iFrame ); + status = Saig_ManVerifyCex( pMan, pMan->pSeqModel ); + if ( status == 0 ) + printf( "Abc_NtkDarSeqSim(): Counter-example verification has FAILED.\n" ); + } + ABC_FREE( pNtk->pModel ); + ABC_FREE( pNtk->pSeqModel ); + pNtk->pSeqModel = pMan->pSeqModel; pMan->pSeqModel = NULL; + RetValue = 0; + } + else + { + printf( "Simulation of %d frames with %d words did not assert the outputs. ", + nFrames, nWords ); + } + ABC_PRT( "Time", clock() - clk ); + Aig_ManStop( pMan ); + return RetValue; +} + +/**Function************************************************************* + + Synopsis [Performs random simulation.] + + Description [] + + SideEffects [] + + SeeAlso [] + +***********************************************************************/ +int Abc_NtkDarSeqEquiv2( Abc_Ntk_t * pNtk, int nFrames, int nWords, int nBinSize, int nRounds, int TimeOut, Abc_Cex_t * pCex, int fLatchOnly, int fVerbose ) +{ + Aig_Man_t * pMan; + int status, RetValue = -1, clk = clock(); + if ( Abc_NtkGetChoiceNum(pNtk) ) + { + printf( "Removing %d choices from the AIG.\n", Abc_NtkGetChoiceNum(pNtk) ); + Abc_AigCleanup((Abc_Aig_t *)pNtk->pManFunc); + } + pMan = Abc_NtkToDar( pNtk, 0, 1 ); + if ( Ssw_RarSignalFilter( pMan, nFrames, nWords, nBinSize, nRounds, TimeOut, pCex, fLatchOnly, fVerbose ) == 0 ) { if ( pMan->pSeqModel ) { |