Commit db43d6fb by Alan Mishchenko

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

parent 0a1b6f8f
...@@ -10952,6 +10952,7 @@ int Abc_CommandCover( Abc_Frame_t * pAbc, int argc, char ** argv ) ...@@ -10952,6 +10952,7 @@ int Abc_CommandCover( Abc_Frame_t * pAbc, int argc, char ** argv )
int fUseEsop; int fUseEsop;
int fUseInvs; int fUseInvs;
int nFaninMax; int nFaninMax;
int nCubesMax;
pNtk = Abc_FrameReadNtk(pAbc); pNtk = Abc_FrameReadNtk(pAbc);
// set defaults // set defaults
...@@ -10960,15 +10961,16 @@ int Abc_CommandCover( Abc_Frame_t * pAbc, int argc, char ** argv ) ...@@ -10960,15 +10961,16 @@ int Abc_CommandCover( Abc_Frame_t * pAbc, int argc, char ** argv )
fVerbose = 0; fVerbose = 0;
fUseInvs = 1; fUseInvs = 1;
nFaninMax = 8; nFaninMax = 8;
nCubesMax = 8;
Extra_UtilGetoptReset(); Extra_UtilGetoptReset();
while ( ( c = Extra_UtilGetopt( argc, argv, "Nsxivh" ) ) != EOF ) while ( ( c = Extra_UtilGetopt( argc, argv, "IPsxivh" ) ) != EOF )
{ {
switch ( c ) switch ( c )
{ {
case 'N': case 'I':
if ( globalUtilOptind >= argc ) 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; goto usage;
} }
nFaninMax = atoi(argv[globalUtilOptind]); nFaninMax = atoi(argv[globalUtilOptind]);
...@@ -10976,6 +10978,17 @@ int Abc_CommandCover( Abc_Frame_t * pAbc, int argc, char ** argv ) ...@@ -10976,6 +10978,17 @@ int Abc_CommandCover( Abc_Frame_t * pAbc, int argc, char ** argv )
if ( nFaninMax < 0 ) if ( nFaninMax < 0 )
goto usage; goto usage;
break; 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': case 's':
fUseSop ^= 1; fUseSop ^= 1;
break; break;
...@@ -11007,7 +11020,7 @@ int Abc_CommandCover( Abc_Frame_t * pAbc, int argc, char ** argv ) ...@@ -11007,7 +11020,7 @@ int Abc_CommandCover( Abc_Frame_t * pAbc, int argc, char ** argv )
} }
// run the command // 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 ) if ( pNtkRes == NULL )
{ {
Abc_Print( -1, "Command has failed.\n" ); Abc_Print( -1, "Command has failed.\n" );
...@@ -11018,10 +11031,11 @@ int Abc_CommandCover( Abc_Frame_t * pAbc, int argc, char ** argv ) ...@@ -11018,10 +11031,11 @@ int Abc_CommandCover( Abc_Frame_t * pAbc, int argc, char ** argv )
return 0; return 0;
usage: 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 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 (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-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-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" ); // Abc_Print( -2, "\t-i : toggle the use of interters [default = %s]\n", fUseInvs? "yes": "no" );
...@@ -88,9 +88,9 @@ extern Abc_Ntk_t * Abc_NtkCovDerive( Cov_Man_t * p, Abc_Ntk_t * pNtk ); ...@@ -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_NtkCovDeriveClean( Cov_Man_t * p, Abc_Ntk_t * pNtk );
extern Abc_Ntk_t * Abc_NtkCovDeriveRegular( Cov_Man_t * p, Abc_Ntk_t * pNtk ); extern Abc_Ntk_t * Abc_NtkCovDeriveRegular( Cov_Man_t * p, Abc_Ntk_t * pNtk );
/*=== covCore.c ===========================================================*/ /*=== 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 ============================================================*/ /*=== 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 Cov_ManFree( Cov_Man_t * p );
extern void Abc_NodeCovDropData( Cov_Man_t * p, Abc_Obj_t * pObj ); extern void Abc_NodeCovDropData( Cov_Man_t * p, Abc_Obj_t * pObj );
/*=== covTest.c ===========================================================*/ /*=== covTest.c ===========================================================*/
......
...@@ -57,7 +57,7 @@ static Min_Cube_t * Abc_NodeCovSum( Cov_Man_t * p, Min_Cube_t * pCover0, Min_Cub ...@@ -57,7 +57,7 @@ static Min_Cube_t * Abc_NodeCovSum( Cov_Man_t * p, Min_Cube_t * pCover0, Min_Cub
SeeAlso [] 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; Abc_Ntk_t * pNtkNew;
Cov_Man_t * p; Cov_Man_t * p;
...@@ -65,7 +65,7 @@ Abc_Ntk_t * Abc_NtkSopEsopCover( Abc_Ntk_t * pNtk, int nFaninMax, int fUseEsop, ...@@ -65,7 +65,7 @@ Abc_Ntk_t * Abc_NtkSopEsopCover( Abc_Ntk_t * pNtk, int nFaninMax, int fUseEsop,
assert( Abc_NtkIsStrash(pNtk) ); assert( Abc_NtkIsStrash(pNtk) );
// create the manager // create the manager
p = Cov_ManAlloc( pNtk, nFaninMax ); p = Cov_ManAlloc( pNtk, nFaninMax, nCubesMax );
p->fUseEsop = fUseEsop; p->fUseEsop = fUseEsop;
p->fUseSop = fUseSop; p->fUseSop = fUseSop;
pNtk->pManCut = p; pNtk->pManCut = p;
......
...@@ -42,7 +42,7 @@ ABC_NAMESPACE_IMPL_START ...@@ -42,7 +42,7 @@ ABC_NAMESPACE_IMPL_START
SeeAlso [] 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_Man_t * pMan;
Cov_Obj_t * pMem; Cov_Obj_t * pMem;
...@@ -54,7 +54,7 @@ Cov_Man_t * Cov_ManAlloc( Abc_Ntk_t * pNtk, int nFaninMax ) ...@@ -54,7 +54,7 @@ Cov_Man_t * Cov_ManAlloc( Abc_Ntk_t * pNtk, int nFaninMax )
pMan = ABC_ALLOC( Cov_Man_t, 1 ); pMan = ABC_ALLOC( Cov_Man_t, 1 );
memset( pMan, 0, sizeof(Cov_Man_t) ); memset( pMan, 0, sizeof(Cov_Man_t) );
pMan->nFaninMax = nFaninMax; pMan->nFaninMax = nFaninMax;
pMan->nCubesMax = 2 * pMan->nFaninMax; pMan->nCubesMax = nCubesMax;
pMan->nWords = Abc_BitWordNum( nFaninMax * 2 ); pMan->nWords = Abc_BitWordNum( nFaninMax * 2 );
// get the cubes // get the cubes
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment