Skip to content

Commit

Permalink
Merge pull request #285 from gadfort/add-lib-merging
Browse files Browse the repository at this point in the history
add library merging flag to read_lib
  • Loading branch information
alanminko authored Apr 14, 2024
2 parents b10d000 + 935c6a8 commit 682480e
Showing 1 changed file with 16 additions and 3 deletions.
19 changes: 16 additions & 3 deletions src/map/scl/scl.c
Original file line number Diff line number Diff line change
Expand Up @@ -183,13 +183,14 @@ int Scl_CommandReadLib( Abc_Frame_t * pAbc, int argc, char ** argv )
int fUnit = 0;
int fVerbose = 1;
int fVeryVerbose = 0;
int fMerge = 0;

SC_DontUse dont_use = {0};
dont_use.dont_use_list = ABC_ALLOC(char *, argc);
dont_use.size = 0;

Extra_UtilGetoptReset();
while ( ( c = Extra_UtilGetopt( argc, argv, "SGMXdnuvwh" ) ) != EOF )
while ( ( c = Extra_UtilGetopt( argc, argv, "SGMXdnuvwmh" ) ) != EOF )
{
switch ( c )
{
Expand Down Expand Up @@ -251,6 +252,9 @@ int Scl_CommandReadLib( Abc_Frame_t * pAbc, int argc, char ** argv )
case 'w':
fVeryVerbose ^= 1;
break;
case 'm':
fMerge ^= 1;
break;
case 'h':
goto usage;
default:
Expand All @@ -271,7 +275,15 @@ int Scl_CommandReadLib( Abc_Frame_t * pAbc, int argc, char ** argv )
Abc_SclLibFree(pLib2);
}
else if ( argc == globalUtilOptind + 1 ) { // expecting one file
pLib = Scl_ReadLibraryFile( pAbc, argv[globalUtilOptind], fVerbose, fVeryVerbose, dont_use );
SC_Lib * pLib1 = Scl_ReadLibraryFile( pAbc, argv[globalUtilOptind], fVerbose, fVeryVerbose, dont_use );

SC_Lib * pLib_ext = (SC_Lib *)pAbc->pLibScl;
if ( fMerge && pLib_ext != NULL && pLib1 != NULL ) {
pLib = Abc_SclMergeLibraries( pLib_ext, pLib1 );
if (pLib1) Abc_SclLibFree(pLib1);
} else {
pLib = pLib1;
}
ABC_FREE(dont_use.dont_use_list);
}
else {
Expand Down Expand Up @@ -308,7 +320,7 @@ int Scl_CommandReadLib( Abc_Frame_t * pAbc, int argc, char ** argv )
return 0;

usage:
fprintf( pAbc->Err, "usage: read_lib [-SG float] [-M num] [-dnuvwh] [-X cell_name] <file> <file2>\n" );
fprintf( pAbc->Err, "usage: read_lib [-SG float] [-M num] [-dnuvwmh] [-X cell_name] <file> <file2>\n" );
fprintf( pAbc->Err, "\t reads Liberty library from file\n" );
fprintf( pAbc->Err, "\t-S float : the slew parameter used to generate the library [default = %.2f]\n", Slew );
fprintf( pAbc->Err, "\t-G float : the gain parameter used to generate the library [default = %.2f]\n", Gain );
Expand All @@ -319,6 +331,7 @@ int Scl_CommandReadLib( Abc_Frame_t * pAbc, int argc, char ** argv )
fprintf( pAbc->Err, "\t-u : toggle setting unit area for all cells [default = %s]\n", fUnit? "yes": "no" );
fprintf( pAbc->Err, "\t-v : toggle writing verbose information [default = %s]\n", fVerbose? "yes": "no" );
fprintf( pAbc->Err, "\t-w : toggle writing information about skipped gates [default = %s]\n", fVeryVerbose? "yes": "no" );
fprintf( pAbc->Err, "\t-m : toggle merging library with exisiting library [default = %s]\n", fMerge? "yes": "no" );
fprintf( pAbc->Err, "\t-h : prints the command summary\n" );
fprintf( pAbc->Err, "\t<file> : the name of a file to read\n" );
fprintf( pAbc->Err, "\t<file2> : the name of a file to read (optional)\n" );
Expand Down

0 comments on commit 682480e

Please sign in to comment.