summaryrefslogtreecommitdiffstats
path: root/src/base/ver
diff options
context:
space:
mode:
authorAlan Mishchenko <alanmi@berkeley.edu>2007-02-16 08:01:00 -0800
committerAlan Mishchenko <alanmi@berkeley.edu>2007-02-16 08:01:00 -0800
commit607c253cd2712bacce21ca9b98a848f331ea03a9 (patch)
treef1189c20d24fec46f4fef155de11d347144c59f3 /src/base/ver
parent5f3e4c0fe21ba5e24db0c187a616a28afc0dabae (diff)
downloadabc-607c253cd2712bacce21ca9b98a848f331ea03a9.tar.gz
abc-607c253cd2712bacce21ca9b98a848f331ea03a9.tar.bz2
abc-607c253cd2712bacce21ca9b98a848f331ea03a9.zip
Version abc70216
Diffstat (limited to 'src/base/ver')
-rw-r--r--src/base/ver/verCore.c56
-rw-r--r--src/base/ver/verStream.c23
2 files changed, 55 insertions, 24 deletions
diff --git a/src/base/ver/verCore.c b/src/base/ver/verCore.c
index 3a1a9584..a8ac99e5 100644
--- a/src/base/ver/verCore.c
+++ b/src/base/ver/verCore.c
@@ -66,7 +66,7 @@ static Abc_Obj_t * Ver_ParseCreateInv( Abc_Ntk_t * pNtk, Abc_Obj_t * pNet );
////////////////////////////////////////////////////////////////////////
/// FUNCTION DEFINITIONS ///
////////////////////////////////////////////////////////////////////////
-
+
/**Function*************************************************************
Synopsis [File parser.]
@@ -396,15 +396,15 @@ int Ver_ParseModule( Ver_Man_t * pMan )
else
Abc_ObjAddFanin( pNet, Abc_NtkCreateNodeConst1(pNtk) );
- // fix the dangling nets
- Abc_NtkFinalizeRead( pNtk );
-
// check the functionality to blackbox if insides are not defined
if ( Abc_NtkNodeNum(pNtk) == 0 && Abc_NtkBoxNum(pNtk) == 0 )
{
pNtk->ntkFunc = ABC_FUNC_BLACKBOX;
pNtk->pManFunc = NULL;
}
+
+ // fix the dangling nets
+ Abc_NtkFinalizeRead( pNtk );
return 1;
}
@@ -435,18 +435,43 @@ int Ver_ParseSignal( Ver_Man_t * pMan, Ver_SignalType_t SigType )
if ( pWord[0] == '[' && !pMan->fNameLast )
{
Lower = atoi( pWord + 1 );
- while ( *pWord && *pWord != ':' )
+ // find the splitter
+ while ( *pWord && *pWord != ':' && *pWord != ']' )
pWord++;
if ( *pWord == 0 )
+ {
+ sprintf( pMan->sError, "Cannot find closing bracket in this line." );
+ Ver_ParsePrintErrorMessage( pMan );
+ return 0;
+ }
+ if ( *pWord == ']' )
Upper = Lower;
else
+ {
Upper = atoi( pWord + 1 );
- if ( Lower > Upper )
- i = Lower, Lower = Upper, Upper = i;
- // get the signal name
- pWord = Ver_ParseGetName( pMan );
- if ( pWord == NULL )
- return 0;
+ if ( Lower > Upper )
+ i = Lower, Lower = Upper, Upper = i;
+ // find the closing paranthesis
+ while ( *pWord && *pWord != ']' )
+ pWord++;
+ if ( *pWord == 0 )
+ {
+ sprintf( pMan->sError, "Cannot find closing bracket in this line." );
+ Ver_ParsePrintErrorMessage( pMan );
+ return 0;
+ }
+ assert( *pWord == ']' );
+ }
+ // check the case of no space between bracket and the next word
+ if ( *(pWord+1) != 0 )
+ pWord++;
+ else
+ {
+ // get the signal name
+ pWord = Ver_ParseGetName( pMan );
+ if ( pWord == NULL )
+ return 0;
+ }
for ( i = Lower; i <= Upper; i++ )
{
sprintf( Buffer, "%s[%d]", pWord, i );
@@ -559,7 +584,11 @@ int Ver_ParseAssign( Ver_Man_t * pMan )
else
pEquation = Ver_StreamGetWord( p, ",;" );
if ( pEquation == NULL )
+ {
+ sprintf( pMan->sError, "Cannot read the equation for %s.", Abc_ObjName(pNet) );
+ Ver_ParsePrintErrorMessage( pMan );
return 0;
+ }
// parse the formula
if ( fReduction )
@@ -969,7 +998,10 @@ int Ver_ParseGate( Ver_Man_t * pMan, Abc_Ntk_t * pNtkGate )
memset( pPolarity, 0, nBytes );
}
// create box to represent this gate
- pNode = Abc_NtkCreateBlackbox( pMan->pNtkCur );
+ if ( Abc_NtkHasBlackbox(pNtkGate) )
+ pNode = Abc_NtkCreateBlackbox( pMan->pNtkCur );
+ else
+ pNode = Abc_NtkCreateWhitebox( pMan->pNtkCur );
pNode->pNext = (Abc_Obj_t *)pPolarity;
pNode->pData = pNtkGate;
// connect to fanin nets
diff --git a/src/base/ver/verStream.c b/src/base/ver/verStream.c
index 0edbcdcb..eed322b9 100644
--- a/src/base/ver/verStream.c
+++ b/src/base/ver/verStream.c
@@ -307,9 +307,6 @@ void Ver_StreamSkipChars( Ver_Stream_t * p, char * pCharsToSkip )
// skip the symbols
for ( pChar = p->pBufferCur; pChar < p->pBufferEnd; pChar++ )
{
- // count the lines
- if ( *pChar == '\n' )
- p->nLineCounter++;
// skip symbols as long as they are in the list
for ( pTemp = pCharsToSkip; *pTemp; pTemp++ )
if ( *pChar == *pTemp )
@@ -319,6 +316,9 @@ void Ver_StreamSkipChars( Ver_Stream_t * p, char * pCharsToSkip )
p->pBufferCur = pChar;
return;
}
+ // count the lines
+ if ( *pChar == '\n' )
+ p->nLineCounter++;
}
// the file is finished or the last part continued
// through VER_OFFSET_SIZE chars till the end of the buffer
@@ -352,19 +352,18 @@ void Ver_StreamSkipToChars( Ver_Stream_t * p, char * pCharsToStop )
// skip the symbols
for ( pChar = p->pBufferCur; pChar < p->pBufferEnd; pChar++ )
{
- // count the lines
- if ( *pChar == '\n' )
- p->nLineCounter++;
// skip symbols as long as they are NOT in the list
for ( pTemp = pCharsToStop; *pTemp; pTemp++ )
if ( *pChar == *pTemp )
break;
if ( *pTemp == 0 ) // pChar is not found in the list
+ {
+ // count the lines
+ if ( *pChar == '\n' )
+ p->nLineCounter++;
continue;
+ }
// the symbol is found - move position and return
- if ( *pChar == '\n' )
- p->nLineCounter--;
- // update buffer
p->pBufferCur = pChar;
return;
}
@@ -403,9 +402,6 @@ char * Ver_StreamGetWord( Ver_Stream_t * p, char * pCharsToStop )
p->nChars = 0;
for ( pChar = p->pBufferCur; pChar < p->pBufferEnd; pChar++ )
{
- // count the lines
- if ( *pChar == '\n' )
- p->nLineCounter++;
// skip symbols as long as they are NOT in the list
for ( pTemp = pCharsToStop; *pTemp; pTemp++ )
if ( *pChar == *pTemp )
@@ -415,6 +411,9 @@ char * Ver_StreamGetWord( Ver_Stream_t * p, char * pCharsToStop )
p->pChars[p->nChars++] = *pChar;
if ( p->nChars == VER_WORD_SIZE )
return NULL;
+ // count the lines
+ if ( *pChar == '\n' )
+ p->nLineCounter++;
continue;
}
// the symbol is found - move the position, set the word end, return the word