Adding switch -P <num> to command 'cover'.

This commit is contained in:
Alan Mishchenko 2016-06-14 20:43:50 -07:00
parent 0a1b6f8fcc
commit db43d6fbd8
4 changed files with 26 additions and 12 deletions

View File

@ -10952,6 +10952,7 @@ int Abc_CommandCover( Abc_Frame_t * pAbc, int argc, char ** argv )
int fUseEsop;
int fUseInvs;
int nFaninMax;
int nCubesMax;
pNtk = Abc_FrameReadNtk(pAbc);
// set defaults
@ -10960,15 +10961,16 @@ int Abc_CommandCover( Abc_Frame_t * pAbc, int argc, char ** argv )
fVerbose = 0;
fUseInvs = 1;
nFaninMax = 8;
nCubesMax = 8;
Extra_UtilGetoptReset();
while ( ( c = Extra_UtilGetopt( argc, argv, "Nsxivh" ) ) != EOF )
while ( ( c = Extra_UtilGetopt( argc, argv, "IPsxivh" ) ) != EOF )
{
switch ( c )
{
case 'N':
case 'I':
if ( globalUtilOptind >= argc )
{
Abc_Print( -1, "Command line switch \"-N\" should be followed by an integer.\n" );
Abc_Print( -1, "Command line switch \"-I\" should be followed by an integer.\n" );
goto usage;
}
nFaninMax = atoi(argv[globalUtilOptind]);
@ -10976,6 +10978,17 @@ int Abc_CommandCover( Abc_Frame_t * pAbc, int argc, char ** argv )
if ( nFaninMax < 0 )
goto usage;
break;
case 'P':
if ( globalUtilOptind >= argc )
{
Abc_Print( -1, "Command line switch \"-P\" should be followed by an integer.\n" );
goto usage;
}
nCubesMax = atoi(argv[globalUtilOptind]);
globalUtilOptind++;
if ( nCubesMax < 0 )
goto usage;
break;
case 's':
fUseSop ^= 1;
break;
@ -11007,7 +11020,7 @@ int Abc_CommandCover( Abc_Frame_t * pAbc, int argc, char ** argv )
}
// run the command
pNtkRes = Abc_NtkSopEsopCover( pNtk, nFaninMax, fUseEsop, fUseSop, fUseInvs, fVerbose );
pNtkRes = Abc_NtkSopEsopCover( pNtk, nFaninMax, nCubesMax, fUseEsop, fUseSop, fUseInvs, fVerbose );
if ( pNtkRes == NULL )
{
Abc_Print( -1, "Command has failed.\n" );
@ -11018,10 +11031,11 @@ int Abc_CommandCover( Abc_Frame_t * pAbc, int argc, char ** argv )
return 0;
usage:
Abc_Print( -2, "usage: cover [-N num] [-sxvh]\n" );
Abc_Print( -2, "usage: cover [-IP num] [-sxvh]\n" );
Abc_Print( -2, "\t decomposition into a network of SOP/ESOP PLAs\n" );
Abc_Print( -2, "\t (this command is known to have bugs)\n");
Abc_Print( -2, "\t-N num : maximum number of inputs [default = %d]\n", nFaninMax );
Abc_Print( -2, "\t-I num : maximum number of inputs [default = %d]\n", nFaninMax );
Abc_Print( -2, "\t-P num : maximum number of products [default = %d]\n", nCubesMax );
Abc_Print( -2, "\t-s : toggle the use of SOPs [default = %s]\n", fUseSop? "yes": "no" );
Abc_Print( -2, "\t-x : toggle the use of ESOPs [default = %s]\n", fUseEsop? "yes": "no" );
// Abc_Print( -2, "\t-i : toggle the use of interters [default = %s]\n", fUseInvs? "yes": "no" );

View File

@ -88,9 +88,9 @@ extern Abc_Ntk_t * Abc_NtkCovDerive( Cov_Man_t * p, Abc_Ntk_t * pNtk );
extern Abc_Ntk_t * Abc_NtkCovDeriveClean( Cov_Man_t * p, Abc_Ntk_t * pNtk );
extern Abc_Ntk_t * Abc_NtkCovDeriveRegular( Cov_Man_t * p, Abc_Ntk_t * pNtk );
/*=== covCore.c ===========================================================*/
extern Abc_Ntk_t * Abc_NtkSopEsopCover( Abc_Ntk_t * pNtk, int nFaninMax, int fUseEsop, int fUseSop, int fUseInvs, int fVerbose );
extern Abc_Ntk_t * Abc_NtkSopEsopCover( Abc_Ntk_t * pNtk, int nFaninMax, int nCubesMax, int fUseEsop, int fUseSop, int fUseInvs, int fVerbose );
/*=== covMan.c ============================================================*/
extern Cov_Man_t * Cov_ManAlloc( Abc_Ntk_t * pNtk, int nFaninMax );
extern Cov_Man_t * Cov_ManAlloc( Abc_Ntk_t * pNtk, int nFaninMax, int nCubesMax );
extern void Cov_ManFree( Cov_Man_t * p );
extern void Abc_NodeCovDropData( Cov_Man_t * p, Abc_Obj_t * pObj );
/*=== covTest.c ===========================================================*/

View File

@ -57,7 +57,7 @@ static Min_Cube_t * Abc_NodeCovSum( Cov_Man_t * p, Min_Cube_t * pCover0, Min_Cub
SeeAlso []
***********************************************************************/
Abc_Ntk_t * Abc_NtkSopEsopCover( Abc_Ntk_t * pNtk, int nFaninMax, int fUseEsop, int fUseSop, int fUseInvs, int fVerbose )
Abc_Ntk_t * Abc_NtkSopEsopCover( Abc_Ntk_t * pNtk, int nFaninMax, int nCubesMax, int fUseEsop, int fUseSop, int fUseInvs, int fVerbose )
{
Abc_Ntk_t * pNtkNew;
Cov_Man_t * p;
@ -65,7 +65,7 @@ Abc_Ntk_t * Abc_NtkSopEsopCover( Abc_Ntk_t * pNtk, int nFaninMax, int fUseEsop,
assert( Abc_NtkIsStrash(pNtk) );
// create the manager
p = Cov_ManAlloc( pNtk, nFaninMax );
p = Cov_ManAlloc( pNtk, nFaninMax, nCubesMax );
p->fUseEsop = fUseEsop;
p->fUseSop = fUseSop;
pNtk->pManCut = p;

View File

@ -42,7 +42,7 @@ ABC_NAMESPACE_IMPL_START
SeeAlso []
***********************************************************************/
Cov_Man_t * Cov_ManAlloc( Abc_Ntk_t * pNtk, int nFaninMax )
Cov_Man_t * Cov_ManAlloc( Abc_Ntk_t * pNtk, int nFaninMax, int nCubesMax )
{
Cov_Man_t * pMan;
Cov_Obj_t * pMem;
@ -54,7 +54,7 @@ Cov_Man_t * Cov_ManAlloc( Abc_Ntk_t * pNtk, int nFaninMax )
pMan = ABC_ALLOC( Cov_Man_t, 1 );
memset( pMan, 0, sizeof(Cov_Man_t) );
pMan->nFaninMax = nFaninMax;
pMan->nCubesMax = 2 * pMan->nFaninMax;
pMan->nCubesMax = nCubesMax;
pMan->nWords = Abc_BitWordNum( nFaninMax * 2 );
// get the cubes