Commit faf9c201 by Alan Mishchenko

Updating code to support barrier buffers.

parent f3291054
...@@ -507,6 +507,8 @@ static inline void Abc_ObjSetMvVar( Abc_Obj_t * pObj, void * pV) { Vec_At ...@@ -507,6 +507,8 @@ static inline void Abc_ObjSetMvVar( Abc_Obj_t * pObj, void * pV) { Vec_At
for ( i = 0; (i < Abc_NtkPoNum(pNtk)) && (((pPo) = Abc_NtkPo(pNtk, i)), 1); i++ ) for ( i = 0; (i < Abc_NtkPoNum(pNtk)) && (((pPo) = Abc_NtkPo(pNtk, i)), 1); i++ )
#define Abc_NtkForEachCo( pNtk, pCo, i ) \ #define Abc_NtkForEachCo( pNtk, pCo, i ) \
for ( i = 0; (i < Abc_NtkCoNum(pNtk)) && (((pCo) = Abc_NtkCo(pNtk, i)), 1); i++ ) for ( i = 0; (i < Abc_NtkCoNum(pNtk)) && (((pCo) = Abc_NtkCo(pNtk, i)), 1); i++ )
#define Abc_NtkForEachLiPo( pNtk, pCo, i ) \
for ( i = 0; (i < Abc_NtkCoNum(pNtk)) && (((pCo) = Abc_NtkCo(pNtk, i < pNtk->nBarBufs ? Abc_NtkCoNum(pNtk) - pNtk->nBarBufs + i : i - pNtk->nBarBufs)), 1); i++ )
// fanin and fanouts // fanin and fanouts
#define Abc_ObjForEachFanin( pObj, pFanin, i ) \ #define Abc_ObjForEachFanin( pObj, pFanin, i ) \
for ( i = 0; (i < Abc_ObjFaninNum(pObj)) && (((pFanin) = Abc_ObjFanin(pObj, i)), 1); i++ ) for ( i = 0; (i < Abc_ObjFaninNum(pObj)) && (((pFanin) = Abc_ObjFanin(pObj, i)), 1); i++ )
......
...@@ -294,6 +294,8 @@ int Abc_AigLevel( Abc_Ntk_t * pNtk ) ...@@ -294,6 +294,8 @@ int Abc_AigLevel( Abc_Ntk_t * pNtk )
Abc_Obj_t * pNode; Abc_Obj_t * pNode;
int i, LevelsMax; int i, LevelsMax;
assert( Abc_NtkIsStrash(pNtk) ); assert( Abc_NtkIsStrash(pNtk) );
if ( pNtk->nBarBufs )
return Abc_NtkLevel( pNtk );
// perform the traversal // perform the traversal
LevelsMax = 0; LevelsMax = 0;
Abc_NtkForEachCo( pNtk, pNode, i ) Abc_NtkForEachCo( pNtk, pNode, i )
......
...@@ -1139,12 +1139,28 @@ int Abc_NtkLevel( Abc_Ntk_t * pNtk ) ...@@ -1139,12 +1139,28 @@ int Abc_NtkLevel( Abc_Ntk_t * pNtk )
// perform the traversal // perform the traversal
LevelsMax = 0; LevelsMax = 0;
Abc_NtkIncrementTravId( pNtk ); Abc_NtkIncrementTravId( pNtk );
if ( pNtk->nBarBufs == 0 )
{
Abc_NtkForEachNode( pNtk, pNode, i ) Abc_NtkForEachNode( pNtk, pNode, i )
{ {
Abc_NtkLevel_rec( pNode ); Abc_NtkLevel_rec( pNode );
if ( LevelsMax < (int)pNode->Level ) if ( LevelsMax < (int)pNode->Level )
LevelsMax = (int)pNode->Level; LevelsMax = (int)pNode->Level;
} }
}
else
{
Abc_NtkForEachLiPo( pNtk, pNode, i )
{
Abc_Obj_t * pDriver = Abc_ObjFanin0(pNode);
Abc_NtkLevel_rec( pDriver );
if ( LevelsMax < (int)pDriver->Level )
LevelsMax = (int)pDriver->Level;
// transfer the delay
if ( i < pNtk->nBarBufs )
Abc_ObjFanout0(Abc_ObjFanout0(pNode))->Level = pDriver->Level;
}
}
return LevelsMax; return LevelsMax;
} }
......
...@@ -185,6 +185,7 @@ void Abc_NtkShow( Abc_Ntk_t * pNtk0, int fGateNames, int fSeq, int fUseReverse ) ...@@ -185,6 +185,7 @@ void Abc_NtkShow( Abc_Ntk_t * pNtk0, int fGateNames, int fSeq, int fUseReverse )
Abc_Ntk_t * pNtk; Abc_Ntk_t * pNtk;
Abc_Obj_t * pNode; Abc_Obj_t * pNode;
Vec_Ptr_t * vNodes; Vec_Ptr_t * vNodes;
int nBarBufs;
char FileNameDot[200]; char FileNameDot[200];
int i; int i;
...@@ -215,10 +216,13 @@ void Abc_NtkShow( Abc_Ntk_t * pNtk0, int fGateNames, int fSeq, int fUseReverse ) ...@@ -215,10 +216,13 @@ void Abc_NtkShow( Abc_Ntk_t * pNtk0, int fGateNames, int fSeq, int fUseReverse )
Abc_NtkForEachObj( pNtk, pNode, i ) Abc_NtkForEachObj( pNtk, pNode, i )
Vec_PtrPush( vNodes, pNode ); Vec_PtrPush( vNodes, pNode );
// write the DOT file // write the DOT file
nBarBufs = pNtk->nBarBufs;
pNtk->nBarBufs = 0;
if ( fSeq ) if ( fSeq )
Io_WriteDotSeq( pNtk, vNodes, NULL, FileNameDot, fGateNames, fUseReverse ); Io_WriteDotSeq( pNtk, vNodes, NULL, FileNameDot, fGateNames, fUseReverse );
else else
Io_WriteDotNtk( pNtk, vNodes, NULL, FileNameDot, fGateNames, fUseReverse ); Io_WriteDotNtk( pNtk, vNodes, NULL, FileNameDot, fGateNames, fUseReverse );
pNtk->nBarBufs = nBarBufs;
Vec_PtrFree( vNodes ); Vec_PtrFree( vNodes );
// visualize the file // visualize the file
......
...@@ -103,7 +103,7 @@ void Abc_NtkBalancePerform( Abc_Ntk_t * pNtk, Abc_Ntk_t * pNtkAig, int fDuplicat ...@@ -103,7 +103,7 @@ void Abc_NtkBalancePerform( Abc_Ntk_t * pNtk, Abc_Ntk_t * pNtkAig, int fDuplicat
{ {
ProgressBar * pProgress; ProgressBar * pProgress;
Vec_Vec_t * vStorage; Vec_Vec_t * vStorage;
Abc_Obj_t * pNode, * pDriver; Abc_Obj_t * pNode;
int i; int i;
// transfer level // transfer level
Abc_NtkForEachCi( pNtk, pNode, i ) Abc_NtkForEachCi( pNtk, pNode, i )
...@@ -114,12 +114,23 @@ void Abc_NtkBalancePerform( Abc_Ntk_t * pNtk, Abc_Ntk_t * pNtkAig, int fDuplicat ...@@ -114,12 +114,23 @@ void Abc_NtkBalancePerform( Abc_Ntk_t * pNtk, Abc_Ntk_t * pNtkAig, int fDuplicat
vStorage = Vec_VecStart( 10 ); vStorage = Vec_VecStart( 10 );
// perform balancing of POs // perform balancing of POs
pProgress = Extra_ProgressBarStart( stdout, Abc_NtkCoNum(pNtk) ); pProgress = Extra_ProgressBarStart( stdout, Abc_NtkCoNum(pNtk) );
if ( pNtk->nBarBufs == 0 )
{
Abc_NtkForEachCo( pNtk, pNode, i ) Abc_NtkForEachCo( pNtk, pNode, i )
{ {
Extra_ProgressBarUpdate( pProgress, i, NULL ); Extra_ProgressBarUpdate( pProgress, i, NULL );
// strash the driver node Abc_NodeBalance_rec( pNtkAig, Abc_ObjFanin0(pNode), vStorage, 0, fDuplicate, fSelective, fUpdateLevel );
pDriver = Abc_ObjFanin0(pNode); }
Abc_NodeBalance_rec( pNtkAig, pDriver, vStorage, 0, fDuplicate, fSelective, fUpdateLevel ); }
else
{
Abc_NtkForEachLiPo( pNtk, pNode, i )
{
Extra_ProgressBarUpdate( pProgress, i, NULL );
Abc_NodeBalance_rec( pNtkAig, Abc_ObjFanin0(pNode), vStorage, 0, fDuplicate, fSelective, fUpdateLevel );
if ( i < pNtk->nBarBufs )
Abc_ObjFanout0(Abc_ObjFanout0(pNode))->Level = Abc_ObjFanin0(pNode)->Level;
}
} }
Extra_ProgressBarStop( pProgress ); Extra_ProgressBarStop( pProgress );
Vec_VecFree( vStorage ); Vec_VecFree( vStorage );
......
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