summaryrefslogtreecommitdiffstats
path: root/src/base/abci/abc.c
diff options
context:
space:
mode:
authorAlan Mishchenko <alanmi@berkeley.edu>2017-12-05 18:22:27 -0800
committerAlan Mishchenko <alanmi@berkeley.edu>2017-12-05 18:22:27 -0800
commit3f35ac8180bf69655662c2ccd2de9411b3533cf4 (patch)
treec2ae71eb5a5ab0a74beed90b2df0ccbaa15b1338 /src/base/abci/abc.c
parente5d8335268eddf7d1bade6bfc8f91da677294674 (diff)
downloadabc-3f35ac8180bf69655662c2ccd2de9411b3533cf4.tar.gz
abc-3f35ac8180bf69655662c2ccd2de9411b3533cf4.tar.bz2
abc-3f35ac8180bf69655662c2ccd2de9411b3533cf4.zip
New command 'lutexact'.
Diffstat (limited to 'src/base/abci/abc.c')
-rw-r--r--src/base/abci/abc.c104
1 files changed, 104 insertions, 0 deletions
diff --git a/src/base/abci/abc.c b/src/base/abci/abc.c
index b1d0df9b..7b24dc8f 100644
--- a/src/base/abci/abc.c
+++ b/src/base/abci/abc.c
@@ -151,6 +151,7 @@ static int Abc_CommandBmsStop ( Abc_Frame_t * pAbc, int argc, cha
static int Abc_CommandBmsPs ( Abc_Frame_t * pAbc, int argc, char ** argv );
static int Abc_CommandMajExact ( Abc_Frame_t * pAbc, int argc, char ** argv );
static int Abc_CommandTwoExact ( Abc_Frame_t * pAbc, int argc, char ** argv );
+static int Abc_CommandLutExact ( Abc_Frame_t * pAbc, int argc, char ** argv );
static int Abc_CommandLogic ( Abc_Frame_t * pAbc, int argc, char ** argv );
static int Abc_CommandComb ( Abc_Frame_t * pAbc, int argc, char ** argv );
@@ -819,6 +820,7 @@ void Abc_Init( Abc_Frame_t * pAbc )
Cmd_CommandAdd( pAbc, "Exact synthesis", "bms_ps", Abc_CommandBmsPs, 0 );
Cmd_CommandAdd( pAbc, "Exact synthesis", "majexact", Abc_CommandMajExact, 0 );
Cmd_CommandAdd( pAbc, "Exact synthesis", "twoexact", Abc_CommandTwoExact, 0 );
+ Cmd_CommandAdd( pAbc, "Exact synthesis", "lutexact", Abc_CommandLutExact, 0 );
Cmd_CommandAdd( pAbc, "Various", "logic", Abc_CommandLogic, 1 );
Cmd_CommandAdd( pAbc, "Various", "comb", Abc_CommandComb, 1 );
@@ -8258,6 +8260,108 @@ usage:
SeeAlso []
***********************************************************************/
+int Abc_CommandLutExact( Abc_Frame_t * pAbc, int argc, char ** argv )
+{
+ extern void Exa3_ManExactSynthesis( char * pTtStr, int nVars, int nNodes, int nLutSize, int fVerbose );
+ extern void Exa3_ManExactSynthesis2( char * pTtStr, int nVars, int nNodes, int nLutSize, int fVerbose );
+ int c, nVars = 5, nNodes = 5, nLutSize = 3, fGlucose = 0, fVerbose = 1; char * pTtStr = NULL;
+ Extra_UtilGetoptReset();
+ while ( ( c = Extra_UtilGetopt( argc, argv, "INKgvh" ) ) != EOF )
+ {
+ switch ( c )
+ {
+ case 'I':
+ if ( globalUtilOptind >= argc )
+ {
+ Abc_Print( -1, "Command line switch \"-I\" should be followed by an integer.\n" );
+ goto usage;
+ }
+ nVars = atoi(argv[globalUtilOptind]);
+ globalUtilOptind++;
+ if ( nVars < 0 )
+ goto usage;
+ break;
+ case 'N':
+ if ( globalUtilOptind >= argc )
+ {
+ Abc_Print( -1, "Command line switch \"-N\" should be followed by an integer.\n" );
+ goto usage;
+ }
+ nNodes = atoi(argv[globalUtilOptind]);
+ globalUtilOptind++;
+ if ( nNodes < 0 )
+ goto usage;
+ break;
+ case 'K':
+ if ( globalUtilOptind >= argc )
+ {
+ Abc_Print( -1, "Command line switch \"-K\" should be followed by an integer.\n" );
+ goto usage;
+ }
+ nLutSize = atoi(argv[globalUtilOptind]);
+ globalUtilOptind++;
+ if ( nLutSize < 0 )
+ goto usage;
+ break;
+ case 'g':
+ fGlucose ^= 1;
+ break;
+ case 'v':
+ fVerbose ^= 1;
+ break;
+ case 'h':
+ goto usage;
+ default:
+ goto usage;
+ }
+ }
+ if ( argc == globalUtilOptind + 1 )
+ pTtStr = argv[globalUtilOptind];
+ if ( pTtStr == NULL )
+ {
+ Abc_Print( -1, "Truth table should be given on the command line.\n" );
+ return 1;
+ }
+ if ( nVars > 10 )
+ {
+ Abc_Print( -1, "Function should not have more than 10 inputs.\n" );
+ return 1;
+ }
+ if ( nLutSize > 6 )
+ {
+ Abc_Print( -1, "Node size should not be more than 6 inputs.\n" );
+ return 1;
+ }
+ if ( fGlucose )
+ Exa3_ManExactSynthesis( pTtStr, nVars, nNodes, nLutSize, fVerbose );
+ else
+ Exa3_ManExactSynthesis2( pTtStr, nVars, nNodes, nLutSize, fVerbose );
+ return 0;
+
+usage:
+ Abc_Print( -2, "usage: lutexact [-INK <num>] [-fcgvh] <hex>\n" );
+ Abc_Print( -2, "\t exact synthesis of multi-input function using two-input gates\n" );
+ Abc_Print( -2, "\t-I <num> : the number of input variables [default = %d]\n", nVars );
+ Abc_Print( -2, "\t-N <num> : the number of K-input nodes [default = %d]\n", nNodes );
+ Abc_Print( -2, "\t-K <num> : the number of node fanins [default = %d]\n", nLutSize );
+ Abc_Print( -2, "\t-g : toggle using Glucose 3.0 by Gilles Audemard and Laurent Simon [default = %s]\n", fGlucose ? "yes" : "no" );
+ Abc_Print( -2, "\t-v : toggle verbose printout [default = %s]\n", fVerbose ? "yes" : "no" );
+ Abc_Print( -2, "\t-h : print the command usage\n" );
+ Abc_Print( -2, "\t<hex> : truth table in hex notation\n" );
+ return 1;
+}
+
+/**Function*************************************************************
+
+ Synopsis []
+
+ Description []
+
+ SideEffects []
+
+ SeeAlso []
+
+***********************************************************************/
int Abc_CommandLogic( Abc_Frame_t * pAbc, int argc, char ** argv )
{
Abc_Ntk_t * pNtk, * pNtkRes;