summaryrefslogtreecommitdiffstats
path: root/src/base
diff options
context:
space:
mode:
authorAlan Mishchenko <alanmi@berkeley.edu>2022-06-02 07:47:33 -0700
committerAlan Mishchenko <alanmi@berkeley.edu>2022-06-02 07:47:33 -0700
commit94ab17c39e847a2326138068fadfe52c3675f70b (patch)
tree54b21496d40240f75e184536210232d4d106d843 /src/base
parent5a3e0a1f15cf4299470c81fdf314f22ea2f37fa7 (diff)
downloadabc-94ab17c39e847a2326138068fadfe52c3675f70b.tar.gz
abc-94ab17c39e847a2326138068fadfe52c3675f70b.tar.bz2
abc-94ab17c39e847a2326138068fadfe52c3675f70b.zip
Supporting new resub problem format.
Diffstat (limited to 'src/base')
-rw-r--r--src/base/io/io.c53
-rw-r--r--src/base/main/mainUtils.c2
2 files changed, 54 insertions, 1 deletions
diff --git a/src/base/io/io.c b/src/base/io/io.c
index 26bfb1f4..9b3d288a 100644
--- a/src/base/io/io.c
+++ b/src/base/io/io.c
@@ -84,6 +84,7 @@ static int IoCommandWriteTruths ( Abc_Frame_t * pAbc, int argc, char **argv );
static int IoCommandWriteStatus ( Abc_Frame_t * pAbc, int argc, char **argv );
static int IoCommandWriteSmv ( Abc_Frame_t * pAbc, int argc, char **argv );
static int IoCommandWriteJson ( Abc_Frame_t * pAbc, int argc, char **argv );
+static int IoCommandWriteResub ( Abc_Frame_t * pAbc, int argc, char **argv );
extern void Abc_FrameCopyLTLDataBase( Abc_Frame_t *pAbc, Abc_Ntk_t * pNtk );
@@ -155,6 +156,7 @@ void Io_Init( Abc_Frame_t * pAbc )
Cmd_CommandAdd( pAbc, "I/O", "write_status", IoCommandWriteStatus, 0 );
Cmd_CommandAdd( pAbc, "I/O", "write_smv", IoCommandWriteSmv, 0 );
Cmd_CommandAdd( pAbc, "I/O", "write_json", IoCommandWriteJson, 0 );
+ Cmd_CommandAdd( pAbc, "I/O", "&write_resub", IoCommandWriteResub, 0 );
}
/**Function*************************************************************
@@ -3480,6 +3482,57 @@ usage:
return 1;
}
+/**Function*************************************************************
+
+ Synopsis []
+
+ Description []
+
+ SideEffects []
+
+ SeeAlso []
+
+***********************************************************************/
+int IoCommandWriteResub( Abc_Frame_t * pAbc, int argc, char **argv )
+{
+ extern void Gia_ManWriteResub( Gia_Man_t * p, char * pFileName );
+ char * pFileName;
+ int c;
+ Extra_UtilGetoptReset();
+ while ( ( c = Extra_UtilGetopt( argc, argv, "ch" ) ) != EOF )
+ {
+ switch ( c )
+ {
+ case 'h':
+ goto usage;
+ default:
+ goto usage;
+ }
+ }
+ if ( argc != globalUtilOptind + 1 )
+ goto usage;
+ pFileName = argv[globalUtilOptind];
+ if ( pAbc->pGia == NULL )
+ {
+ Abc_Print( -1, "IoCommandWriteResub(): There is no AIG.\n" );
+ return 1;
+ }
+ if ( Gia_ManCiNum(pAbc->pGia) > 20 )
+ {
+ Abc_Print( -1, "IoCommandWriteResub(): The number of inputs is wrong.\n" );
+ return 1;
+ }
+ Gia_ManWriteResub( pAbc->pGia, pFileName );
+ return 0;
+
+usage:
+ fprintf( pAbc->Err, "usage: &write_resub [-ch] <file>\n" );
+ fprintf( pAbc->Err, "\t write the network in resub format\n" );
+ fprintf( pAbc->Err, "\t-h : print the help message\n" );
+ fprintf( pAbc->Err, "\tfile : the name of the file to write (extension .json)\n" );
+ return 1;
+}
+
////////////////////////////////////////////////////////////////////////
/// END OF FILE ///
////////////////////////////////////////////////////////////////////////
diff --git a/src/base/main/mainUtils.c b/src/base/main/mainUtils.c
index bb6d0a31..377299fd 100644
--- a/src/base/main/mainUtils.c
+++ b/src/base/main/mainUtils.c
@@ -160,7 +160,7 @@ void Abc_UtilsPrintUsage( Abc_Frame_t * pAbc, char * ProgName )
void Abc_UtilsSource( Abc_Frame_t * pAbc )
{
#ifdef WIN32
- if ( Cmd_CommandExecute(pAbc, "source -s abc.rc") )
+ if ( Cmd_CommandExecute(pAbc, "source abc.rc") )
{
if ( Cmd_CommandExecute(pAbc, "source ..\\abc.rc") == 0 )
printf( "Loaded \"abc.rc\" from the parent directory.\n" );