summaryrefslogtreecommitdiffstats
path: root/src/map/amap
diff options
context:
space:
mode:
authorAlan Mishchenko <alanmi@berkeley.edu>2009-03-10 08:01:00 -0700
committerAlan Mishchenko <alanmi@berkeley.edu>2009-03-10 08:01:00 -0700
commit32314347bae6ddcd841a268e797ec4da45726abb (patch)
treee2e5fd1711f04a06d0da2b8003bc02cb9a5dd446 /src/map/amap
parentc03f9b516bed2c06ec2bfc78617eba5fc9a11c32 (diff)
downloadabc-32314347bae6ddcd841a268e797ec4da45726abb.tar.gz
abc-32314347bae6ddcd841a268e797ec4da45726abb.tar.bz2
abc-32314347bae6ddcd841a268e797ec4da45726abb.zip
Version abc90310
Diffstat (limited to 'src/map/amap')
-rw-r--r--src/map/amap/amapLiberty.c33
-rw-r--r--src/map/amap/amapParse.c10
2 files changed, 28 insertions, 15 deletions
diff --git a/src/map/amap/amapLiberty.c b/src/map/amap/amapLiberty.c
index 7f46ffdf..4177e27e 100644
--- a/src/map/amap/amapLiberty.c
+++ b/src/map/amap/amapLiberty.c
@@ -346,6 +346,7 @@ int Amap_LibertyPrintGenlib( Amap_Tree_t * p, char * pFileName )
{
FILE * pFile;
Amap_Item_t * pCell, * pArea, * pFunc, * pPin, * pOutput;
+ char * pForm;
int Counter;
if ( pFileName == NULL )
pFile = stdout;
@@ -408,6 +409,12 @@ int Amap_LibertyPrintGenlib( Amap_Tree_t * p, char * pFileName )
}
pOutput = Amap_LibertyCellOutput( p, pCell );
pFunc = Amap_LibertyPinFunction( p, pOutput );
+ pForm = Amap_LibertyGetStringFormula( p, pFunc->Head );
+ if ( !strcmp(pForm, "0") || !strcmp(pForm, "1") )
+ {
+ 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) );
@@ -542,13 +549,17 @@ static inline int Amap_LibertyCharIsSpace( char c )
SeeAlso []
***********************************************************************/
-static inline int Amap_LibertySkipSpaces( Amap_Tree_t * p, char ** ppPos, char * pEnd )
+static inline int Amap_LibertySkipSpaces( Amap_Tree_t * p, char ** ppPos, char * pEnd, int fStopAtNewLine )
{
char * pPos = *ppPos;
for ( ; pPos < pEnd; pPos++ )
{
if ( *pPos == '\n' )
+ {
p->nLines++;
+ if ( fStopAtNewLine )
+ break;
+ }
if ( !Amap_LibertyCharIsSpace(*pPos) )
break;
}
@@ -582,9 +593,9 @@ static inline int Amap_LibertySkipEntry( char ** ppPos, char * pEnd )
else
{
for ( ; pPos < pEnd; pPos++ )
- if ( *pPos == ' ' ||
- *pPos == ':' || *pPos == ';' ||
- *pPos == '(' || *pPos == ')' ||
+ if ( *pPos == ' ' || *pPos == '\r' || *pPos == '\n' ||
+ *pPos == ':' || *pPos == ';' ||
+ *pPos == '(' || *pPos == ')' ||
*pPos == '{' || *pPos == '}' )
break;
}
@@ -708,28 +719,28 @@ int Amap_LibertyBuildItem( Amap_Tree_t * p, char ** ppPos, char * pEnd )
Amap_Item_t * pItem;
Amap_Pair_t Key, Head, Body;
char * pNext, * pStop;
- if ( Amap_LibertySkipSpaces( p, ppPos, pEnd ) )
+ if ( Amap_LibertySkipSpaces( p, ppPos, pEnd, 0 ) )
return -2;
Key.Beg = *ppPos - p->pContents;
if ( Amap_LibertySkipEntry( ppPos, pEnd ) )
goto exit;
Key.End = *ppPos - p->pContents;
- if ( Amap_LibertySkipSpaces( p, ppPos, pEnd ) )
+ if ( Amap_LibertySkipSpaces( p, ppPos, pEnd, 0 ) )
goto exit;
pNext = *ppPos;
if ( *pNext == ':' )
{
*ppPos = pNext + 1;
- if ( Amap_LibertySkipSpaces( p, ppPos, pEnd ) )
+ if ( Amap_LibertySkipSpaces( p, ppPos, pEnd, 0 ) )
goto exit;
Head.Beg = *ppPos - p->pContents;
if ( Amap_LibertySkipEntry( ppPos, pEnd ) )
goto exit;
Head.End = *ppPos - p->pContents;
- if ( Amap_LibertySkipSpaces( p, ppPos, pEnd ) )
+ if ( Amap_LibertySkipSpaces( p, ppPos, pEnd, 1 ) )
goto exit;
pNext = *ppPos;
- if ( *pNext != ';' )
+ if ( *pNext != ';' && *pNext != '\n' )
goto exit;
*ppPos = pNext + 1;
// end of equation
@@ -747,7 +758,7 @@ int Amap_LibertyBuildItem( Amap_Tree_t * p, char ** ppPos, char * pEnd )
Head.Beg = pNext - p->pContents + 1;
Head.End = pStop - p->pContents;
*ppPos = pStop + 1;
- if ( Amap_LibertySkipSpaces( p, ppPos, pEnd ) )
+ if ( Amap_LibertySkipSpaces( p, ppPos, pEnd, 0 ) )
{
// end of list
pItem = Amap_LibertyNewItem( p, AMAP_LIBERTY_LIST );
@@ -883,7 +894,7 @@ int Amap_LibertyParse( char * pFileName, char * pFileGenlib, int fVerbose )
{
if ( fVerbose )
printf( "Parsing finished successfully.\n" );
-// Amap_LibertyPrintLiberty( p, "temp.lib" );
+// Amap_LibertyPrintLiberty( p, "temp_.lib" );
Amap_LibertyPrintGenlib( p, "temp.genlib" );
RetValue = 1;
}
diff --git a/src/map/amap/amapParse.c b/src/map/amap/amapParse.c
index 48dabca2..bfa8e6a5 100644
--- a/src/map/amap/amapParse.c
+++ b/src/map/amap/amapParse.c
@@ -35,6 +35,7 @@
#define AMAP_EQN_SYM_AND '*' // logic AND
#define AMAP_EQN_SYM_XOR '^' // logic XOR
#define AMAP_EQN_SYM_OR '+' // logic OR
+#define AMAP_EQN_SYM_OR2 '|' // logic OR
// the list of opcodes (also specifying operation precedence)
#define AMAP_EQN_OPER_NEG 10 // negation
@@ -180,6 +181,7 @@ Hop_Obj_t * Amap_ParseFormula( FILE * pOutput, char * pFormInit, Vec_Ptr_t * vVa
break;
case AMAP_EQN_SYM_AND:
case AMAP_EQN_SYM_OR:
+ case AMAP_EQN_SYM_OR2:
case AMAP_EQN_SYM_XOR:
if ( Flag != AMAP_EQN_FLAG_VAR )
{
@@ -189,7 +191,7 @@ Hop_Obj_t * Amap_ParseFormula( FILE * pOutput, char * pFormInit, Vec_Ptr_t * vVa
}
if ( *pTemp == AMAP_EQN_SYM_AND )
Vec_IntPush( pStackOp, AMAP_EQN_OPER_AND );
- else if ( *pTemp == AMAP_EQN_SYM_OR )
+ else if ( *pTemp == AMAP_EQN_SYM_OR || *pTemp == AMAP_EQN_SYM_OR2 )
Vec_IntPush( pStackOp, AMAP_EQN_OPER_OR );
else //if ( *pTemp == AMAP_EQN_SYM_XOR )
Vec_IntPush( pStackOp, AMAP_EQN_OPER_XOR );
@@ -246,9 +248,9 @@ Hop_Obj_t * Amap_ParseFormula( FILE * pOutput, char * pFormInit, Vec_Ptr_t * vVa
// scan the next name
for ( i = 0; pTemp[i] &&
pTemp[i] != ' ' && pTemp[i] != '\t' && pTemp[i] != '\r' && pTemp[i] != '\n' &&
- pTemp[i] != AMAP_EQN_SYM_AND && pTemp[i] != AMAP_EQN_SYM_OR &&
- pTemp[i] != AMAP_EQN_SYM_XOR && pTemp[i] != AMAP_EQN_SYM_NEGAFT &&
- pTemp[i] != AMAP_EQN_SYM_CLOSE; i++ )
+ pTemp[i] != AMAP_EQN_SYM_AND && pTemp[i] != AMAP_EQN_SYM_OR && pTemp[i] != AMAP_EQN_SYM_OR2 &&
+ pTemp[i] != AMAP_EQN_SYM_XOR && pTemp[i] != AMAP_EQN_SYM_NEGAFT && pTemp[i] != AMAP_EQN_SYM_CLOSE;
+ i++ )
{
if ( pTemp[i] == AMAP_EQN_SYM_NEG || pTemp[i] == AMAP_EQN_SYM_OPEN )
{