/**Function************************************************************* Synopsis [Counts the number of EXOR type nodes.] Description [] SideEffects [] SeeAlso [] ***********************************************************************/ int Fraig_ManCountExors( Fraig_Man_t * pMan ) { int i, nExors; nExors = 0; for ( i = 0; i < pMan->vNodes->nSize; i++ ) nExors += Fraig_NodeIsExorType( pMan->vNodes->pArray[i] ); return nExors; }
/**Function************************************************************* Synopsis [Returns 1 if the node is EXOR, 0 if it is NEXOR.] Description [The node should be EXOR type and not complemented.] SideEffects [] SeeAlso [] ***********************************************************************/ int Fraig_NodeIsExor( Fraig_Node_t * pNode ) { Fraig_Node_t * pNode1; assert( !Fraig_IsComplement(pNode) ); assert( Fraig_NodeIsExorType(pNode) ); assert( Fraig_IsComplement(pNode->p1) ); // get children pNode1 = Fraig_Regular(pNode->p1); return Fraig_IsComplement(pNode1->p1) == Fraig_IsComplement(pNode1->p2); }
/**Function************************************************************* Synopsis [Adds clauses to the solver.] Description [] SideEffects [] SeeAlso [] ***********************************************************************/ void Fraig_SupergateAddClausesExor( Fraig_Man_t * p, Fraig_Node_t * pNode ) { Fraig_Node_t * pNode1, * pNode2; int fComp, RetValue; assert( !Fraig_IsComplement( pNode ) ); assert( Fraig_NodeIsExorType( pNode ) ); // get nodes pNode1 = Fraig_Regular(Fraig_Regular(pNode->p1)->p1); pNode2 = Fraig_Regular(Fraig_Regular(pNode->p1)->p2); // get the complemented attribute of the EXOR/NEXOR gate fComp = Fraig_NodeIsExor( pNode ); // 1 if EXOR, 0 if NEXOR // create four clauses Msat_IntVecClear( p->vProj ); Msat_IntVecPush( p->vProj, MSAT_VAR2LIT(pNode->Num, fComp) ); Msat_IntVecPush( p->vProj, MSAT_VAR2LIT(pNode1->Num, fComp) ); Msat_IntVecPush( p->vProj, MSAT_VAR2LIT(pNode2->Num, fComp) ); RetValue = Msat_SolverAddClause( p->pSat, p->vProj ); assert( RetValue ); Msat_IntVecClear( p->vProj ); Msat_IntVecPush( p->vProj, MSAT_VAR2LIT(pNode->Num, fComp) ); Msat_IntVecPush( p->vProj, MSAT_VAR2LIT(pNode1->Num, !fComp) ); Msat_IntVecPush( p->vProj, MSAT_VAR2LIT(pNode2->Num, !fComp) ); RetValue = Msat_SolverAddClause( p->pSat, p->vProj ); assert( RetValue ); Msat_IntVecClear( p->vProj ); Msat_IntVecPush( p->vProj, MSAT_VAR2LIT(pNode->Num, !fComp) ); Msat_IntVecPush( p->vProj, MSAT_VAR2LIT(pNode1->Num, fComp) ); Msat_IntVecPush( p->vProj, MSAT_VAR2LIT(pNode2->Num, !fComp) ); RetValue = Msat_SolverAddClause( p->pSat, p->vProj ); assert( RetValue ); Msat_IntVecClear( p->vProj ); Msat_IntVecPush( p->vProj, MSAT_VAR2LIT(pNode->Num, !fComp) ); Msat_IntVecPush( p->vProj, MSAT_VAR2LIT(pNode1->Num, !fComp) ); Msat_IntVecPush( p->vProj, MSAT_VAR2LIT(pNode2->Num, fComp) ); RetValue = Msat_SolverAddClause( p->pSat, p->vProj ); assert( RetValue ); }