mirror of https://github.com/YosysHQ/abc.git
Integrating barrier buffers.
This commit is contained in:
parent
b379b3ee20
commit
aadfea8b4d
|
|
@ -461,15 +461,24 @@ static inline void Abc_ObjSetMvVar( Abc_Obj_t * pObj, void * pV) { Vec_At
|
|||
#define Abc_NtkForEachNode( pNtk, pNode, i ) \
|
||||
for ( i = 0; (i < Vec_PtrSize((pNtk)->vObjs)) && (((pNode) = Abc_NtkObj(pNtk, i)), 1); i++ ) \
|
||||
if ( (pNode) == NULL || !Abc_ObjIsNode(pNode) ) {} else
|
||||
#define Abc_NtkForEachNodeNotBarBuf( pNtk, pNode, i ) \
|
||||
for ( i = 0; (i < Vec_PtrSize((pNtk)->vObjs)) && (((pNode) = Abc_NtkObj(pNtk, i)), 1); i++ ) \
|
||||
if ( (pNode) == NULL || !Abc_ObjIsNode(pNode) || Abc_ObjIsBarBuf(pNode) ) {} else
|
||||
#define Abc_NtkForEachNode1( pNtk, pNode, i ) \
|
||||
for ( i = 0; (i < Vec_PtrSize((pNtk)->vObjs)) && (((pNode) = Abc_NtkObj(pNtk, i)), 1); i++ ) \
|
||||
if ( (pNode) == NULL || !Abc_ObjIsNode(pNode) || !Abc_ObjFaninNum(pNode) ) {} else
|
||||
#define Abc_NtkForEachNodeNotBarBuf1( pNtk, pNode, i ) \
|
||||
for ( i = 0; (i < Vec_PtrSize((pNtk)->vObjs)) && (((pNode) = Abc_NtkObj(pNtk, i)), 1); i++ ) \
|
||||
if ( (pNode) == NULL || !Abc_ObjIsNode(pNode) || !Abc_ObjFaninNum(pNode) || Abc_ObjIsBarBuf(pNode) ) {} else
|
||||
#define Abc_NtkForEachNodeReverse( pNtk, pNode, i ) \
|
||||
for ( i = Vec_PtrSize((pNtk)->vObjs) - 1; (i >= 0) && (((pNode) = Abc_NtkObj(pNtk, i)), 1); i-- ) \
|
||||
if ( (pNode) == NULL || !Abc_ObjIsNode(pNode) ) {} else
|
||||
#define Abc_NtkForEachNodeReverse1( pNtk, pNode, i ) \
|
||||
for ( i = Vec_PtrSize((pNtk)->vObjs) - 1; (i >= 0) && (((pNode) = Abc_NtkObj(pNtk, i)), 1); i-- ) \
|
||||
if ( (pNode) == NULL || !Abc_ObjIsNode(pNode) || !Abc_ObjFaninNum(pNode) ) {} else
|
||||
#define Abc_NtkForEachBarBuf( pNtk, pNode, i ) \
|
||||
for ( i = 0; (i < Vec_PtrSize((pNtk)->vObjs)) && (((pNode) = Abc_NtkObj(pNtk, i)), 1); i++ ) \
|
||||
if ( (pNode) == NULL || !Abc_ObjIsBarBuf(pNode) ) {} else
|
||||
#define Abc_NtkForEachGate( pNtk, pNode, i ) \
|
||||
for ( i = 0; (i < Vec_PtrSize((pNtk)->vObjs)) && (((pNode) = Abc_NtkObj(pNtk, i)), 1); i++ ) \
|
||||
if ( (pNode) == NULL || !Abc_ObjIsGate(pNode) ) {} else
|
||||
|
|
|
|||
|
|
@ -87,10 +87,14 @@ Vec_Ptr_t * Abc_NtkDfs( Abc_Ntk_t * pNtk, int fCollectAll )
|
|||
Abc_NtkIncrementTravId( pNtk );
|
||||
// start the array of nodes
|
||||
vNodes = Vec_PtrAlloc( 100 );
|
||||
Abc_NtkForEachCo( pNtk, pObj, i )
|
||||
Abc_NtkForEachObj( 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 )
|
||||
|
|
|
|||
|
|
@ -232,6 +232,7 @@ static inline float SC_PairMin( SC_Pair * d ) { return Abc
|
|||
static inline float SC_PairAve( SC_Pair * d ) { return 0.5 * d->rise + 0.5 * d->fall; }
|
||||
static inline void SC_PairDup( SC_Pair * d, SC_Pair * s ) { *d = *s; }
|
||||
static inline void SC_PairMove( SC_Pair * d, SC_Pair * s ) { *d = *s; s->rise = s->fall = 0; }
|
||||
static inline void SC_PairAdd( SC_Pair * d, SC_Pair * s ) { d->rise += s->rise; d->fall += s->fall;}
|
||||
static inline int SC_PairEqual( SC_Pair * d, SC_Pair * s ) { return d->rise == s->rise && d->fall == s->fall; }
|
||||
static inline int SC_PairEqualE( SC_Pair * d, SC_Pair * s, float E ) { return d->rise - s->rise < E && s->rise - d->rise < E && d->fall - s->fall < E && s->fall - d->fall < E; }
|
||||
|
||||
|
|
|
|||
|
|
@ -154,6 +154,15 @@ void Abc_SclComputeLoad( SC_Man * p )
|
|||
printf( "Maximum input drive strength is exceeded at primary input %d.\n", i );
|
||||
}
|
||||
}
|
||||
/*
|
||||
// transfer load from barbufs
|
||||
Abc_NtkForEachBarBuf( p->pNtk, pObj, i )
|
||||
{
|
||||
SC_Pair * pLoad = Abc_SclObjLoad( p, pObj );
|
||||
SC_Pair * pLoadF = Abc_SclObjLoad( p, Abc_ObjFanin(pObj, 0) );
|
||||
SC_PairAdd( pLoadF, pLoad );
|
||||
}
|
||||
*/
|
||||
// calculate average load
|
||||
// if ( p->EstLoadMax )
|
||||
{
|
||||
|
|
|
|||
|
|
@ -106,7 +106,8 @@ struct SC_Man_
|
|||
////////////////////////////////////////////////////////////////////////
|
||||
|
||||
static inline SC_Lib * Abc_SclObjLib( Abc_Obj_t * p ) { return (SC_Lib *)p->pNtk->pSCLib; }
|
||||
static inline SC_Cell * Abc_SclObjCell( Abc_Obj_t * p ) { return SC_LibCell( Abc_SclObjLib(p), Vec_IntEntry(p->pNtk->vGates, Abc_ObjId(p)) ); }
|
||||
static inline int Abc_SclObjCellId( Abc_Obj_t * p ) { return Vec_IntEntry( p->pNtk->vGates, Abc_ObjId(p) ); }
|
||||
static inline SC_Cell * Abc_SclObjCell( Abc_Obj_t * p ) { int c = Abc_SclObjCellId(p); return c == -1 ? NULL:SC_LibCell(Abc_SclObjLib(p), c); }
|
||||
static inline void Abc_SclObjSetCell( Abc_Obj_t * p, SC_Cell * pCell ) { Vec_IntWriteEntry( p->pNtk->vGates, Abc_ObjId(p), pCell->Id ); }
|
||||
|
||||
static inline SC_Pair * Abc_SclObjLoad( SC_Man * p, Abc_Obj_t * pObj ) { return p->pLoads + Abc_ObjId(pObj); }
|
||||
|
|
@ -579,6 +580,8 @@ extern void Abc_SclSclGates2MioGates( SC_Lib * pLib, Abc_Ntk_t * p );
|
|||
extern void Abc_SclPrintGateSizes( SC_Lib * pLib, Abc_Ntk_t * p );
|
||||
extern void Abc_SclMinsizePerform( SC_Lib * pLib, Abc_Ntk_t * p, int fUseMax, int fVerbose );
|
||||
extern int Abc_SclCountMinSize( SC_Lib * pLib, Abc_Ntk_t * p, int fUseMax );
|
||||
extern Vec_Int_t * Abc_SclExtractBarBufs( Abc_Ntk_t * pNtk );
|
||||
extern void Abc_SclInsertBarBufs( Abc_Ntk_t * pNtk, Vec_Int_t * vBufs );
|
||||
|
||||
|
||||
ABC_NAMESPACE_HEADER_END
|
||||
|
|
|
|||
|
|
@ -844,7 +844,7 @@ void Abc_SclUpsizeRemoveDangling( SC_Man * p, Abc_Ntk_t * pNtk )
|
|||
SC_Cell * pCell;
|
||||
Abc_Obj_t * pObj;
|
||||
int i;
|
||||
Abc_NtkForEachNode( pNtk, pObj, i )
|
||||
Abc_NtkForEachNodeNotBarBuf( pNtk, pObj, i )
|
||||
if ( Abc_ObjFanoutNum(pObj) == 0 )
|
||||
{
|
||||
pCell = Abc_SclObjCell( pObj );
|
||||
|
|
|
|||
|
|
@ -47,33 +47,46 @@ ABC_NAMESPACE_IMPL_START
|
|||
void Abc_SclMioGates2SclGates( SC_Lib * pLib, Abc_Ntk_t * p )
|
||||
{
|
||||
Abc_Obj_t * pObj;
|
||||
int i;
|
||||
int i, gateId, bufferId;
|
||||
// find buffer
|
||||
if ( Mio_LibraryReadBuf((Mio_Library_t *)p->pManFunc) == NULL )
|
||||
{
|
||||
printf( "Cannot find buffer in the current library. Quitting.\n" );
|
||||
return;
|
||||
}
|
||||
bufferId = Abc_SclCellFind( pLib, Mio_GateReadName(Mio_LibraryReadBuf((Mio_Library_t *)p->pManFunc)) );
|
||||
assert( bufferId >= 0 );
|
||||
// remap cells
|
||||
assert( p->vGates == NULL );
|
||||
p->vGates = Vec_IntStartFull( Abc_NtkObjNumMax(p) );
|
||||
Abc_NtkForEachNode1( p, pObj, i )
|
||||
{
|
||||
char * pName = Mio_GateReadName((Mio_Gate_t *)pObj->pData);
|
||||
int gateId = Abc_SclCellFind( pLib, pName );
|
||||
if ( Abc_ObjIsBarBuf(pObj) )
|
||||
gateId = bufferId;
|
||||
else
|
||||
gateId = Abc_SclCellFind( pLib, Mio_GateReadName((Mio_Gate_t *)pObj->pData) );
|
||||
assert( gateId >= 0 );
|
||||
Vec_IntWriteEntry( p->vGates, i, gateId );
|
||||
//printf( "Found gate %s\n", pName );
|
||||
}
|
||||
p->pSCLib = pLib;
|
||||
}
|
||||
void Abc_SclSclGates2MioGates( SC_Lib * pLib, Abc_Ntk_t * p )
|
||||
{
|
||||
Abc_Obj_t * pObj;
|
||||
SC_Cell * pCell;
|
||||
int i, Counter = 0, CounterAll = 0;
|
||||
assert( p->vGates != NULL );
|
||||
Abc_NtkForEachNode1( p, pObj, i )
|
||||
{
|
||||
SC_Cell * pCell = Abc_SclObjCell(pObj);
|
||||
pCell = Abc_SclObjCell(pObj);
|
||||
assert( pCell->n_inputs == Abc_ObjFaninNum(pObj) );
|
||||
pObj->pData = Mio_LibraryReadGateByName( (Mio_Library_t *)p->pManFunc, pCell->pName, NULL );
|
||||
if ( Abc_ObjIsBarBuf(pObj) )
|
||||
pObj->pData = NULL;
|
||||
else
|
||||
pObj->pData = Mio_LibraryReadGateByName( (Mio_Library_t *)p->pManFunc, pCell->pName, NULL );
|
||||
Counter += (pObj->pData == NULL);
|
||||
assert( pObj->fMarkA == 0 && pObj->fMarkB == 0 );
|
||||
CounterAll++;
|
||||
//printf( "Found gate %s\n", pCell->name );
|
||||
}
|
||||
if ( Counter )
|
||||
printf( "Could not find %d (out of %d) gates in the current library.\n", Counter, CounterAll );
|
||||
|
|
@ -96,11 +109,12 @@ void Abc_SclSclGates2MioGates( SC_Lib * pLib, Abc_Ntk_t * p )
|
|||
void Abc_SclManPrintGateSizes( SC_Lib * pLib, Abc_Ntk_t * p, Vec_Int_t * vGates )
|
||||
{
|
||||
Abc_Obj_t * pObj;
|
||||
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 )
|
||||
{
|
||||
SC_Cell * pCell = SC_LibCell( pLib, Vec_IntEntry(vGates, Abc_ObjId(pObj)) );
|
||||
pCell = SC_LibCell( pLib, Vec_IntEntry(vGates, Abc_ObjId(pObj)) );
|
||||
assert( pCell->Order < ABC_SCL_MAX_SIZE );
|
||||
Counters[pCell->Order]++;
|
||||
Areas[pCell->Order] += pCell->area;
|
||||
|
|
@ -124,6 +138,7 @@ void Abc_SclPrintGateSizes( SC_Lib * pLib, Abc_Ntk_t * p )
|
|||
{
|
||||
Abc_SclMioGates2SclGates( pLib, p );
|
||||
Abc_SclManPrintGateSizes( pLib, p, p->vGates );
|
||||
Abc_SclSclGates2MioGates( pLib, p );
|
||||
Vec_IntFreeP( &p->vGates );
|
||||
p->pSCLib = NULL;
|
||||
}
|
||||
|
|
@ -238,6 +253,44 @@ void Abc_SclReadTimingConstr( Abc_Frame_t * pAbc, char * pFileName, int fVerbose
|
|||
fclose( pFile );
|
||||
}
|
||||
|
||||
/**Function*************************************************************
|
||||
|
||||
Synopsis []
|
||||
|
||||
Description []
|
||||
|
||||
SideEffects []
|
||||
|
||||
SeeAlso []
|
||||
|
||||
***********************************************************************/
|
||||
Vec_Int_t * Abc_SclExtractBarBufs( Abc_Ntk_t * pNtk )
|
||||
{
|
||||
Vec_Int_t * vBufs;
|
||||
Mio_Gate_t * pBuffer;
|
||||
Abc_Obj_t * pObj; int i;
|
||||
pBuffer = Mio_LibraryReadBuf( (Mio_Library_t *)pNtk->pManFunc );
|
||||
if ( pBuffer == NULL )
|
||||
{
|
||||
printf( "Cannot find buffer in the current library. Quitting.\n" );
|
||||
return NULL;
|
||||
}
|
||||
vBufs = Vec_IntAlloc( 100 );
|
||||
Abc_NtkForEachBarBuf( pNtk, pObj, i )
|
||||
{
|
||||
assert( pObj->pData == NULL );
|
||||
pObj->pData = pBuffer;
|
||||
Vec_IntPush( vBufs, i );
|
||||
}
|
||||
return vBufs;
|
||||
}
|
||||
void Abc_SclInsertBarBufs( Abc_Ntk_t * pNtk, Vec_Int_t * vBufs )
|
||||
{
|
||||
Abc_Obj_t * pObj; int i;
|
||||
Abc_NtkForEachObjVec( vBufs, pNtk, pObj, i )
|
||||
pObj->pData = NULL;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
/// END OF FILE ///
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
|
|
|
|||
Loading…
Reference in New Issue