summaryrefslogtreecommitdiffstats
path: root/src/map/amap/amapLiberty.c
diff options
context:
space:
mode:
authorAlan Mishchenko <alanmi@berkeley.edu>2012-09-19 17:35:04 -0700
committerAlan Mishchenko <alanmi@berkeley.edu>2012-09-19 17:35:04 -0700
commit480ca14c75e9f8c54ca9b55c39162324aaa1e288 (patch)
tree446dc0fd3a98d5d60c01f01f5b95e380b002ce34 /src/map/amap/amapLiberty.c
parent3af0f719afa368cafbe7c8178d0995819b47be90 (diff)
downloadabc-480ca14c75e9f8c54ca9b55c39162324aaa1e288.tar.gz
abc-480ca14c75e9f8c54ca9b55c39162324aaa1e288.tar.bz2
abc-480ca14c75e9f8c54ca9b55c39162324aaa1e288.zip
Extending Liberty parser to handle multi-output cells.
Diffstat (limited to 'src/map/amap/amapLiberty.c')
-rw-r--r--src/map/amap/amapLiberty.c58
1 files changed, 39 insertions, 19 deletions
diff --git a/src/map/amap/amapLiberty.c b/src/map/amap/amapLiberty.c
index 7e8a9af5..e961b68c 100644
--- a/src/map/amap/amapLiberty.c
+++ b/src/map/amap/amapLiberty.c
@@ -229,7 +229,7 @@ Amap_Item_t * Amap_LibertyPinFunction( Amap_Tree_t * p, Amap_Item_t * pPin )
/**Function*************************************************************
- Synopsis [Returns cell's function.]
+ Synopsis [Returns output pin(s).]
Description []
@@ -250,6 +250,20 @@ Amap_Item_t * Amap_LibertyCellOutput( Amap_Tree_t * p, Amap_Item_t * pCell )
}
return NULL;
}
+Vec_Ptr_t * Amap_LibertyCellOutputs( Amap_Tree_t * p, Amap_Item_t * pCell )
+{
+ Amap_Item_t * pPin;
+ Vec_Ptr_t * vOutPins;
+ vOutPins = Vec_PtrAlloc( 2 );
+ Amap_ItemForEachChild( p, pCell, pPin )
+ {
+ if ( Amap_LibertyCompare(p, pPin->Key, "pin") )
+ continue;
+ if ( Amap_LibertyPinFunction(p, pPin) )
+ Vec_PtrPush( vOutPins, pPin );
+ }
+ return vOutPins;
+}
/**Function*************************************************************
@@ -353,9 +367,10 @@ char * Amap_LibertyGetStringFormula( Amap_Tree_t * p, Amap_Pair_t Pair )
int Amap_LibertyPrintGenlib( Amap_Tree_t * p, char * pFileName, int fVerbose )
{
FILE * pFile;
+ Vec_Ptr_t * vOutputs;
Amap_Item_t * pCell, * pArea, * pFunc, * pPin, * pOutput;
char * pForm;
- int Counter;
+ int i, Counter;
if ( pFileName == NULL )
pFile = stdout;
else
@@ -406,12 +421,14 @@ int Amap_LibertyPrintGenlib( Amap_Tree_t * p, char * pFileName, int fVerbose )
printf( "Amap_LibertyPrintGenlib() skipped cell \"%s\" without logic function.\n", Amap_LibertyGetString(p, pCell->Head) );
continue;
}
+/*
if ( Counter > 1 )
{
if ( fVerbose )
printf( "Amap_LibertyPrintGenlib() skipped multi-output cell \"%s\".\n", Amap_LibertyGetString(p, pCell->Head) );
continue;
}
+*/
pArea = Amap_LibertyCellArea( p, pCell );
if ( pArea == NULL )
{
@@ -419,25 +436,28 @@ int Amap_LibertyPrintGenlib( Amap_Tree_t * p, char * pFileName, int fVerbose )
printf( "Amap_LibertyPrintGenlib() skipped cell \"%s\" with unspecified area.\n", Amap_LibertyGetString(p, pCell->Head) );
continue;
}
- pOutput = Amap_LibertyCellOutput( p, pCell );
- pFunc = Amap_LibertyPinFunction( p, pOutput );
- pForm = Amap_LibertyGetStringFormula( p, pFunc->Head );
- if ( !strcmp(pForm, "0") || !strcmp(pForm, "1") )
+// pOutput = Amap_LibertyCellOutput( p, pCell );
+ vOutputs = Amap_LibertyCellOutputs( p, pCell );
+ Vec_PtrForEachEntry( Amap_Item_t *, vOutputs, pOutput, i )
{
- if ( fVerbose )
- printf( "Amap_LibertyPrintGenlib() skipped cell \"%s\" with constant formula \"%s\".\n", Amap_LibertyGetString(p, pCell->Head), pForm );
- continue;
+ pFunc = Amap_LibertyPinFunction( p, pOutput );
+ pForm = Amap_LibertyGetStringFormula( p, pFunc->Head );
+ if ( !strcmp(pForm, "0") || !strcmp(pForm, "1") )
+ {
+ if ( fVerbose )
+ printf( "Amap_LibertyPrintGenlib() skipped cell \"%s\" with constant formula \"%s\".\n", Amap_LibertyGetString(p, pCell->Head), pForm );
+ continue;
+ }
+ fprintf( pFile, "GATE " );
+ fprintf( pFile, "%16s ", Amap_LibertyGetString(p, pCell->Head) );
+ fprintf( pFile, "%f ", atof(Amap_LibertyGetString(p, pArea->Head)) );
+ fprintf( pFile, "%s=", Amap_LibertyGetString(p, pOutput->Head) );
+ fprintf( pFile, "%s;\n", Amap_LibertyGetStringFormula(p, pFunc->Head) );
+ Amap_ItemForEachChild( p, pCell, pPin )
+ if ( pPin != pOutput && !Amap_LibertyCompare(p, pPin->Key, "pin") )
+ fprintf( pFile, " PIN %13s UNKNOWN 1 999 1.00 0.00 1.00 0.00\n", Amap_LibertyGetString(p, pPin->Head) );
}
-
- fprintf( pFile, "GATE " );
- fprintf( pFile, "%16s ", Amap_LibertyGetString(p, pCell->Head) );
- fprintf( pFile, "%f ", atof(Amap_LibertyGetString(p, pArea->Head)) );
- fprintf( pFile, "%s=", Amap_LibertyGetString(p, pOutput->Head) );
- fprintf( pFile, "%s;\n", Amap_LibertyGetStringFormula(p, pFunc->Head) );
-
- Amap_ItemForEachChild( p, pCell, pPin )
- if ( pPin != pOutput && !Amap_LibertyCompare(p, pPin->Key, "pin") )
- fprintf( pFile, " PIN %13s UNKNOWN 1 999 1.00 0.00 1.00 0.00\n", Amap_LibertyGetString(p, pPin->Head) );
+ Vec_PtrFree( vOutputs );
}
if ( pFile != stdout )
fclose( pFile );