diff options
Diffstat (limited to 'src/base/abci/abc.c')
-rw-r--r-- | src/base/abci/abc.c | 83 |
1 files changed, 82 insertions, 1 deletions
diff --git a/src/base/abci/abc.c b/src/base/abci/abc.c index 3a6c8b1b..69ab229f 100644 --- a/src/base/abci/abc.c +++ b/src/base/abci/abc.c @@ -339,6 +339,7 @@ static int Abc_CommandAbc9Dc2 ( Abc_Frame_t * pAbc, int argc, cha static int Abc_CommandAbc9Bidec ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandAbc9Shrink ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandAbc9Miter ( Abc_Frame_t * pAbc, int argc, char ** argv ); +static int Abc_CommandAbc9Miter2 ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandAbc9Append ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandAbc9Scl ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandAbc9Lcorr ( Abc_Frame_t * pAbc, int argc, char ** argv ); @@ -829,6 +830,7 @@ void Abc_Init( Abc_Frame_t * pAbc ) Cmd_CommandAdd( pAbc, "ABC9", "&bidec", Abc_CommandAbc9Bidec, 0 ); Cmd_CommandAdd( pAbc, "ABC9", "&shrink", Abc_CommandAbc9Shrink, 0 ); Cmd_CommandAdd( pAbc, "ABC9", "&miter", Abc_CommandAbc9Miter, 0 ); + Cmd_CommandAdd( pAbc, "ABC9", "&miter2", Abc_CommandAbc9Miter2, 0 ); Cmd_CommandAdd( pAbc, "ABC9", "&append", Abc_CommandAbc9Append, 0 ); Cmd_CommandAdd( pAbc, "ABC9", "&scl", Abc_CommandAbc9Scl, 0 ); Cmd_CommandAdd( pAbc, "ABC9", "&lcorr", Abc_CommandAbc9Lcorr, 0 ); @@ -26149,7 +26151,7 @@ int Abc_CommandAbc9Miter( Abc_Frame_t * pAbc, int argc, char ** argv ) case 'I': if ( globalUtilOptind >= argc ) { - Abc_Print( -1, "Command line switch \"-I\" should be followed by an integer.\n" ); + Abc_Print( -1, "Command line switch \"-I\" should be followed by a char string.\n" ); goto usage; } nInsDup = atoi(argv[globalUtilOptind]); @@ -26252,6 +26254,85 @@ usage: SeeAlso [] ***********************************************************************/ +int Abc_CommandAbc9Miter2( Abc_Frame_t * pAbc, int argc, char ** argv ) +{ + FILE * pFile; + Gia_Man_t * pAux; + char * FileName, * pTemp, * pInit; + char ** pArgvNew; + int nArgcNew; + int c, fVerbose = 0; + Extra_UtilGetoptReset(); + while ( ( c = Extra_UtilGetopt( argc, argv, "vh" ) ) != EOF ) + { + switch ( c ) + { + case 'v': + fVerbose ^= 1; + break; + case 'h': + goto usage; + default: + goto usage; + } + } + pArgvNew = argv + globalUtilOptind; + nArgcNew = argc - globalUtilOptind; + if ( nArgcNew != 1 ) + { + Abc_Print( -1, "File name is not given on the command line.\n" ); + return 1; + } + // get the input file name + FileName = pArgvNew[0]; + // fix the wrong symbol + for ( pTemp = FileName; *pTemp; pTemp++ ) + if ( *pTemp == '>' ) + *pTemp = '\\'; + if ( (pFile = fopen( FileName, "r" )) == NULL ) + { + Abc_Print( -1, "Cannot open input file \"%s\". ", FileName ); + if ( (FileName = Extra_FileGetSimilarName( FileName, ".aig", NULL, NULL, NULL, NULL )) ) + Abc_Print( 1, "Did you mean \"%s\"?", FileName ); + Abc_Print( 1, "\n" ); + return 1; + } + fclose( pFile ); + // extract string + pInit = Extra_FileReadContents( FileName ); + Extra_StringClean( pInit, "01xX" ); + if ( (int)strlen(pInit) != Gia_ManCoNum(pAbc->pGia) ) + { + Abc_Print( -1, "Init string length (%d) differs from PI and flop count (%d).\n", strlen(pInit), Gia_ManCoNum(pAbc->pGia) ); + ABC_FREE( pInit ); + return 1; + } + // compute the miter + pAux = Gia_ManMiter2( pAbc->pGia, pInit, fVerbose ); + ABC_FREE( pInit ); + Abc_FrameUpdateGia( pAbc, pAux ); + return 0; + +usage: + Abc_Print( -2, "usage: &miter2 [-vh] <file>\n" ); + Abc_Print( -2, "\t creates miter of two copies of the design\n" ); + Abc_Print( -2, "\t-v : toggle printing verbose information [default = %s]\n", fVerbose? "yes": "no" ); + Abc_Print( -2, "\t-h : print the command usage\n"); + Abc_Print( -2, "\t<file> : file name with initialiation string [default = none]\n" ); + return 1; +} + +/**Function************************************************************* + + Synopsis [] + + Description [] + + SideEffects [] + + SeeAlso [] + +***********************************************************************/ int Abc_CommandAbc9Append( Abc_Frame_t * pAbc, int argc, char ** argv ) { FILE * pFile; |