summaryrefslogtreecommitdiffstats
path: root/src/base/io/io.c
diff options
context:
space:
mode:
authorAlan Mishchenko <alanmi@berkeley.edu>2014-06-19 21:16:30 -0700
committerAlan Mishchenko <alanmi@berkeley.edu>2014-06-19 21:16:30 -0700
commitf04d32732b309715b12c4ad503234fdcaefd6094 (patch)
tree0e47d366aa5d699eb6397130fa496d68b5a562c5 /src/base/io/io.c
parentf98f610bab81cefa651c69027550645c59bf4014 (diff)
downloadabc-f04d32732b309715b12c4ad503234fdcaefd6094.tar.gz
abc-f04d32732b309715b12c4ad503234fdcaefd6094.tar.bz2
abc-f04d32732b309715b12c4ad503234fdcaefd6094.zip
Added quick GIG parser.
Diffstat (limited to 'src/base/io/io.c')
-rw-r--r--src/base/io/io.c59
1 files changed, 59 insertions, 0 deletions
diff --git a/src/base/io/io.c b/src/base/io/io.c
index 82b050c3..d5ef65b8 100644
--- a/src/base/io/io.c
+++ b/src/base/io/io.c
@@ -45,6 +45,7 @@ static int IoCommandReadPla ( Abc_Frame_t * pAbc, int argc, char **argv );
static int IoCommandReadTruth ( Abc_Frame_t * pAbc, int argc, char **argv );
static int IoCommandReadVerilog ( Abc_Frame_t * pAbc, int argc, char **argv );
static int IoCommandReadStatus ( Abc_Frame_t * pAbc, int argc, char **argv );
+static int IoCommandReadGig ( Abc_Frame_t * pAbc, int argc, char **argv );
static int IoCommandWrite ( Abc_Frame_t * pAbc, int argc, char **argv );
static int IoCommandWriteHie ( Abc_Frame_t * pAbc, int argc, char **argv );
@@ -108,6 +109,7 @@ void Io_Init( Abc_Frame_t * pAbc )
Cmd_CommandAdd( pAbc, "I/O", "read_truth", IoCommandReadTruth, 1 );
Cmd_CommandAdd( pAbc, "I/O", "read_verilog", IoCommandReadVerilog, 1 );
Cmd_CommandAdd( pAbc, "I/O", "read_status", IoCommandReadStatus, 0 );
+ Cmd_CommandAdd( pAbc, "I/O", "&read_gig", IoCommandReadGig, 0 );
Cmd_CommandAdd( pAbc, "I/O", "write", IoCommandWrite, 0 );
Cmd_CommandAdd( pAbc, "I/O", "write_hie", IoCommandWriteHie, 0 );
@@ -1132,6 +1134,63 @@ usage:
return 1;
}
+/**Function*************************************************************
+
+ Synopsis []
+
+ Description []
+
+ SideEffects []
+
+ SeeAlso []
+
+***********************************************************************/
+int IoCommandReadGig( Abc_Frame_t * pAbc, int argc, char ** argv )
+{
+ extern Gia_Man_t * Gia_ManReadGig( char * pFileName );
+ Gia_Man_t * pAig;
+ char * pFileName;
+ FILE * pFile;
+ int c;
+
+ Extra_UtilGetoptReset();
+ while ( ( c = Extra_UtilGetopt( argc, argv, "h" ) ) != EOF )
+ {
+ switch ( c )
+ {
+ case 'h':
+ goto usage;
+ default:
+ goto usage;
+ }
+ }
+ if ( argc != globalUtilOptind + 1 )
+ {
+ goto usage;
+ }
+
+ // get the input file name
+ pFileName = argv[globalUtilOptind];
+ if ( (pFile = fopen( pFileName, "r" )) == NULL )
+ {
+ fprintf( pAbc->Err, "Cannot open input file \"%s\". \n", pFileName );
+ return 1;
+ }
+ fclose( pFile );
+
+ // set the new network
+ pAig = Gia_ManReadGig( pFileName );
+ //Abc_FrameUpdateGia( pAbc, pAig );
+ return 0;
+
+usage:
+ fprintf( pAbc->Err, "usage: &read_gig [-h] <file>\n" );
+ fprintf( pAbc->Err, "\t reads design in GIG format\n" );
+ fprintf( pAbc->Err, "\t-h : prints the command summary\n" );
+ fprintf( pAbc->Err, "\tfile : the name of a file to read\n" );
+ return 1;
+}
+
/**Function*************************************************************