abc/src/aig/ivy/ivyCut.c
/**Function*************************************************************

  Synopsis    [Evaluate the cost of removing the node from the set of leaves.]

  Description [Returns the number of new leaves that will be brought in.
  Returns large number if the node cannot be removed from the set of leaves.]
               
  SideEffects []

  SeeAlso     []

***********************************************************************/
Function
Synopsis    [Evaluate the cost of removing the node from the set of leaves.]

Description [Returns the number of new leaves that will be brought in.
Returns large number if the node cannot be removed from the set of leaves.]




Function Synopsis [ Evaluate the cost of removing the node from the set of leaves . ] Description [ Returns the number of new leaves that will be brought in . Returns large number if the node cannot be removed from the set of leaves . ]
static inline int Ivy_NodeGetLeafCostOne( Ivy_Man_t * p, int Leaf, Vec_Int_t * vInside )
{
    Ivy_Obj_t * pNode;
    int nLatches, FaninLeaf, Cost;
    assert( Leaf > 0 ); 
    pNode = Ivy_ManObj( p, Ivy_LeafId(Leaf) );
    if ( Ivy_ObjIsPi(pNode) || Ivy_ObjIsConst1(pNode) )
        return 999;
    nLatches = Ivy_LeafLat(Leaf) + Ivy_ObjIsLatch(pNode);
    if ( nLatches > 15 )
        return 999;
    FaninLeaf = Ivy_LeafCreate( Ivy_ObjFaninId0(pNode), nLatches );
    Cost = FaninLeaf && (Vec_IntFind(vInside, FaninLeaf) == -1);
    if ( Ivy_ObjIsLatch(pNode) || Ivy_ObjIsBuf(pNode) )
        return Cost;
    assert( Ivy_ObjIsNode(pNode) );
    FaninLeaf = Ivy_LeafCreate( Ivy_ObjFaninId1(pNode), nLatches );
    Cost += FaninLeaf && (Vec_IntFind(vInside, FaninLeaf) == -1);
    return Cost;
}
static inline int Ivy_NodeGetLeafCostOne ( Ivy_Man_t * p , int Leaf , Vec_Int_t * vInside ) { Ivy_Obj_t * pNode ; int nLatches , FaninLeaf , Cost ; assert ( Leaf > 0 ) ; pNode = Ivy_ManObj ( p , Ivy_LeafId ( Leaf ) ) ; if ( Ivy_ObjIsPi ( pNode ) || Ivy_ObjIsConst1 ( pNode ) ) return 999 ; nLatches = Ivy_LeafLat ( Leaf ) + Ivy_ObjIsLatch ( pNode ) ; if ( nLatches > 15 ) return 999 ; FaninLeaf = Ivy_LeafCreate ( Ivy_ObjFaninId0 ( pNode ) , nLatches ) ; Cost = FaninLeaf && ( Vec_IntFind ( vInside , FaninLeaf ) == -1 ) ; if ( Ivy_ObjIsLatch ( pNode ) || Ivy_ObjIsBuf ( pNode ) ) return Cost ; assert ( Ivy_ObjIsNode ( pNode ) ) ; FaninLeaf = Ivy_LeafCreate ( Ivy_ObjFaninId1 ( pNode ) , nLatches ) ; Cost += FaninLeaf && ( Vec_IntFind ( vInside , FaninLeaf ) == -1 ) ; return Cost ; }
Function
Synopsis    [Evaluate the cost of removing the node from the set of leaves.]
Function Synopsis [ Evaluate the cost of removing the node from the set of leaves . ]
// make sure leaf is not a contant node // get the node // cannot expand over the PI node // get the number of latches // get the first fanin // quit if this is the one fanin node // get the second fanin