summaryrefslogtreecommitdiffstats
path: root/src/base
diff options
context:
space:
mode:
authorAlan Mishchenko <alanmi@berkeley.edu>2014-08-27 12:23:31 -0700
committerAlan Mishchenko <alanmi@berkeley.edu>2014-08-27 12:23:31 -0700
commit9c154cfe61ea8792a9773f894b4c17fb2d9b255a (patch)
tree9d2c737a96799d7964086f785e6b754ab746de09 /src/base
parent66d9a80b3db7f9194ee084f210e0ae5f3a9516d7 (diff)
downloadabc-9c154cfe61ea8792a9773f894b4c17fb2d9b255a.tar.gz
abc-9c154cfe61ea8792a9773f894b4c17fb2d9b255a.tar.bz2
abc-9c154cfe61ea8792a9773f894b4c17fb2d9b255a.zip
Improvements to DSD balancing.
Diffstat (limited to 'src/base')
-rw-r--r--src/base/abci/abc.c132
-rw-r--r--src/base/main/main.h2
-rw-r--r--src/base/main/mainFrame.c5
-rw-r--r--src/base/main/mainInt.h1
4 files changed, 103 insertions, 37 deletions
diff --git a/src/base/abci/abc.c b/src/base/abci/abc.c
index 019f7011..bd6f135b 100644
--- a/src/base/abci/abc.c
+++ b/src/base/abci/abc.c
@@ -15662,26 +15662,21 @@ int Abc_CommandDsdSave( Abc_Frame_t * pAbc, int argc, char ** argv )
char * FileName;
char ** pArgvNew;
int nArgcNew;
- int c;
-
+ int c, fSecond = 0;
Extra_UtilGetoptReset();
- while ( ( c = Extra_UtilGetopt( argc, argv, "h" ) ) != EOF )
+ while ( ( c = Extra_UtilGetopt( argc, argv, "bh" ) ) != EOF )
{
switch ( c )
{
+ case 'b':
+ fSecond ^= 1;
+ break;
case 'h':
goto usage;
default:
goto usage;
}
}
-
- if ( !Abc_FrameReadManDsd() )
- {
- Abc_Print( -1, "The DSD manager is not started.\n" );
- return 1;
- }
-
pArgvNew = argv + globalUtilOptind;
nArgcNew = argc - globalUtilOptind;
if ( nArgcNew != 1 )
@@ -15691,12 +15686,30 @@ int Abc_CommandDsdSave( Abc_Frame_t * pAbc, int argc, char ** argv )
}
// get the input file name
FileName = (nArgcNew == 1) ? pArgvNew[0] : NULL;
- If_DsdManSave( (If_DsdMan_t *)Abc_FrameReadManDsd(), FileName );
+ if ( fSecond )
+ {
+ if ( !Abc_FrameReadManDsd2() )
+ {
+ Abc_Print( -1, "The DSD manager is not started.\n" );
+ return 1;
+ }
+ If_DsdManSave( (If_DsdMan_t *)Abc_FrameReadManDsd2(), FileName );
+ }
+ else
+ {
+ if ( !Abc_FrameReadManDsd() )
+ {
+ Abc_Print( -1, "The DSD manager is not started.\n" );
+ return 1;
+ }
+ If_DsdManSave( (If_DsdMan_t *)Abc_FrameReadManDsd(), FileName );
+ }
return 0;
usage:
- Abc_Print( -2, "usage: dsd_save [-h] <file>\n" );
+ Abc_Print( -2, "usage: dsd_save [-bh] <file>\n" );
Abc_Print( -2, "\t saves DSD manager into a file\n");
+ Abc_Print( -2, "\t-b : toggles processing second manager [default = %s]\n", fSecond? "yes": "no" );
Abc_Print( -2, "\t-h : print the command usage\n");
Abc_Print( -2, "\t<file> : (optional) file name to write\n");
return 1;
@@ -15717,14 +15730,17 @@ int Abc_CommandDsdLoad( Abc_Frame_t * pAbc, int argc, char ** argv )
{
char * FileName, * pTemp;
char ** pArgvNew;
- int c, nArgcNew;
+ int c, nArgcNew, fSecond = 0;
FILE * pFile;
If_DsdMan_t * pDsdMan;
Extra_UtilGetoptReset();
- while ( ( c = Extra_UtilGetopt( argc, argv, "h" ) ) != EOF )
+ while ( ( c = Extra_UtilGetopt( argc, argv, "bh" ) ) != EOF )
{
switch ( c )
{
+ case 'b':
+ fSecond ^= 1;
+ break;
case 'h':
goto usage;
default:
@@ -15753,16 +15769,28 @@ int Abc_CommandDsdLoad( Abc_Frame_t * pAbc, int argc, char ** argv )
return 1;
}
fclose( pFile );
- Abc_FrameSetManDsd( NULL );
- pDsdMan = If_DsdManLoad(FileName);
- if ( pDsdMan == NULL )
- return 1;
- Abc_FrameSetManDsd( pDsdMan );
+ if ( fSecond )
+ {
+ Abc_FrameSetManDsd2( NULL );
+ pDsdMan = If_DsdManLoad(FileName);
+ if ( pDsdMan == NULL )
+ return 1;
+ Abc_FrameSetManDsd2( pDsdMan );
+ }
+ else
+ {
+ Abc_FrameSetManDsd( NULL );
+ pDsdMan = If_DsdManLoad(FileName);
+ if ( pDsdMan == NULL )
+ return 1;
+ Abc_FrameSetManDsd( pDsdMan );
+ }
return 0;
usage:
- Abc_Print( -2, "usage: dsd_load [-h] <file>\n" );
+ Abc_Print( -2, "usage: dsd_load [-bh] <file>\n" );
Abc_Print( -2, "\t loads DSD manager from file\n");
+ Abc_Print( -2, "\t-b : toggles processing second manager [default = %s]\n", fSecond? "yes": "no" );
Abc_Print( -2, "\t-h : print the command usage\n");
Abc_Print( -2, "\t<file> : file name to read\n");
return 1;
@@ -15781,30 +15809,46 @@ usage:
***********************************************************************/
int Abc_CommandDsdFree( Abc_Frame_t * pAbc, int argc, char ** argv )
{
- int c;
+ int c, fSecond = 0;
Extra_UtilGetoptReset();
- while ( ( c = Extra_UtilGetopt( argc, argv, "h" ) ) != EOF )
+ while ( ( c = Extra_UtilGetopt( argc, argv, "bh" ) ) != EOF )
{
switch ( c )
{
+ case 'b':
+ fSecond ^= 1;
+ break;
case 'h':
goto usage;
default:
goto usage;
}
}
- if ( !Abc_FrameReadManDsd() )
+ if ( fSecond )
{
- Abc_Print( 1, "The DSD manager is not started.\n" );
- return 0;
+ if ( !Abc_FrameReadManDsd2() )
+ {
+ Abc_Print( 1, "The DSD manager is not started.\n" );
+ return 0;
+ }
+ Abc_FrameSetManDsd2( NULL );
+ }
+ else
+ {
+ if ( !Abc_FrameReadManDsd() )
+ {
+ Abc_Print( 1, "The DSD manager is not started.\n" );
+ return 0;
+ }
+ Abc_FrameSetManDsd( NULL );
}
- Abc_FrameSetManDsd( NULL );
return 0;
usage:
- Abc_Print( -2, "usage: dsd_ps [-h]\n" );
- Abc_Print( -2, "\t deletes DSD manager\n" );
- Abc_Print( -2, "\t-h : print the command usage\n");
+ Abc_Print( -2, "usage: dsd_free [-bh]\n" );
+ Abc_Print( -2, "\t deletes DSD manager\n" );
+ Abc_Print( -2, "\t-b : toggles processing second manager [default = %s]\n", fSecond? "yes": "no" );
+ Abc_Print( -2, "\t-h : print the command usage\n");
return 1;
}
@@ -15821,9 +15865,9 @@ usage:
***********************************************************************/
int Abc_CommandDsdPs( Abc_Frame_t * pAbc, int argc, char ** argv )
{
- int c, Number = 0, Support = 0, fOccurs = 0, fTtDump = 0, fVerbose = 0;
+ int c, Number = 0, Support = 0, fOccurs = 0, fTtDump = 0, fSecond = 0, fVerbose = 0;
Extra_UtilGetoptReset();
- while ( ( c = Extra_UtilGetopt( argc, argv, "NSotvh" ) ) != EOF )
+ while ( ( c = Extra_UtilGetopt( argc, argv, "NSotbvh" ) ) != EOF )
{
switch ( c )
{
@@ -15855,6 +15899,9 @@ int Abc_CommandDsdPs( Abc_Frame_t * pAbc, int argc, char ** argv )
case 't':
fTtDump ^= 1;
break;
+ case 'b':
+ fSecond ^= 1;
+ break;
case 'v':
fVerbose ^= 1;
break;
@@ -15864,21 +15911,34 @@ int Abc_CommandDsdPs( Abc_Frame_t * pAbc, int argc, char ** argv )
goto usage;
}
}
- if ( !Abc_FrameReadManDsd() )
+ if ( fSecond )
{
- Abc_Print( 1, "The DSD manager is not started.\n" );
- return 0;
+ if ( !Abc_FrameReadManDsd2() )
+ {
+ Abc_Print( 1, "The DSD manager is not started.\n" );
+ return 0;
+ }
+ If_DsdManPrint( (If_DsdMan_t *)Abc_FrameReadManDsd2(), NULL, Number, Support, fOccurs, fTtDump, fVerbose );
+ }
+ else
+ {
+ if ( !Abc_FrameReadManDsd() )
+ {
+ Abc_Print( 1, "The DSD manager is not started.\n" );
+ return 0;
+ }
+ If_DsdManPrint( (If_DsdMan_t *)Abc_FrameReadManDsd(), NULL, Number, Support, fOccurs, fTtDump, fVerbose );
}
- If_DsdManPrint( (If_DsdMan_t *)Abc_FrameReadManDsd(), NULL, Number, Support, fOccurs, fTtDump, fVerbose );
return 0;
usage:
- Abc_Print( -2, "usage: dsd_ps [-NS num] [-ovh]\n" );
+ Abc_Print( -2, "usage: dsd_ps [-NS num] [-obvh]\n" );
Abc_Print( -2, "\t prints statistics of DSD manager\n" );
Abc_Print( -2, "\t-N num : show structures whose ID divides by N [default = %d]\n", Number );
Abc_Print( -2, "\t-S num : show structures whose support size is S [default = %d]\n", Support );
Abc_Print( -2, "\t-o : toggles printing occurence distribution [default = %s]\n", fOccurs? "yes": "no" );
Abc_Print( -2, "\t-t : toggles dumping truth tables [default = %s]\n", fTtDump? "yes": "no" );
+ Abc_Print( -2, "\t-b : toggles processing second manager [default = %s]\n", fSecond? "yes": "no" );
Abc_Print( -2, "\t-v : toggles verbose output [default = %s]\n", fVerbose? "yes": "no" );
Abc_Print( -2, "\t-h : print the command usage\n");
return 1;
diff --git a/src/base/main/main.h b/src/base/main/main.h
index 38867e88..3b169bbc 100644
--- a/src/base/main/main.h
+++ b/src/base/main/main.h
@@ -106,6 +106,7 @@ extern ABC_DLL void * Abc_FrameReadLibScl();
extern ABC_DLL void * Abc_FrameReadManDd();
extern ABC_DLL void * Abc_FrameReadManDec();
extern ABC_DLL void * Abc_FrameReadManDsd();
+extern ABC_DLL void * Abc_FrameReadManDsd2();
extern ABC_DLL char * Abc_FrameReadFlag( char * pFlag );
extern ABC_DLL int Abc_FrameIsFlagEnabled( char * pFlag );
@@ -140,6 +141,7 @@ extern ABC_DLL void Abc_FrameSetCex( Abc_Cex_t * pCex );
extern ABC_DLL void Abc_FrameSetNFrames( int nFrames );
extern ABC_DLL void Abc_FrameSetStatus( int Status );
extern ABC_DLL void Abc_FrameSetManDsd( void * pMan );
+extern ABC_DLL void Abc_FrameSetManDsd2( void * pMan );
extern ABC_DLL int Abc_FrameCheckPoConst( Abc_Frame_t * p, int iPoNum );
diff --git a/src/base/main/mainFrame.c b/src/base/main/mainFrame.c
index c3af051a..06159427 100644
--- a/src/base/main/mainFrame.c
+++ b/src/base/main/mainFrame.c
@@ -60,6 +60,7 @@ void * Abc_FrameReadLibScl() { return s_GlobalFr
void * Abc_FrameReadManDd() { if ( s_GlobalFrame->dd == NULL ) s_GlobalFrame->dd = Cudd_Init( 0, 0, CUDD_UNIQUE_SLOTS, CUDD_CACHE_SLOTS, 0 ); return s_GlobalFrame->dd; }
void * Abc_FrameReadManDec() { if ( s_GlobalFrame->pManDec == NULL ) s_GlobalFrame->pManDec = Dec_ManStart(); return s_GlobalFrame->pManDec; }
void * Abc_FrameReadManDsd() { return s_GlobalFrame->pManDsd; }
+void * Abc_FrameReadManDsd2() { return s_GlobalFrame->pManDsd2; }
char * Abc_FrameReadFlag( char * pFlag ) { return Cmd_FlagReadByName( s_GlobalFrame, pFlag ); }
int Abc_FrameReadBmcFrames( Abc_Frame_t * p ) { return s_GlobalFrame->nFrames; }
@@ -85,7 +86,8 @@ void Abc_FrameSetFlag( char * pFlag, char * pValue ) { Cmd_FlagUpdateVal
void Abc_FrameSetCex( Abc_Cex_t * pCex ) { ABC_FREE( s_GlobalFrame->pCex ); s_GlobalFrame->pCex = pCex; }
void Abc_FrameSetNFrames( int nFrames ) { ABC_FREE( s_GlobalFrame->pCex ); s_GlobalFrame->nFrames = nFrames; }
void Abc_FrameSetStatus( int Status ) { ABC_FREE( s_GlobalFrame->pCex ); s_GlobalFrame->Status = Status; }
-void Abc_FrameSetManDsd( void * pMan ) { if (s_GlobalFrame->pManDsd && s_GlobalFrame->pManDsd != pMan) If_DsdManFree((If_DsdMan_t *)s_GlobalFrame->pManDsd, 0); s_GlobalFrame->pManDsd = pMan; }
+void Abc_FrameSetManDsd( void * pMan ) { if (s_GlobalFrame->pManDsd && s_GlobalFrame->pManDsd != pMan) If_DsdManFree((If_DsdMan_t *)s_GlobalFrame->pManDsd, 0); s_GlobalFrame->pManDsd = pMan; }
+void Abc_FrameSetManDsd2( void * pMan ) { if (s_GlobalFrame->pManDsd2 && s_GlobalFrame->pManDsd2 != pMan) If_DsdManFree((If_DsdMan_t *)s_GlobalFrame->pManDsd2, 0); s_GlobalFrame->pManDsd2 = pMan; }
int Abc_FrameIsBatchMode() { return s_GlobalFrame ? s_GlobalFrame->fBatchMode : 0; }
@@ -195,6 +197,7 @@ void Abc_FrameDeallocate( Abc_Frame_t * p )
if ( p->pSave3 ) Aig_ManStop( (Aig_Man_t *)p->pSave3 );
if ( p->pSave4 ) Aig_ManStop( (Aig_Man_t *)p->pSave4 );
if ( p->pManDsd ) If_DsdManFree( (If_DsdMan_t *)p->pManDsd, 0 );
+ if ( p->pManDsd2 ) If_DsdManFree( (If_DsdMan_t *)p->pManDsd2, 0 );
if ( p->vPlugInComBinPairs )
{
char * pTemp;
diff --git a/src/base/main/mainInt.h b/src/base/main/mainInt.h
index c8276eeb..50a52090 100644
--- a/src/base/main/mainInt.h
+++ b/src/base/main/mainInt.h
@@ -85,6 +85,7 @@ struct Abc_Frame_t_
// decomposition package
void * pManDec; // decomposition manager
void * pManDsd; // decomposition manager
+ void * pManDsd2; // decomposition manager
DdManager * dd; // temporary BDD package
// libraries for mapping
void * pLibLut; // the current LUT library