@@ -229,6 +229,7 @@ static int Abc_CommandEspresso ( Abc_Frame_t * pAbc, int argc, cha
229229static int Abc_CommandGen ( Abc_Frame_t * pAbc, int argc, char ** argv );
230230static int Abc_CommandGenTF ( Abc_Frame_t * pAbc, int argc, char ** argv );
231231static int Abc_CommandGenAT ( Abc_Frame_t * pAbc, int argc, char ** argv );
232+ static int Abc_CommandGenPop ( Abc_Frame_t * pAbc, int argc, char ** argv );
232233static int Abc_CommandGenFsm ( Abc_Frame_t * pAbc, int argc, char ** argv );
233234static int Abc_CommandCover ( Abc_Frame_t * pAbc, int argc, char ** argv );
234235static int Abc_CommandDouble ( Abc_Frame_t * pAbc, int argc, char ** argv );
@@ -1060,6 +1061,7 @@ void Abc_Init( Abc_Frame_t * pAbc )
10601061 Cmd_CommandAdd( pAbc, "Various", "gen", Abc_CommandGen, 0 );
10611062 Cmd_CommandAdd( pAbc, "Various", "gentf", Abc_CommandGenTF, 0 );
10621063 Cmd_CommandAdd( pAbc, "Various", "genat", Abc_CommandGenAT, 0 );
1064+ Cmd_CommandAdd( pAbc, "Various", "genpop", Abc_CommandGenPop, 0 );
10631065 Cmd_CommandAdd( pAbc, "Various", "genfsm", Abc_CommandGenFsm, 0 );
10641066 Cmd_CommandAdd( pAbc, "Various", "cover", Abc_CommandCover, 1 );
10651067 Cmd_CommandAdd( pAbc, "Various", "double", Abc_CommandDouble, 1 );
@@ -16031,6 +16033,81 @@ int Abc_CommandGenAT( Abc_Frame_t * pAbc, int argc, char ** argv )
1603116033 return 1;
1603216034}
1603316035
16036+ /**Function*************************************************************
16037+
16038+ Synopsis []
16039+
16040+ Description []
16041+
16042+ SideEffects []
16043+
16044+ SeeAlso []
16045+
16046+ ***********************************************************************/
16047+ int Abc_CommandGenPop( Abc_Frame_t * pAbc, int argc, char ** argv )
16048+ {
16049+ extern Abc_Ntk_t * Abc_NtkLutCascadeFromPopcountLuts( int nVars, int nLutSize, int fVerbose, char * pFileName );
16050+ char * pFileName = NULL;
16051+ Abc_Ntk_t * pNtk = NULL;
16052+ int c, nVars = 10, nLutSize = 6, fVerbose = 0;
16053+ Extra_UtilGetoptReset();
16054+ while ( ( c = Extra_UtilGetopt( argc, argv, "NKvh" ) ) != EOF )
16055+ {
16056+ switch ( c )
16057+ {
16058+ case 'N':
16059+ if ( globalUtilOptind >= argc )
16060+ {
16061+ Abc_Print( -1, "Command line switch \"-N\" should be followed by an integer.\n" );
16062+ goto usage;
16063+ }
16064+ nVars = atoi(argv[globalUtilOptind]);
16065+ globalUtilOptind++;
16066+ if ( nVars < 0 )
16067+ goto usage;
16068+ break;
16069+ case 'K':
16070+ if ( globalUtilOptind >= argc )
16071+ {
16072+ Abc_Print( -1, "Command line switch \"-K\" should be followed by an integer.\n" );
16073+ goto usage;
16074+ }
16075+ nLutSize = atoi(argv[globalUtilOptind]);
16076+ globalUtilOptind++;
16077+ if ( nLutSize < 0 )
16078+ goto usage;
16079+ break;
16080+ case 'v':
16081+ fVerbose ^= 1;
16082+ break;
16083+ case 'h':
16084+ goto usage;
16085+ default:
16086+ goto usage;
16087+ }
16088+ }
16089+ if ( argc == globalUtilOptind + 1 )
16090+ pFileName = argv[globalUtilOptind];
16091+ pNtk = Abc_NtkLutCascadeFromPopcountLuts( nVars, nLutSize, fVerbose, pFileName );
16092+ if ( pNtk == NULL )
16093+ {
16094+ fprintf( pAbc->Err, "Deriving the network has failed.\n" );
16095+ return 1;
16096+ }
16097+ Abc_FrameReplaceCurrentNetwork( pAbc, pNtk );
16098+ return 0;
16099+
16100+ usage:
16101+ Abc_Print( -2, "usage: genpop [-NK num] [-vh] <file.v>\n" );
16102+ Abc_Print( -2, "\t generates the adder tree\n" );
16103+ Abc_Print( -2, "\t-N <num> : the number of support variables [default = %d]\n", nVars );
16104+ Abc_Print( -2, "\t-K <num> : the number of LUT inputs [default = %d]\n", nLutSize );
16105+ Abc_Print( -2, "\t-v : prints verbose information [default = %s]\n", fVerbose? "yes": "no" );
16106+ Abc_Print( -2, "\t-h : print the command usage\n");
16107+ Abc_Print( -2, "\t-<file.v> : (optional) Verilog file name\n");
16108+ return 1;
16109+ }
16110+
1603416111/**Function*************************************************************
1603516112
1603616113 Synopsis []
0 commit comments