From d34821e7689181c13982766258869a8decdca7a8 Mon Sep 17 00:00:00 2001 From: Alan Mishchenko Date: Wed, 14 May 2025 14:17:05 -0700 Subject: [PATCH] Skipping cells with more than two outputs in "read_lib". --- src/map/amap/amapRead.c | 10 +++++----- src/map/scl/sclLiberty.c | 14 +++++++++++--- 2 files changed, 16 insertions(+), 8 deletions(-) diff --git a/src/map/amap/amapRead.c b/src/map/amap/amapRead.c index 9e6ee21c8..6722466b5 100644 --- a/src/map/amap/amapRead.c +++ b/src/map/amap/amapRead.c @@ -377,7 +377,7 @@ Amap_Lib_t * Amap_ParseTokens( Vec_Ptr_t * vTokens, int fVerbose ) if ( strcmp( pToken, AMAP_STRING_PIN ) ) { Amap_LibFree( p ); - printf( "Cannot parse gate %s.\n", pGate->pName ); + printf( "Cannot parse cell %s.\n", pGate->pName ); return NULL; } // read pin @@ -393,7 +393,7 @@ Amap_Lib_t * Amap_ParseTokens( Vec_Ptr_t * vTokens, int fVerbose ) else { Amap_LibFree( p ); - printf( "Cannot read phase of pin %s of gate %s\n", pPin->pName, pGate->pName ); + printf( "Cannot read phase of pin %s of cell %s\n", pPin->pName, pGate->pName ); return NULL; } pToken = (char *)Vec_PtrEntry(vTokens, iPos++); @@ -421,7 +421,7 @@ Amap_Lib_t * Amap_ParseTokens( Vec_Ptr_t * vTokens, int fVerbose ) Vec_PtrPush( p->vGates, pGate ); } pToken = (char *)Vec_PtrEntry(vTokens, iPos++); -//printf( "Finished reading gate %s (%s)\n", pGate->pName, pGate->pOutName ); +//printf( "Finished reading cell %s (%s)\n", pGate->pName, pGate->pOutName ); } while ( strcmp( pToken, ".end" ) ); @@ -432,7 +432,7 @@ Amap_Lib_t * Amap_ParseTokens( Vec_Ptr_t * vTokens, int fVerbose ) if ( pPrev && !strcmp(pPrev->pName, pGate->pName) ) { pPrev->pTwin = pGate, pGate->pTwin = pPrev; -// printf( "Warning: Detected multi-output gate \"%s\".\n", pGate->pName ); +// printf( "Warning: Detected multi-output cell \"%s\".\n", pGate->pName ); if ( pMoGate == NULL ) pMoGate = pGate->pName; Count++; @@ -440,7 +440,7 @@ Amap_Lib_t * Amap_ParseTokens( Vec_Ptr_t * vTokens, int fVerbose ) pPrev = pGate; } if ( Count ) - printf( "Warning: Detected %d multi-output gates (for example, \"%s\").\n", Count, pMoGate ); + printf( "Warning: Detected %d multi-output cells (for example, \"%s\").\n", Count, pMoGate ); return p; } diff --git a/src/map/scl/sclLiberty.c b/src/map/scl/sclLiberty.c index 2e3838eea..8a620086f 100644 --- a/src/map/scl/sclLiberty.c +++ b/src/map/scl/sclLiberty.c @@ -1509,7 +1509,7 @@ Vec_Str_t * Scl_LibertyReadSclStr( Scl_Tree_t * p, int fVerbose, int fVeryVerbos Vec_Wrd_t * vTruth; char * pFormula, * pName; int i, k, Counter, nOutputs, nCells; - int nSkipped[4] = {0}; + int nSkipped[5] = {0}; // read delay-table templates vTemples = Scl_LibertyReadTemplates( p ); @@ -1561,6 +1561,12 @@ Vec_Str_t * Scl_LibertyReadSclStr( Scl_Tree_t * p, int fVerbose, int fVeryVerbos nSkipped[2]++; continue; } + if ( Counter > 2 ) + { + if ( fVeryVerbose ) printf( "Scl_LibertyReadGenlib() skipped cell \"%s\" with more than two outputs.\n", Scl_LibertyReadString(p, pCell->Head) ); + nSkipped[4]++; + continue; + } nCells++; } // read cells @@ -1577,6 +1583,8 @@ Vec_Str_t * Scl_LibertyReadSclStr( Scl_Tree_t * p, int fVerbose, int fVeryVerbos continue; if ( (Counter = Scl_LibertyReadCellOutputNum(p, pCell)) == 0 ) continue; + if ( Counter > 2 ) + continue; // top level information Vec_StrPutS_( vOut, Scl_LibertyReadString(p, pCell->Head) ); pName = Scl_LibertyReadCellArea(p, pCell); @@ -1742,8 +1750,8 @@ Vec_Str_t * Scl_LibertyReadSclStr( Scl_Tree_t * p, int fVerbose, int fVeryVerbos { printf( "Library \"%s\" from \"%s\" has %d cells ", Scl_LibertyReadString(p, Scl_LibertyRoot(p)->Head), p->pFileName, nCells ); - printf( "(%d skipped: %d seq; %d tri-state; %d no func; %d dont_use). ", - nSkipped[0]+nSkipped[1]+nSkipped[2], nSkipped[0], nSkipped[1], nSkipped[2], nSkipped[3] ); + printf( "(%d skipped: %d seq; %d tri-state; %d no func; %d dont_use; %d with 3+ outputs). ", + nSkipped[0]+nSkipped[1]+nSkipped[2]+nSkipped[3]+nSkipped[4], nSkipped[0], nSkipped[1], nSkipped[2], nSkipped[3], nSkipped[4] ); Abc_PrintTime( 1, "Time", Abc_Clock() - p->clkStart ); } return vOut;