48 Vec_IntFreeP( &
p->vIdsOrig );
49 p->vIdsOrig = Vec_IntStartNatural( Gia_ManObjNum(
p) );
53 Vec_IntFreeP( &
p->vIdsOrig );
54 p->vIdsOrig = Vec_IntStartFull( Gia_ManObjNum(
p) );
59 if (
p->vIdsOrig == NULL )
62 Vec_IntWriteEntry( pNew->
vIdsOrig, 0, 0 );
64 if ( ~pObj->
Value && Abc_Lit2Var(pObj->
Value) && Vec_IntEntry(
p->vIdsOrig, i) != -1 && Vec_IntEntry(pNew->
vIdsOrig, Abc_Lit2Var(pObj->
Value)) == -1 )
65 Vec_IntWriteEntry( pNew->
vIdsOrig, Abc_Lit2Var(pObj->
Value), Vec_IntEntry(
p->vIdsOrig, i) );
73 int Smo = One < Two ? One : Two;
74 int Big = One < Two ? Two : One;
76 if ( Vec_IntEntry(vMap, Big) == -1 )
77 Vec_IntWriteEntry( vMap, Big, Smo );
83 if ( Vec_IntEntry(vMap, One) == -1 )
93 vMap2Smaller = Vec_IntStartFull( nObjs );
97 vMapResult = Vec_IntStartFull( nObjs );
101 Vec_IntFree( vMap2Smaller );
113 pNew->
pSpec = Abc_UtilStrsav(
p->pSpec );
114 pNew->
pName = Abc_UtilStrsav(
p->pName );
116 Gia_ManConst0(
p)->Value = 0;
118 pObj->
Value = Gia_ManAppendCi(pNew);
122 if ( Vec_IntEntry(vMap, i) == -1 )
126 pRepr = Gia_ManObj(
p, Vec_IntEntry(vMap, i) );
132 pObj->
Value = Gia_ManAppendCo( pNew, Gia_ObjFanin0Copy(pObj) );
137 for ( i = 0; i < Gia_ManObjNum(
p); i++ )
142 int iRepr = Abc_Lit2Var(pObj->
Value);
145 Gia_ObjSetRepr(
p, i, 0 );
148 pRepr = Gia_ManObj( pNew, iRepr );
149 if ( !~pRepr->
Value )
155 Gia_ObjSetRepr(
p, i, pRepr->
Value );
212 if ( pObj->
Value == 0 )
215 assert( Gia_ObjIsAnd(pObj) );
220 pRepr =
p->pReprs ? Gia_ObjReprObj(
p, Gia_ObjId(
p,pObj) ) : NULL;
221 return pRepr == NULL || pRepr->
Value == 0;
241 Gia_ManConst0(
p)->Value = 0;
262 unsigned * pNexts, * pTails;
267 pTails =
ABC_ALLOC(
unsigned, Gia_ManObjNum(
p) );
268 for ( i = 0; i < Gia_ManObjNum(
p); i++ )
270 for ( i = 0; i < Gia_ManObjNum(
p); i++ )
273 if ( !
p->pReprs[i].iRepr ||
p->pReprs[i].iRepr ==
GIA_VOID )
275 pNexts[ pTails[
p->pReprs[i].iRepr] ] = i;
276 pTails[
p->pReprs[i].iRepr] = i;
279 return (
int *)pNexts;
299 for ( i = 0; i < Gia_ManObjNum(
p); i++ )
301 for ( i = 0; i < Gia_ManObjNum(
p); i++ )
303 if (
p->pNexts[i] == 0 )
308 for ( iObj =
p->pNexts[i]; iObj; iObj =
p->pNexts[iObj] )
309 p->pReprs[iObj].iRepr = i;
331 for ( i = 0; i < Gia_ManObjNum(
p); i++ )
333 for ( i = 0; i < Gia_ManObjNum(
p); i++ )
335 if (
p->pSibls[i] == 0 )
339 for ( iObj =
p->pSibls[i]; iObj; iObj =
p->pSibls[iObj] )
340 p->pReprs[iObj].iRepr = i;
360 for ( i = 0; i < Gia_ManObjNum(
p); i++ )
361 nLits += (Gia_ObjRepr(
p, i) !=
GIA_VOID);
379 if (
p->pReprs == NULL )
381 for ( i = 1; i < Gia_ManObjNum(
p); i++ )
382 Counter += Gia_ObjIsHead(
p, i);
400 if ( nLitsReal != nLits )
401 Abc_Print( 1,
"Detected a mismatch in counting equivalence classes (%d).\n", nLitsReal - nLits );
418 int i, Counter = 0, Counter0 = 0, CounterX = 0, Proved = 0, nLits;
419 for ( i = 1; i < Gia_ManObjNum(
p); i++ )
421 if ( Gia_ObjIsHead(
p, i) )
423 else if ( Gia_ObjIsConst(
p, i) )
425 else if ( Gia_ObjIsNone(
p, i) )
427 if ( Gia_ObjProved(
p, i) )
430 CounterX -= Gia_ManCoNum(
p);
431 nLits = Gia_ManCiNum(
p) + Gia_ManAndNum(
p) - Counter - CounterX;
436 Abc_Print( 1,
"cst =%3d cls =%6d lit =%8d\n", Counter0, Counter, nLits );
452 int i, Counter = 0, Counter0 = 0, CounterX = 0;
453 if (
p->pReprs == NULL ||
p->pNexts == NULL )
455 for ( i = 1; i < Gia_ManObjNum(
p); i++ )
457 if ( Gia_ObjIsHead(
p, i) )
459 else if ( Gia_ObjIsConst(
p, i) )
461 else if ( Gia_ObjIsNone(
p, i) )
464 CounterX -= Gia_ManCoNum(
p);
465 return Gia_ManCiNum(
p) + Gia_ManAndNum(
p) - Counter - CounterX;
484 assert( Gia_ObjRepr(
p, Ent) == i );
495 Abc_Print( 1,
" %d", Ent );
496 if (
p->pReprs[Ent].fColorA ||
p->pReprs[Ent].fColorB )
497 Abc_Print( 1,
" <%d%d>",
p->pReprs[Ent].fColorA,
p->pReprs[Ent].fColorB );
499 Abc_Print( 1,
" }\n" );
503 int i, Counter = 0, Counter0 = 0, CounterX = 0, Proved = 0, nLits;
504 for ( i = 1; i < Gia_ManObjNum(
p); i++ )
506 if ( Gia_ObjIsHead(
p, i) )
508 else if ( Gia_ObjIsConst(
p, i) )
510 else if ( Gia_ObjIsNone(
p, i) )
512 if ( Gia_ObjProved(
p, i) )
515 CounterX -= Gia_ManCoNum(
p);
516 nLits = Gia_ManCiNum(
p) + Gia_ManAndNum(
p) - Counter - CounterX;
519 Abc_Print( 1,
"cst =%8d cls =%7d lit =%8d unused =%8d proof =%6d\n",
520 Counter0, Counter, nLits, CounterX, Proved );
525 Abc_Print( 1,
"Const0 (%d) = ", Counter0 );
527 Abc_Print( 1,
"%d ", i );
528 Abc_Print( 1,
"\n" );
562 int Level0, Level1, LevelMax;
564 if ( Gia_ObjIsCi(pPivot) || iPivot == 0 )
566 if ( Gia_ObjLevel(
p, pPivot) )
567 return Gia_ObjLevel(
p, pPivot);
568 if ( fDiveIn && Gia_ObjIsClass(
p, iPivot) )
570 int iObj, ObjMin = -1, iRepr = Gia_ObjRepr(
p, iPivot), LevMin =
ABC_INFINITY;
574 if ( LevMin > LevCur )
581 Vec_IntWriteEntry( vMap, iRepr, ObjMin );
583 Gia_ObjSetLevelId(
p, iObj, LevMin );
586 assert( Gia_ObjIsAnd(pPivot) );
589 LevelMax = 1 + Abc_MaxInt(Level0, Level1);
590 Gia_ObjSetLevel(
p, pPivot, LevelMax );
595 Vec_Int_t * vMap = Vec_IntStartFull( Gia_ManObjNum(
p) );
597 int i, LevelCur, LevelMax = 0;
603 LevelMax = Abc_MaxInt(LevelMax, LevelCur);
624 if ( Gia_ObjRepr(
p, Gia_ObjId(
p,pObj)) ==
GIA_VOID )
629 if ( !Gia_ObjProved(
p, Gia_ObjId(
p,pObj)) )
633 if ( fDualOut && !Gia_ObjDiffColors2(
p, Gia_ObjId(
p, pObj), Gia_ObjRepr(
p, Gia_ObjId(
p,pObj)) ) )
635 return Gia_ManObj(
p, Gia_ObjRepr(
p, Gia_ObjId(
p,pObj)) );
652 if ( (pRepr = Gia_ManEquivRepr(
p, pObj, fUseAll, fDualOut)) )
655 pObj->
Value = Abc_LitNotCond( pRepr->
Value, Gia_ObjPhaseReal(pRepr) ^ Gia_ObjPhaseReal(pObj) );
660 assert( Gia_ObjIsAnd(pObj) );
682 if ( !
p->pReprs &&
p->pSibls )
686 for ( i = 0; i < Gia_ManObjNum(
p); i++ )
688 for ( i = 0; i < Gia_ManObjNum(
p); i++ )
689 if (
p->pSibls[i] > 0 )
691 if ( pMap[
p->pSibls[i]] == -1 )
692 pMap[
p->pSibls[i]] =
p->pSibls[i];
693 pMap[i] = pMap[
p->pSibls[i]];
695 for ( i = 0; i < Gia_ManObjNum(
p); i++ )
696 if (
p->pSibls[i] > 0 )
697 Gia_ObjSetRepr(
p, i, pMap[i] );
705 Abc_Print( 1,
"Gia_ManEquivReduce(): Equivalence classes are not available.\n" );
708 if ( fDualOut && (Gia_ManPoNum(
p) & 1) )
710 Abc_Print( 1,
"Gia_ManEquivReduce(): Dual-output miter should have even number of POs.\n" );
715 if ( Gia_ObjReprObj(
p, i) != NULL )
717 if ( i == Gia_ManObjNum(
p) )
735 pNew->
pName = Abc_UtilStrsav(
p->pName );
736 pNew->
pSpec = Abc_UtilStrsav(
p->pSpec );
738 Gia_ManConst0(
p)->Value = 0;
740 pObj->
Value = Gia_ManAppendCi(pNew);
745 pObj->
Value = Gia_ManAppendCo( pNew, Gia_ObjFanin0Copy(pObj) );
764 int iTemp, Rand, Count = 0;
767 Rand = rand() % Count;
770 if ( Count++ == Rand )
772 return Gia_ManObj(
p, iTemp);
791 assert( Gia_ObjIsAnd(pObj) );
792 if ( fDiveIn && (pRepr = Gia_ManEquivRepr(
p, pObj, 1, 0)) )
794 int iTemp, iRepr = Gia_ObjId(
p, pRepr);
800 pTemp->
Value = Abc_LitNotCond( pRepr2->
Value, Gia_ObjPhaseReal(pRepr2) ^ Gia_ObjPhaseReal(pTemp) );
817 if ( fRandom ) srand(time(NULL));
818 if ( !
p->pReprs &&
p->pSibls )
822 for ( i = 0; i < Gia_ManObjNum(
p); i++ )
824 for ( i = 0; i < Gia_ManObjNum(
p); i++ )
825 if (
p->pSibls[i] > 0 )
827 if ( pMap[
p->pSibls[i]] == -1 )
828 pMap[
p->pSibls[i]] =
p->pSibls[i];
829 pMap[i] = pMap[
p->pSibls[i]];
831 for ( i = 0; i < Gia_ManObjNum(
p); i++ )
832 if (
p->pSibls[i] > 0 )
833 Gia_ObjSetRepr(
p, i, pMap[i] );
841 Abc_Print( 1,
"Gia_ManEquivReduce(): Equivalence classes are not available.\n" );
846 if ( Gia_ObjReprObj(
p, i) != NULL )
848 if ( i == Gia_ManObjNum(
p) )
853 pNew->
pName = Abc_UtilStrsav(
p->pName );
854 pNew->
pSpec = Abc_UtilStrsav(
p->pSpec );
856 Gia_ManConst0(
p)->Value = 0;
858 pObj->
Value = Gia_ManAppendCi(pNew);
863 pObj->
Value = Gia_ManAppendCo( pNew, Gia_ObjFanin0Copy(pObj) );
866 Vec_IntFreeP( &vMap );
886 assert( (Gia_ManPoNum(
p) & 1) == 0 );
889 pObj1 = Gia_ManPo(
p, ++i );
890 if ( Gia_ObjChild0(pObj0) != Gia_ObjChild0(pObj1) )
892 pObj0->
iDiff0 = Gia_ObjId(
p, pObj0);
894 pObj1->
iDiff0 = Gia_ObjId(
p, pObj1);
918 pObjNew = Gia_ManObj( pNew, Abc_Lit2Var(pObj->
Value) );
939 int i, k, iNode, iRepr, iPrev;
942 for ( i = 0; i < Gia_ManObjNum(pFinal); i++ )
943 Gia_ObjSetRepr( pFinal, i,
GIA_VOID );
947 pObj = Gia_ManObj(
p, i );
950 pObjNew = Gia_ManObj( pNew, Abc_Lit2Var(pObj->
Value) );
951 if ( Abc_Lit2Var(pObjNew->
Value) == 0 )
953 Gia_ObjSetRepr( pFinal, Abc_Lit2Var(pObjNew->
Value), 0 );
956 vClass = Vec_IntAlloc( 100 );
959 Vec_IntClear( vClass );
962 pObj = Gia_ManObj(
p, k );
965 pObjNew = Gia_ManObj( pNew, Abc_Lit2Var(pObj->
Value) );
966 Vec_IntPushUnique( vClass, Abc_Lit2Var(pObjNew->
Value) );
968 if ( Vec_IntSize( vClass ) < 2 )
970 Vec_IntSort( vClass, 0 );
971 iRepr = iPrev = Vec_IntEntry( vClass, 0 );
974 Gia_ObjSetRepr( pFinal, iNode, iRepr );
979 Vec_IntFree( vClass );
998 int i, k, iNode, iRepr, iPrev;
1002 for ( i = 0; i < Gia_ManObjNum(pNew); i++ )
1003 Gia_ObjSetRepr( pNew, i,
GIA_VOID );
1006 Gia_ObjSetRepr( pNew, Abc_Lit2Var(Gia_ManObj(
p, i)->Value), 0 );
1008 vClass = Vec_IntAlloc( 100 );
1011 Vec_IntClear( vClass );
1013 Vec_IntPushUnique( vClass, Abc_Lit2Var(Gia_ManObj(
p, k)->Value) );
1014 assert( Vec_IntSize( vClass ) > 1 );
1015 Vec_IntSort( vClass, 0 );
1016 iRepr = iPrev = Vec_IntEntry( vClass, 0 );
1019 Gia_ObjSetRepr( pNew, iNode, iRepr );
1024 Vec_IntFree( vClass );
1077 if ( Gia_ObjVisitColor(
p, Gia_ObjId(
p,pObj), fOdds ) )
1079 if ( Gia_ObjIsRo(
p, pObj) )
1081 assert( Gia_ObjIsAnd(pObj) );
1100 int i, nNodes[2], nDiffs[2];
1101 assert( (Gia_ManPoNum(
p) & 1) == 0 );
1102 Gia_ObjSetColors(
p, 0 );
1104 Gia_ObjSetColors(
p, Gia_ObjId(
p,pObj) );
1105 nNodes[0] = nNodes[1] = Gia_ManPiNum(
p);
1111 nDiffs[0] = Gia_ManCandNum(
p) - nNodes[0];
1112 nDiffs[1] = Gia_ManCandNum(
p) - nNodes[1];
1115 Abc_Print( 1,
"CI+AND = %7d A = %7d B = %7d Ad = %7d Bd = %7d AB = %7d.\n",
1116 Gia_ManCandNum(
p), nNodes[0], nNodes[1], nDiffs[0], nDiffs[1],
1117 Gia_ManCandNum(
p) - nDiffs[0] - nDiffs[1] );
1119 return (nDiffs[0] + nDiffs[1]) / 2;
1137 pRepr = Gia_ObjReprObj(
p, Gia_ObjId(
p,pObj) );
1138 if ( pRepr == NULL )
1141 if ( fDualOut && !Gia_ObjDiffColors2(
p, Gia_ObjId(
p, pObj), Gia_ObjId(
p, pRepr) ) )
1143 iLitNew = Abc_LitNotCond( pRepr->
Value, Gia_ObjPhaseReal(pRepr) ^ Gia_ObjPhaseReal(pObj) );
1144 if ( pObj->
Value != iLitNew && !Gia_ObjProved(
p, Gia_ObjId(
p,pObj)) )
1147 Vec_IntPush( vTrace, 1 );
1148 if ( vGuide == NULL || Vec_IntEntry( vGuide, Vec_IntSize(vTrace)-1 ) )
1151 Vec_IntPush( vMap, Gia_ObjId(
p, pObj) );
1158 Vec_IntPush( vTrace, 0 );
1161 pObj->
Value = iLitNew;
1179 assert( Gia_ObjIsAnd(pObj) );
1180 Gia_ManSpecReduce_rec( pNew,
p, Gia_ObjFanin0(pObj), vXorLits, fDualOut, fSpeculate, vTrace, vGuide, vMap );
1181 Gia_ManSpecReduce_rec( pNew,
p, Gia_ObjFanin1(pObj), vXorLits, fDualOut, fSpeculate, vTrace, vGuide, vMap );
1183 Gia_ManSpecBuild( pNew,
p, pObj, vXorLits, fDualOut, fSpeculate, vTrace, vGuide, vMap );
1205 Abc_Print( 1,
"Gia_ManSpecReduce(): Equivalence classes are not available.\n" );
1208 Vec_IntClear( vTrace );
1209 vXorLits = Vec_IntAlloc( 1000 );
1213 pNew->
pName = Abc_UtilStrsav(
p->pName );
1214 pNew->
pSpec = Abc_UtilStrsav(
p->pSpec );
1216 Gia_ManConst0(
p)->Value = 0;
1218 pObj->
Value = Gia_ManAppendCi(pNew);
1220 Gia_ManSpecBuild( pNew,
p, pObj, vXorLits, 0, 1, vTrace, NULL, vMap );
1224 Gia_ManAppendCo( pNew, Gia_ObjFanin0Copy(pObj) );
1226 Gia_ManAppendCo( pNew, iLitNew );
1227 if ( Vec_IntSize(vXorLits) == 0 )
1229 Abc_Print( 1,
"Speculatively reduced model has no primary outputs.\n" );
1230 Gia_ManAppendCo( pNew, 0 );
1233 Gia_ManAppendCo( pNew, Gia_ObjFanin0Copy(pObj) );
1235 Vec_IntFree( vXorLits );
1259 Vec_Int_t * vTrace = NULL, * vGuide = NULL;
1262 Abc_Print( 1,
"Gia_ManSpecReduce(): Equivalence classes are not available.\n" );
1265 if ( fDualOut && (Gia_ManPoNum(
p) & 1) )
1267 Abc_Print( 1,
"Gia_ManSpecReduce(): Dual-output miter should have even number of POs.\n" );
1272 vGuide = Vec_IntAlloc( 100 );
1276 vTrace = Vec_IntAlloc( 100 );
1278 vXorLits = Vec_IntAlloc( 1000 );
1284 pNew->
pName = Abc_UtilStrsav(
p->pName );
1285 pNew->
pSpec = Abc_UtilStrsav(
p->pSpec );
1287 Gia_ManConst0(
p)->Value = 0;
1289 pObj->
Value = Gia_ManAppendCi(pNew);
1291 Gia_ManSpecBuild( pNew,
p, pObj, vXorLits, fDualOut, fSpeculate, vTrace, vGuide, NULL );
1293 Gia_ManSpecReduce_rec( pNew,
p, Gia_ObjFanin0(pObj), vXorLits, fDualOut, fSpeculate, vTrace, vGuide, NULL );
1297 Gia_ManAppendCo( pNew, Gia_ObjFanin0Copy(pObj) );
1300 Gia_ManAppendCo( pNew, iLitNew );
1301 if ( Vec_IntSize(vXorLits) == 0 )
1303 Abc_Print( 1,
"Speculatively reduced model has no primary outputs.\n" );
1304 Gia_ManAppendCo( pNew, 0 );
1307 Gia_ManAppendCo( pNew, Gia_ObjFanin0Copy(pObj) );
1309 Vec_IntFree( vXorLits );
1318 int iLit, nAddPos = 0;
1323 assert( Gia_ManPoNum(pNew) == Gia_ManPoNum(
p) + nAddPos );
1325 Vec_IntFreeP( &vTrace );
1326 Vec_IntFreeP( &vGuide );
1345 pRepr = Gia_ObjReprObj(
p, Gia_ObjId(
p,pObj) );
1346 if ( pRepr == NULL )
1349 if ( fDualOut && !Gia_ObjDiffColors2(
p, Gia_ObjId(
p, pObj), Gia_ObjId(
p, pRepr) ) )
1351 iLitNew = Abc_LitNotCond( Gia_ObjCopyF(
p, f, pRepr), Gia_ObjPhaseReal(pRepr) ^ Gia_ObjPhaseReal(pObj) );
1352 if ( Gia_ObjCopyF(
p, f, pObj) != iLitNew && !Gia_ObjProved(
p, Gia_ObjId(
p,pObj)) )
1353 Vec_IntPush( vXorLits,
Gia_ManHashXor(pNew, Gia_ObjCopyF(
p, f, pObj), iLitNew) );
1354 Gia_ObjSetCopyF(
p, f, pObj, iLitNew );
1370 if ( ~Gia_ObjCopyF(
p, f, pObj) )
1372 assert( Gia_ObjIsAnd(pObj) );
1375 Gia_ObjSetCopyF(
p, f, pObj,
Gia_ManHashAnd(pNew, Gia_ObjFanin0CopyF(
p, f, pObj), Gia_ObjFanin1CopyF(
p, f, pObj)) );
1398 Abc_Print( 1,
"Gia_ManSpecReduceInit(): Equivalence classes are not available.\n" );
1401 if ( Gia_ManRegNum(
p) == 0 )
1403 Abc_Print( 1,
"Gia_ManSpecReduceInit(): Circuit is not sequential.\n" );
1406 if ( Gia_ManRegNum(
p) != pInit->nRegs )
1408 Abc_Print( 1,
"Gia_ManSpecReduceInit(): Mismatch in the number of registers.\n" );
1411 if ( fDualOut && (Gia_ManPoNum(
p) & 1) )
1413 Abc_Print( 1,
"Gia_ManSpecReduceInit(): Dual-output miter should have even number of POs.\n" );
1424 assert( pInit->nRegs == Gia_ManRegNum(
p) && pInit->nPis == 0 );
1425 Vec_IntFill( &
p->vCopies, nFrames * Gia_ManObjNum(
p), -1 );
1426 vXorLits = Vec_IntAlloc( 1000 );
1431 pNew->
pName = Abc_UtilStrsav(
p->pName );
1432 pNew->
pSpec = Abc_UtilStrsav(
p->pSpec );
1435 Gia_ObjSetCopyF(
p, 0, pObj, Abc_InfoHasBit(pInit->pData, i) );
1436 for ( f = 0; f < nFrames; f++ )
1438 Gia_ObjSetCopyF(
p, f, Gia_ManConst0(
p), 0 );
1440 Gia_ObjSetCopyF(
p, f, pObj, Gia_ManAppendCi(pNew) );
1446 Gia_ObjSetCopyF(
p, f, pObj, Gia_ObjFanin0CopyF(
p, f, pObj) );
1448 if ( f == nFrames - 1 )
1451 Gia_ObjSetCopyF(
p, f+1, pObjRo, Gia_ObjCopyF(
p, f, pObjRi) );
1454 Gia_ManAppendCo( pNew, iLitNew );
1455 if ( Vec_IntSize(vXorLits) == 0 )
1458 Gia_ManAppendCo( pNew, 0 );
1460 Vec_IntErase( &
p->vCopies );
1461 Vec_IntFree( vXorLits );
1485 for ( f = 1; ; f++ )
1488 if ( (nMinOutputs == 0 && Gia_ManPoNum(pFrames) >= nLits/2+1) ||
1489 (nMinOutputs != 0 && Gia_ManPoNum(pFrames) >= nMinOutputs) )
1491 if ( f == nFramesMax )
1493 if ( Gia_ManAndNum(pFrames) > 500000 )
1501 if ( f == nFramesMax )
1502 Abc_Print( 1,
"Stopped unrolling after %d frames.\n", nFramesMax );
1523 int iRepr, iNode, Ent, k;
1524 int nRemovedLits = 0, nRemovedClas = 0;
1525 int nTotalLits = 0, nTotalClas = 0;
1529 vClass = Vec_IntAlloc( 100 );
1530 vClassNew = Vec_IntAlloc( 100 );
1532 if ( Gia_ObjIsCi(pObj) || Gia_ObjIsAnd(pObj) )
1533 assert( Gia_ObjColors(
p, i) );
1537 Vec_IntClear( vClass );
1538 Vec_IntClear( vClassNew );
1542 Vec_IntPush( vClass, iNode );
1543 assert( Gia_ObjColors(
p, iNode) );
1544 if ( Gia_ObjColors(
p, iNode) != 3 )
1545 Vec_IntPush( vClassNew, iNode );
1551 p->pReprs[Ent].fFailed =
p->pReprs[Ent].fProved = 0;
1555 if ( Vec_IntSize(vClassNew) < 2 )
1562 Vec_IntFree( vClass );
1563 Vec_IntFree( vClassNew );
1565 Abc_Print( 1,
"Removed classes = %6d (out of %6d). Removed literals = %6d (out of %6d).\n",
1566 nRemovedClas, nTotalClas, nRemovedLits, nTotalLits );
1584 int i, iLit, nAddPos, nLits = 0;
1585 int nLitsAll, Counter = 0;
1587 if ( nLitsAll == 0 )
1589 Abc_Print( 1,
"Gia_ManEquivMark(): Current AIG does not have equivalences.\n" );
1594 if ( pMiter == NULL )
1596 Abc_Print( 1,
"Gia_ManEquivMark(): Input file %s could not be read.\n", pFileName );
1601 Vec_Int_t * vTrace = Vec_IntAlloc( 100 );
1604 assert( Vec_IntSize(vTrace) == nLitsAll );
1611 if ( Gia_ManPoNum(pMiter) != Gia_ManPoNum(
p) + nAddPos )
1613 Abc_Print( 1,
"Gia_ManEquivMark(): The number of POs is not correct: MiterPONum(%d) != AIGPONum(%d) + AIGFilteredEquivNum(%d).\n",
1614 Gia_ManPoNum(pMiter), Gia_ManPoNum(
p), nAddPos );
1616 Vec_IntFreeP( &vTrace );
1620 nLits = iLit = Counter = 0;
1621 for ( i = 0; i < Gia_ManObjNum(
p); i++ )
1625 if ( Vec_IntEntry( vTrace, nLits++ ) == 0 )
1627 pObj = Gia_ManPo( pMiter, Gia_ManPoNum(
p) + iLit++ );
1628 if ( Gia_ObjFaninLit0p(pMiter, pObj) == 0 )
1630 Gia_ObjSetProved(
p, i);
1634 assert( nLits == nLitsAll );
1635 assert( iLit == nAddPos );
1636 Vec_IntFreeP( &vTrace );
1640 if ( Gia_ManPoNum(pMiter) != Gia_ManPoNum(
p) + nLitsAll )
1642 Abc_Print( 1,
"Gia_ManEquivMark(): The number of POs is not correct: MiterPONum(%d) != AIGPONum(%d) + AIGEquivNum(%d).\n",
1643 Gia_ManPoNum(pMiter), Gia_ManPoNum(
p), nLitsAll );
1649 for ( i = 0; i < Gia_ManObjNum(
p); i++ )
1653 pObj = Gia_ManPo( pMiter, Gia_ManPoNum(
p) + nLits++ );
1654 if ( Gia_ObjFaninLit0p(pMiter, pObj) == 0 )
1656 Gia_ObjSetProved(
p, i);
1660 assert( nLits == nLitsAll );
1663 Abc_Print( 1,
"Set %d equivalences as proved.\n", Counter );
1682 int i, iObjId, Entry, Prev = -1;
1684 if (
p->pReprs == NULL ||
p->pNexts == NULL )
1686 Abc_Print( 1,
"Gia_ManEquivFilter(): Equivalence classes are not defined.\n" );
1690 if ( vPoIds == NULL )
1692 Abc_Print( 1,
"Gia_ManEquivFilter(): Array of disproved POs is not available.\n" );
1695 if ( Vec_IntSize(vPoIds) == 0 )
1698 vMap = Vec_IntAlloc( 1000 );
1699 vTrace = Vec_IntAlloc( 1000 );
1701 Vec_IntFree( vTrace );
1703 assert( Gia_ManPoNum(pSrm) == Gia_ManPoNum(
p) + Vec_IntSize(vMap) );
1706 printf(
"Design POs = %d. SRM POs = %d. Spec POs = %d. Disproved POs = %d.\n",
1707 Gia_ManPoNum(
p), Gia_ManPoNum(
p) + Vec_IntSize(vMap), Vec_IntSize(vMap), Vec_IntSize(vPoIds) );
1709 Vec_IntSort( vPoIds, 0 );
1712 if ( Entry < 0 || Entry >= Gia_ManPoNum(
p) + Vec_IntSize(vMap) )
1714 Abc_Print( 1,
"Gia_ManEquivFilter(): Array of disproved POs contains PO index (%d),\n", Entry );
1715 Abc_Print( 1,
"which does not fit into the range of available PO indexes of the SRM: [%d; %d].\n", 0, Gia_ManPoNum(
p) + Vec_IntSize(vMap)-1 );
1716 Vec_IntFree( vMap );
1719 if ( Entry < Gia_ManPoNum(
p) )
1720 Abc_Print( 0,
"Gia_ManEquivFilter(): One of the original POs (%d) have failed.\n", Entry );
1721 if ( Prev == Entry )
1723 Abc_Print( 1,
"Gia_ManEquivFilter(): Array of disproved POs contains at least one duplicate entry (%d),\n", Entry );
1724 Vec_IntFree( vMap );
1732 if ( Entry < Gia_ManPoNum(
p) )
1734 iObjId = Vec_IntEntry( vMap, Entry - Gia_ManPoNum(
p) );
1735 Gia_ObjUnsetRepr(
p, iObjId );
1738 Vec_IntFree( vMap );
1758 vPoIds = Vec_IntAlloc( 1000 );
1759 for ( i = 0; i < 10; i++ )
1761 Vec_IntPush( vPoIds, Gia_ManPoNum(
p) + 2 * i + 2 );
1762 printf(
"%d ", Gia_ManPoNum(
p) + 2*i + 2 );
1766 Vec_IntFree( vPoIds );
1783 int i, k, iNode, iRepr;
1784 int iReprBest, iLevelBest, iLevelCur, iMffcBest, iMffcCur;
1785 assert(
p->pReprs != NULL &&
p->pNexts != NULL );
1789 vClass = Vec_IntAlloc( 100 );
1792 Vec_IntClear( vClass );
1797 iLevelCur = Gia_ObjLevel(
p,Gia_ManObj(
p, k) );
1799 if ( iLevelBest > iLevelCur || (iLevelBest == iLevelCur && iMffcBest > iMffcCur) )
1802 iLevelBest = iLevelCur;
1803 iMffcBest = iMffcCur;
1805 Vec_IntPush( vClass, k );
1807 assert( Vec_IntSize( vClass ) > 1 );
1809 if ( i == iReprBest )
1818 Gia_ObjSetProved(
p, i );
1819 Gia_ObjUnsetProved(
p, iRepr );
1821 if ( iNode != iRepr )
1822 Gia_ObjSetRepr(
p, iNode, iRepr );
1824 Vec_IntFree( vClass );
1844 if ( pNode == NULL )
1846 if ( Gia_ObjIsCi(pNode) )
1850 if ( pNode == pOld )
1856 Vec_PtrPush( vVisited, pNode );
1882 assert( !Gia_IsComplement(pOld) );
1883 assert( !Gia_IsComplement(pNode) );
1884 vVisited = Vec_PtrAlloc( 100 );
1888 Vec_PtrFree( vVisited );
1906 if ( Gia_ObjNext(
p, Gia_ObjId(
p, pOld)) == 0 )
1908 Gia_ObjSetNext(
p, Gia_ObjId(
p, pOld), Gia_ObjId(
p, pNode) );
1927 Gia_Obj_t * pRepr, * pReprNew, * pObjNew;
1930 if ( (pRepr = Gia_ObjReprObj(
p, Gia_ObjId(
p, pObj))) && !Gia_ObjFailed(
p,Gia_ObjId(
p,pObj)) )
1932 if ( Gia_ObjIsConst0(pRepr) )
1934 pObj->
Value = Abc_LitNotCond( pRepr->
Value, Gia_ObjPhaseReal(pRepr) ^ Gia_ObjPhaseReal(pObj) );
1938 assert( Gia_ObjIsAnd(pObj) );
1942 if ( Abc_LitRegular(pObj->
Value) == Abc_LitRegular(pRepr->
Value) )
1944 assert( (
int)pObj->
Value == Abc_LitNotCond( pRepr->
Value, Gia_ObjPhaseReal(pRepr) ^ Gia_ObjPhaseReal(pObj) ) );
1950 pReprNew = Gia_ManObj( pNew, Abc_Lit2Var(pRepr->
Value) );
1951 pObjNew = Gia_ManObj( pNew, Abc_Lit2Var(pObj->
Value) );
1952 if ( Gia_ObjReprObj( pNew, Gia_ObjId(pNew, pObjNew) ) )
1955 if ( Gia_ObjReprObj( pNew, Gia_ObjId(pNew, pObjNew) ) != pReprNew )
1957 pObj->
Value = Abc_LitNotCond( pRepr->
Value, Gia_ObjPhaseReal(pRepr) ^ Gia_ObjPhaseReal(pObj) );
1962 assert( Gia_ObjNext(pNew, Gia_ObjId(pNew, pObjNew)) == 0 );
1963 Gia_ObjSetRepr( pNew, Gia_ObjId(pNew, pObjNew), Gia_ObjId(pNew, pReprNew) );
1966 pObj->
Value = Abc_LitNotCond( pRepr->
Value, Gia_ObjPhaseReal(pRepr) ^ Gia_ObjPhaseReal(pObj) );
1969 assert( Gia_ObjIsAnd(pObj) );
1989 int i, iObj, iPrev, Counter = 0;
1994 if ( Gia_ObjIsAnd(pObj) )
1996 Gia_ObjFanin0(pObj)->fMark0 = 1;
1997 Gia_ObjFanin1(pObj)->fMark0 = 1;
1999 else if ( Gia_ObjIsCo(pObj) )
2000 Gia_ObjFanin0(pObj)->fMark0 = 1;
2005 for ( iPrev = i, iObj = Gia_ObjNext(
p, i); iObj; iObj = Gia_ObjNext(
p, iPrev) )
2007 if ( !Gia_ManObj(
p, iObj)->fMark0 )
2013 Gia_ObjSetNext(
p, iPrev, Gia_ObjNext(
p, iObj) );
2014 Gia_ObjSetNext(
p, iObj, 0 );
2041 assert( (Gia_ManCoNum(
p) % nSnapshots) == 0 );
2044 pNew->
pSpec = Abc_UtilStrsav(
p->pSpec );
2045 pNew->
pName = Abc_UtilStrsav(
p->pName );
2048 for ( i = 0; i < Gia_ManObjNum(
p); i++ )
2051 Gia_ManConst0(
p)->Value = 0;
2053 pObj->
Value = Gia_ManAppendCi(pNew);
2055 if ( (pRepr = Gia_ObjReprObj(
p, Gia_ObjId(
p, pObj))) )
2057 assert( Gia_ObjIsConst0(pRepr) || Gia_ObjIsRo(
p, pRepr) );
2066 Vec_IntFree( vNodes );
2068 if ( i % nSnapshots == 0 )
2069 Gia_ManAppendCo( pNew, Gia_ObjFanin0Copy(pObj) );
2095 if (
p->pReprs == NULL ||
p->pNexts == NULL )
2098 Counter += Gia_ObjIsHead(
p, i );
2117 if (
p->pReprs == NULL ||
p->pNexts == NULL )
2120 Counter += (int)(Gia_ObjNext(
p, i ) > 0);
2149 if (
p->pReprs == NULL )
2152 if ( Gia_ObjReprObj(
p, i) != NULL )
2154 return i == Gia_ManObjNum(
p);
2173 int nIter, nStart = 0;
2176 Abc_Print( 1,
"Gia_CommandSpecI(): Equivalence classes are not defined.\n" );
2182 for ( nIter = 0; ; nIter++ )
2186 Abc_Print( 1,
"Gia_CommandSpecI: No equivalences left.\n" );
2189 Abc_Print( 1,
"ITER %3d : ", nIter );
2199 Abc_Print( 1,
"Gia_CommandSpecI: There are only trivial equiv candidates left (PO drivers). Quitting.\n" );
2206 int nFrames = nFramesInit;
2207 int nNodeDelta = 2000;
2208 int nBTLimit = nBTLimitInit;
2209 int nBTLimitAll = 2000000;
2213 Saig_BmcPerform( pTemp, nStart, nFrames, nNodeDelta, 0, nBTLimit, nBTLimitAll, fVerbose, 0, NULL, 0, 0 );
2214 pCex = pTemp->pSeqModel; pTemp->pSeqModel = NULL;
2218 Abc_Print( 1,
"Gia_CommandSpecI(): Internal BMC could not find a counter-example.\n" );
2222 nStart = pCex->iFrame;
2270 Gia_Obj_t * pObj1, * pObj2, * pObjM, * pObj;
2271 int i, iObj, iNext, Counter = 0;
2274 Abc_Print( 1,
"Equivalences are not defined.\n" );
2278 if ( pGia1 == NULL )
2280 Abc_Print( 1,
"Cannot read first file %s.\n", pName1 );
2284 if ( pGia2 == NULL )
2287 Abc_Print( 1,
"Cannot read second file %s.\n", pName2 );
2291 if ( pMiter == NULL )
2295 Abc_Print( 1,
"Cannot create sequential miter.\n" );
2299 if ( Gia_ManObjNum(pGia) != Gia_ManObjNum(pMiter) )
2304 Abc_Print( 1,
"The number of objects in different.\n" );
2312 Abc_Print( 1,
"The AIG structure of the miter does not match.\n" );
2319 if ( pObj1->
Value == ~0 )
2321 pObjM = Gia_ManObj( pMiter, Abc_Lit2Var(pObj1->
Value) );
2322 pObj = Gia_ManObj( pGia, Gia_ObjId(pMiter, pObjM) );
2328 if ( pObj2->
Value == ~0 )
2330 pObjM = Gia_ManObj( pMiter, Abc_Lit2Var(pObj2->
Value) );
2331 pObj = Gia_ManObj( pGia, Gia_ObjId(pMiter, pObjM) );
2338 Gia_ObjUnsetRepr( pGia, i );
2344 int ClassA = -1, ClassB = -1;
2347 pObj = Gia_ManObj( pGia, iObj );
2350 if ( fLatchA && !Gia_ObjIsRo(pGia, pObj) )
2356 if ( fLatchB && !Gia_ObjIsRo(pGia, pObj) )
2362 for ( iObj = i, iNext = Gia_ObjNext(pGia, iObj); iObj;
2363 iObj = iNext, iNext = Gia_ObjNext(pGia, iObj) )
2365 Gia_ObjUnsetRepr( pGia, iObj );
2366 Gia_ObjSetNext( pGia, iObj, 0 );
2368 assert( !Gia_ObjIsHead(pGia, i) );
2369 if ( ClassA > 0 && ClassB > 0 )
2371 if ( ClassA > ClassB )
2377 assert( ClassA < ClassB );
2378 Gia_ObjSetNext( pGia, ClassA, ClassB );
2379 Gia_ObjSetRepr( pGia, ClassB, ClassA );
2381 assert( Gia_ObjIsHead(pGia, ClassA) );
2384 Abc_Print( 1,
"The number of two-node classes after filtering = %d.\n", Counter );
2408 Gia_Obj_t * pObj1, * pObj2, * pObjM, * pObj = NULL;
2409 int i, k, iObj, iNext, iPrev, iRepr;
2410 int iLitsOld, iLitsNew;
2413 Abc_Print( 1,
"Equivalences are not defined.\n" );
2417 if ( pGia1 == NULL )
2419 Abc_Print( 1,
"Cannot read first file %s.\n", pName1 );
2423 if ( pGia2 == NULL )
2426 Abc_Print( 1,
"Cannot read second file %s.\n", pName2 );
2430 if ( pMiter == NULL )
2434 Abc_Print( 1,
"Cannot create sequential miter.\n" );
2438 if ( Gia_ManObjNum(pGia) != Gia_ManObjNum(pMiter) )
2443 Abc_Print( 1,
"The number of objects in different.\n" );
2451 Abc_Print( 1,
"The AIG structure of the miter does not match.\n" );
2458 if ( pObj1->
Value == ~0 )
2460 pObjM = Gia_ManObj( pMiter, Abc_Lit2Var(pObj1->
Value) );
2461 pObj = Gia_ManObj( pGia, Gia_ObjId(pMiter, pObjM) );
2467 if ( pObj2->
Value == ~0 )
2469 pObjM = Gia_ManObj( pMiter, Abc_Lit2Var(pObj2->
Value) );
2470 pObj = Gia_ManObj( pGia, Gia_ObjId(pMiter, pObjM) );
2475 iLitsOld = iLitsNew = 0;
2479 pObj = Gia_ManObj( pGia, i );
2483 Gia_ObjUnsetRepr( pGia, i );
2488 vNodes = Vec_IntAlloc( 100 );
2491 int fSeenA = 0, fSeenB = 0;
2493 Vec_IntClear( vNodes );
2496 pObj = Gia_ManObj( pGia, iObj );
2500 Vec_IntPush( vNodes, iObj );
2505 Vec_IntPush( vNodes, iObj );
2511 for ( iObj = i, iNext = Gia_ObjNext(pGia, iObj); iObj;
2512 iObj = iNext, iNext = Gia_ObjNext(pGia, iObj) )
2514 Gia_ObjUnsetRepr( pGia, iObj );
2515 Gia_ObjSetNext( pGia, iObj, 0 );
2517 assert( !Gia_ObjIsHead(pGia, i) );
2518 if ( fSeenA && fSeenB && Vec_IntSize(vNodes) > 1 )
2521 iPrev = iRepr = Vec_IntEntry( vNodes, 0 );
2524 Gia_ObjSetRepr( pGia, iObj, iRepr );
2525 Gia_ObjSetNext( pGia, iPrev, iObj );
2529 assert( Gia_ObjNext(pGia, iPrev) == 0 );
2532 Vec_IntFree( vNodes );
2533 Abc_Print( 1,
"The number of literals: Before = %d. After = %d.\n", iLitsOld, iLitsNew );
2556 int i, k, iObj, iNext, iPrev, iRepr;
2557 int iLitsOld = 0, iLitsNew = 0;
2558 assert( fFlopsOnly ^ fFlopsWith );
2559 vNodes = Vec_IntAlloc( 100 );
2561 vFfIds = Vec_IntStart( Gia_ManObjNum(pGia) );
2562 if ( fUseRiDrivers )
2565 Vec_IntWriteEntry( vFfIds, Gia_ObjFaninId0p(pGia, pObjR), 1 );
2570 Vec_IntWriteEntry( vFfIds, Gia_ObjId(pGia, pObjR), 1 );
2577 if ( !Vec_IntEntry(vFfIds, i) )
2578 Gia_ObjUnsetRepr( pGia, i );
2587 Vec_IntClear( vNodes );
2590 if ( Vec_IntEntry(vFfIds, iObj) )
2591 Vec_IntPush( vNodes, iObj );
2596 for ( iObj = i, iNext = Gia_ObjNext(pGia, iObj); iObj;
2597 iObj = iNext, iNext = Gia_ObjNext(pGia, iObj) )
2599 Gia_ObjUnsetRepr( pGia, iObj );
2600 Gia_ObjSetNext( pGia, iObj, 0 );
2602 assert( !Gia_ObjIsHead(pGia, i) );
2603 if ( Vec_IntSize(vNodes) > 1 )
2606 iPrev = iRepr = Vec_IntEntry( vNodes, 0 );
2609 Gia_ObjSetRepr( pGia, iObj, iRepr );
2610 Gia_ObjSetNext( pGia, iPrev, iObj );
2614 assert( Gia_ObjNext(pGia, iPrev) == 0 );
2625 if ( Vec_IntEntry(vFfIds, iObj) )
2635 for ( iObj = i, iNext = Gia_ObjNext(pGia, iObj); iObj;
2636 iObj = iNext, iNext = Gia_ObjNext(pGia, iObj) )
2638 Gia_ObjUnsetRepr( pGia, iObj );
2639 Gia_ObjSetNext( pGia, iObj, 0 );
2643 assert( !Gia_ObjIsHead(pGia, i) );
2646 Vec_IntFree( vNodes );
2647 Vec_IntFree( vFfIds );
2648 Abc_Print( 1,
"The number of literals: Before = %d. After = %d.\n", iLitsOld, iLitsNew );
2666 if ( Gia_ObjIsCi(pObj) )
2667 return pObj->
Value = Gia_ManAppendCi(pNew);
2669 if ( Gia_ObjIsCo(pObj) )
2670 return pObj->
Value = Gia_ManAppendCo( pNew, Gia_ObjFanin0Copy(pObj) );
2672 return pObj->
Value = Gia_ManAppendAnd( pNew, Gia_ObjFanin0Copy(pObj), Gia_ObjFanin1Copy(pObj) );
2681 pNew->
pName = Abc_UtilStrsav(
p->pName );
2682 pNew->
pSpec = Abc_UtilStrsav(
p->pSpec );
2683 Gia_ManConst0(
p)->Value = 0;
2685 pObj->
Value = Gia_ManAppendCi(pNew);
2694 pObj->
Value = Gia_ManAppendCo( pNew, Gia_ObjFanin0Copy(pObj) );
2696 assert( Gia_ManObjNum(pNew) == Gia_ManObjNum(
p) );
2702 int i, k, iNode, iRepr;
2703 assert( Gia_ManObjNum(
p) == Gia_ManObjNum(pNew) );
2710 for ( i = 0; i < Gia_ManObjNum(pNew); i++ )
2711 Gia_ObjSetRepr( pNew, i,
GIA_VOID );
2714 Gia_ObjSetRepr( pNew, Abc_Lit2Var(Gia_ManObj(
p, i)->Value), 0 );
2716 vClass = Vec_IntAlloc( 100 );
2719 Vec_IntClear( vClass );
2721 Vec_IntPushUnique( vClass, Abc_Lit2Var(Gia_ManObj(
p, k)->Value) );
2722 assert( Vec_IntSize( vClass ) > 1 );
2723 Vec_IntSort( vClass, 0 );
2724 iRepr = Vec_IntEntry( vClass, 0 );
2726 Gia_ObjSetRepr( pNew, iNode, iRepr );
2728 Vec_IntFree( vClass );
2735 int * pNexts =
p->pNexts;
2738 assert( Gia_ManObjNum(
p) == Gia_ManObjNum(pNew) );
2746 Gia_ManObj(pNew, Abc_Lit2Var(pObj->
Value))->Value = Abc_Var2Lit(i, 0);
2750 for ( i = 0; i < Gia_ManObjNum(
p); i++ )
2751 pReprs[i].fProved = 0;
2753 if (
memcmp(
p->pReprs, pReprs,
sizeof(
int)*Gia_ManObjNum(
p)) )
2754 printf(
"Verification of reprs failed.\n" );
2756 printf(
"Verification of reprs succeeded.\n" );
2757 if (
memcmp(
p->pNexts, pNexts,
sizeof(
int)*Gia_ManObjNum(
p)) )
2758 printf(
"Verification of nexts failed.\n" );
2760 printf(
"Verification of nexts succeeded.\n" );
2783 int i, k, iNode, iRepr;
2792 Gia_ManObj(
p, Abc_Lit2Var(pObj->
Value))->Value = Abc_Var2Lit(i, 0);
2795 for ( i = 0; i < Gia_ManObjNum(pOld); i++ )
2796 Gia_ObjSetRepr( pOld, i,
GIA_VOID );
2799 Gia_ObjSetRepr( pOld, Abc_Lit2Var(Gia_ManObj(
p, i)->Value), 0 );
2801 vClass = Vec_IntAlloc( 100 );
2804 Vec_IntClear( vClass );
2806 if ( (
int)Gia_ManObj(
p, k)->Value >= 0 )
2807 Vec_IntPushUnique( vClass, Abc_Lit2Var(Gia_ManObj(
p, k)->Value) );
2808 if ( Vec_IntSize( vClass ) <= 1 )
2810 assert( Vec_IntSize( vClass ) > 1 );
2811 Vec_IntSort( vClass, 0 );
2812 iRepr = Vec_IntEntry( vClass, 0 );
2814 Gia_ObjSetRepr( pOld, iNode, iRepr );
2816 Vec_IntFree( vClass );
2835 if ( Gia_ObjIsTravIdPreviousId(
p, iObj) )
2837 if ( Gia_ObjIsTravIdCurrentId(
p, iObj) )
2839 Gia_ObjSetTravIdCurrentId(
p, iObj);
2840 pObj = Gia_ManObj(
p, iObj );
2841 if ( Gia_ObjIsCi(pObj) )
2843 assert( Gia_ObjIsAnd(pObj) );
2847 Gia_ObjSetTravIdPreviousId(
p, iObj);
2852 int iObjNew, iRepr, iObj, Res, fHaveChoices = 0;
2858 iObjNew = Abc_Lit2Var( Gia_ManObj(
p, iRepr)->Value );
2861 Gia_ObjSetTravIdPreviousId( pNew, iObjNew );
2862 p->pReprs[iRepr].fColorA = 1;
2865 assert(
p->pReprs[iObj].iRepr == (
unsigned)iRepr );
2866 iObjNew = Abc_Lit2Var( Gia_ManObj(
p, iObj)->Value );
2869 p->pReprs[iObj].fColorA = 1;
2872 Gia_ObjSetTravIdPreviousId( pNew, iObjNew );
2875 return fHaveChoices;
2883 if ( !Gia_ObjIsClass(
p, iObj) )
2887 Vec_Int_t * vLits = Vec_IntAlloc( 100 );
2888 int i, iHead, iNext, iRepr = Gia_ObjIsHead(
p, iObj) ? iObj : Gia_ObjRepr(
p, iObj);
2890 if (
p->pReprs[iObj].fColorA )
2892 Vec_IntSort( vLits, 1 );
2893 iHead = Abc_Lit2Var( Vec_IntEntry(vLits, 0) );
2894 if ( Vec_IntSize(vLits) > 1 )
2898 pCho->
pSibls[iHead] = Abc_Lit2Var(iNext);
2899 iHead = Abc_Lit2Var(iNext);
2902 return Abc_LitNotCond( Vec_IntEntry(vLits, 0), Gia_ManObj(
p, iHead)->fPhase );
2915 pCho->
pName = Abc_UtilStrsav(
p->pName );
2916 pCho->
pSpec = Abc_UtilStrsav(
p->pSpec );
2919 Gia_ManConst0(pNew)->Value = 0;
2920 for ( i = 0; i < Gia_ManCiNum(pNew); i++ )
2921 Gia_ManCi(pNew, i)->Value = Gia_ManAppendCi( pCho );
2925 pObj->
Value = Gia_ManAppendCo( pCho, Gia_ObjFanin0Copy(pObj) );
2944 Vec_Int_t * vXors = Vec_IntAlloc( 100 );
2947 pNew->
pName = Abc_UtilStrsav(
p->pName );
2948 pNew->
pSpec = Abc_UtilStrsav(
p->pSpec );
2952 Gia_ManConst0(
p)->Value = 0;
2954 pObj->
Value = Gia_ManAppendCi( pNew );
2959 pRepr = Gia_ObjReprObj(
p, i );
2960 if ( pRepr && Abc_Lit2Var(pObj->
Value) != Abc_Lit2Var(pRepr->
Value) )
2970 if ( Vec_IntSize(vXors) == 0 )
2971 Vec_IntPush( vXors, 0 );
2973 Gia_ManAppendCo( pNew, iLit );
2974 Vec_IntFree( vXors );
2983 if ( pFileName == NULL )
2984 pFileName =
"test.aig";
2986 Abc_Print( 1,
"Speculatively reduced model was written into file \"%s\".\n", pFileName );
#define ABC_FALLOC(type, num)
#define ABC_ALLOC(type, num)
#define ABC_INFINITY
MACRO DEFINITIONS ///.
#define ABC_CALLOC(type, num)
#define ABC_NAMESPACE_IMPL_START
#define ABC_NAMESPACE_IMPL_END
void Aig_ManStop(Aig_Man_t *p)
typedefABC_NAMESPACE_HEADER_START struct Aig_Man_t_ Aig_Man_t
INCLUDES ///.
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
int Saig_BmcPerform(Aig_Man_t *pAig, int nStart, int nFramesMax, int nNodesMax, int nTimeOut, int nConfMaxOne, int nConfMaxAll, int fVerbose, int fVerbOverwrite, int *piFrames, int fSilent, int fUseSatoko)
void Cec_ManSimClassCreate(Gia_Man_t *p, Vec_Int_t *vClass)
struct Cec_ParFra_t_ Cec_ParFra_t
int Cec_ManCheckNonTrivialCands(Gia_Man_t *pAig)
void Cec_ManFraSetDefaultParams(Cec_ParFra_t *p)
int Cec_ManSeqResimulateCounter(Gia_Man_t *pAig, Cec_ParSim_t *pPars, Abc_Cex_t *pCex)
Gia_Man_t * Cec_ManSatSweeping(Gia_Man_t *pAig, Cec_ParFra_t *pPars, int fSilent)
void Cec_ManSimSetDefaultParams(Cec_ParSim_t *p)
struct Cec_ParSim_t_ Cec_ParSim_t
Aig_Man_t * Gia_ManToAig(Gia_Man_t *p, int fChoices)
int Cec4_ManSatSolverChoices_rec(Gia_Man_t *pCho, Gia_Man_t *p, Gia_Man_t *pNew, int iObj)
void Gia_ManEquivImprove(Gia_Man_t *p)
void Gia_ManEquivFixOutputPairs(Gia_Man_t *p)
int Gia_ManCheckTopoOrder(Gia_Man_t *p)
int Gia_ManChangeOrder_rec(Gia_Man_t *pNew, Gia_Man_t *p, Gia_Obj_t *pObj)
void Gia_ManTransferEquivs(Gia_Man_t *p, Gia_Man_t *pNew)
void Gia_ManEquivFilter(Gia_Man_t *p, Vec_Int_t *vPoIds, int fVerbose)
Gia_Man_t * Gia_ManSpecReduce(Gia_Man_t *p, int fDualOut, int fSynthesis, int fSpeculate, int fSkipSome, int fVerbose)
int Gia_ManEquivCountLits(Gia_Man_t *p)
int Gia_CommandSpecI(Gia_Man_t *pGia, int nFramesInit, int nBTLimitInit, int fStart, int fCheckMiter, int fVerbose)
void Gia_ManTransferTest(Gia_Man_t *p)
int Gia_ObjCheckTfi(Gia_Man_t *p, Gia_Obj_t *pOld, Gia_Obj_t *pNode)
void Gia_ManEquivToChoices_rec(Gia_Man_t *pNew, Gia_Man_t *p, Gia_Obj_t *pObj)
int Gia_ManEquivCountLitsAll(Gia_Man_t *p)
Gia_Man_t * Gia_ManEquivReduce(Gia_Man_t *p, int fUseAll, int fDualOut, int fSkipPhase, int fVerbose)
Gia_Man_t * Gia_ManCombSpecReduce(Gia_Man_t *p)
Gia_Obj_t * Gia_MakeRandomChoice(Gia_Man_t *p, int iRepr)
int Gia_ManEquivSetColor_rec(Gia_Man_t *p, Gia_Obj_t *pObj, int fOdds)
int Gia_ManCountChoiceNodes(Gia_Man_t *p)
void Gia_ManOrigIdsStart(Gia_Man_t *p)
void Gia_ManDeriveReprsFromSibls(Gia_Man_t *p)
void Gia_ManDeriveReprs(Gia_Man_t *p)
void Gia_ManTransferEquivs2(Gia_Man_t *p, Gia_Man_t *pOld)
void Gia_ManEquivDeriveReprs(Gia_Man_t *p, Gia_Man_t *pNew, Gia_Man_t *pFinal)
int * Gia_ManDeriveNexts(Gia_Man_t *p)
int Gia_ManEquivSetColors(Gia_Man_t *p, int fVerbose)
int Cec4_ManMarkIndependentClasses_rec(Gia_Man_t *p, int iObj)
Gia_Man_t * Gia_ManOrigIdsReduceTest(Gia_Man_t *p, Vec_Int_t *vPairs)
int Gia_ManChoiceMinLevel_rec(Gia_Man_t *p, int iPivot, int fDiveIn, Vec_Int_t *vMap)
int Cec4_ManSatSolverAnd_rec(Gia_Man_t *pCho, Gia_Man_t *p, Gia_Man_t *pNew, int iObj)
void Gia_ManRemoveBadChoices(Gia_Man_t *p)
void Gia_ManEquivReduce2_rec(Gia_Man_t *pNew, Gia_Man_t *p, Gia_Obj_t *pObj, Vec_Int_t *vMap, int fDiveIn)
void Gia_ManEquivFilterTest(Gia_Man_t *p)
Gia_Man_t * Cec4_ManSatSolverChoices(Gia_Man_t *p, Gia_Man_t *pNew)
void Gia_ManSpecReduceInit_rec(Gia_Man_t *pNew, Gia_Man_t *p, Gia_Obj_t *pObj, Vec_Int_t *vXorLits, int f, int fDualOut)
void Gia_ManEquivUpdatePointers(Gia_Man_t *p, Gia_Man_t *pNew)
void Gia_ManCombSpecReduceTest(Gia_Man_t *p, char *pFileName)
void Gia_ManEquivPrintClasses(Gia_Man_t *p, int fVerbose, float Mem)
void Gia_ManPrintStatsClasses(Gia_Man_t *p)
ABC_NAMESPACE_IMPL_END ABC_NAMESPACE_IMPL_START int Gia_ManHasNoEquivs(Gia_Man_t *p)
ABC_NAMESPACE_IMPL_START void Gia_ManOrigIdsInit(Gia_Man_t *p)
DECLARATIONS ///.
void Gia_ManEquivMark(Gia_Man_t *p, char *pFileName, int fSkipSome, int fVerbose)
void Gia_ManEquivPrintOne(Gia_Man_t *p, int i, int Counter)
void Gia_ManSpecReduce_rec(Gia_Man_t *pNew, Gia_Man_t *p, Gia_Obj_t *pObj, Vec_Int_t *vXorLits, int fDualOut, int fSpeculate, Vec_Int_t *vTrace, Vec_Int_t *vGuide, Vec_Int_t *vMap)
Vec_Int_t * Gia_ManChoiceMinLevel(Gia_Man_t *p)
int Gia_ManEquivCountOne(Gia_Man_t *p, int i)
void Gia_ManSpecBuildInit(Gia_Man_t *pNew, Gia_Man_t *p, Gia_Obj_t *pObj, Vec_Int_t *vXorLits, int f, int fDualOut)
int Gia_ManEquivCountClasses(Gia_Man_t *p)
int Cec4_ManMarkIndependentClasses(Gia_Man_t *p, Gia_Man_t *pNew)
Gia_Man_t * Gia_ManEquivRemapDfs(Gia_Man_t *p)
Gia_Man_t * Gia_ManComputeGiaEquivs(Gia_Man_t *pGia, int nConfs, int fVerbose)
int Gia_ManOrigIdsRemapPairsExtract(Vec_Int_t *vMap, int One)
int Gia_ManCountChoices(Gia_Man_t *p)
int Gia_ManCheckTopoOrder_rec(Gia_Man_t *p, Gia_Obj_t *pObj)
int Gia_ObjCheckTfi_rec(Gia_Man_t *p, Gia_Obj_t *pOld, Gia_Obj_t *pNode, Vec_Ptr_t *vVisited)
Vec_Int_t * Gia_ManOrigIdsRemapPairs(Vec_Int_t *vEquivPairs, int nObjs)
void Gia_ManEquivTransform(Gia_Man_t *p, int fVerbose)
Gia_Man_t * Gia_ManEquivToChoices(Gia_Man_t *p, int nSnapshots)
Gia_Man_t * Gia_ManSpecReduceTrace(Gia_Man_t *p, Vec_Int_t *vTrace, Vec_Int_t *vMap)
int Gia_ManFilterEquivsUsingParts(Gia_Man_t *pGia, char *pName1, char *pName2)
Gia_Man_t * Gia_ManEquivReduce2(Gia_Man_t *p, int fRandom)
void Gia_ManEquivReduce_rec(Gia_Man_t *pNew, Gia_Man_t *p, Gia_Obj_t *pObj, int fUseAll, int fDualOut)
int Gia_ManEquivCheckLits(Gia_Man_t *p, int nLits)
void Gia_ManAddNextEntry_rec(Gia_Man_t *p, Gia_Obj_t *pOld, Gia_Obj_t *pNode)
void Gia_ManFilterEquivsUsingLatches(Gia_Man_t *pGia, int fFlopsOnly, int fFlopsWith, int fUseRiDrivers)
Gia_Man_t * Gia_ManChangeOrder(Gia_Man_t *p)
int Gia_ManFilterEquivsForSpeculation(Gia_Man_t *pGia, char *pName1, char *pName2, int fLatchA, int fLatchB)
void Gia_ManOrigIdsRemapPairsInsert(Vec_Int_t *vMap, int One, int Two)
void Gia_ManOrigIdsRemap(Gia_Man_t *p, Gia_Man_t *pNew)
Gia_Man_t * Gia_ManSpecReduceInitFrames(Gia_Man_t *p, Abc_Cex_t *pInit, int nFramesMax, int *pnFrames, int fDualOut, int nMinOutputs)
Gia_Man_t * Gia_ManOrigIdsReduce(Gia_Man_t *p, Vec_Int_t *vPairs)
Gia_Man_t * Gia_ManEquivReduceAndRemap(Gia_Man_t *p, int fSeq, int fMiterPairs)
Gia_Man_t * Gia_ManSpecReduceInit(Gia_Man_t *p, Abc_Cex_t *pInit, int nFrames, int fDualOut)
struct Gia_Rpr_t_ Gia_Rpr_t
void Gia_ManStop(Gia_Man_t *p)
Gia_Man_t * Gia_ManDup(Gia_Man_t *p)
int Gia_ManCombMarkUsed(Gia_Man_t *p)
#define Gia_ManForEachRo(p, pObj, i)
int Gia_ManSeqMarkUsed(Gia_Man_t *p)
#define Gia_ManForEachPo(p, pObj, i)
#define Gia_ManForEachAnd(p, pObj, i)
#define Gia_ManForEachConst(p, i)
Gia_Man_t * Gia_AigerRead(char *pFileName, int fGiaSimple, int fSkipStrash, int fCheck)
void Gia_ManSetRegNum(Gia_Man_t *p, int nRegs)
#define Gia_ManForEachCoDriverId(p, DriverId, i)
void Gia_ManHashAlloc(Gia_Man_t *p)
#define Gia_ClassForEachObj1(p, i, iObj)
#define Gia_ManForEachPi(p, pObj, i)
Gia_Man_t * Gia_ManStart(int nObjsMax)
FUNCTION DEFINITIONS ///.
struct Gia_Obj_t_ Gia_Obj_t
Gia_Man_t * Gia_ManDupMarked(Gia_Man_t *p)
int Gia_ManHashXor(Gia_Man_t *p, int iLit0, int iLit1)
#define Gia_ClassForEachObj(p, i, iObj)
void Gia_ManFillValue(Gia_Man_t *p)
struct Gia_Man_t_ Gia_Man_t
#define Gia_ManForEachObj1(p, pObj, i)
#define Gia_ManForEachObjVec(vVec, p, pObj, i)
int Gia_NodeMffcSize(Gia_Man_t *p, Gia_Obj_t *pNode)
#define Gia_ManForEachClassReverse(p, i)
#define Gia_ManForEachClass(p, i)
Gia_Man_t * Gia_ManCleanup(Gia_Man_t *p)
Gia_Man_t * Gia_ManDupDfs(Gia_Man_t *p)
void Gia_ManCleanMark0(Gia_Man_t *p)
Gia_Man_t * Gia_ManSeqStructSweep(Gia_Man_t *p, int fConst, int fEquiv, int fVerbose)
Vec_Int_t * Gia_ManGetDangling(Gia_Man_t *p)
void Gia_ManCreateRefs(Gia_Man_t *p)
void Gia_ManCleanLevels(Gia_Man_t *p, int Size)
int Gia_ManHashAnd(Gia_Man_t *p, int iLit0, int iLit1)
void Gia_ManIncrementTravId(Gia_Man_t *p)
Gia_Man_t * Gia_ManMiter(Gia_Man_t *pAig0, Gia_Man_t *pAig1, int nInsDup, int fDualOut, int fSeq, int fImplic, int fVerbose)
#define Gia_ManForEachObj(p, pObj, i)
MACRO DEFINITIONS ///.
#define Gia_ManForEachCo(p, pObj, i)
#define Gia_ManForEachCi(p, pObj, i)
#define Gia_ManForEachRiRo(p, pObjRi, pObjRo, i)
void Gia_ManSetPhase(Gia_Man_t *p)
void Gia_ManHashStop(Gia_Man_t *p)
void Gia_ManPrintStats(Gia_Man_t *p, Gps_Par_t *pPars)
void Gia_ManCleanMark01(Gia_Man_t *p)
int Gia_ManLevelNum(Gia_Man_t *p)
#define Gia_ManForEachRi(p, pObj, i)
void Gia_AigerWrite(Gia_Man_t *p, char *pFileName, int fWriteSymbols, int fCompact, int fWriteNewLine)
void Gia_ManCleanMark1(Gia_Man_t *p)
typedefABC_NAMESPACE_HEADER_START struct Abc_Cex_t_ Abc_Cex_t
INCLUDES ///.
#define Vec_IntForEachEntryDouble(vVec, Entry1, Entry2, i)
#define Vec_IntForEachEntry(vVec, Entry, i)
MACRO DEFINITIONS ///.
#define Vec_IntForEachEntryStart(vVec, Entry, i, Start)
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.