summaryrefslogtreecommitdiffstats
path: root/src/base/abci
diff options
context:
space:
mode:
authorAlan Mishchenko <alanmi@berkeley.edu>2020-03-12 00:33:45 +0200
committerAlan Mishchenko <alanmi@berkeley.edu>2020-03-12 00:33:45 +0200
commitda5a7a235fe32a33b2d7b3beaec8cd7aa3c88c97 (patch)
treee9a8d0edcc53807abd953ca797ae046d3e496b97 /src/base/abci
parentdc3a544b1f1a6e513cc8ef4588d6181d63b2f2a2 (diff)
downloadabc-da5a7a235fe32a33b2d7b3beaec8cd7aa3c88c97.tar.gz
abc-da5a7a235fe32a33b2d7b3beaec8cd7aa3c88c97.tar.bz2
abc-da5a7a235fe32a33b2d7b3beaec8cd7aa3c88c97.zip
Adding limit on the number of live BDD nodes in command 'muxes -g'.
Diffstat (limited to 'src/base/abci')
-rw-r--r--src/base/abci/abc.c29
-rw-r--r--src/base/abci/abcNtbdd.c18
2 files changed, 31 insertions, 16 deletions
diff --git a/src/base/abci/abc.c b/src/base/abci/abc.c
index deda44e3..3f9aae45 100644
--- a/src/base/abci/abc.c
+++ b/src/base/abci/abc.c
@@ -10985,15 +10985,25 @@ usage:
int Abc_CommandMuxes( Abc_Frame_t * pAbc, int argc, char ** argv )
{
Abc_Ntk_t * pNtk, * pNtkRes;
- int c, fGlobal = 0;
-
+ int c, fGlobal = 0, Limit = 1000000;
pNtk = Abc_FrameReadNtk(pAbc);
// set defaults
Extra_UtilGetoptReset();
- while ( ( c = Extra_UtilGetopt( argc, argv, "gh" ) ) != EOF )
+ while ( ( c = Extra_UtilGetopt( argc, argv, "Bgh" ) ) != EOF )
{
switch ( c )
{
+ case 'B':
+ if ( globalUtilOptind >= argc )
+ {
+ Abc_Print( -1, "Command line switch \"-B\" should be followed by an integer.\n" );
+ goto usage;
+ }
+ Limit = atoi(argv[globalUtilOptind]);
+ globalUtilOptind++;
+ if ( Limit < 0 )
+ goto usage;
+ break;
case 'g':
fGlobal ^= 1;
break;
@@ -11028,7 +11038,7 @@ int Abc_CommandMuxes( Abc_Frame_t * pAbc, int argc, char ** argv )
}
// get the new network
- pNtkRes = Abc_NtkBddToMuxes( pNtk, fGlobal );
+ pNtkRes = Abc_NtkBddToMuxes( pNtk, fGlobal, Limit );
if ( pNtkRes == NULL )
{
Abc_Print( -1, "Converting to MUXes has failed.\n" );
@@ -11039,11 +11049,12 @@ int Abc_CommandMuxes( Abc_Frame_t * pAbc, int argc, char ** argv )
return 0;
usage:
- Abc_Print( -2, "usage: muxes [-gh]\n" );
- Abc_Print( -2, "\t converts the current network into a network derived by\n" );
- Abc_Print( -2, "\t replacing all nodes by DAGs isomorphic to the local BDDs\n" );
- Abc_Print( -2, "\t-g : toggle visualizing the global BDDs of primary outputs [default = %s].\n", fGlobal? "yes": "no" );
- Abc_Print( -2, "\t-h : print the command usage\n");
+ Abc_Print( -2, "usage: muxes [-B num] [-gh]\n" );
+ Abc_Print( -2, "\t converts the current network into a network derived by\n" );
+ Abc_Print( -2, "\t replacing all nodes by DAGs isomorphic to the local BDDs\n" );
+ Abc_Print( -2, "\t-B <num>: limit on live BDD nodes during collapsing [default = %d]\n", Limit );
+ Abc_Print( -2, "\t-g : toggle visualizing the global BDDs of primary outputs [default = %s].\n", fGlobal? "yes": "no" );
+ Abc_Print( -2, "\t-h : print the command usage\n");
return 1;
}
diff --git a/src/base/abci/abcNtbdd.c b/src/base/abci/abcNtbdd.c
index 5dc662d7..fc926857 100644
--- a/src/base/abci/abcNtbdd.c
+++ b/src/base/abci/abcNtbdd.c
@@ -34,7 +34,7 @@ ABC_NAMESPACE_IMPL_START
#ifdef ABC_USE_CUDD
-static void Abc_NtkBddToMuxesPerformGlo( Abc_Ntk_t * pNtk, Abc_Ntk_t * pNtkNew );
+static int Abc_NtkBddToMuxesPerformGlo( Abc_Ntk_t * pNtk, Abc_Ntk_t * pNtkNew, int Limit );
static void Abc_NtkBddToMuxesPerform( Abc_Ntk_t * pNtk, Abc_Ntk_t * pNtkNew );
static Abc_Obj_t * Abc_NodeBddToMuxes( Abc_Obj_t * pNodeOld, Abc_Ntk_t * pNtkNew );
static Abc_Obj_t * Abc_NodeBddToMuxes_rec( DdManager * dd, DdNode * bFunc, Abc_Ntk_t * pNtkNew, st__table * tBdd2Node );
@@ -129,12 +129,15 @@ Abc_Ntk_t * Abc_NtkDeriveFromBdd( void * dd0, void * bFunc, char * pNamePo, Vec_
SeeAlso []
***********************************************************************/
-Abc_Ntk_t * Abc_NtkBddToMuxes( Abc_Ntk_t * pNtk, int fGlobal )
+Abc_Ntk_t * Abc_NtkBddToMuxes( Abc_Ntk_t * pNtk, int fGlobal, int Limit )
{
Abc_Ntk_t * pNtkNew;
pNtkNew = Abc_NtkStartFrom( pNtk, ABC_NTK_LOGIC, ABC_FUNC_SOP );
if ( fGlobal )
- Abc_NtkBddToMuxesPerformGlo( pNtk, pNtkNew );
+ {
+ if ( !Abc_NtkBddToMuxesPerformGlo( pNtk, pNtkNew, Limit ) )
+ return NULL;
+ }
else
{
Abc_NtkBddToMuxesPerform( pNtk, pNtkNew );
@@ -259,17 +262,17 @@ Abc_Obj_t * Abc_NodeBddToMuxes_rec( DdManager * dd, DdNode * bFunc, Abc_Ntk_t *
SeeAlso []
***********************************************************************/
-void Abc_NtkBddToMuxesPerformGlo( Abc_Ntk_t * pNtk, Abc_Ntk_t * pNtkNew )
+int Abc_NtkBddToMuxesPerformGlo( Abc_Ntk_t * pNtk, Abc_Ntk_t * pNtkNew, int Limit )
{
DdManager * dd;
Abc_Obj_t * pObj, * pObjNew; int i;
st__table * tBdd2Node;
assert( Abc_NtkIsStrash(pNtk) );
- dd = (DdManager *)Abc_NtkBuildGlobalBdds( pNtk, 10000000, 1, 1, 0, 0 );
+ dd = (DdManager *)Abc_NtkBuildGlobalBdds( pNtk, Limit, 1, 1, 0, 0 );
if ( dd == NULL )
{
printf( "Construction of global BDDs has failed.\n" );
- return;
+ return 0;
}
//printf( "Shared BDD size = %6d nodes.\n", Cudd_ReadKeys(dd) - Cudd_ReadDead(dd) );
@@ -292,6 +295,7 @@ void Abc_NtkBddToMuxesPerformGlo( Abc_Ntk_t * pNtk, Abc_Ntk_t * pNtkNew )
Abc_NtkFreeGlobalBdds( pNtk, 0 );
Extra_StopManager( dd );
Abc_NtkCleanCopy( pNtk );
+ return 1;
}
/**Function*************************************************************
@@ -655,7 +659,7 @@ ABC_PRT( "Time", Abc_Clock() - clk );
#else
double Abc_NtkSpacePercentage( Abc_Obj_t * pNode ) { return 0.0; }
-Abc_Ntk_t * Abc_NtkBddToMuxes( Abc_Ntk_t * pNtk, int fGlobal ) { return NULL; }
+Abc_Ntk_t * Abc_NtkBddToMuxes( Abc_Ntk_t * pNtk, int fGlobal, int Limit ) { return NULL; }
#endif