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