mirror of https://github.com/YosysHQ/abc.git
Improvements and tuning of CBA with buffering/sizing.
This commit is contained in:
parent
eb270018b9
commit
8410daf3e4
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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 )
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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 );
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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) )
|
||||
|
|
|
|||
|
|
@ -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 );
|
||||
|
|
|
|||
|
|
@ -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) )
|
||||
{
|
||||
|
|
|
|||
|
|
@ -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
|
||||
{
|
||||
|
|
|
|||
|
|
@ -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 );
|
||||
|
|
|
|||
|
|
@ -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 ///
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
|
|
|
|||
|
|
@ -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*************************************************************
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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) );
|
||||
|
|
|
|||
Loading…
Reference in New Issue