Commit 37107a3b by Alan Mishchenko

Added new API to traverse the cut in the mapper.

parent fac39766
......@@ -525,6 +525,7 @@ extern Vec_Ptr_t * If_ManCollectMappingDirect( If_Man_t * p );
extern Vec_Int_t * If_ManCollectMappingInt( If_Man_t * p );
extern int If_ManCountSpecialPos( If_Man_t * p );
extern void If_CutTraverse( If_Man_t * p, If_Obj_t * pRoot, If_Cut_t * pCut, Vec_Ptr_t * vNodes );
/*=== abcRec.c ============================================================*/
extern int If_CutDelayRecCost(If_Man_t* p, If_Cut_t* pCut, If_Obj_t * pObj);
......
......@@ -75,7 +75,8 @@ float If_CutDelaySpecial( If_Man_t * p, If_Cut_t * pCut, int fCarry )
Delay = IF_MAX( Delay, Pin2Pin[fCarry][i] + DelayCur );
}
return Delay;
}
}
/**Function*************************************************************
......@@ -263,6 +264,7 @@ void If_ObjPerformMappingAnd( If_Man_t * p, If_Obj_t * pObj, int Mode, int fPrep
pCut->AveRefs = (Mode == 0)? (float)0.0 : If_CutAverageRefs( p, pCut );
// insert the cut into storage
If_CutSort( p, pCutSet, pCut );
// If_CutTraverse( p, pObj, pCut );
}
assert( pCutSet->nCuts > 0 );
......
......@@ -769,6 +769,57 @@ int If_ManCountSpecialPos( If_Man_t * p )
}
/**Function*************************************************************
Synopsis [Traverse the cut and counts its volume.]
Description []
SideEffects []
SeeAlso []
***********************************************************************/
static void If_CutTraverse_rec( If_Obj_t * pNode, Vec_Ptr_t * vNodes )
{
if ( pNode->fMark )
return;
pNode->fMark = 1;
// assert( !If_ObjIsCi(pNode) ); // does not hold with cut minimization
if ( If_ObjIsAnd(pNode) )
If_CutTraverse_rec( If_ObjFanin0(pNode), vNodes );
if ( If_ObjIsAnd(pNode) )
If_CutTraverse_rec( If_ObjFanin1(pNode), vNodes );
Vec_PtrPush( vNodes, pNode );
}
void If_CutTraverse( If_Man_t * p, If_Obj_t * pRoot, If_Cut_t * pCut, Vec_Ptr_t * vNodes )
{
If_Obj_t * pLeaf;
int i;
// collect the internal nodes of the cut
Vec_PtrClear( vNodes );
If_CutForEachLeaf( p, pCut, pLeaf, i )
{
Vec_PtrPush( vNodes, pLeaf );
assert( pLeaf->fMark == 0 );
pLeaf->fMark = 1;
}
// collect other nodes
If_CutTraverse_rec( pRoot, vNodes );
// clean the mark
Vec_PtrForEachEntry( If_Obj_t *, vNodes, pLeaf, i )
pLeaf->fMark = 0;
}
void If_CutTraverseTest( If_Man_t * p, If_Obj_t * pRoot, If_Cut_t * pCut )
{
Vec_Ptr_t * vNodes;
vNodes = Vec_PtrAlloc( 1000 );
If_CutTraverse( p, pRoot, pCut, vNodes );
//if ( Vec_PtrSize(vNodes) > 30 )
//printf( "%d ", Vec_PtrSize(vNodes) );
Vec_PtrFree( vNodes );
}
////////////////////////////////////////////////////////////////////////
/// END OF FILE ///
////////////////////////////////////////////////////////////////////////
......
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