Commit 34006708 by Alan Mishchenko

Handling constant nodes in gate sizing.

parent b9a1c6ec
...@@ -463,6 +463,9 @@ static inline void Abc_ObjSetMvVar( Abc_Obj_t * pObj, void * pV) { Vec_At ...@@ -463,6 +463,9 @@ static inline void Abc_ObjSetMvVar( Abc_Obj_t * pObj, void * pV) { Vec_At
#define Abc_NtkForEachNode( pNtk, pNode, i ) \ #define Abc_NtkForEachNode( pNtk, pNode, i ) \
for ( i = 0; (i < Vec_PtrSize((pNtk)->vObjs)) && (((pNode) = Abc_NtkObj(pNtk, i)), 1); i++ ) \ for ( i = 0; (i < Vec_PtrSize((pNtk)->vObjs)) && (((pNode) = Abc_NtkObj(pNtk, i)), 1); i++ ) \
if ( (pNode) == NULL || !Abc_ObjIsNode(pNode) ) {} else if ( (pNode) == NULL || !Abc_ObjIsNode(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_NtkForEachNodeReverse( pNtk, pNode, i ) \ #define Abc_NtkForEachNodeReverse( pNtk, pNode, i ) \
for ( i = Vec_PtrSize((pNtk)->vObjs) - 1; (i >= 0) && (((pNode) = Abc_NtkObj(pNtk, i)), 1); i-- ) \ for ( i = Vec_PtrSize((pNtk)->vObjs) - 1; (i >= 0) && (((pNode) = Abc_NtkObj(pNtk, i)), 1); i-- ) \
if ( (pNode) == NULL || !Abc_ObjIsNode(pNode) ) {} else if ( (pNode) == NULL || !Abc_ObjIsNode(pNode) ) {} else
......
...@@ -132,7 +132,7 @@ void Abc_SclComputeLoad( SC_Man * p ) ...@@ -132,7 +132,7 @@ void Abc_SclComputeLoad( SC_Man * p )
pLoad->rise = pLoad->fall = 0.0; pLoad->rise = pLoad->fall = 0.0;
} }
// add cell load // add cell load
Abc_NtkForEachNode( p->pNtk, pObj, i ) Abc_NtkForEachNode1( p->pNtk, pObj, i )
{ {
SC_Cell * pCell = Abc_SclObjCell( p, pObj ); SC_Cell * pCell = Abc_SclObjCell( p, pObj );
Abc_ObjForEachFanin( pObj, pFanin, k ) Abc_ObjForEachFanin( pObj, pFanin, k )
...@@ -147,7 +147,7 @@ void Abc_SclComputeLoad( SC_Man * p ) ...@@ -147,7 +147,7 @@ void Abc_SclComputeLoad( SC_Man * p )
vWireCaps = Abc_SclFindWireCaps( p ); vWireCaps = Abc_SclFindWireCaps( p );
if ( vWireCaps ) if ( vWireCaps )
{ {
Abc_NtkForEachNode( p->pNtk, pObj, i ) Abc_NtkForEachNode1( p->pNtk, pObj, i )
{ {
SC_Pair * pLoad = Abc_SclObjLoad( p, pObj ); SC_Pair * pLoad = Abc_SclObjLoad( p, pObj );
k = Abc_MinInt( Vec_FltSize(vWireCaps)-1, Abc_ObjFanoutNum(pObj) ); k = Abc_MinInt( Vec_FltSize(vWireCaps)-1, Abc_ObjFanoutNum(pObj) );
......
...@@ -181,7 +181,7 @@ static inline float Abc_SclGetTotalArea( SC_Man * p ) ...@@ -181,7 +181,7 @@ static inline float Abc_SclGetTotalArea( SC_Man * p )
double Area = 0; double Area = 0;
Abc_Obj_t * pObj; Abc_Obj_t * pObj;
int i; int i;
Abc_NtkForEachNode( p->pNtk, pObj, i ) Abc_NtkForEachNode1( p->pNtk, pObj, i )
Area += Abc_SclObjCell( p, pObj )->area; Area += Abc_SclObjCell( p, pObj )->area;
return Area; return Area;
} }
......
...@@ -49,7 +49,7 @@ Vec_Int_t * Abc_SclCollectNodes( Abc_Ntk_t * p ) ...@@ -49,7 +49,7 @@ Vec_Int_t * Abc_SclCollectNodes( Abc_Ntk_t * p )
Abc_Obj_t * pObj; Abc_Obj_t * pObj;
int i; int i;
vRes = Vec_IntAlloc( Abc_NtkNodeNum(p) ); vRes = Vec_IntAlloc( Abc_NtkNodeNum(p) );
Abc_NtkForEachNode( p, pObj, i ) Abc_NtkForEachNode1( p, pObj, i )
Vec_IntPush( vRes, i ); Vec_IntPush( vRes, i );
return vRes; return vRes;
} }
......
...@@ -108,6 +108,7 @@ void Abc_SclTimeNtkPrint( SC_Man * p, int fShowAll ) ...@@ -108,6 +108,7 @@ void Abc_SclTimeNtkPrint( SC_Man * p, int fShowAll )
{ {
// printf( "Timing information for all nodes: \n" ); // printf( "Timing information for all nodes: \n" );
Abc_NtkForEachNodeReverse( p->pNtk, pObj, i ) Abc_NtkForEachNodeReverse( p->pNtk, pObj, i )
if ( Abc_ObjFaninNum(pObj) > 0 )
Abc_SclTimeGatePrint( p, pObj, -1 ); Abc_SclTimeGatePrint( p, pObj, -1 );
} }
else else
...@@ -238,7 +239,7 @@ void Abc_SclTimeNtk( SC_Man * p ) ...@@ -238,7 +239,7 @@ void Abc_SclTimeNtk( SC_Man * p )
{ {
Abc_Obj_t * pObj; Abc_Obj_t * pObj;
int i; int i;
Abc_NtkForEachNode( p->pNtk, pObj, i ) Abc_NtkForEachNode1( p->pNtk, pObj, i )
Abc_SclTimeGate( p, pObj ); Abc_SclTimeGate( p, pObj );
Abc_NtkForEachCo( p->pNtk, pObj, i ) Abc_NtkForEachCo( p->pNtk, pObj, i )
Abc_SclObjDupFanin( p, pObj ); Abc_SclObjDupFanin( p, pObj );
......
...@@ -198,7 +198,7 @@ Vec_Int_t * Abc_SclManFindGates( SC_Lib * pLib, Abc_Ntk_t * p ) ...@@ -198,7 +198,7 @@ Vec_Int_t * Abc_SclManFindGates( SC_Lib * pLib, Abc_Ntk_t * p )
Abc_Obj_t * pObj; Abc_Obj_t * pObj;
int i; int i;
vVec = Vec_IntStartFull( Abc_NtkObjNumMax(p) ); vVec = Vec_IntStartFull( Abc_NtkObjNumMax(p) );
Abc_NtkForEachNode( p, pObj, i ) Abc_NtkForEachNode1( p, pObj, i )
{ {
char * pName = Mio_GateReadName((Mio_Gate_t *)pObj->pData); char * pName = Mio_GateReadName((Mio_Gate_t *)pObj->pData);
int gateId = Abc_SclCellFind( pLib, pName ); int gateId = Abc_SclCellFind( pLib, pName );
...@@ -212,7 +212,7 @@ void Abc_SclManSetGates( SC_Lib * pLib, Abc_Ntk_t * p, Vec_Int_t * vGates ) ...@@ -212,7 +212,7 @@ void Abc_SclManSetGates( SC_Lib * pLib, Abc_Ntk_t * p, Vec_Int_t * vGates )
{ {
Abc_Obj_t * pObj; Abc_Obj_t * pObj;
int i; int i;
Abc_NtkForEachNode( p, pObj, i ) Abc_NtkForEachNode1( p, pObj, i )
{ {
SC_Cell * pCell = SC_LibCell( pLib, Vec_IntEntry(vGates, Abc_ObjId(pObj)) ); SC_Cell * pCell = SC_LibCell( pLib, Vec_IntEntry(vGates, Abc_ObjId(pObj)) );
assert( pCell->n_inputs == Abc_ObjFaninNum(pObj) ); assert( pCell->n_inputs == Abc_ObjFaninNum(pObj) );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment