Commit 4359311d by Alan Mishchenko

Changes to the old parser.

parent 73496629
...@@ -187,15 +187,30 @@ Vec_Int_t * Acb_VerilogSimpleLex( char * pFileName, Abc_Nam_t * pNames ) ...@@ -187,15 +187,30 @@ Vec_Int_t * Acb_VerilogSimpleLex( char * pFileName, Abc_Nam_t * pNames )
{ {
Vec_Int_t * vBuffer = Vec_IntAlloc( 1000 ); Vec_Int_t * vBuffer = Vec_IntAlloc( 1000 );
char * pBuffer = Extra_FileReadContents( pFileName ); char * pBuffer = Extra_FileReadContents( pFileName );
char * pToken; char * pToken, * pStart, * pLimit = pBuffer + strlen(pBuffer);
if ( pBuffer == NULL ) if ( pBuffer == NULL )
return NULL; return NULL;
Acb_VerilogRemoveComments( pBuffer ); Acb_VerilogRemoveComments( pBuffer );
pToken = strtok( pBuffer, " \n\r\t()," ); pToken = strtok( pBuffer, " \n\r\t(),;=" );
while ( pToken ) while ( pToken )
{ {
Vec_IntPush( vBuffer, Abc_NamStrFindOrAdd(pNames, pToken, NULL) ); int iToken = Abc_NamStrFindOrAdd( pNames, pToken, NULL );
pToken = strtok( NULL, " \n\r\t(),;" ); if ( !strcmp(pToken, "assign") )
Vec_IntPush( vBuffer, ACB_BUF );
else
Vec_IntPush( vBuffer, iToken );
if ( iToken >= ACB_BUF && iToken < ACB_UNUSED )
{
for ( pStart = pToken; pStart < pLimit && *pStart != '\n'; pStart++ )
if ( *pStart == '(' )
break;
if ( *pStart == '(' )
{
pToken = strtok( pStart, " \n\r\t(),;=" );
continue;
}
}
pToken = strtok( NULL, " \n\r\t(),;=" );
} }
ABC_FREE( pBuffer ); ABC_FREE( pBuffer );
return vBuffer; return vBuffer;
...@@ -234,8 +249,8 @@ void * Acb_VerilogSimpleParse( Vec_Int_t * vBuffer, Abc_Nam_t * pNames ) ...@@ -234,8 +249,8 @@ void * Acb_VerilogSimpleParse( Vec_Int_t * vBuffer, Abc_Nam_t * pNames )
Vec_IntPush( vTypes, Token ); Vec_IntPush( vTypes, Token );
Vec_IntPush( vTypes, Vec_IntSize(vFanins) ); Vec_IntPush( vTypes, Vec_IntSize(vFanins) );
vCur = vFanins; vCur = vFanins;
if ( pToken[1] == 'z' && pToken[2] == '_' && pToken[3] == 'g' && pToken[4] == '_' ) //if ( pToken[1] == 'z' && pToken[2] == '_' && pToken[3] == 'g' && pToken[4] == '_' )
i++; // i++;
} }
else else
Vec_IntPush( vCur, Token ); Vec_IntPush( vCur, Token );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment