summaryrefslogtreecommitdiffstats
path: root/src/base/main
diff options
context:
space:
mode:
Diffstat (limited to 'src/base/main')
-rw-r--r--src/base/main/main.c21
-rw-r--r--src/base/main/main.h31
-rw-r--r--src/base/main/mainFrame.c94
-rw-r--r--src/base/main/mainInt.h11
-rw-r--r--src/base/main/mainUtils.c10
5 files changed, 97 insertions, 70 deletions
diff --git a/src/base/main/main.c b/src/base/main/main.c
index a3fd979a..0622a3bd 100644
--- a/src/base/main/main.c
+++ b/src/base/main/main.c
@@ -231,29 +231,22 @@ usage:
Synopsis [Returns 1 if s is a file type recognized, else returns 0.]
- Description [Returns 1 if s is a file type recognized by VIS, else returns
- 0. Recognized types are "blif", "blif_mv", "blif_mvs", and "none".]
+ Description [Returns 1 if s is a file type recognized by ABC, else returns 0.
+ Recognized types are "blif", "bench", "pla", and "none".]
SideEffects []
******************************************************************************/
-static int
-TypeCheck(
- Abc_Frame_t * pAbc,
- char * s)
+static int TypeCheck( Abc_Frame_t * pAbc, char * s )
{
- if (strcmp(s, "blif") == 0) {
+ if (strcmp(s, "blif") == 0)
return 1;
- }
- else if (strcmp(s, "blif_mv") == 0) {
+ else if (strcmp(s, "bench") == 0)
return 1;
- }
- else if (strcmp(s, "blif_mvs") == 0) {
+ else if (strcmp(s, "pla") == 0)
return 1;
- }
- else if (strcmp(s, "none") == 0) {
+ else if (strcmp(s, "none") == 0)
return 1;
- }
else {
fprintf( pAbc->Err, "unknown type %s\n", s );
return 0;
diff --git a/src/base/main/main.h b/src/base/main/main.h
index 72eec599..0d47dec5 100644
--- a/src/base/main/main.h
+++ b/src/base/main/main.h
@@ -90,21 +90,22 @@ extern void Abc_FrameDeleteAllNetworks( Abc_Frame_t * p );
extern void Abc_FrameSetGlobalFrame( Abc_Frame_t * p );
extern Abc_Frame_t * Abc_FrameGetGlobalFrame();
-extern Abc_Ntk_t * Abc_FrameReadNtkStore ( Abc_Frame_t * pFrame );
-extern int Abc_FrameReadNtkStoreSize ( Abc_Frame_t * pFrame );
-extern void Abc_FrameSetNtkStore ( Abc_Frame_t * pFrame, Abc_Ntk_t * pNtk );
-extern void Abc_FrameSetNtkStoreSize ( Abc_Frame_t * pFrame, int nStored );
-
-extern void * Abc_FrameReadLibLut ( Abc_Frame_t * pFrame );
-extern void * Abc_FrameReadLibGen ( Abc_Frame_t * pFrame );
-extern void * Abc_FrameReadLibSuper ( Abc_Frame_t * pFrame );
-extern void Abc_FrameSetLibLut ( Abc_Frame_t * pFrame, void * pLib );
-extern void Abc_FrameSetLibGen ( Abc_Frame_t * pFrame, void * pLib );
-extern void Abc_FrameSetLibSuper ( Abc_Frame_t * pFrame, void * pLib );
-
-extern void * Abc_FrameReadManDd ( Abc_Frame_t * pFrame );
-extern void * Abc_FrameReadManDec ( Abc_Frame_t * pFrame );
-
+extern Abc_Ntk_t * Abc_FrameReadNtkStore();
+extern int Abc_FrameReadNtkStoreSize();
+extern void * Abc_FrameReadLibLut();
+extern void * Abc_FrameReadLibGen();
+extern void * Abc_FrameReadLibSuper();
+extern void * Abc_FrameReadManDd();
+extern void * Abc_FrameReadManDec();
+extern char * Abc_FrameReadFlag( char * pFlag );
+extern bool Abc_FrameIsFlagEnabled( char * pFlag );
+
+extern void Abc_FrameSetNtkStore( Abc_Ntk_t * pNtk );
+extern void Abc_FrameSetNtkStoreSize( int nStored );
+extern void Abc_FrameSetLibLut( void * pLib );
+extern void Abc_FrameSetLibGen( void * pLib );
+extern void Abc_FrameSetLibSuper( void * pLib );
+extern void Abc_FrameSetFlag( char * pFlag, char * pValue );
////////////////////////////////////////////////////////////////////////
/// END OF FILE ///
diff --git a/src/base/main/mainFrame.c b/src/base/main/mainFrame.c
index 09a750ea..77c9f579 100644
--- a/src/base/main/mainFrame.c
+++ b/src/base/main/mainFrame.c
@@ -26,7 +26,7 @@
/// DECLARATIONS ///
////////////////////////////////////////////////////////////////////////
-static Abc_Frame_t * Abc_FrameGlobalFrame = 0;
+static Abc_Frame_t * s_GlobalFrame = NULL;
////////////////////////////////////////////////////////////////////////
/// FUNCTION DEFITIONS ///
@@ -34,6 +34,57 @@ static Abc_Frame_t * Abc_FrameGlobalFrame = 0;
/**Function*************************************************************
+ Synopsis [APIs to access parameters in the flobal frame.]
+
+ Description []
+
+ SideEffects []
+
+ SeeAlso []
+
+***********************************************************************/
+Abc_Ntk_t * Abc_FrameReadNtkStore() { return s_GlobalFrame->pStored; }
+int Abc_FrameReadNtkStoreSize() { return s_GlobalFrame->nStored; }
+void * Abc_FrameReadLibLut() { return s_GlobalFrame->pLibLut; }
+void * Abc_FrameReadLibGen() { return s_GlobalFrame->pLibGen; }
+void * Abc_FrameReadLibSuper() { return s_GlobalFrame->pLibSuper; }
+void * Abc_FrameReadManDd() { return s_GlobalFrame->dd; }
+void * Abc_FrameReadManDec() { return s_GlobalFrame->pManDec; }
+char * Abc_FrameReadFlag( char * pFlag ) { return Cmd_FlagReadByName( s_GlobalFrame, pFlag ); }
+
+void Abc_FrameSetNtkStore( Abc_Ntk_t * pNtk ) { s_GlobalFrame->pStored = pNtk; }
+void Abc_FrameSetNtkStoreSize( int nStored ) { s_GlobalFrame->nStored = nStored; }
+void Abc_FrameSetLibLut( void * pLib ) { s_GlobalFrame->pLibLut = pLib; }
+void Abc_FrameSetLibGen( void * pLib ) { s_GlobalFrame->pLibGen = pLib; }
+void Abc_FrameSetLibSuper( void * pLib ) { s_GlobalFrame->pLibSuper = pLib; }
+void Abc_FrameSetFlag( char * pFlag, char * pValue ) { Cmd_FlagUpdateValue( s_GlobalFrame, pFlag, pValue ); }
+
+/**Function*************************************************************
+
+ Synopsis [Returns 1 if the flag is enabled without value or with value 1.]
+
+ Description []
+
+ SideEffects []
+
+ SeeAlso []
+
+***********************************************************************/
+bool Abc_FrameIsFlagEnabled( char * pFlag )
+{
+ char * pValue;
+ // if flag is not defined, it is not enabled
+ pValue = Abc_FrameReadFlag( pFlag );
+ if ( pValue == NULL )
+ return 0;
+ // if flag is defined but value is not empty (no parameter) or "1", it is not enabled
+ if ( strcmp(pValue, "") && strcmp(pValue, "1") )
+ return 0;
+ return 1;
+}
+
+/**Function*************************************************************
+
Synopsis []
Description []
@@ -311,7 +362,7 @@ void Abc_FrameReplaceCurrentNetwork( Abc_Frame_t * p, Abc_Ntk_t * pNtk )
return;
// transfer the parameters to the new network
- if ( p->pNtkCur )
+ if ( p->pNtkCur && Abc_FrameIsFlagEnabled( "backup" ) )
{
Abc_NtkSetBackup( pNtk, Abc_NtkBackup(p->pNtkCur) );
Abc_NtkSetStep( pNtk, Abc_NtkStep(p->pNtkCur) );
@@ -322,6 +373,9 @@ void Abc_FrameReplaceCurrentNetwork( Abc_Frame_t * p, Abc_Ntk_t * pNtk )
{
Abc_NtkSetBackup( pNtk, NULL );
Abc_NtkSetStep( pNtk, ++p->nSteps );
+ // delete the current network if present but backup is disabled
+ if ( p->pNtkCur )
+ Abc_NtkDelete( p->pNtkCur );
}
// set the new current network
p->pNtkCur = pNtk;
@@ -385,7 +439,7 @@ void Abc_FrameDeleteAllNetworks( Abc_Frame_t * p )
***********************************************************************/
void Abc_FrameSetGlobalFrame( Abc_Frame_t * p )
{
- Abc_FrameGlobalFrame = p;
+ s_GlobalFrame = p;
}
/**Function*************************************************************
@@ -401,43 +455,17 @@ void Abc_FrameSetGlobalFrame( Abc_Frame_t * p )
***********************************************************************/
Abc_Frame_t * Abc_FrameGetGlobalFrame()
{
- if ( Abc_FrameGlobalFrame == 0 )
+ if ( s_GlobalFrame == 0 )
{
// start the framework
- Abc_FrameGlobalFrame = Abc_FrameAllocate();
+ s_GlobalFrame = Abc_FrameAllocate();
// perform initializations
- Abc_FrameInit( Abc_FrameGlobalFrame );
+ Abc_FrameInit( s_GlobalFrame );
}
- return Abc_FrameGlobalFrame;
+ return s_GlobalFrame;
}
-/**Function*************************************************************
-
- Synopsis []
-
- Description []
-
- SideEffects []
-
- SeeAlso []
-
-***********************************************************************/
-Abc_Ntk_t * Abc_FrameReadNtkStore ( Abc_Frame_t * pFrame ) { return pFrame->pStored; }
-int Abc_FrameReadNtkStoreSize ( Abc_Frame_t * pFrame ) { return pFrame->nStored; }
-void Abc_FrameSetNtkStore ( Abc_Frame_t * pFrame, Abc_Ntk_t * pNtk ) { pFrame->pStored = pNtk; }
-void Abc_FrameSetNtkStoreSize ( Abc_Frame_t * pFrame, int nStored ) { pFrame->nStored = nStored;}
-
-void * Abc_FrameReadLibLut ( Abc_Frame_t * pFrame ) { return pFrame->pLibLut; }
-void * Abc_FrameReadLibGen ( Abc_Frame_t * pFrame ) { return pFrame->pLibGen; }
-void * Abc_FrameReadLibSuper ( Abc_Frame_t * pFrame ) { return pFrame->pLibSuper; }
-void Abc_FrameSetLibLut ( Abc_Frame_t * pFrame, void * pLib ) { pFrame->pLibLut = pLib; }
-void Abc_FrameSetLibGen ( Abc_Frame_t * pFrame, void * pLib ) { pFrame->pLibGen = pLib; }
-void Abc_FrameSetLibSuper ( Abc_Frame_t * pFrame, void * pLib ) { pFrame->pLibSuper = pLib; }
-
-void * Abc_FrameReadManDd ( Abc_Frame_t * pFrame ) { return pFrame->dd; }
-void * Abc_FrameReadManDec ( Abc_Frame_t * pFrame ) { return pFrame->pManDec; }
-
////////////////////////////////////////////////////////////////////////
/// END OF FILE ///
////////////////////////////////////////////////////////////////////////
diff --git a/src/base/main/mainInt.h b/src/base/main/mainInt.h
index 95d5b22d..6b929854 100644
--- a/src/base/main/mainInt.h
+++ b/src/base/main/mainInt.h
@@ -32,7 +32,7 @@
////////////////////////////////////////////////////////////////////////
// the current version
-#define ABC_VERSION "UC Berkeley, ABC 1.0"
+#define ABC_VERSION "UC Berkeley, ABC 1.01"
// the maximum length of an input line
#define MAX_STR 32768
@@ -53,8 +53,8 @@ struct Abc_Frame_t_
// the functionality
Abc_Ntk_t * pNtkCur; // the current network
int nSteps; // the counter of different network processed
- // when this flag is 1, the current command is executed in autoexec mode
- int fAutoexac;
+ int fAutoexac; // marks the autoexec mode
+ int fBatchMode; // are we invoked in batch mode?
// output streams
FILE * Out;
FILE * Err;
@@ -62,14 +62,13 @@ struct Abc_Frame_t_
// used for runtime measurement
int TimeCommand; // the runtime of the last command
int TimeTotal; // the total runtime of all commands
- int fBatchMode; // are we invoked in batch mode?
// temporary storage for structural choices
Abc_Ntk_t * pStored; // the stored networks
int nStored; // the number of stored networks
// decomposition package
- DdManager * dd; // temporary BDD package
void * pManDec; // decomposition manager
-
+ DdManager * dd; // temporary BDD package
+ // libraries for mapping
void * pLibLut; // the current LUT library
void * pLibGen; // the current genlib
void * pLibSuper; // the current supergate library
diff --git a/src/base/main/mainUtils.c b/src/base/main/mainUtils.c
index 35d3c364..9d1201fa 100644
--- a/src/base/main/mainUtils.c
+++ b/src/base/main/mainUtils.c
@@ -161,8 +161,14 @@ void Abc_UtilsSource( Abc_Frame_t * pAbc )
Cmd_CommandExecute( pAbc, "source -s abc.rc" );
}
#endif //WIN32
-
- return;
+ {
+ // reset command history
+ char * pName;
+ int i;
+ Vec_PtrForEachEntry( pAbc->aHistory, pName, i )
+ free( pName );
+ pAbc->aHistory->nSize = 0;
+ }
}
/**Function********************************************************************