summaryrefslogtreecommitdiffstats
path: root/src/base
diff options
context:
space:
mode:
authorAlan Mishchenko <alanmi@berkeley.edu>2020-01-21 20:41:54 -0800
committerAlan Mishchenko <alanmi@berkeley.edu>2020-01-21 20:41:54 -0800
commitafebb18041e7bb47671c0cde5d0cd11822087463 (patch)
tree8995b1bfd7fb43df0403be80020fa8791ebb7b6b /src/base
parent07002bc9f9a23978a2b475f1d2b7fccb89e3d24a (diff)
downloadabc-afebb18041e7bb47671c0cde5d0cd11822087463.tar.gz
abc-afebb18041e7bb47671c0cde5d0cd11822087463.tar.bz2
abc-afebb18041e7bb47671c0cde5d0cd11822087463.zip
Experiments with resubstitution.
Diffstat (limited to 'src/base')
-rw-r--r--src/base/abci/abc.c71
1 files changed, 70 insertions, 1 deletions
diff --git a/src/base/abci/abc.c b/src/base/abci/abc.c
index f6fc7ea6..6a852bf7 100644
--- a/src/base/abci/abc.c
+++ b/src/base/abci/abc.c
@@ -414,6 +414,7 @@ static int Abc_CommandAbc9Sim3 ( Abc_Frame_t * pAbc, int argc, cha
static int Abc_CommandAbc9ReadSim ( Abc_Frame_t * pAbc, int argc, char ** argv );
static int Abc_CommandAbc9WriteSim ( Abc_Frame_t * pAbc, int argc, char ** argv );
static int Abc_CommandAbc9SimPat ( Abc_Frame_t * pAbc, int argc, char ** argv );
+static int Abc_CommandAbc9SimRsb ( Abc_Frame_t * pAbc, int argc, char ** argv );
static int Abc_CommandAbc9Resim ( Abc_Frame_t * pAbc, int argc, char ** argv );
static int Abc_CommandAbc9SpecI ( Abc_Frame_t * pAbc, int argc, char ** argv );
static int Abc_CommandAbc9Equiv ( Abc_Frame_t * pAbc, int argc, char ** argv );
@@ -1126,6 +1127,7 @@ void Abc_Init( Abc_Frame_t * pAbc )
Cmd_CommandAdd( pAbc, "ABC9", "&read_sim", Abc_CommandAbc9ReadSim, 0 );
Cmd_CommandAdd( pAbc, "ABC9", "&write_sim", Abc_CommandAbc9WriteSim, 0 );
Cmd_CommandAdd( pAbc, "ABC9", "&simpat", Abc_CommandAbc9SimPat, 0 );
+ Cmd_CommandAdd( pAbc, "ABC9", "&simrsb", Abc_CommandAbc9SimRsb, 0 );
Cmd_CommandAdd( pAbc, "ABC9", "&resim", Abc_CommandAbc9Resim, 0 );
Cmd_CommandAdd( pAbc, "ABC9", "&speci", Abc_CommandAbc9SpecI, 0 );
Cmd_CommandAdd( pAbc, "ABC9", "&equiv", Abc_CommandAbc9Equiv, 0 );
@@ -32687,7 +32689,7 @@ int Abc_CommandAbc9SimPat( Abc_Frame_t * pAbc, int argc, char ** argv )
}
if ( pAbc->pGia->vSimsPi == NULL )
{
- Abc_Print( -1, "Abc_CommandAbc9WriteSim(): Does not have simulation information available.\n" );
+ Abc_Print( -1, "Abc_CommandAbc9SimPat(): Does not have simulation information available.\n" );
return 0;
}
Gia_ManSimPat( pAbc->pGia, nWords, fVerbose );
@@ -32713,6 +32715,73 @@ usage:
SeeAlso []
***********************************************************************/
+int Abc_CommandAbc9SimRsb( Abc_Frame_t * pAbc, int argc, char ** argv )
+{
+ extern void Gia_ManSimRsb( Gia_Man_t * p, int nCands, int fVerbose );
+ int c, nCands = 32, fVerbose = 0;
+ Extra_UtilGetoptReset();
+ while ( ( c = Extra_UtilGetopt( argc, argv, "Nvh" ) ) != EOF )
+ {
+ switch ( c )
+ {
+ case 'N':
+ if ( globalUtilOptind >= argc )
+ {
+ Abc_Print( -1, "Command line switch \"-N\" should be followed by an integer.\n" );
+ goto usage;
+ }
+ nCands = atoi(argv[globalUtilOptind]);
+ globalUtilOptind++;
+ if ( nCands < 0 )
+ goto usage;
+ break;
+ case 'v':
+ fVerbose ^= 1;
+ break;
+ case 'h':
+ goto usage;
+ default:
+ goto usage;
+ }
+ }
+ if ( pAbc->pGia == NULL )
+ {
+ Abc_Print( -1, "Abc_CommandAbc9SimRsb(): There is no AIG.\n" );
+ return 1;
+ }
+ if ( Gia_ManRegNum(pAbc->pGia) > 0 )
+ {
+ Abc_Print( -1, "Abc_CommandAbc9SimRsb(): This command works only for combinational AIGs.\n" );
+ return 0;
+ }
+ if ( pAbc->pGia->vSimsPi == NULL )
+ {
+ Abc_Print( -1, "Abc_CommandAbc9SimRsb(): Does not have simulation information available.\n" );
+ return 0;
+ }
+ Gia_ManSimRsb( pAbc->pGia, nCands, fVerbose );
+ return 0;
+
+usage:
+ Abc_Print( -2, "usage: &simrsb [-N num] [-vh]\n" );
+ Abc_Print( -2, "\t performs resubstitution\n" );
+ Abc_Print( -2, "\t-C num : the number of candidates to try [default = %d]\n", nCands );
+ 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_CommandAbc9Resim( Abc_Frame_t * pAbc, int argc, char ** argv )
{
Cec_ParSim_t Pars, * pPars = &Pars;