/**Function************************************************************* Synopsis [Duplicates while ORing the POs of sequential circuit.] Description [] SideEffects [] SeeAlso [] ***********************************************************************/ Aig_Man_t * Saig_ManCreateEquivMiter( Aig_Man_t * pAig, Vec_Int_t * vPairs ) { Aig_Man_t * pAigNew; Aig_Obj_t * pObj, * pObj2, * pMiter; int i; if ( pAig->nConstrs > 0 ) { printf( "The AIG manager should have no constraints.\n" ); return NULL; } // start the new manager pAigNew = Aig_ManStart( Aig_ManNodeNum(pAig) ); pAigNew->pName = Aig_UtilStrsav( pAig->pName ); pAigNew->nConstrs = pAig->nConstrs; // map the constant node Aig_ManConst1(pAig)->pData = Aig_ManConst1( pAigNew ); // create variables for PIs Aig_ManForEachPi( pAig, pObj, i ) pObj->pData = Aig_ObjCreatePi( pAigNew ); // add internal nodes of this frame Aig_ManForEachNode( pAig, pObj, i ) pObj->pData = Aig_And( pAigNew, Aig_ObjChild0Copy(pObj), Aig_ObjChild1Copy(pObj) ); // create POs assert( Vec_IntSize(vPairs) % 2 == 0 ); Aig_ManForEachNodeVec( pAig, vPairs, pObj, i ) { pObj2 = Aig_ManObj( pAig, Vec_IntEntry(vPairs, ++i) ); pMiter = Aig_Exor( pAigNew, (Aig_Obj_t *)pObj->pData, (Aig_Obj_t *)pObj2->pData ); pMiter = Aig_NotCond( pMiter, pObj->fPhase ^ pObj2->fPhase ); Aig_ObjCreatePo( pAigNew, pMiter ); }
/**Function************************************************************* Synopsis [Computes the care set of the node under ODCs.] Description [] SideEffects [] SeeAlso [] ***********************************************************************/ Aig_Obj_t * Abc_NtkConstructAig_rec( Mfs_Man_t * p, Abc_Obj_t * pNode, Aig_Man_t * pMan ) { Aig_Obj_t * pRoot, * pExor; Abc_Obj_t * pObj; int i; // assign AIG nodes to the leaves Vec_PtrForEachEntry( Abc_Obj_t *, p->vSupp, pObj, i ) pObj->pCopy = pObj->pNext = (Abc_Obj_t *)Aig_ObjCreatePi( pMan ); // strash intermediate nodes Abc_NtkIncrementTravId( pNode->pNtk ); Vec_PtrForEachEntry( Abc_Obj_t *, p->vNodes, pObj, i ) { Abc_MfsConvertHopToAig( pObj, pMan ); if ( pObj == pNode ) pObj->pNext = Abc_ObjNot(pObj->pNext); } // create the observability condition pRoot = Aig_ManConst0(pMan); Vec_PtrForEachEntry( Abc_Obj_t *, p->vRoots, pObj, i ) { pExor = Aig_Exor( pMan, (Aig_Obj_t *)pObj->pCopy, (Aig_Obj_t *)pObj->pNext ); pRoot = Aig_Or( pMan, pRoot, pExor ); } return pRoot; }
/**Function************************************************************* Synopsis [Should be called after each equality check.] Description [Result should be 1 if they are equal.] SideEffects [] SeeAlso [] ***********************************************************************/ void Cudd2_bddEqual( void * pCudd, void * pArg0, void * pArg1, int Result ) { Aig_Obj_t * pNode0, * pNode1, * pNode; pNode0 = Cudd2_GetArg( pArg0 ); pNode1 = Cudd2_GetArg( pArg1 ); pNode = Aig_Exor( s_pCuddMan->pAig, pNode0, pNode1 ); Aig_ObjCreatePo( s_pCuddMan->pAig, pNode ); }
/**Function************************************************************* Synopsis [Performs BDD operation.] Description [] SideEffects [] SeeAlso [] ***********************************************************************/ void Cudd2_bddXor( void * pCudd, void * pArg0, void * pArg1, void * pResult ) { Aig_Obj_t * pNode0, * pNode1, * pNode; pNode0 = Cudd2_GetArg( pArg0 ); pNode1 = Cudd2_GetArg( pArg1 ); pNode = Aig_Exor( s_pCuddMan->pAig, pNode0, pNode1 ); Cudd2_SetArg( pNode, pResult ); }
/**Function************************************************************* Synopsis [Perform one operation.] Description [The argument nodes can be complemented.] SideEffects [] SeeAlso [] ***********************************************************************/ Aig_Obj_t * Aig_Oper( Aig_Man_t * p, Aig_Obj_t * p0, Aig_Obj_t * p1, Aig_Type_t Type ) { if ( Type == AIG_OBJ_AND ) return Aig_And( p, p0, p1 ); if ( Type == AIG_OBJ_EXOR ) return Aig_Exor( p, p0, p1 ); assert( 0 ); return NULL; }
/**Function************************************************************* Synopsis [Creates AND function with nVars inputs.] Description [] SideEffects [] SeeAlso [] ***********************************************************************/ Aig_Obj_t * Aig_CreateExor( Aig_Man_t * p, int nVars ) { Aig_Obj_t * pFunc; int i; pFunc = Aig_ManConst0( p ); for ( i = 0; i < nVars; i++ ) pFunc = Aig_Exor( p, pFunc, Aig_IthVar(p, i) ); return pFunc; }
/**Function************************************************************* Synopsis [Implements the miter.] Description [] SideEffects [] SeeAlso [] ***********************************************************************/ Aig_Obj_t * Aig_MiterTwo( Aig_Man_t * p, Vec_Ptr_t * vNodes1, Vec_Ptr_t * vNodes2 ) { int i; assert( vNodes1->nSize > 0 && vNodes1->nSize > 0 ); assert( vNodes1->nSize == vNodes2->nSize ); for ( i = 0; i < vNodes1->nSize; i++ ) vNodes1->pArray[i] = Aig_Not( Aig_Exor( p, vNodes1->pArray[i], vNodes2->pArray[i] ) ); return Aig_Not( Aig_Multi_rec( p, (Aig_Obj_t **)vNodes1->pArray, vNodes1->nSize, AIG_OBJ_AND ) ); }
/**Function************************************************************* Synopsis [Implements the miter.] Description [] SideEffects [] SeeAlso [] ***********************************************************************/ Aig_Obj_t * Aig_Miter( Aig_Man_t * p, Vec_Ptr_t * vPairs ) { int i; assert( vPairs->nSize > 0 ); assert( vPairs->nSize % 2 == 0 ); for ( i = 0; i < vPairs->nSize; i += 2 ) vPairs->pArray[i/2] = Aig_Not( Aig_Exor( p, vPairs->pArray[i], vPairs->pArray[i+1] ) ); vPairs->nSize = vPairs->nSize/2; return Aig_Not( Aig_Multi_rec( p, (Aig_Obj_t **)vPairs->pArray, vPairs->nSize, AIG_OBJ_AND ) ); }