diff options
author | Alan Mishchenko <alanmi@berkeley.edu> | 2018-07-04 14:04:08 -0700 |
---|---|---|
committer | Alan Mishchenko <alanmi@berkeley.edu> | 2018-07-04 14:04:08 -0700 |
commit | f49e8f0fe73e2b9cf673f754c9fd0951be9a3756 (patch) | |
tree | 75531dc376093f4cdac4427209136bebcf4154d1 /src/base | |
parent | 7522e68b58167b225a81becc59bd4decc6602de7 (diff) | |
download | abc-f49e8f0fe73e2b9cf673f754c9fd0951be9a3756.tar.gz abc-f49e8f0fe73e2b9cf673f754c9fd0951be9a3756.tar.bz2 abc-f49e8f0fe73e2b9cf673f754c9fd0951be9a3756.zip |
Adding command 'majgen'.
Diffstat (limited to 'src/base')
-rw-r--r-- | src/base/abci/abc.c | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/src/base/abci/abc.c b/src/base/abci/abc.c index e891882d..e98e746f 100644 --- a/src/base/abci/abc.c +++ b/src/base/abci/abc.c @@ -155,6 +155,7 @@ static int Abc_CommandTwoExact ( Abc_Frame_t * pAbc, int argc, cha static int Abc_CommandLutExact ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandAllExact ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandTestExact ( Abc_Frame_t * pAbc, int argc, char ** argv ); +static int Abc_CommandMajGen ( 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 ); @@ -847,6 +848,7 @@ void Abc_Init( Abc_Frame_t * pAbc ) Cmd_CommandAdd( pAbc, "Exact synthesis", "lutexact", Abc_CommandLutExact, 0 ); Cmd_CommandAdd( pAbc, "Exact synthesis", "allexact", Abc_CommandAllExact, 0 ); Cmd_CommandAdd( pAbc, "Exact synthesis", "testexact", Abc_CommandTestExact, 0 ); + Cmd_CommandAdd( pAbc, "Exact synthesis", "majgen", Abc_CommandMajGen, 0 ); Cmd_CommandAdd( pAbc, "Various", "logic", Abc_CommandLogic, 1 ); Cmd_CommandAdd( pAbc, "Various", "comb", Abc_CommandComb, 1 ); @@ -8753,6 +8755,58 @@ usage: SeeAlso [] ***********************************************************************/ +int Abc_CommandMajGen( Abc_Frame_t * pAbc, int argc, char ** argv ) +{ + extern int Gem_Enumerate( int nVars, int fVerbose ); + int c, nVars = 8, 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; + } + nVars = atoi(argv[globalUtilOptind]); + globalUtilOptind++; + if ( nVars < 0 ) + goto usage; + break; + case 'v': + fVerbose ^= 1; + break; + case 'h': + goto usage; + default: + goto usage; + } + } + Gem_Enumerate( nVars, fVerbose ); + return 0; + +usage: + Abc_Print( -2, "usage: majgen [-N <num>] [-vh]>\n" ); + Abc_Print( -2, "\t generates networks for majority gates\n" ); + Abc_Print( -2, "\t-N <num> : the maximum number of variables [default = %d]\n", nVars ); + 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************************************************************* + + Synopsis [] + + Description [] + + SideEffects [] + + SeeAlso [] + +***********************************************************************/ int Abc_CommandLogic( Abc_Frame_t * pAbc, int argc, char ** argv ) { Abc_Ntk_t * pNtk, * pNtkRes; |