From 9399faac485e842f3409892181d2bdab986a7137 Mon Sep 17 00:00:00 2001 From: Alan Mishchenko Date: Sun, 17 Sep 2023 12:40:33 +0800 Subject: [PATCH] Improvements to &gen_hie. --- src/aig/gia/giaMan.c | 3 +-- src/base/abci/abc.c | 35 +++++++++++++++++++++++++---------- 2 files changed, 26 insertions(+), 12 deletions(-) diff --git a/src/aig/gia/giaMan.c b/src/aig/gia/giaMan.c index a48da5c29..2449b5df7 100644 --- a/src/aig/gia/giaMan.c +++ b/src/aig/gia/giaMan.c @@ -1728,10 +1728,9 @@ void Gia_FreeMany( Gia_Man_t ** pGias, int nGias ) for ( i = 0; i < nGias; i++ ) Gia_ManStopP( &pGias[i] ); } -void Gia_GenSandwich( char ** pFNames, int nFNames ) +void Gia_GenSandwich( char ** pFNames, int nFNames, char * pFileName ) { FILE * pFile = NULL; - char * pFileName = (char *)"sandwich.v"; Gia_Man_t * pGias[16] = {0}; int i, k; assert( nFNames <= 16 ); diff --git a/src/base/abci/abc.c b/src/base/abci/abc.c index a1ee17305..4bb3a4344 100644 --- a/src/base/abci/abc.c +++ b/src/base/abci/abc.c @@ -51755,15 +51755,24 @@ usage: ***********************************************************************/ int Abc_CommandAbc9GenHie( Abc_Frame_t * pAbc, int argc, char ** argv ) { - extern void Gia_GenSandwich( char ** pFNames, int nFNames ); + extern void Gia_GenSandwich( char ** pFNames, int nFNames, char * pFileName ); + char * pFileName = (char *)"sandwich.v"; int c, fVerbose = 0; char ** pArgvNew; int nArgcNew; Extra_UtilGetoptReset(); - while ( ( c = Extra_UtilGetopt( argc, argv, "vh" ) ) != EOF ) + while ( ( c = Extra_UtilGetopt( argc, argv, "Fvh" ) ) != EOF ) { switch ( c ) { + case 'F': + if ( globalUtilOptind >= argc ) + { + Abc_Print( -1, "Command line switch \"-F\" should be followed by a file name.\n" ); + goto usage; + } + pFileName = argv[globalUtilOptind++]; + break; case 'v': fVerbose ^= 1; break; @@ -51774,16 +51783,22 @@ int Abc_CommandAbc9GenHie( Abc_Frame_t * pAbc, int argc, char ** argv ) } } pArgvNew = argv + globalUtilOptind; - nArgcNew = argc - globalUtilOptind; - Gia_GenSandwich( pArgvNew, nArgcNew ); + nArgcNew = argc - globalUtilOptind; + if ( nArgcNew < 1 ) + { + Abc_Print( -1, "Abc_CommandAbc9GenHie(): At least one AIG file should be given on the command line.\n" ); + return 0; + } + Gia_GenSandwich( pArgvNew, nArgcNew, pFileName ); return 0; usage: - Abc_Print( -2, "usage: &gen_hie [-vh] ... \n" ); - Abc_Print( -2, "\t generates a hierarchical design\n" ); - Abc_Print( -2, "\t-v : toggles printing verbose information [default = %s]\n", fVerbose? "yes": "no" ); - Abc_Print( -2, "\t-h : print the command usage\n"); - Abc_Print( -2, "\t : the AIG files for the instance modules\n"); - Abc_Print( -2, "\t (the PO count of should not be less than the PI count of )\n"); + Abc_Print( -2, "usage: &gen_hie [-F ] [-vh] ... \n" ); + Abc_Print( -2, "\t generates a hierarchical design in Verilog\n" ); + Abc_Print( -2, "\t-F : the output file name (optional) [default = \"sandwich.v\"]\n" ); + Abc_Print( -2, "\t-v : toggles printing verbose information [default = %s]\n", fVerbose? "yes": "no" ); + Abc_Print( -2, "\t-h : print the command usage\n"); + Abc_Print( -2, "\t : the AIG files for the instance modules\n"); + Abc_Print( -2, "\t (the PO count of should not be less than the PI count of )\n"); return 1;}