diff options
-rw-r--r-- | src/base/abc/abc.h | 2 | ||||
-rw-r--r-- | src/base/abc/abcDfs.c | 13 | ||||
-rw-r--r-- | src/base/abc/abcFunc.c | 2 | ||||
-rw-r--r-- | src/base/abc/abcObj.c | 2 | ||||
-rw-r--r-- | src/base/abci/abcPrint.c | 4 | ||||
-rw-r--r-- | src/base/cba/cba.h | 16 | ||||
-rw-r--r-- | src/base/cba/cbaBlast.c | 68 | ||||
-rw-r--r-- | src/base/io/ioWriteBlif.c | 15 | ||||
-rw-r--r-- | src/map/scl/sclBufSize.c | 27 | ||||
-rw-r--r-- | src/map/scl/sclDnsize.c | 25 | ||||
-rw-r--r-- | src/map/scl/sclSize.c | 23 | ||||
-rw-r--r-- | src/map/scl/sclSize.h | 6 | ||||
-rw-r--r-- | src/map/scl/sclUtil.c | 24 |
13 files changed, 142 insertions, 85 deletions
diff --git a/src/base/abc/abc.h b/src/base/abc/abc.h index c23a711a..bf84226b 100644 --- a/src/base/abc/abc.h +++ b/src/base/abc/abc.h @@ -358,7 +358,7 @@ static inline int Abc_ObjIsLatch( Abc_Obj_t * pObj ) { return pO static inline int Abc_ObjIsBox( Abc_Obj_t * pObj ) { return pObj->Type == ABC_OBJ_LATCH || pObj->Type == ABC_OBJ_WHITEBOX || pObj->Type == ABC_OBJ_BLACKBOX; } static inline int Abc_ObjIsWhitebox( Abc_Obj_t * pObj ) { return pObj->Type == ABC_OBJ_WHITEBOX;} static inline int Abc_ObjIsBlackbox( Abc_Obj_t * pObj ) { return pObj->Type == ABC_OBJ_BLACKBOX;} -static inline int Abc_ObjIsBarBuf( Abc_Obj_t * pObj ) { return Abc_NtkIsLogic(pObj->pNtk) && Abc_ObjIsNode(pObj) && Vec_IntSize(&pObj->vFanins) == 1 && pObj->pData == NULL; } +static inline int Abc_ObjIsBarBuf( Abc_Obj_t * pObj ) { return Abc_NtkHasMapping(pObj->pNtk) && Abc_ObjIsNode(pObj) && Vec_IntSize(&pObj->vFanins) == 1 && pObj->pData == NULL; } static inline void Abc_ObjBlackboxToWhitebox( Abc_Obj_t * pObj ) { assert( Abc_ObjIsBlackbox(pObj) ); pObj->Type = ABC_OBJ_WHITEBOX; pObj->pNtk->nObjCounts[ABC_OBJ_BLACKBOX]--; pObj->pNtk->nObjCounts[ABC_OBJ_WHITEBOX]++; } // working with fanin/fanout edges diff --git a/src/base/abc/abcDfs.c b/src/base/abc/abcDfs.c index 9dd2b4bf..811a6929 100644 --- a/src/base/abc/abcDfs.c +++ b/src/base/abc/abcDfs.c @@ -87,14 +87,17 @@ Vec_Ptr_t * Abc_NtkDfs( Abc_Ntk_t * pNtk, int fCollectAll ) Abc_NtkIncrementTravId( pNtk ); // start the array of nodes vNodes = Vec_PtrAlloc( 100 ); - Abc_NtkForEachObj( pNtk, pObj, i ) + if ( pNtk->nBarBufs2 > 0 ) + Abc_NtkForEachBarBuf( pNtk, pObj, i ) + { + Abc_NodeSetTravIdCurrent( pObj ); + Abc_NtkDfs_rec( Abc_ObjFanin0Ntk(Abc_ObjFanin0(pObj)), vNodes ); + Vec_PtrPush( vNodes, pObj ); + } + Abc_NtkForEachCo( pNtk, pObj, i ) { - if ( !Abc_ObjIsCo(pObj) && !Abc_ObjIsBarBuf(pObj) ) - continue; Abc_NodeSetTravIdCurrent( pObj ); Abc_NtkDfs_rec( Abc_ObjFanin0Ntk(Abc_ObjFanin0(pObj)), vNodes ); - if ( Abc_ObjIsBarBuf(pObj) ) - Vec_PtrPush( vNodes, pObj ); } // collect dangling nodes if asked to if ( fCollectAll ) diff --git a/src/base/abc/abcFunc.c b/src/base/abc/abcFunc.c index 782091d7..6e9e3d09 100644 --- a/src/base/abc/abcFunc.c +++ b/src/base/abc/abcFunc.c @@ -1081,7 +1081,6 @@ int Abc_NtkMapToSop( Abc_Ntk_t * pNtk ) // update the functionality manager assert( pNtk->pManFunc == Abc_FrameReadLibGen() ); pNtk->pManFunc = Mem_FlexStart(); - pNtk->ntkFunc = ABC_FUNC_SOP; // update the nodes Abc_NtkForEachNode( pNtk, pNode, i ) { @@ -1091,6 +1090,7 @@ int Abc_NtkMapToSop( Abc_Ntk_t * pNtk ) assert( Abc_SopGetVarNum(pSop) == Abc_ObjFaninNum(pNode) ); pNode->pData = Abc_SopRegister( (Mem_Flex_t *)pNtk->pManFunc, pSop ); } + pNtk->ntkFunc = ABC_FUNC_SOP; return 1; } diff --git a/src/base/abc/abcObj.c b/src/base/abc/abcObj.c index 94a5f0bb..91d89026 100644 --- a/src/base/abc/abcObj.c +++ b/src/base/abc/abcObj.c @@ -377,7 +377,7 @@ Abc_Obj_t * Abc_NtkDupObj( Abc_Ntk_t * pNtkNew, Abc_Obj_t * pObj, int fCopyName else if ( Abc_NtkHasAig(pNtkNew) ) pObjNew->pData = Hop_Transfer((Hop_Man_t *)pObj->pNtk->pManFunc, (Hop_Man_t *)pNtkNew->pManFunc, (Hop_Obj_t *)pObj->pData, Abc_ObjFaninNum(pObj)); else if ( Abc_NtkHasMapping(pNtkNew) ) - pObjNew->pData = pObj->pData; + pObjNew->pData = pObj->pData, pNtkNew->nBarBufs2 += !pObj->pData; else assert( 0 ); } } diff --git a/src/base/abci/abcPrint.c b/src/base/abci/abcPrint.c index 02c06e65..361f1e99 100644 --- a/src/base/abci/abcPrint.c +++ b/src/base/abci/abcPrint.c @@ -1073,7 +1073,7 @@ void Abc_NtkPrintGates( Abc_Ntk_t * pNtk, int fUseLibrary ) // count the gates by name CounterTotal = 0; - Abc_NtkForEachNode( pNtk, pObj, i ) + Abc_NtkForEachNodeNotBarBuf( pNtk, pObj, i ) { if ( i == 0 ) continue; Mio_GateSetValue( (Mio_Gate_t *)pObj->pData, 1 + Mio_GateReadValue((Mio_Gate_t *)pObj->pData) ); @@ -1128,7 +1128,7 @@ void Abc_NtkPrintGates( Abc_Ntk_t * pNtk, int fUseLibrary ) // get hold of the SOP of the node CountConst = CountBuf = CountInv = CountAnd = CountOr = CountOther = CounterTotal = 0; - Abc_NtkForEachNode( pNtk, pObj, i ) + Abc_NtkForEachNodeNotBarBuf( pNtk, pObj, i ) { if ( i == 0 ) continue; if ( Abc_NtkHasMapping(pNtk) ) diff --git a/src/base/cba/cba.h b/src/base/cba/cba.h index f1b94390..2ac3ed35 100644 --- a/src/base/cba/cba.h +++ b/src/base/cba/cba.h @@ -157,10 +157,10 @@ struct Cba_Man_t_ int nNtks; // number of current networks Cba_Ntk_t * pNtks; // networks // user data - Vec_Int_t * vBuf2RootNtk; - Vec_Int_t * vBuf2RootObj; - Vec_Int_t * vBuf2LeafNtk; - Vec_Int_t * vBuf2LeafObj; + Vec_Int_t vBuf2RootNtk; + Vec_Int_t vBuf2RootObj; + Vec_Int_t vBuf2LeafNtk; + Vec_Int_t vBuf2LeafObj; void * pMioLib; void ** ppGraphs; int ElemGates[4]; @@ -574,10 +574,10 @@ static inline void Cba_ManFree( Cba_Man_t * p ) Cba_Ntk_t * pNtk; int i; Cba_ManForEachNtk( p, pNtk, i ) Cba_NtkFree( pNtk ); - Vec_IntFreeP( &p->vBuf2LeafNtk ); - Vec_IntFreeP( &p->vBuf2LeafObj ); - Vec_IntFreeP( &p->vBuf2RootNtk ); - Vec_IntFreeP( &p->vBuf2RootObj ); + Vec_IntErase( &p->vBuf2LeafNtk ); + Vec_IntErase( &p->vBuf2LeafObj ); + Vec_IntErase( &p->vBuf2RootNtk ); + Vec_IntErase( &p->vBuf2RootObj ); Abc_NamDeref( p->pStrs ); Abc_NamDeref( p->pMods ); ABC_FREE( p->pName ); diff --git a/src/base/cba/cbaBlast.c b/src/base/cba/cbaBlast.c index 2f955241..aff8799a 100644 --- a/src/base/cba/cbaBlast.c +++ b/src/base/cba/cbaBlast.c @@ -90,12 +90,12 @@ int Cba_ManAddBarbuf( Gia_Man_t * pNew, int iRes, Cba_Man_t * p, int iLNtk, int return iRes; assert( iRes > 0 ); if ( vMap && Abc_Lit2Var(iRes) < Vec_IntSize(vMap) && (iIdLit = Vec_IntEntry(vMap, Abc_Lit2Var(iRes))) >= 0 && - Vec_IntEntry(p->vBuf2LeafNtk, Abc_Lit2Var(iIdLit)) == iLNtk && Vec_IntEntry(p->vBuf2RootNtk, Abc_Lit2Var(iIdLit)) == iRNtk ) + Vec_IntEntry(&p->vBuf2LeafNtk, Abc_Lit2Var(iIdLit)) == iLNtk && Vec_IntEntry(&p->vBuf2RootNtk, Abc_Lit2Var(iIdLit)) == iRNtk ) return Abc_LitNotCond( Vec_IntEntry(pNew->vBarBufs, Abc_Lit2Var(iIdLit)), Abc_LitIsCompl(iRes) ^ Abc_LitIsCompl(iIdLit) ); - Vec_IntPush( p->vBuf2LeafNtk, iLNtk ); - Vec_IntPush( p->vBuf2LeafObj, iLObj ); - Vec_IntPush( p->vBuf2RootNtk, iRNtk ); - Vec_IntPush( p->vBuf2RootObj, iRObj ); + Vec_IntPush( &p->vBuf2LeafNtk, iLNtk ); + Vec_IntPush( &p->vBuf2LeafObj, iLObj ); + Vec_IntPush( &p->vBuf2RootNtk, iRNtk ); + Vec_IntPush( &p->vBuf2RootObj, iRObj ); iBufLit = Gia_ManAppendBuf( pNew, iRes ); if ( vMap ) { @@ -196,14 +196,10 @@ Gia_Man_t * Cba_ManExtract( Cba_Man_t * p, int fBuffers, int fVerbose ) Vec_Int_t * vMap = NULL; int i, iObj; - Vec_IntFreeP( &p->vBuf2LeafNtk ); - Vec_IntFreeP( &p->vBuf2LeafObj ); - Vec_IntFreeP( &p->vBuf2RootNtk ); - Vec_IntFreeP( &p->vBuf2RootObj ); - p->vBuf2LeafNtk = Vec_IntAlloc( 1000 ); - p->vBuf2LeafObj = Vec_IntAlloc( 1000 ); - p->vBuf2RootNtk = Vec_IntAlloc( 1000 ); - p->vBuf2RootObj = Vec_IntAlloc( 1000 ); + Vec_IntClear( &p->vBuf2LeafNtk ); + Vec_IntClear( &p->vBuf2LeafObj ); + Vec_IntClear( &p->vBuf2RootNtk ); + Vec_IntClear( &p->vBuf2RootObj ); Cba_ManForEachNtk( p, pNtk, i ) Cba_NtkStartCopies(pNtk); @@ -231,7 +227,7 @@ Gia_Man_t * Cba_ManExtract( Cba_Man_t * p, int fBuffers, int fVerbose ) // primary outputs Cba_NtkForEachPo( pRoot, iObj, i ) Gia_ManAppendCo( pNew, Cba_ObjCopy(pRoot, iObj) ); - assert( Vec_IntSize(p->vBuf2LeafNtk) == pNew->nBufs ); + assert( Vec_IntSize(&p->vBuf2LeafNtk) == pNew->nBufs ); // cleanup pNew = Gia_ManCleanup( pTemp = pNew ); @@ -254,14 +250,14 @@ Gia_Man_t * Cba_ManExtract( Cba_Man_t * p, int fBuffers, int fVerbose ) void Cba_ManMarkNodesGia( Cba_Man_t * p, Gia_Man_t * pGia ) { Gia_Obj_t * pObj; int i, Count = 0; - assert( Vec_IntSize(p->vBuf2LeafNtk) == Gia_ManBufNum(pGia) ); + assert( Vec_IntSize(&p->vBuf2LeafNtk) == Gia_ManBufNum(pGia) ); Gia_ManConst0(pGia)->Value = 0; Gia_ManForEachPi( pGia, pObj, i ) pObj->Value = 0; Gia_ManForEachAnd( pGia, pObj, i ) { if ( Gia_ObjIsBuf(pObj) ) - pObj->Value = Vec_IntEntry( p->vBuf2LeafNtk, Count++ ); + pObj->Value = Vec_IntEntry( &p->vBuf2LeafNtk, Count++ ); else { pObj->Value = Gia_ObjFanin0(pObj)->Value; @@ -278,21 +274,21 @@ void Cba_ManMarkNodesGia( Cba_Man_t * p, Gia_Man_t * pGia ) void Cba_ManRemapBarbufs( Cba_Man_t * pNew, Cba_Man_t * p ) { Cba_Ntk_t * pNtk; int Entry, i; - assert( p->vBuf2RootNtk != NULL ); - assert( pNew->vBuf2RootNtk == NULL ); - pNew->vBuf2RootNtk = Vec_IntDup( p->vBuf2RootNtk ); - pNew->vBuf2RootObj = Vec_IntDup( p->vBuf2RootObj ); - pNew->vBuf2LeafNtk = Vec_IntDup( p->vBuf2LeafNtk ); - pNew->vBuf2LeafObj = Vec_IntDup( p->vBuf2LeafObj ); - Vec_IntForEachEntry( p->vBuf2LeafObj, Entry, i ) + assert( Vec_IntSize(&p->vBuf2RootNtk) ); + assert( !Vec_IntSize(&pNew->vBuf2RootNtk) ); + Vec_IntAppend( &pNew->vBuf2RootNtk, &p->vBuf2RootNtk ); + Vec_IntAppend( &pNew->vBuf2RootObj, &p->vBuf2RootObj ); + Vec_IntAppend( &pNew->vBuf2LeafNtk, &p->vBuf2LeafNtk ); + Vec_IntAppend( &pNew->vBuf2LeafObj, &p->vBuf2LeafObj ); + Vec_IntForEachEntry( &p->vBuf2LeafObj, Entry, i ) { - pNtk = Cba_ManNtk( p, Vec_IntEntry(p->vBuf2LeafNtk, i) ); - Vec_IntWriteEntry( pNew->vBuf2LeafObj, i, Cba_ObjCopy(pNtk, Entry) ); + pNtk = Cba_ManNtk( p, Vec_IntEntry(&p->vBuf2LeafNtk, i) ); + Vec_IntWriteEntry( &pNew->vBuf2LeafObj, i, Cba_ObjCopy(pNtk, Entry) ); } - Vec_IntForEachEntry( p->vBuf2RootObj, Entry, i ) + Vec_IntForEachEntry( &p->vBuf2RootObj, Entry, i ) { - pNtk = Cba_ManNtk( p, Vec_IntEntry(p->vBuf2RootNtk, i) ); - Vec_IntWriteEntry( pNew->vBuf2RootObj, i, Cba_ObjCopy(pNtk, Entry) ); + pNtk = Cba_ManNtk( p, Vec_IntEntry(&p->vBuf2RootNtk, i) ); + Vec_IntWriteEntry( &pNew->vBuf2RootObj, i, Cba_ObjCopy(pNtk, Entry) ); } } void Cba_NtkCreateAndConnectBuffer( Gia_Man_t * pGia, Gia_Obj_t * pObj, Cba_Ntk_t * p, int iTerm ) @@ -326,13 +322,13 @@ void Cba_NtkInsertGia( Cba_Man_t * p, Gia_Man_t * pGia ) { if ( Gia_ObjIsBuf(pObj) ) { - pNtk = Cba_ManNtk( p, Vec_IntEntry(p->vBuf2RootNtk, Count) ); - iTerm = Vec_IntEntry( p->vBuf2RootObj, Count ); + pNtk = Cba_ManNtk( p, Vec_IntEntry(&p->vBuf2RootNtk, Count) ); + iTerm = Vec_IntEntry( &p->vBuf2RootObj, Count ); assert( Cba_ObjIsCo(pNtk, iTerm) ); if ( Cba_ObjFanin(pNtk, iTerm) == -1 ) // not a feedthrough Cba_NtkCreateAndConnectBuffer( pGia, pObj, pNtk, iTerm ); // prepare leaf - pObj->Value = Vec_IntEntry( p->vBuf2LeafObj, Count++ ); + pObj->Value = Vec_IntEntry( &p->vBuf2LeafObj, Count++ ); } else { @@ -424,13 +420,13 @@ static inline int Abc_NodeIsSeriousGate( Abc_Obj_t * p ) void Cba_ManMarkNodesAbc( Cba_Man_t * p, Abc_Ntk_t * pNtk ) { Abc_Obj_t * pObj, * pFanin; int i, k, Count = 0; - assert( Vec_IntSize(p->vBuf2LeafNtk) == pNtk->nBarBufs2 ); + assert( Vec_IntSize(&p->vBuf2LeafNtk) == pNtk->nBarBufs2 ); Abc_NtkForEachPi( pNtk, pObj, i ) pObj->iTemp = 0; Abc_NtkForEachNode( pNtk, pObj, i ) { if ( Abc_ObjIsBarBuf(pObj) ) - pObj->iTemp = Vec_IntEntry( p->vBuf2LeafNtk, Count++ ); + pObj->iTemp = Vec_IntEntry( &p->vBuf2LeafNtk, Count++ ); else if ( Abc_NodeIsSeriousGate(pObj) ) { pObj->iTemp = Abc_ObjFanin0(pObj)->iTemp; @@ -505,13 +501,13 @@ void Cba_NtkInsertNtk( Cba_Man_t * p, Abc_Ntk_t * pNtk ) { if ( Abc_ObjIsBarBuf(pObj) ) { - pCbaNtk = Cba_ManNtk( p, Vec_IntEntry(p->vBuf2RootNtk, Count) ); - iTerm = Vec_IntEntry( p->vBuf2RootObj, Count ); + pCbaNtk = Cba_ManNtk( p, Vec_IntEntry(&p->vBuf2RootNtk, Count) ); + iTerm = Vec_IntEntry( &p->vBuf2RootObj, Count ); assert( Cba_ObjIsCo(pCbaNtk, iTerm) ); if ( Cba_ObjFanin(pCbaNtk, iTerm) == -1 ) // not a feedthrough Cba_NtkCreateOrConnectFanin( Abc_ObjFanin0(pObj), pCbaNtk, iTerm ); // prepare leaf - pObj->iTemp = Vec_IntEntry( p->vBuf2LeafObj, Count++ ); + pObj->iTemp = Vec_IntEntry( &p->vBuf2LeafObj, Count++ ); } else if ( Abc_NodeIsSeriousGate(pObj) ) { diff --git a/src/base/io/ioWriteBlif.c b/src/base/io/ioWriteBlif.c index 65546c01..88544d9f 100644 --- a/src/base/io/ioWriteBlif.c +++ b/src/base/io/ioWriteBlif.c @@ -615,9 +615,18 @@ int Io_NtkWriteNode( FILE * pFile, Abc_Obj_t * pNode, int Length ) if ( Abc_NtkHasMapping(pNode->pNtk) ) { // write the .gate line - fprintf( pFile, ".gate" ); - RetValue = Io_NtkWriteNodeGate( pFile, pNode, Length ); - fprintf( pFile, "\n" ); + if ( Abc_ObjIsBarBuf(pNode) ) + { + fprintf( pFile, ".barbuf " ); + fprintf( pFile, "%s %s", Abc_ObjName(Abc_ObjFanin0(pNode)), Abc_ObjName(Abc_ObjFanout0(pNode)) ); + fprintf( pFile, "\n" ); + } + else + { + fprintf( pFile, ".gate" ); + RetValue = Io_NtkWriteNodeGate( pFile, pNode, Length ); + fprintf( pFile, "\n" ); + } } else { diff --git a/src/map/scl/sclBufSize.c b/src/map/scl/sclBufSize.c index 96b00af1..7707704d 100644 --- a/src/map/scl/sclBufSize.c +++ b/src/map/scl/sclBufSize.c @@ -172,8 +172,6 @@ static inline float Abc_NtkComputeEdgeDept( Abc_Obj_t * pFanout, int iFanin, flo float Load = Bus_SclObjLoad( pFanout ); float Dept = Bus_SclObjDept( pFanout ); float Edge = Scl_LibPinArrivalEstimate( Abc_SclObjCell(pFanout), iFanin, Slew, Load ); -//if ( Abc_ObjFaninNum(pFanout) == 0 ) -//printf( "Edge = %.2f\n", Edge ); assert( Edge > 0 ); return Dept + Edge; } @@ -183,8 +181,12 @@ float Abc_NtkComputeNodeDeparture( Abc_Obj_t * pObj, float Slew ) int i; assert( Bus_SclObjDept(pObj) == 0 ); Abc_ObjForEachFanout( pObj, pFanout, i ) - if ( !Abc_ObjIsCo(pFanout) ) // add required times here + { + if ( Abc_ObjIsBarBuf(pFanout) ) + Bus_SclObjUpdateDept( pObj, Bus_SclObjDept(pFanout) ); + else if ( !Abc_ObjIsCo(pFanout) ) // add required times here Bus_SclObjUpdateDept( pObj, Abc_NtkComputeEdgeDept(pFanout, Abc_NodeFindFanin(pFanout, pObj), Slew) ); + } return Bus_SclObjDept( pObj ); } void Abc_NtkComputeFanoutInfo( Abc_Obj_t * pObj, float Slew ) @@ -192,12 +194,19 @@ void Abc_NtkComputeFanoutInfo( Abc_Obj_t * pObj, float Slew ) Abc_Obj_t * pFanout; int i; Abc_ObjForEachFanout( pObj, pFanout, i ) - if ( !Abc_ObjIsCo(pFanout) ) + { + if ( Abc_ObjIsBarBuf(pFanout) ) + { + Bus_SclObjSetETime( pFanout, Bus_SclObjDept(pFanout) ); + Bus_SclObjSetCin( pFanout, Bus_SclObjLoad(pFanout) ); + } + else if ( !Abc_ObjIsCo(pFanout) ) { int iFanin = Abc_NodeFindFanin(pFanout, pObj); Bus_SclObjSetETime( pFanout, Abc_NtkComputeEdgeDept(pFanout, iFanin, Slew) ); Bus_SclObjSetCin( pFanout, SC_CellPinCap( Abc_SclObjCell(pFanout), iFanin ) ); } + } } float Abc_NtkComputeNodeLoad( Bus_Man_t * p, Abc_Obj_t * pObj ) { @@ -407,10 +416,12 @@ void Abc_SclBufSize( Bus_Man_t * p, float Gain ) Abc_NtkComputeFanoutInfo( pObj, p->pPars->Slew ); Load = Abc_NtkComputeNodeLoad( p, pObj ); // consider the gate - if ( Abc_ObjIsCi(pObj) ) + if ( Abc_ObjIsCi(pObj) || Abc_ObjIsBarBuf(pObj) ) { pCell = p->pPiDrive; - Cin = SC_CellPinCapAve( pCell ); + // if PI driver is not given, assume Cin to be equal to Load + // this way, buffering of the PIs is performed + Cin = pCell ? SC_CellPinCapAve(pCell) : Load; } else { @@ -418,7 +429,7 @@ void Abc_SclBufSize( Bus_Man_t * p, float Gain ) Cin = SC_CellPinCapAve( pCell->pAve ); // Cin = SC_CellPinCapAve( pCell->pRepr->pNext ); } - // consider upsizing the gate + // consider buffering this gate if ( !p->pPars->fSizeOnly && (Abc_ObjFanoutNum(pObj) > p->pPars->nDegree || Load > GainGate * Cin) ) { // add one or more inverters @@ -448,6 +459,8 @@ void Abc_SclBufSize( Bus_Man_t * p, float Gain ) if ( Abc_ObjIsCi(pObj) ) continue; Abc_NtkComputeNodeDeparture( pObj, p->pPars->Slew ); + if ( Abc_ObjIsBarBuf(pObj) ) + continue; // create cell pCellNew = Abc_SclFindSmallestGate( pCell, Load / GainGate ); Abc_SclObjSetCell( pObj, pCellNew ); diff --git a/src/map/scl/sclDnsize.c b/src/map/scl/sclDnsize.c index c4bfc0b9..6060385e 100644 --- a/src/map/scl/sclDnsize.c +++ b/src/map/scl/sclDnsize.c @@ -239,7 +239,7 @@ void Abc_SclDnsizePrint( SC_Man * p, int Iter, int nAttempts, int nOverlaps, int SeeAlso [] ***********************************************************************/ -void Abc_SclDnsizePerform( SC_Lib * pLib, Abc_Ntk_t * pNtk, SC_SizePars * pPars ) +void Abc_SclDnsizePerformInt( SC_Lib * pLib, Abc_Ntk_t * pNtk, SC_SizePars * pPars ) { SC_Man * p; Abc_Obj_t * pObj; @@ -346,6 +346,29 @@ void Abc_SclDnsizePerform( SC_Lib * pLib, Abc_Ntk_t * pNtk, SC_SizePars * pPars // Abc_NtkCleanMarkAB( pNtk ); } +/**Function************************************************************* + + Synopsis [] + + Description [] + + SideEffects [] + + SeeAlso [] + +***********************************************************************/ +void Abc_SclDnsizePerform( SC_Lib * pLib, Abc_Ntk_t * pNtk, SC_SizePars * pPars ) +{ + Abc_Ntk_t * pNtkNew = pNtk; + if ( pNtk->nBarBufs2 > 0 ) + pNtkNew = Abc_NtkDupDfsNoBarBufs( pNtk ); + Abc_SclDnsizePerformInt( pLib, pNtkNew, pPars ); + if ( pNtk->nBarBufs2 > 0 ) + Abc_SclTransferGates( pNtk, pNtkNew ); + if ( pNtk->nBarBufs2 > 0 ) + Abc_NtkDelete( pNtkNew ); +} + //////////////////////////////////////////////////////////////////////// /// END OF FILE /// //////////////////////////////////////////////////////////////////////// diff --git a/src/map/scl/sclSize.c b/src/map/scl/sclSize.c index affe0652..d323df8b 100644 --- a/src/map/scl/sclSize.c +++ b/src/map/scl/sclSize.c @@ -668,7 +668,7 @@ SC_Man * Abc_SclManStart( SC_Lib * pLib, Abc_Ntk_t * pNtk, int fUseWireLoads, in SeeAlso [] ***********************************************************************/ -void Abc_SclTimePerform( SC_Lib * pLib, Abc_Ntk_t * pNtk, int nTreeCRatio, int fUseWireLoads, int fShowAll, int fPrintPath, int fDumpStats ) +void Abc_SclTimePerformInt( SC_Lib * pLib, Abc_Ntk_t * pNtk, int nTreeCRatio, int fUseWireLoads, int fShowAll, int fPrintPath, int fDumpStats ) { SC_Man * p; p = Abc_SclManStart( pLib, pNtk, fUseWireLoads, 1, 0, nTreeCRatio ); @@ -678,6 +678,27 @@ void Abc_SclTimePerform( SC_Lib * pLib, Abc_Ntk_t * pNtk, int nTreeCRatio, int f Abc_SclManFree( p ); } +/**Function************************************************************* + + Synopsis [] + + Description [] + + SideEffects [] + + SeeAlso [] + +***********************************************************************/ +void Abc_SclTimePerform( SC_Lib * pLib, Abc_Ntk_t * pNtk, int nTreeCRatio, int fUseWireLoads, int fShowAll, int fPrintPath, int fDumpStats ) +{ + Abc_Ntk_t * pNtkNew = pNtk; + if ( pNtk->nBarBufs2 > 0 ) + pNtkNew = Abc_NtkDupDfsNoBarBufs( pNtk ); + Abc_SclTimePerformInt( pLib, pNtkNew, nTreeCRatio, fUseWireLoads, fShowAll, fPrintPath, fDumpStats ); + if ( pNtk->nBarBufs2 > 0 ) + Abc_NtkDelete( pNtkNew ); +} + /**Function************************************************************* diff --git a/src/map/scl/sclSize.h b/src/map/scl/sclSize.h index 78c1f2f2..3ec0d83e 100644 --- a/src/map/scl/sclSize.h +++ b/src/map/scl/sclSize.h @@ -430,7 +430,7 @@ static inline int Abc_SclGetBufInvCount( Abc_Ntk_t * pNtk ) { Abc_Obj_t * pObj; int i, Count = 0; - Abc_NtkForEachNode( pNtk, pObj, i ) + Abc_NtkForEachNodeNotBarBuf1( pNtk, pObj, i ) Count += (Abc_ObjFaninNum(pObj) == 1); return Count; } @@ -439,7 +439,7 @@ static inline float Abc_SclGetAverageSize( Abc_Ntk_t * pNtk ) Abc_Obj_t * pObj; double Total = 0; int i, Count = 0; - Abc_NtkForEachNode1( pNtk, pObj, i ) + Abc_NtkForEachNodeNotBarBuf1( pNtk, pObj, i ) Count++, Total += 100.0*Abc_SclObjCell(pObj)->Order/Abc_SclObjCell(pObj)->nGates; return (float)(Total / Count); } @@ -448,7 +448,7 @@ static inline float Abc_SclGetTotalArea( Abc_Ntk_t * pNtk ) double Area = 0; Abc_Obj_t * pObj; int i; - Abc_NtkForEachNode1( pNtk, pObj, i ) + Abc_NtkForEachNodeNotBarBuf1( pNtk, pObj, i ) Area += Abc_SclObjCell(pObj)->area; return Area; } diff --git a/src/map/scl/sclUtil.c b/src/map/scl/sclUtil.c index 5af1b88b..de33d50a 100644 --- a/src/map/scl/sclUtil.c +++ b/src/map/scl/sclUtil.c @@ -59,12 +59,9 @@ void Abc_SclMioGates2SclGates( SC_Lib * pLib, Abc_Ntk_t * p ) // remap cells assert( p->vGates == NULL ); p->vGates = Vec_IntStartFull( Abc_NtkObjNumMax(p) ); - Abc_NtkForEachNode1( p, pObj, i ) + Abc_NtkForEachNodeNotBarBuf1( p, pObj, i ) { - if ( Abc_ObjIsBarBuf(pObj) ) - gateId = bufferId; - else - gateId = Abc_SclCellFind( pLib, Mio_GateReadName((Mio_Gate_t *)pObj->pData) ); + gateId = Abc_SclCellFind( pLib, Mio_GateReadName((Mio_Gate_t *)pObj->pData) ); assert( gateId >= 0 ); Vec_IntWriteEntry( p->vGates, i, gateId ); } @@ -76,14 +73,11 @@ void Abc_SclSclGates2MioGates( SC_Lib * pLib, Abc_Ntk_t * p ) SC_Cell * pCell; int i, Counter = 0, CounterAll = 0; assert( p->vGates != NULL ); - Abc_NtkForEachNode1( p, pObj, i ) + Abc_NtkForEachNodeNotBarBuf1( p, pObj, i ) { pCell = Abc_SclObjCell(pObj); assert( pCell->n_inputs == Abc_ObjFaninNum(pObj) ); - if ( Abc_ObjIsBarBuf(pObj) ) - pObj->pData = NULL; - else - pObj->pData = Mio_LibraryReadGateByName( (Mio_Library_t *)p->pManFunc, pCell->pName, NULL ); + pObj->pData = Mio_LibraryReadGateByName( (Mio_Library_t *)p->pManFunc, pCell->pName, NULL ); Counter += (pObj->pData == NULL); assert( pObj->fMarkA == 0 && pObj->fMarkB == 0 ); CounterAll++; @@ -110,12 +104,10 @@ void Abc_SclTransferGates( Abc_Ntk_t * pOld, Abc_Ntk_t * pNew ) Abc_Obj_t * pObj; int i; assert( pOld->nBarBufs2 > 0 ); assert( pNew->nBarBufs2 == 0 ); - Abc_NtkForEachNode( pOld, pObj, i ) + Abc_NtkForEachNodeNotBarBuf( pOld, pObj, i ) { if ( pObj->pCopy == NULL ) continue; - if ( Abc_ObjIsBarBuf(pObj) ) - continue; assert( Abc_ObjNtk(pObj->pCopy) == pNew ); pObj->pData = pObj->pCopy->pData; } @@ -139,7 +131,7 @@ void Abc_SclManPrintGateSizes( SC_Lib * pLib, Abc_Ntk_t * p, Vec_Int_t * vGates SC_Cell * pCell; int i, nGates = 0, Counters[ABC_SCL_MAX_SIZE] = {0}; double TotArea = 0, Areas[ABC_SCL_MAX_SIZE] = {0}; - Abc_NtkForEachNode1( p, pObj, i ) + Abc_NtkForEachNodeNotBarBuf1( p, pObj, i ) { pCell = SC_LibCell( pLib, Vec_IntEntry(vGates, Abc_ObjId(pObj)) ); assert( pCell->Order < ABC_SCL_MAX_SIZE ); @@ -216,7 +208,7 @@ void Abc_SclMinsizePerform( SC_Lib * pLib, Abc_Ntk_t * p, int fUseMax, int fVerb int i, gateId; vMinCells = Abc_SclFindMinAreas( pLib, fUseMax ); Abc_SclMioGates2SclGates( pLib, p ); - Abc_NtkForEachNode1( p, pObj, i ) + Abc_NtkForEachNodeNotBarBuf1( p, pObj, i ) { gateId = Vec_IntEntry( p->vGates, i ); assert( gateId >= 0 && gateId < Vec_PtrSize(pLib->vCells) ); @@ -233,7 +225,7 @@ int Abc_SclCountMinSize( SC_Lib * pLib, Abc_Ntk_t * p, int fUseMax ) Abc_Obj_t * pObj; int i, gateId, Counter = 0; vMinCells = Abc_SclFindMinAreas( pLib, fUseMax ); - Abc_NtkForEachNode1( p, pObj, i ) + Abc_NtkForEachNodeNotBarBuf1( p, pObj, i ) { gateId = Vec_IntEntry( p->vGates, i ); Counter += ( gateId == Vec_IntEntry(vMinCells, gateId) ); |