/**Function************************************************************* Synopsis [Collects nodes in the DFS order.] Description [] SideEffects [] SeeAlso [] ***********************************************************************/ void Ivy_ManDfs_rec( Ivy_Man_t * p, Ivy_Obj_t * pObj, Vec_Int_t * vNodes ) { if ( Ivy_ObjIsMarkA(pObj) ) return; Ivy_ObjSetMarkA(pObj); if ( Ivy_ObjIsConst1(pObj) || Ivy_ObjIsCi(pObj) ) { if ( p->pHaig == NULL && pObj->pEquiv ) Ivy_ManDfs_rec( p, Ivy_Regular(pObj->pEquiv), vNodes ); return; } //printf( "visiting node %d\n", pObj->Id ); /* if ( pObj->Id == 87 || pObj->Id == 90 ) { int y = 0; } */ assert( Ivy_ObjIsBuf(pObj) || Ivy_ObjIsAnd(pObj) || Ivy_ObjIsExor(pObj) ); Ivy_ManDfs_rec( p, Ivy_ObjFanin0(pObj), vNodes ); if ( !Ivy_ObjIsBuf(pObj) ) Ivy_ManDfs_rec( p, Ivy_ObjFanin1(pObj), vNodes ); if ( p->pHaig == NULL && pObj->pEquiv ) Ivy_ManDfs_rec( p, Ivy_Regular(pObj->pEquiv), vNodes ); Vec_IntPush( vNodes, pObj->Id ); //printf( "adding node %d with fanins %d and %d and equiv %d (refs = %d)\n", // pObj->Id, Ivy_ObjFanin0(pObj)->Id, Ivy_ObjFanin1(pObj)->Id, // pObj->pEquiv? Ivy_Regular(pObj->pEquiv)->Id: -1, Ivy_ObjRefs(pObj) ); }
// procedure to detect an EXOR gate static inline int Ivy_ObjIsExorType( Ivy_Obj_t * p0, Ivy_Obj_t * p1, Ivy_Obj_t ** ppFan0, Ivy_Obj_t ** ppFan1 ) { if ( !Ivy_IsComplement(p0) || !Ivy_IsComplement(p1) ) return 0; p0 = Ivy_Regular(p0); p1 = Ivy_Regular(p1); if ( !Ivy_ObjIsAnd(p0) || !Ivy_ObjIsAnd(p1) ) return 0; if ( Ivy_ObjFanin0(p0) != Ivy_ObjFanin0(p1) || Ivy_ObjFanin1(p0) != Ivy_ObjFanin1(p1) ) return 0; if ( Ivy_ObjFaninC0(p0) == Ivy_ObjFaninC0(p1) || Ivy_ObjFaninC1(p0) == Ivy_ObjFaninC1(p1) ) return 0; *ppFan0 = Ivy_ObjChild0(p0); *ppFan1 = Ivy_ObjChild1(p0); return 1; }
/**Function************************************************************* Synopsis [Computes truth table of the cut.] Description [] SideEffects [] SeeAlso [] ***********************************************************************/ void Ivy_ManCollectCut_rec( Ivy_Man_t * p, Ivy_Obj_t * pNode, Vec_Int_t * vNodes ) { if ( pNode->fMarkA ) return; pNode->fMarkA = 1; assert( Ivy_ObjIsAnd(pNode) || Ivy_ObjIsExor(pNode) ); Ivy_ManCollectCut_rec( p, Ivy_ObjFanin0(pNode), vNodes ); Ivy_ManCollectCut_rec( p, Ivy_ObjFanin1(pNode), vNodes ); Vec_IntPush( vNodes, pNode->Id ); }
ABC_NAMESPACE_IMPL_START //////////////////////////////////////////////////////////////////////// /// DECLARATIONS /// //////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////// /// FUNCTION DEFINITIONS /// //////////////////////////////////////////////////////////////////////// /**Function************************************************************* Synopsis [Collects nodes in the DFS order.] Description [] SideEffects [] SeeAlso [] ***********************************************************************/ void Ivy_ManDfs_rec( Ivy_Man_t * p, Ivy_Obj_t * pObj, Vec_Int_t * vNodes ) { if ( Ivy_ObjIsMarkA(pObj) ) return; Ivy_ObjSetMarkA(pObj); if ( Ivy_ObjIsConst1(pObj) || Ivy_ObjIsCi(pObj) ) { if ( p->pHaig == NULL && pObj->pEquiv ) Ivy_ManDfs_rec( p, Ivy_Regular(pObj->pEquiv), vNodes ); return; } //printf( "visiting node %d\n", pObj->Id ); /* if ( pObj->Id == 87 || pObj->Id == 90 ) { int y = 0; } */ assert( Ivy_ObjIsBuf(pObj) || Ivy_ObjIsAnd(pObj) || Ivy_ObjIsExor(pObj) ); Ivy_ManDfs_rec( p, Ivy_ObjFanin0(pObj), vNodes ); if ( !Ivy_ObjIsBuf(pObj) ) Ivy_ManDfs_rec( p, Ivy_ObjFanin1(pObj), vNodes ); if ( p->pHaig == NULL && pObj->pEquiv ) Ivy_ManDfs_rec( p, Ivy_Regular(pObj->pEquiv), vNodes ); Vec_IntPush( vNodes, pObj->Id ); //printf( "adding node %d with fanins %d and %d and equiv %d (refs = %d)\n", // pObj->Id, Ivy_ObjFanin0(pObj)->Id, Ivy_ObjFanin1(pObj)->Id, // pObj->pEquiv? Ivy_Regular(pObj->pEquiv)->Id: -1, Ivy_ObjRefs(pObj) ); }