Commit 98e377bd by Alan Mishchenko

Adding features to CNF generation.

parent fbc9c00f
...@@ -1643,11 +1643,11 @@ Cnf_Dat_t * Mf_ManGenerateCnf( Gia_Man_t * pGia, int nLutSize, int fCnfObjIds, i ...@@ -1643,11 +1643,11 @@ Cnf_Dat_t * Mf_ManGenerateCnf( Gia_Man_t * pGia, int nLutSize, int fCnfObjIds, i
// Cnf_DataPrint( (Cnf_Dat_t *)pGia->pData, 1 ); // Cnf_DataPrint( (Cnf_Dat_t *)pGia->pData, 1 );
return pGia->pData; return pGia->pData;
} }
void Mf_ManDumpCnf( Gia_Man_t * p, char * pFileName, int nLutSize, int fVerbose ) void Mf_ManDumpCnf( Gia_Man_t * p, char * pFileName, int nLutSize, int fCnfObjIds, int fAddOrCla, int fVerbose )
{ {
abctime clk = Abc_Clock(); abctime clk = Abc_Clock();
Cnf_Dat_t * pCnf; Cnf_Dat_t * pCnf;
pCnf = Mf_ManGenerateCnf( p, nLutSize, 0, 1, fVerbose ); pCnf = Mf_ManGenerateCnf( p, nLutSize, fCnfObjIds, fAddOrCla, fVerbose );
Cnf_DataWriteIntoFile( pCnf, pFileName, 0, NULL, NULL ); Cnf_DataWriteIntoFile( pCnf, pFileName, 0, NULL, NULL );
// if ( fVerbose ) // if ( fVerbose )
{ {
......
...@@ -1939,14 +1939,16 @@ usage: ...@@ -1939,14 +1939,16 @@ usage:
int IoCommandWriteCnf2( Abc_Frame_t * pAbc, int argc, char **argv ) int IoCommandWriteCnf2( Abc_Frame_t * pAbc, int argc, char **argv )
{ {
extern void Jf_ManDumpCnf( Gia_Man_t * p, char * pFileName, int fVerbose ); extern void Jf_ManDumpCnf( Gia_Man_t * p, char * pFileName, int fVerbose );
extern void Mf_ManDumpCnf( Gia_Man_t * p, char * pFileName, int nLutSize, int fVerbose ); extern void Mf_ManDumpCnf( Gia_Man_t * p, char * pFileName, int nLutSize, int fCnfObjIds, int fAddOrCla, int fVerbose );
FILE * pFile; FILE * pFile;
char * pFileName; char * pFileName;
int nLutSize = 6; int nLutSize = 6;
int fNewAlgo = 1; int fNewAlgo = 1;
int fCnfObjIds = 0;
int fAddOrCla = 1;
int c, fVerbose = 0; int c, fVerbose = 0;
Extra_UtilGetoptReset(); Extra_UtilGetoptReset();
while ( ( c = Extra_UtilGetopt( argc, argv, "Kavh" ) ) != EOF ) while ( ( c = Extra_UtilGetopt( argc, argv, "Kaiovh" ) ) != EOF )
{ {
switch ( c ) switch ( c )
{ {
...@@ -1962,6 +1964,12 @@ int IoCommandWriteCnf2( Abc_Frame_t * pAbc, int argc, char **argv ) ...@@ -1962,6 +1964,12 @@ int IoCommandWriteCnf2( Abc_Frame_t * pAbc, int argc, char **argv )
case 'a': case 'a':
fNewAlgo ^= 1; fNewAlgo ^= 1;
break; break;
case 'i':
fCnfObjIds ^= 1;
break;
case 'o':
fAddOrCla ^= 1;
break;
case 'v': case 'v':
fVerbose ^= 1; fVerbose ^= 1;
break; break;
...@@ -2003,16 +2011,18 @@ int IoCommandWriteCnf2( Abc_Frame_t * pAbc, int argc, char **argv ) ...@@ -2003,16 +2011,18 @@ int IoCommandWriteCnf2( Abc_Frame_t * pAbc, int argc, char **argv )
} }
fclose( pFile ); fclose( pFile );
if ( fNewAlgo ) if ( fNewAlgo )
Mf_ManDumpCnf( pAbc->pGia, pFileName, nLutSize, fVerbose ); Mf_ManDumpCnf( pAbc->pGia, pFileName, nLutSize, fCnfObjIds, fAddOrCla, fVerbose );
else else
Jf_ManDumpCnf( pAbc->pGia, pFileName, fVerbose ); Jf_ManDumpCnf( pAbc->pGia, pFileName, fVerbose );
return 0; return 0;
usage: usage:
fprintf( pAbc->Err, "usage: &write_cnf [-Kavh] <file>\n" ); fprintf( pAbc->Err, "usage: &write_cnf [-Kaiovh] <file>\n" );
fprintf( pAbc->Err, "\t writes CNF produced by a new generator\n" ); fprintf( pAbc->Err, "\t writes CNF produced by a new generator\n" );
fprintf( pAbc->Err, "\t-K <num> : the LUT size (3 <= num <= 8) [default = %d]\n", nLutSize ); fprintf( pAbc->Err, "\t-K <num> : the LUT size (3 <= num <= 8) [default = %d]\n", nLutSize );
fprintf( pAbc->Err, "\t-a : toggle using new algorithm [default = %s]\n", fNewAlgo? "yes" : "no" ); fprintf( pAbc->Err, "\t-a : toggle using new algorithm [default = %s]\n", fNewAlgo? "yes" : "no" );
fprintf( pAbc->Err, "\t-i : toggle using AIG object IDs as CNF variables [default = %s]\n", fCnfObjIds? "yes" : "no" );
fprintf( pAbc->Err, "\t-o : toggle adding OR clause for the outputs [default = %s]\n", fAddOrCla? "yes" : "no" );
fprintf( pAbc->Err, "\t-v : toggle printing verbose information [default = %s]\n", fVerbose? "yes" : "no" ); fprintf( pAbc->Err, "\t-v : toggle printing verbose information [default = %s]\n", fVerbose? "yes" : "no" );
fprintf( pAbc->Err, "\t-h : print the help massage\n" ); fprintf( pAbc->Err, "\t-h : print the help massage\n" );
fprintf( pAbc->Err, "\tfile : the name of the file to write\n" ); fprintf( pAbc->Err, "\tfile : the name of the file to write\n" );
......
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