Commit f91f23be by Alan Mishchenko

Adding new switch 'bdd -s' to translate SOP directly into BDD.

parent 67bfb4ba
...@@ -8450,18 +8450,21 @@ usage: ...@@ -8450,18 +8450,21 @@ usage:
int Abc_CommandBdd( Abc_Frame_t * pAbc, int argc, char ** argv ) int Abc_CommandBdd( Abc_Frame_t * pAbc, int argc, char ** argv )
{ {
Abc_Ntk_t * pNtk = Abc_FrameReadNtk(pAbc); Abc_Ntk_t * pNtk = Abc_FrameReadNtk(pAbc);
int fReorder = 1; int fReorder = 1, fBdd2Sop = 0;
int c; int c;
// set defaults // set defaults
Extra_UtilGetoptReset(); Extra_UtilGetoptReset();
while ( ( c = Extra_UtilGetopt( argc, argv, "rh" ) ) != EOF ) while ( ( c = Extra_UtilGetopt( argc, argv, "rsh" ) ) != EOF )
{ {
switch ( c ) switch ( c )
{ {
case 'r': case 'r':
fReorder ^= 1; fReorder ^= 1;
break; break;
case 's':
fBdd2Sop ^= 1;
break;
case 'h': case 'h':
goto usage; goto usage;
default: default:
...@@ -8478,6 +8481,8 @@ int Abc_CommandBdd( Abc_Frame_t * pAbc, int argc, char ** argv ) ...@@ -8478,6 +8481,8 @@ int Abc_CommandBdd( Abc_Frame_t * pAbc, int argc, char ** argv )
Abc_Print( -1, "Converting to BDD is possible only for logic networks.\n" ); Abc_Print( -1, "Converting to BDD is possible only for logic networks.\n" );
return 1; return 1;
} }
if ( fBdd2Sop && Abc_NtkHasSop(pNtk) )
return !Abc_NtkSopToBdd(pNtk);
if ( Abc_NtkIsBddLogic(pNtk) ) if ( Abc_NtkIsBddLogic(pNtk) )
{ {
Abc_Print( -1, "The logic network is already in the BDD form.\n" ); Abc_Print( -1, "The logic network is already in the BDD form.\n" );
...@@ -8491,9 +8496,10 @@ int Abc_CommandBdd( Abc_Frame_t * pAbc, int argc, char ** argv ) ...@@ -8491,9 +8496,10 @@ int Abc_CommandBdd( Abc_Frame_t * pAbc, int argc, char ** argv )
return 0; return 0;
usage: usage:
Abc_Print( -2, "usage: bdd [-rh]\n" ); Abc_Print( -2, "usage: bdd [-rsh]\n" );
Abc_Print( -2, "\t converts node functions to BDD\n" ); Abc_Print( -2, "\t converts node functions to BDD\n" );
Abc_Print( -2, "\t-r : toggles enabling dynamic variable reordering [default = %s]\n", fReorder? "yes": "no" ); Abc_Print( -2, "\t-r : toggles enabling dynamic variable reordering [default = %s]\n", fReorder? "yes": "no" );
Abc_Print( -2, "\t-s : toggles constructing BDDs directly from SOPs [default = %s]\n", fBdd2Sop? "yes": "no" );
Abc_Print( -2, "\t-h : print the command usage\n"); Abc_Print( -2, "\t-h : print the command usage\n");
return 1; return 1;
} }
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