diff options
Diffstat (limited to 'src/map')
-rw-r--r-- | src/map/amap/amapRead.c | 66 | ||||
-rw-r--r-- | src/map/amap/amapUniq.c | 7 | ||||
-rw-r--r-- | src/map/if/if.h | 4 | ||||
-rw-r--r-- | src/map/if/ifCore.c | 2 | ||||
-rw-r--r-- | src/map/if/ifCut.c | 62 | ||||
-rw-r--r-- | src/map/if/ifDsd.c | 8 | ||||
-rw-r--r-- | src/map/if/ifMan.c | 2 | ||||
-rw-r--r-- | src/map/mio/mioRead.c | 61 | ||||
-rw-r--r-- | src/map/mio/mioUtils.c | 5 | ||||
-rw-r--r-- | src/map/scl/sclLiberty.c | 6 |
10 files changed, 160 insertions, 63 deletions
diff --git a/src/map/amap/amapRead.c b/src/map/amap/amapRead.c index 3ccfc011..9e6ee21c 100644 --- a/src/map/amap/amapRead.c +++ b/src/map/amap/amapRead.c @@ -126,41 +126,52 @@ void Amap_RemoveComments( char * pBuffer, int * pnDots, int * pnLines ) // (in the BLIF file, comments are lines starting with "#") nDots = nLines = 0; for ( pCur = pBuffer; *pCur; pCur++ ) - { + { // if this is the beginning of comment // clean it with spaces until the new line statement - if ( *pCur == '#' ) - while ( *pCur != '\n' ) - *pCur++ = ' '; - + if ( *pCur == '#' ) { + while ( *pCur != '\n' ) { + *pCur++ = ' '; + } + } // count the number of new lines and dots if ( *pCur == '\n' ) { - if (*(pCur-1)=='\r') { - // DOS(R) file support - if (*(pCur-2)!='\\') nLines++; - else { - // rewind to backslash and overwrite with a space - *(pCur-2) = ' '; - *(pCur-1) = ' '; - *pCur = ' '; - } - } else { - // UNIX(TM) file support - if (*(pCur-1)!='\\') nLines++; - else { - // rewind to backslash and overwrite with a space - *(pCur-1) = ' '; - *pCur = ' '; + if (pCur > pBuffer) { + if (*(pCur - 1) == '\r') { + // DOS(R) file support + if (pCur > (pBuffer + 1)) { + if (*(pCur - 2)!='\\') { + nLines++; + } + else { + // rewind to backslash and overwrite with a space + *(pCur - 2) = ' '; + *(pCur - 1) = ' '; + *pCur = ' '; + } + } + } else { + // UNIX(TM) file support + if (*(pCur - 1) != '\\') { + nLines++; + } + else { + // rewind to backslash and overwrite with a space + *(pCur-1) = ' '; + *pCur = ' '; + } + } + } } + else if ( *pCur == '.' ) { + nDots++; } - } - else if ( *pCur == '.' ) - nDots++; - } + } + if ( pnDots ) - *pnDots = nDots; + *pnDots = nDots; if ( pnLines ) - *pnLines = nLines; + *pnLines = nLines; } /**Function************************************************************* @@ -491,4 +502,3 @@ Amap_Lib_t * Amap_LibReadFile( char * pFileName, int fVerbose ) ABC_NAMESPACE_IMPL_END - diff --git a/src/map/amap/amapUniq.c b/src/map/amap/amapUniq.c index dd858c96..e2be4343 100644 --- a/src/map/amap/amapUniq.c +++ b/src/map/amap/amapUniq.c @@ -278,15 +278,14 @@ Abc_Lit2Var(iFan2), (Abc_LitIsCompl(iFan2)?'-':'+') ); int ** Amap_LibLookupTableAlloc( Vec_Ptr_t * vVec, int fVerbose ) { Vec_Int_t * vOne; - int ** pRes, * pBuffer; + int ** pRes; int i, k, nTotal, nSize, nEntries, Value; // count the total size nEntries = nSize = Vec_PtrSize( vVec ); Vec_PtrForEachEntry( Vec_Int_t *, vVec, vOne, i ) nEntries += Vec_IntSize(vOne); - pBuffer = ABC_ALLOC( int, nSize * sizeof(void *) + nEntries ); - pRes = (int **)pBuffer; - pRes[0] = pBuffer + nSize * sizeof(void *); + pRes = (int **)ABC_ALLOC( char, nSize * sizeof(void *) + nEntries * sizeof(int) ); + pRes[0] = (int *)((char *)pRes + nSize * sizeof(void *)); nTotal = 0; Vec_PtrForEachEntry( Vec_Int_t *, vVec, vOne, i ) { diff --git a/src/map/if/if.h b/src/map/if/if.h index aa9608c9..13fa4108 100644 --- a/src/map/if/if.h +++ b/src/map/if/if.h @@ -275,6 +275,8 @@ struct If_Man_t_ void * pUserMan; Vec_Int_t * vDump; int pDumpIns[16]; + Vec_Str_t * vMarks; + Vec_Int_t * vVisited2; // timing manager Tim_Man_t * pManTim; @@ -564,7 +566,7 @@ extern If_DsdMan_t * If_DsdManAlloc( int nVars, int nLutSize ); extern void If_DsdManAllocIsops( If_DsdMan_t * p, int nLutSize ); extern void If_DsdManPrint( If_DsdMan_t * p, char * pFileName, int Number, int Support, int fOccurs, int fTtDump, int fVerbose ); extern void If_DsdManTune( If_DsdMan_t * p, int LutSize, int fFast, int fAdd, int fSpec, int fVerbose ); -extern void Id_DsdManTuneStr( If_DsdMan_t * p, char * pStruct, int nConfls, int nProcs, int fVerbose ); +extern void Id_DsdManTuneStr( If_DsdMan_t * p, char * pStruct, int nConfls, int nProcs, int nInputs, int fVerbose ); extern void If_DsdManFree( If_DsdMan_t * p, int fVerbose ); extern void If_DsdManSave( If_DsdMan_t * p, char * pFileName ); extern If_DsdMan_t * If_DsdManLoad( char * pFileName ); diff --git a/src/map/if/ifCore.c b/src/map/if/ifCore.c index 0c9287a1..c03061af 100644 --- a/src/map/if/ifCore.c +++ b/src/map/if/ifCore.c @@ -106,6 +106,8 @@ int If_ManPerformMappingComb( If_Man_t * p ) If_Obj_t * pObj; abctime clkTotal = Abc_Clock(); int i; + //p->vVisited2 = Vec_IntAlloc( 100 ); + //p->vMarks = Vec_StrStart( If_ManObjNum(p) ); // set arrival times and fanout estimates If_ManForEachCi( p, pObj, i ) diff --git a/src/map/if/ifCut.c b/src/map/if/ifCut.c index 2d6889c0..079781e0 100644 --- a/src/map/if/ifCut.c +++ b/src/map/if/ifCut.c @@ -1494,6 +1494,68 @@ int If_CutCountTotalFanins( If_Man_t * p ) return 1; } +/**Function************************************************************* + + Synopsis [] + + Description [] + + SideEffects [] + + SeeAlso [] + +***********************************************************************/ +int If_CutFilter2_rec( If_Man_t * p, If_Obj_t * pObj, int LevelMin ) +{ + char * pVisited = Vec_StrEntryP(p->vMarks, pObj->Id); + if ( *pVisited ) + return *pVisited; + Vec_IntPush( p->vVisited2, pObj->Id ); + if ( (int)pObj->Level <= LevelMin ) + return (*pVisited = 1); + if ( If_CutFilter2_rec( p, pObj->pFanin0, LevelMin ) == 1 ) + return (*pVisited = 1); + if ( If_CutFilter2_rec( p, pObj->pFanin1, LevelMin ) == 1 ) + return (*pVisited = 1); + return (*pVisited = 2); +} +int If_CutFilter2( If_Man_t * p, If_Obj_t * pNode, If_Cut_t * pCut ) +{ + If_Obj_t * pLeaf, * pTemp; int i, Count = 0; +// printf( "Considering node %d and cut {", pNode->Id ); +// If_CutForEachLeaf( p, pCut, pLeaf, i ) +// printf( " %d", pLeaf->Id ); +// printf( " }\n" ); + If_CutForEachLeaf( p, pCut, pLeaf, i ) + { + int k, iObj, RetValue, nLevelMin = ABC_INFINITY; + Vec_IntClear( p->vVisited2 ); + If_CutForEachLeaf( p, pCut, pTemp, k ) + { + if ( pTemp == pLeaf ) + continue; + nLevelMin = Abc_MinInt( nLevelMin, (int)pTemp->Level ); + assert( Vec_StrEntry(p->vMarks, pTemp->Id) == 0 ); + Vec_StrWriteEntry( p->vMarks, pTemp->Id, 2 ); + Vec_IntPush( p->vVisited2, pTemp->Id ); + } + RetValue = If_CutFilter2_rec( p, pLeaf, nLevelMin ); + Vec_IntForEachEntry( p->vVisited2, iObj, k ) + Vec_StrWriteEntry( p->vMarks, iObj, 0 ); + if ( RetValue == 2 ) + { + Count++; + pCut->nLeaves--; + for ( k = i; k < (int)pCut->nLeaves; k++ ) + pCut->pLeaves[k] = pCut->pLeaves[k+1]; + i--; + } + } + //if ( Count ) + // printf( "%d", Count ); + return 0; +} + //////////////////////////////////////////////////////////////////////// /// END OF FILE /// //////////////////////////////////////////////////////////////////////// diff --git a/src/map/if/ifDsd.c b/src/map/if/ifDsd.c index ddfc1036..d33c42d6 100644 --- a/src/map/if/ifDsd.c +++ b/src/map/if/ifDsd.c @@ -2554,7 +2554,7 @@ void Id_DsdManTuneStr1( If_DsdMan_t * p, char * pStruct, int nConfls, int fVerbo ***********************************************************************/ #ifndef ABC_USE_PTHREADS -void Id_DsdManTuneStr( If_DsdMan_t * p, char * pStruct, int nConfls, int nProcs, int fVerbose ) +void Id_DsdManTuneStr( If_DsdMan_t * p, char * pStruct, int nConfls, int nProcs, int nInputs, int fVerbose ) { Id_DsdManTuneStr1( p, pStruct, nConfls, fVerbose ); } @@ -2600,7 +2600,7 @@ void * Ifn_WorkerThread( void * pArg ) assert( 0 ); return NULL; } -void Id_DsdManTuneStr( If_DsdMan_t * p, char * pStruct, int nConfls, int nProcs, int fVerbose ) +void Id_DsdManTuneStr( If_DsdMan_t * p, char * pStruct, int nConfls, int nProcs, int nInputs, int fVerbose ) { int fVeryVerbose = 0; ProgressBar * pProgress = NULL; @@ -2703,8 +2703,8 @@ void Id_DsdManTuneStr( If_DsdMan_t * p, char * pStruct, int nConfls, int nProcs, Extra_ProgressBarUpdate( pProgress, k, NULL ); pObj = If_DsdVecObj( &p->vObjs, k ); nVars = If_DsdObjSuppSize(pObj); - //if ( nVars <= LutSize ) - // continue; + if ( nInputs && nVars < nInputs ) + continue; clk = Abc_Clock(); If_DsdManComputeTruthPtr( p, Abc_Var2Lit(k, 0), NULL, ThData[i].pTruth ); clkUsed += Abc_Clock() - clk; diff --git a/src/map/if/ifMan.c b/src/map/if/ifMan.c index 4027b780..6ecd0eb8 100644 --- a/src/map/if/ifMan.c +++ b/src/map/if/ifMan.c @@ -273,6 +273,8 @@ void If_ManStop( If_Man_t * p ) Vec_IntFreeP( &p->vPairRes ); Vec_StrFreeP( &p->vPairPerms ); Vec_PtrFreeP( &p->vVisited ); + Vec_StrFreeP( &p->vMarks ); + Vec_IntFreeP( &p->vVisited2 ); if ( p->vPairHash ) Hash_IntManStop( p->vPairHash ); for ( i = 6; i <= Abc_MaxInt(6,p->pPars->nLutSize); i++ ) diff --git a/src/map/mio/mioRead.c b/src/map/mio/mioRead.c index c0a83cfd..c19c07d4 100644 --- a/src/map/mio/mioRead.c +++ b/src/map/mio/mioRead.c @@ -734,37 +734,48 @@ void Io_ReadFileRemoveComments( char * pBuffer, int * pnDots, int * pnLines ) // (in the BLIF file, comments are lines starting with "#") nDots = nLines = 0; for ( pCur = pBuffer; *pCur; pCur++ ) - { + { // if this is the beginning of comment // clean it with spaces until the new line statement - if ( *pCur == '#' ) - while ( *pCur != '\n' ) - *pCur++ = ' '; - + if ( *pCur == '#' ) { + while ( *pCur != '\n' ) { + *pCur++ = ' '; + } + } // count the number of new lines and dots if ( *pCur == '\n' ) { - if (*(pCur-1)=='\r') { - // DOS(R) file support - if (*(pCur-2)!='\\') nLines++; - else { - // rewind to backslash and overwrite with a space - *(pCur-2) = ' '; - *(pCur-1) = ' '; - *pCur = ' '; - } - } else { - // UNIX(TM) file support - if (*(pCur-1)!='\\') nLines++; - else { - // rewind to backslash and overwrite with a space - *(pCur-1) = ' '; - *pCur = ' '; + if (pCur > pBuffer) { + if (*(pCur - 1) == '\r') { + // DOS(R) file support + if (pCur > (pBuffer + 1)) { + if (*(pCur - 2) != '\\') { + nLines++; + } + else { + // rewind to backslash and overwrite with a space + *(pCur - 2) = ' '; + *(pCur - 1) = ' '; + *pCur = ' '; + } + } + } else { + // UNIX(TM) file support + if (*(pCur - 1) != '\\') { + nLines++; + } + else { + // rewind to backslash and overwrite with a space + *(pCur - 1) = ' '; + *pCur = ' '; + } + } + } } + else if ( *pCur == '.' ) { + nDots++; } - } - else if ( *pCur == '.' ) - nDots++; - } + } + if ( pnDots ) *pnDots = nDots; if ( pnLines ) diff --git a/src/map/mio/mioUtils.c b/src/map/mio/mioUtils.c index c7180e1c..06e880c2 100644 --- a/src/map/mio/mioUtils.c +++ b/src/map/mio/mioUtils.c @@ -224,6 +224,7 @@ void Mio_WritePin( FILE * pFile, Mio_Pin_t * pPin, int NameLen, int fAllPins ) ***********************************************************************/ void Mio_WriteGate( FILE * pFile, Mio_Gate_t * pGate, int GateLen, int NameLen, int FormLen, int fPrintSops, int fAllPins ) { + //Vec_Int_t * vCover = Vec_IntAlloc( 1 << 10 ); int nLits; char Buffer[5000]; Mio_Pin_t * pPin; assert( NameLen+FormLen+2 < 5000 ); @@ -239,7 +240,11 @@ void Mio_WriteGate( FILE * pFile, Mio_Gate_t * pGate, int GateLen, int NameLen, else // different pins Mio_GateForEachPin( pGate, pPin ) Mio_WritePin( pFile, pPin, NameLen, 0 ); + //nLits = 2*Kit_TruthLitNum((unsigned*)&pGate->uTruth, Mio_GateReadPinNum(pGate), vCover); + //if ( nLits != Mio_GateReadArea(pGate) ) + // printf( " # %d ", nLits ); fprintf( pFile, "\n" ); + //Vec_IntFree( vCover ); } /**Function************************************************************* diff --git a/src/map/scl/sclLiberty.c b/src/map/scl/sclLiberty.c index 4b6adab4..49b5c237 100644 --- a/src/map/scl/sclLiberty.c +++ b/src/map/scl/sclLiberty.c @@ -955,6 +955,8 @@ int Scl_LibertyReadPinDirection( Scl_Tree_t * p, Scl_Item_t * pPin ) return 0; if ( !strcmp(pToken, "output") ) return 1; + if ( !strcmp(pToken, "internal") ) + return 2; break; } return -1; @@ -1525,7 +1527,7 @@ Vec_Str_t * Scl_LibertyReadSclStr( Scl_Tree_t * p, int fVerbose, int fVeryVerbos float CapOne, CapRise, CapFall; if ( Scl_LibertyReadPinFormula(p, pPin) != NULL ) // skip output pin continue; - assert( Scl_LibertyReadPinDirection(p, pPin) == 0 ); + assert( Scl_LibertyReadPinDirection(p, pPin) == 0 || Scl_LibertyReadPinDirection(p, pPin) == 2); pName = Scl_LibertyReadString(p, pPin->Head); Vec_PtrPush( vNameIns, Abc_UtilStrsav(pName) ); Vec_StrPutS_( vOut, pName ); @@ -1546,6 +1548,8 @@ Vec_Str_t * Scl_LibertyReadSclStr( Scl_Tree_t * p, int fVerbose, int fVeryVerbos { if ( !Scl_LibertyReadPinFormula(p, pPin) ) // skip input pin continue; + if (Scl_LibertyReadPinDirection(p, pPin) == 2) // skip internal pin + continue; assert( Scl_LibertyReadPinDirection(p, pPin) == 1 ); pName = Scl_LibertyReadString(p, pPin->Head); Vec_StrPutS_( vOut, pName ); |