120 int pLits[4], RetValue, VarF, VarI, VarT, VarE, fCompT, fCompE;
122 assert( !Gia_IsComplement( pNode ) );
127 VarF = CecG_ObjSatNum(
p,pNode);
128 VarI = CecG_ObjSatNum(
p,pNodeI);
129 VarT = CecG_ObjSatNum(
p,Gia_Regular(pNodeT));
130 VarE = CecG_ObjSatNum(
p,Gia_Regular(pNodeE));
132 fCompT = Gia_IsComplement(pNodeT);
133 fCompE = Gia_IsComplement(pNodeE);
143 pLits[0] = toLitCond(VarI, 1);
144 pLits[1] = toLitCond(VarT, 1^fCompT);
145 pLits[2] = toLitCond(VarF, 0);
146 if (
p->pPars->fPolarFlip )
148 if ( pNodeI->
fPhase ) pLits[0] = lit_neg( pLits[0] );
149 if ( Gia_Regular(pNodeT)->fPhase ) pLits[1] = lit_neg( pLits[1] );
150 if ( pNode->
fPhase ) pLits[2] = lit_neg( pLits[2] );
154 pLits[0] = toLitCond(VarI, 1);
155 pLits[1] = toLitCond(VarT, 0^fCompT);
156 pLits[2] = toLitCond(VarF, 1);
157 if (
p->pPars->fPolarFlip )
159 if ( pNodeI->
fPhase ) pLits[0] = lit_neg( pLits[0] );
160 if ( Gia_Regular(pNodeT)->fPhase ) pLits[1] = lit_neg( pLits[1] );
161 if ( pNode->
fPhase ) pLits[2] = lit_neg( pLits[2] );
165 pLits[0] = toLitCond(VarI, 0);
166 pLits[1] = toLitCond(VarE, 1^fCompE);
167 pLits[2] = toLitCond(VarF, 0);
168 if (
p->pPars->fPolarFlip )
170 if ( pNodeI->
fPhase ) pLits[0] = lit_neg( pLits[0] );
171 if ( Gia_Regular(pNodeE)->fPhase ) pLits[1] = lit_neg( pLits[1] );
172 if ( pNode->
fPhase ) pLits[2] = lit_neg( pLits[2] );
176 pLits[0] = toLitCond(VarI, 0);
177 pLits[1] = toLitCond(VarE, 0^fCompE);
178 pLits[2] = toLitCond(VarF, 1);
179 if (
p->pPars->fPolarFlip )
181 if ( pNodeI->
fPhase ) pLits[0] = lit_neg( pLits[0] );
182 if ( Gia_Regular(pNodeE)->fPhase ) pLits[1] = lit_neg( pLits[1] );
183 if ( pNode->
fPhase ) pLits[2] = lit_neg( pLits[2] );
201 pLits[0] = toLitCond(VarT, 0^fCompT);
202 pLits[1] = toLitCond(VarE, 0^fCompE);
203 pLits[2] = toLitCond(VarF, 1);
204 if (
p->pPars->fPolarFlip )
206 if ( Gia_Regular(pNodeT)->fPhase ) pLits[0] = lit_neg( pLits[0] );
207 if ( Gia_Regular(pNodeE)->fPhase ) pLits[1] = lit_neg( pLits[1] );
208 if ( pNode->
fPhase ) pLits[2] = lit_neg( pLits[2] );
212 pLits[0] = toLitCond(VarT, 1^fCompT);
213 pLits[1] = toLitCond(VarE, 1^fCompE);
214 pLits[2] = toLitCond(VarF, 0);
215 if (
p->pPars->fPolarFlip )
217 if ( Gia_Regular(pNodeT)->fPhase ) pLits[0] = lit_neg( pLits[0] );
218 if ( Gia_Regular(pNodeE)->fPhase ) pLits[1] = lit_neg( pLits[1] );
219 if ( pNode->
fPhase ) pLits[2] = lit_neg( pLits[2] );
239 int * pLits, nLits, RetValue, i;
240 assert( !Gia_IsComplement(pNode) );
241 assert( Gia_ObjIsAnd( pNode ) );
243 nLits = Vec_PtrSize(vSuper) + 1;
249 pLits[0] = toLitCond(CecG_ObjSatNum(
p,Gia_Regular(pFanin)), Gia_IsComplement(pFanin));
250 pLits[1] = toLitCond(CecG_ObjSatNum(
p,pNode), 1);
251 if (
p->pPars->fPolarFlip )
253 if ( Gia_Regular(pFanin)->fPhase ) pLits[0] = lit_neg( pLits[0] );
254 if ( pNode->
fPhase ) pLits[1] = lit_neg( pLits[1] );
262 pLits[i] = toLitCond(CecG_ObjSatNum(
p,Gia_Regular(pFanin)), !Gia_IsComplement(pFanin));
263 if (
p->pPars->fPolarFlip )
265 if ( Gia_Regular(pFanin)->fPhase ) pLits[i] = lit_neg( pLits[i] );
268 pLits[nLits-1] = toLitCond(CecG_ObjSatNum(
p,pNode), 0);
269 if (
p->pPars->fPolarFlip )
271 if ( pNode->
fPhase ) pLits[nLits-1] = lit_neg( pLits[nLits-1] );
292 if ( Gia_IsComplement(pObj) || Gia_ObjIsCi(pObj) ||
293 (!fFirst && Gia_ObjValue(pObj) > 1) ||
296 Vec_PtrPushUnique( vSuper, pObj );
300 Vec_PtrPushUnique( vSuper, Gia_ObjChild0(pObj) );
301 Vec_PtrPushUnique( vSuper, Gia_ObjChild1(pObj) );
368 int i, k, fUseMuxes = 0 ==
p->pPars->SolverType;
370 if ( CecG_ObjSatNum(
p,pObj) )
372 if ( Gia_ObjIsCi(pObj) )
374 Vec_PtrPush(
p->vUsedNodes, pObj );
378 assert( Gia_ObjIsAnd(pObj) );
381 vFrontier = Vec_PtrAlloc( 100 );
387 assert( CecG_ObjSatNum(
p,pNode) );
390 Vec_PtrClear(
p->vFanins );
391 Vec_PtrPushUnique(
p->vFanins, Gia_ObjFanin0( Gia_ObjFanin0(pNode) ) );
392 Vec_PtrPushUnique(
p->vFanins, Gia_ObjFanin0( Gia_ObjFanin1(pNode) ) );
393 Vec_PtrPushUnique(
p->vFanins, Gia_ObjFanin1( Gia_ObjFanin0(pNode) ) );
394 Vec_PtrPushUnique(
p->vFanins, Gia_ObjFanin1( Gia_ObjFanin1(pNode) ) );
405 if(
p->pPars->SolverType < 2 )
408 assert( Vec_PtrSize(
p->vFanins) > 1 );
410 if(
p->pPars->SolverType )
412 int var = CecG_ObjSatNum(
p, pNode );
413 int Lit0 = Abc_Var2Lit( CecG_ObjSatNum(
p, Gia_ObjFanin0(pNode) ), Gia_ObjFaninC0(pNode) );
414 int Lit1 = Abc_Var2Lit( CecG_ObjSatNum(
p, Gia_ObjFanin1(pNode) ), Gia_ObjFaninC1(pNode) );
415 assert(Gia_ObjIsAnd(pNode));
416 if ( (Lit0 > Lit1) ^ Gia_ObjIsXor(pNode) )
417 Lit1 ^= Lit0, Lit0 ^= Lit1, Lit1 ^= Lit0;
420 Vec_PtrFree( vFrontier );
482 int nBTLimit =
p->pPars->nBTLimit;
483 int Lit, RetValue, nConflicts;
486 if ( pObj == Gia_ManConst0(
p->pAig) )
488 if ( pObj == Gia_ManConst1(
p->pAig) )
498 if (
p->pSat == NULL ||
499 (
p->pPars->nSatVarMax &&
501 p->nCallsSince >
p->pPars->nCallsRecycle) )
507 if(
p->pPars->SolverType ){
522 Lit = toLitCond( CecG_ObjSatNum(
p,pObjR), Gia_IsComplement(pObj) );
523 if (
p->pPars->fPolarFlip )
525 if ( pObjR->
fPhase ) Lit = lit_neg( Lit );
535p->timeSatUnsat += Abc_Clock() - clk;
536 Lit = lit_neg( Lit );
544 else if ( RetValue ==
l_True )
546p->timeSatSat += Abc_Clock() - clk;
554p->timeSatUndec += Abc_Clock() - clk;
568 abctime clk = Abc_Clock(), clk2;
570 if( pPars->SolverType )
571 pPars->fPolarFlip = 0;
575 pPat->iStart = Vec_StrSize(pPat->vStorage);
578 pPat->nPatLitsMin = 0;
587 if ( Gia_ObjIsConst0(Gia_ObjFanin0(pObj)) )
589 status = !Gia_ObjFaninC0(pObj);
590 pObj->
fMark0 = (status == 0);
591 pObj->
fMark1 = (status == 1);
594 Bar_ProgressUpdate( pProgress, i,
"SAT..." );
597 pObj->
fMark0 = (status == 0);
598 pObj->
fMark1 = (status == 1);
600 if ( f0Proved && status == 1 )
601 Gia_ManPatchCoDriver( pAig, i, 0 );
621 if ( pPars->fCheckMiter )
624 p->timeTotal = Abc_Clock() - clk;
625 printf(
"Recycles %d\n",
p->nRecycles);
627 if ( pPars->fVerbose )