Commit 7592aa8a by Alan Mishchenko

Adding commands backup/restore.

parent 83bc1148
...@@ -3919,6 +3919,10 @@ SOURCE=.\src\aig\gia\giaPat.c ...@@ -3919,6 +3919,10 @@ SOURCE=.\src\aig\gia\giaPat.c
# End Source File # End Source File
# Begin Source File # Begin Source File
SOURCE=.\src\aig\gia\giaQbf.c
# End Source File
# Begin Source File
SOURCE=.\src\aig\gia\giaResub.c SOURCE=.\src\aig\gia\giaResub.c
# End Source File # End Source File
# Begin Source File # Begin Source File
......
...@@ -187,6 +187,9 @@ static int Abc_CommandNpnSave ( Abc_Frame_t * pAbc, int argc, cha ...@@ -187,6 +187,9 @@ static int Abc_CommandNpnSave ( Abc_Frame_t * pAbc, int argc, cha
static int Abc_CommandSendAig ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandSendAig ( Abc_Frame_t * pAbc, int argc, char ** argv );
static int Abc_CommandSendStatus ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandSendStatus ( Abc_Frame_t * pAbc, int argc, char ** argv );
static int Abc_CommandBackup ( Abc_Frame_t * pAbc, int argc, char ** argv );
static int Abc_CommandRestore ( Abc_Frame_t * pAbc, int argc, char ** argv );
static int Abc_CommandIStrash ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandIStrash ( Abc_Frame_t * pAbc, int argc, char ** argv );
static int Abc_CommandICut ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandICut ( Abc_Frame_t * pAbc, int argc, char ** argv );
static int Abc_CommandIRewrite ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandIRewrite ( Abc_Frame_t * pAbc, int argc, char ** argv );
...@@ -785,6 +788,9 @@ void Abc_Init( Abc_Frame_t * pAbc ) ...@@ -785,6 +788,9 @@ void Abc_Init( Abc_Frame_t * pAbc )
Cmd_CommandAdd( pAbc, "Various", "send_aig", Abc_CommandSendAig, 0 ); Cmd_CommandAdd( pAbc, "Various", "send_aig", Abc_CommandSendAig, 0 );
Cmd_CommandAdd( pAbc, "Various", "send_status", Abc_CommandSendStatus, 0 ); Cmd_CommandAdd( pAbc, "Various", "send_status", Abc_CommandSendStatus, 0 );
Cmd_CommandAdd( pAbc, "Various", "backup", Abc_CommandBackup, 0 );
Cmd_CommandAdd( pAbc, "Various", "restore", Abc_CommandRestore, 0 );
Cmd_CommandAdd( pAbc, "New AIG", "istrash", Abc_CommandIStrash, 1 ); Cmd_CommandAdd( pAbc, "New AIG", "istrash", Abc_CommandIStrash, 1 );
Cmd_CommandAdd( pAbc, "New AIG", "icut", Abc_CommandICut, 0 ); Cmd_CommandAdd( pAbc, "New AIG", "icut", Abc_CommandICut, 0 );
Cmd_CommandAdd( pAbc, "New AIG", "irw", Abc_CommandIRewrite, 1 ); Cmd_CommandAdd( pAbc, "New AIG", "irw", Abc_CommandIRewrite, 1 );
...@@ -13178,6 +13184,82 @@ usage: ...@@ -13178,6 +13184,82 @@ usage:
SeeAlso [] SeeAlso []
***********************************************************************/ ***********************************************************************/
int Abc_CommandBackup( Abc_Frame_t * pAbc, int argc, char ** argv )
{
Abc_Ntk_t * pNtk = Abc_FrameReadNtk(pAbc);
int c;
// set defaults
Extra_UtilGetoptReset();
while ( ( c = Extra_UtilGetopt( argc, argv, "h" ) ) != EOF )
{
switch ( c )
{
case 'h':
goto usage;
default:
goto usage;
}
}
if ( pNtk == NULL )
{
Abc_Print( -1, "Empty network.\n" );
return 1;
}
if ( pAbc->pNtkBackup )
Abc_NtkDelete( pAbc->pNtkBackup );
pAbc->pNtkBackup = Abc_NtkDup( pNtk );
return 0;
usage:
Abc_Print( -2, "usage: backup [-h]\n" );
Abc_Print( -2, "\t backs up the current network\n" );
Abc_Print( -2, "\t-h : print the command usage\n");
return 1;
}
int Abc_CommandRestore( Abc_Frame_t * pAbc, int argc, char ** argv )
{
int c;
// set defaults
Extra_UtilGetoptReset();
while ( ( c = Extra_UtilGetopt( argc, argv, "h" ) ) != EOF )
{
switch ( c )
{
case 'h':
goto usage;
default:
goto usage;
}
}
if ( pAbc->pNtkBackup == NULL )
{
Abc_Print( -1, "There is no backup network.\n" );
return 1;
}
Abc_FrameReplaceCurrentNetwork( pAbc, Abc_NtkDup(pAbc->pNtkBackup) );
return 0;
usage:
Abc_Print( -2, "usage: restore [-h]\n" );
Abc_Print( -2, "\t restores the current network\n" );
Abc_Print( -2, "\t-h : print the command usage\n");
return 1;
}
/**Function*************************************************************
Synopsis []
Description []
SideEffects []
SeeAlso []
***********************************************************************/
int Abc_CommandFraig( Abc_Frame_t * pAbc, int argc, char ** argv ) int Abc_CommandFraig( Abc_Frame_t * pAbc, int argc, char ** argv )
{ {
char Buffer[100]; char Buffer[100];
...@@ -198,6 +198,7 @@ void Abc_FrameDeallocate( Abc_Frame_t * p ) ...@@ -198,6 +198,7 @@ void Abc_FrameDeallocate( Abc_Frame_t * p )
if ( p->pSave4 ) Aig_ManStop( (Aig_Man_t *)p->pSave4 ); if ( p->pSave4 ) Aig_ManStop( (Aig_Man_t *)p->pSave4 );
if ( p->pManDsd ) If_DsdManFree( (If_DsdMan_t *)p->pManDsd, 0 ); if ( p->pManDsd ) If_DsdManFree( (If_DsdMan_t *)p->pManDsd, 0 );
if ( p->pManDsd2 ) If_DsdManFree( (If_DsdMan_t *)p->pManDsd2, 0 ); if ( p->pManDsd2 ) If_DsdManFree( (If_DsdMan_t *)p->pManDsd2, 0 );
if ( p->pNtkBackup) Abc_NtkDelete( p->pNtkBackup );
if ( p->vPlugInComBinPairs ) if ( p->vPlugInComBinPairs )
{ {
char * pTemp; char * pTemp;
......
...@@ -68,6 +68,7 @@ struct Abc_Frame_t_ ...@@ -68,6 +68,7 @@ struct Abc_Frame_t_
Abc_Ntk_t * pNtkCur; // the current network Abc_Ntk_t * pNtkCur; // the current network
Abc_Ntk_t * pNtkBestDelay; // the current network Abc_Ntk_t * pNtkBestDelay; // the current network
Abc_Ntk_t * pNtkBestArea; // the current network Abc_Ntk_t * pNtkBestArea; // the current network
Abc_Ntk_t * pNtkBackup; // the current network
int nSteps; // the counter of different network processed int nSteps; // the counter of different network processed
int fSource; // marks the source mode int fSource; // marks the source mode
int fAutoexac; // marks the autoexec mode int fAutoexac; // marks the autoexec mode
......
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