summaryrefslogtreecommitdiffstats
path: root/src/base/abci/abc.c
diff options
context:
space:
mode:
authorAlan Mishchenko <alanmi@berkeley.edu>2012-08-08 01:42:14 -0700
committerAlan Mishchenko <alanmi@berkeley.edu>2012-08-08 01:42:14 -0700
commit41fa9a1016d27bd6385e5b49969394d75bba99fd (patch)
treeeb54fa446e99e6361cdc15419bc6f1553006d350 /src/base/abci/abc.c
parent094bdc05728d850b25d099d24d20e60784d6d8cf (diff)
downloadabc-41fa9a1016d27bd6385e5b49969394d75bba99fd.tar.gz
abc-41fa9a1016d27bd6385e5b49969394d75bba99fd.tar.bz2
abc-41fa9a1016d27bd6385e5b49969394d75bba99fd.zip
New command 'testnpn' to compare semi-canonical forms.
Diffstat (limited to 'src/base/abci/abc.c')
-rw-r--r--src/base/abci/abc.c69
1 files changed, 69 insertions, 0 deletions
diff --git a/src/base/abci/abc.c b/src/base/abci/abc.c
index 7461f443..dede6c51 100644
--- a/src/base/abci/abc.c
+++ b/src/base/abci/abc.c
@@ -109,6 +109,7 @@ static int Abc_CommandPowerdown ( Abc_Frame_t * pAbc, int argc, cha
static int Abc_CommandAddBuffs ( Abc_Frame_t * pAbc, int argc, char ** argv );
//static int Abc_CommandMerge ( Abc_Frame_t * pAbc, int argc, char ** argv );
static int Abc_CommandTestDec ( Abc_Frame_t * pAbc, int argc, char ** argv );
+static int Abc_CommandTestNpn ( Abc_Frame_t * pAbc, int argc, char ** argv );
static int Abc_CommandRewrite ( Abc_Frame_t * pAbc, int argc, char ** argv );
static int Abc_CommandRefactor ( Abc_Frame_t * pAbc, int argc, char ** argv );
@@ -571,6 +572,7 @@ void Abc_Init( Abc_Frame_t * pAbc )
Cmd_CommandAdd( pAbc, "Synthesis", "addbuffs", Abc_CommandAddBuffs, 1 );
// Cmd_CommandAdd( pAbc, "Synthesis", "merge", Abc_CommandMerge, 1 );
Cmd_CommandAdd( pAbc, "Synthesis", "testdec", Abc_CommandTestDec, 0 );
+ Cmd_CommandAdd( pAbc, "Synthesis", "testnpn", Abc_CommandTestNpn, 0 );
Cmd_CommandAdd( pAbc, "Synthesis", "rewrite", Abc_CommandRewrite, 1 );
Cmd_CommandAdd( pAbc, "Synthesis", "refactor", Abc_CommandRefactor, 1 );
@@ -4865,6 +4867,73 @@ usage:
return 1;
}
+/**Function*************************************************************
+
+ Synopsis []
+
+ Description []
+
+ SideEffects []
+
+ SeeAlso []
+
+***********************************************************************/
+int Abc_CommandTestNpn( Abc_Frame_t * pAbc, int argc, char ** argv )
+{
+ extern int Abc_NpnTest( char * pFileName, int NpnType, int fVerbose );
+ char * pFileName;
+ int c;
+ int fVerbose = 0;
+ int NpnType = 0;
+ Extra_UtilGetoptReset();
+ while ( ( c = Extra_UtilGetopt( argc, argv, "Avh" ) ) != EOF )
+ {
+ switch ( c )
+ {
+ case 'A':
+ if ( globalUtilOptind >= argc )
+ {
+ Abc_Print( -1, "Command line switch \"-A\" should be followed by an integer.\n" );
+ goto usage;
+ }
+ NpnType = atoi(argv[globalUtilOptind]);
+ globalUtilOptind++;
+ if ( NpnType < 0 )
+ goto usage;
+ break;
+ case 'v':
+ fVerbose ^= 1;
+ break;
+ case 'h':
+ goto usage;
+ default:
+ goto usage;
+ }
+ }
+ if ( argc != globalUtilOptind + 1 )
+ {
+ printf( "Input file is not given.\n" );
+ goto usage;
+ }
+ // get the output file name
+ pFileName = argv[globalUtilOptind];
+ // call the testbench
+ Abc_NpnTest( pFileName, NpnType, fVerbose );
+ return 0;
+
+usage:
+ Abc_Print( -2, "usage: testnpn [-A <num>] [-vh] <file_name>\n" );
+ Abc_Print( -2, "\t testbench for computing semi-canonical forms of Boolean functions\n" );
+ Abc_Print( -2, "\t-A <num> : semi-caninical form computation algorithm [default = %d]\n", NpnType );
+ Abc_Print( -2, "\t 0: none (reading and writing the file)\n" );
+ Abc_Print( -2, "\t 1: semi-canonical form by counting 1s in cofactors\n" );
+ Abc_Print( -2, "\t 2: semi-canonical form by minimizing truth table value\n" );
+ Abc_Print( -2, "\t 3: exact canonical form (slow for more than 6 variables)\n" );
+ Abc_Print( -2, "\t-v : toggle verbose printout [default = %s]\n", fVerbose? "yes": "no" );
+ Abc_Print( -2, "\t-h : print the command usage\n");
+ return 1;
+}
+
/**Function*************************************************************