33static inline int Sle_CutSize(
int * pCut ) {
return pCut[0] & 0xF; }
34static inline int Sle_CutSign(
int * pCut ) {
return ((
unsigned)pCut[0]) >> 4; }
35static inline int Sle_CutSetSizeSign(
int s,
int S ) {
return (S << 4) | s; }
36static inline int * Sle_CutLeaves(
int * pCut ) {
return pCut + 1; }
38static inline int Sle_CutIsUsed(
int * pCut ) {
return pCut[1] != 0; }
39static inline void Sle_CutSetUnused(
int * pCut ) { pCut[1] = 0; }
41static inline int Sle_ListCutNum(
int * pList ) {
return pList[0]; }
43#define Sle_ForEachCut( pList, pCut, i ) for ( i = 0, pCut = pList + 1; i < pList[0]; i++, pCut += Sle_CutSize(pCut) + 1 )
44#define Sle_ForEachCut1( pList, pCut, i ) for ( i = 0, pCut = pList + 1; i <= pList[0]; i++, pCut += Sle_CutSize(pCut) + 1 )
61static inline int Sle_CutMergeOrder(
int * pCut0,
int * pCut1,
int * pCut,
int nLutSize )
63 int nSize0 = Sle_CutSize(pCut0);
64 int nSize1 = Sle_CutSize(pCut1);
65 int i, * pC0 = Sle_CutLeaves(pCut0);
66 int k, * pC1 = Sle_CutLeaves(pCut1);
67 int c, * pC = Sle_CutLeaves(pCut);
69 if ( nSize0 == nLutSize && nSize1 == nLutSize )
71 for ( i = 0; i < nSize0; i++ )
73 if ( pC0[i] != pC1[i] )
return 0;
76 pCut[0] = Sle_CutSetSizeSign( nLutSize, Sle_CutSign(pCut0) | Sle_CutSign(pCut1) );
81 if ( nSize0 == 0 )
goto FlushCut1;
82 if ( nSize1 == 0 )
goto FlushCut0;
85 if ( c == nLutSize )
return 0;
86 if ( pC0[i] < pC1[k] )
89 if ( i >= nSize0 )
goto FlushCut1;
91 else if ( pC0[i] > pC1[k] )
94 if ( k >= nSize1 )
goto FlushCut0;
98 pC[c++] = pC0[i++]; k++;
99 if ( i >= nSize0 )
goto FlushCut1;
100 if ( k >= nSize1 )
goto FlushCut0;
105 if ( c + nSize0 > nLutSize + i )
return 0;
108 pCut[0] = Sle_CutSetSizeSign( c, Sle_CutSign(pCut0) | Sle_CutSign(pCut1) );
112 if ( c + nSize1 > nLutSize + k )
return 0;
115 pCut[0] = Sle_CutSetSizeSign( c, Sle_CutSign(pCut0) | Sle_CutSign(pCut1) );
118static inline int Sle_SetCutIsContainedOrder(
int * pBase,
int * pCut )
120 int i, nSizeB = Sle_CutSize(pBase);
121 int k, nSizeC = Sle_CutSize(pCut);
122 int * pLeaveB = Sle_CutLeaves(pBase);
123 int * pLeaveC = Sle_CutLeaves(pCut);
124 if ( nSizeB == nSizeC )
126 for ( i = 0; i < nSizeB; i++ )
127 if ( pLeaveB[i] != pLeaveC[i] )
131 assert( nSizeB > nSizeC );
134 for ( i = k = 0; i < nSizeB; i++ )
136 if ( pLeaveB[i] > pLeaveC[k] )
138 if ( pLeaveB[i] == pLeaveC[k] )
146static inline int Sle_CutCountBits(
unsigned i )
148 i = i - ((i >> 1) & 0x55555555);
149 i = (i & 0x33333333) + ((i >> 2) & 0x33333333);
150 i = ((i + (i >> 4)) & 0x0F0F0F0F);
151 return (i*(0x01010101))>>24;
153static inline int Sle_SetLastCutIsContained(
Vec_Int_t * vTemp,
int * pBase )
155 int i, * pCut, * pList = Vec_IntArray(vTemp);
157 if ( Sle_CutIsUsed(pCut) && Sle_CutSize(pCut) <= Sle_CutSize(pBase) && (Sle_CutSign(pCut) & Sle_CutSign(pBase)) == Sle_CutSign(pCut) && Sle_SetCutIsContainedOrder(pBase, pCut) )
161static inline void Sle_SetAddCut(
Vec_Int_t * vTemp,
int * pCut )
163 int i, * pBase, * pList = Vec_IntArray(vTemp);
165 if ( Sle_CutIsUsed(pBase) && Sle_CutSize(pCut) < Sle_CutSize(pBase) && (Sle_CutSign(pCut) & Sle_CutSign(pBase)) == Sle_CutSign(pCut) && Sle_SetCutIsContainedOrder(pBase, pCut) )
166 Sle_CutSetUnused( pBase );
167 Vec_IntPushArray( vTemp, pCut, Sle_CutSize(pCut)+1 );
168 Vec_IntAddToEntry( vTemp, 0, 1 );
173 int * pList0 = Vec_IntEntryP( vCuts, Vec_IntEntry(vCuts, Gia_ObjFaninId0(pObj, iObj)) );
174 int * pList1 = Vec_IntEntryP( vCuts, Vec_IntEntry(vCuts, Gia_ObjFaninId1(pObj, iObj)) );
175 int * pCut0, * pCut1, i, k, Cut[8], nCuts = 0;
176 Vec_IntFill( vTemp, 1, 0 );
180 if ( Sle_CutSize(pCut0) + Sle_CutSize(pCut1) > nLutSize && Sle_CutCountBits(Sle_CutSign(pCut0) | Sle_CutSign(pCut1)) > nLutSize )
182 if ( !Sle_CutMergeOrder(pCut0, pCut1, Cut, nLutSize) )
184 if ( Sle_SetLastCutIsContained(vTemp, Cut) )
186 Sle_SetAddCut( vTemp, Cut );
189 Vec_IntWriteEntry( vCuts, iObj, Vec_IntSize(vCuts) );
190 Vec_IntPush( vCuts, -1 );
191 pList0 = Vec_IntArray(vTemp);
194 if ( !Sle_CutIsUsed(pCut0) )
196 Vec_IntPushArray( vCuts, pCut0, Sle_CutSize(pCut0)+1 );
200 Vec_IntPush( vCuts, Sle_CutSetSizeSign(1, 1<<(iObj % 28)) );
201 Vec_IntPush( vCuts, iObj );
202 Vec_IntWriteEntry( vCuts, Vec_IntEntry(vCuts, iObj), nCuts );
207 int i, iObj, nCuts = 0;
208 Vec_Int_t * vTemp = Vec_IntAlloc( 1000 );
209 Vec_Int_t * vCuts = Vec_IntAlloc( 30 * Gia_ManAndNum(
p) );
211 Vec_IntFill( vCuts, Gia_ManObjNum(
p), 0 );
214 Vec_IntWriteEntry( vCuts, iObj, Vec_IntSize(vCuts) );
215 Vec_IntPush( vCuts, 0 );
216 Vec_IntPush( vCuts, Sle_CutSetSizeSign(1, 1<<(iObj % 28)) );
217 Vec_IntPush( vCuts, iObj );
222 printf(
"Nodes = %d. Cuts = %d. Cuts/Node = %.2f. Ints/Node = %.2f. Mem = %.2f MB.\n",
223 Gia_ManAndNum(
p), nCuts, 1.0*nCuts/Gia_ManAndNum(
p),
224 1.0*(Vec_IntSize(vCuts)-Gia_ManObjNum(
p))/Gia_ManAndNum(
p),
225 1.0*Vec_IntMemory(vCuts) / (1<<20) );
226 Vec_IntFree( vTemp );
243 int nSize = Sle_CutSize(pCut);
244 int k, * pC = Sle_CutLeaves(pCut);
246 for ( k = 0; k < nSize; k++ )
247 DelayMax = Abc_MaxInt( DelayMax, Vec_IntEntry(vTime, pC[k]) );
253 int * pList = Vec_IntEntryP( vCuts, Vec_IntEntry(vCuts, iObj) );
257 DelayMin = Abc_MinInt( DelayMin, Delay );
259 Vec_IntWriteEntry( vTime, iObj, DelayMin );
264 int iObj, Delay, DelayMax = 0;
265 Vec_Int_t * vTime = Vec_IntStart( Gia_ManObjNum(
p) );
269 DelayMax = Abc_MaxInt( DelayMax, Delay );
271 Vec_IntFree( vTime );
289 int nSize = Sle_CutSize(pCut);
290 int k, * pC = Sle_CutLeaves(pCut);
292 for ( k = 0; k < nSize; k++ )
293 printf(
" %d", pC[k] );
299 int * pList = Vec_IntEntryP( vCuts, Vec_IntEntry(vCuts, iObj) );
300 printf(
"Obj %3d\n", iObj );
315 Vec_IntFree( vCuts );
334 Vec_Bit_t * vMask = Vec_BitStart( Gia_ManObjNum(pGia) );
336 Vec_BitWriteEntry( vMask, iObj, 1 );
353 int k, * pC = Sle_CutLeaves(pCut);
354 for ( k = 0; k < Sle_CutSize(pCut); k++ )
355 if ( Vec_BitEntry(vMask, pC[k]) )
373 int i, iFanin, * pCut, * pList = Vec_IntEntryP( vCuts, Vec_IntEntry(vCuts, iObj) );
376 int nSize = Sle_CutSize(pCut);
377 int k, * pC = Sle_CutLeaves(pCut);
379 for ( k = 0; k < nSize; k++ )
380 if ( Vec_BitEntry(vMask, pC[k]) && !Vec_BitEntry(vMap, pC[k]) )
382 Vec_BitWriteEntry( vMap, pC[k], 1 );
383 Vec_IntPush( vCutFanins, pC[k] );
387 Vec_BitWriteEntry( vMap, iFanin, 0 );
392 Vec_Bit_t * vMap = Vec_BitStart( Gia_ManObjNum(pGia) );
393 Vec_Wec_t * vCutFanins = Vec_WecStart( Gia_ManObjNum(pGia) );
437static inline int * Sle_ManList(
Sle_Man_t *
p,
int i ) {
return Vec_IntEntryP(
p->vCuts, Vec_IntEntry(
p->vCuts, i)); }
454 p->nLevels = nLevels;
455 p->fVerbose = fVerbose;
459 p->vFanoutEdges = Vec_WecStart( Gia_ManObjNum(pGia) );
460 p->vEdgeCuts = Vec_WecAlloc( 100 );
461 p->vObjMap = Vec_IntStartFull( Gia_ManObjNum(pGia) );
462 p->vCutFirst = Vec_IntStartFull( Gia_ManObjNum(pGia) );
463 p->vEdgeFirst = Vec_IntStartFull( Gia_ManObjNum(pGia) );
464 p->vDelayFirst = Vec_IntStartFull( Gia_ManObjNum(pGia) );
465 p->vPolars = Vec_IntAlloc( 100 );
466 p->vLits = Vec_IntAlloc( 100 );
473 Vec_BitFree(
p->vMask );
474 Vec_IntFree(
p->vCuts );
475 Vec_WecFree(
p->vCutFanins );
476 Vec_WecFree(
p->vFanoutEdges );
477 Vec_WecFree(
p->vEdgeCuts );
478 Vec_IntFree(
p->vObjMap );
479 Vec_IntFree(
p->vCutFirst );
480 Vec_IntFree(
p->vEdgeFirst );
481 Vec_IntFree(
p->vDelayFirst );
482 Vec_IntFree(
p->vPolars );
483 Vec_IntFree(
p->vLits );
500 int iObj, Counter = Gia_ManObjNum(
p->pGia);
502 p->nNodeVars = Counter;
506 Vec_IntWriteEntry(
p->vCutFirst, iObj, Counter );
507 Counter += Sle_ListCutNum( Sle_ManList(
p, iObj) );
509 p->nCutVars = Counter -
p->nNodeVars;
513 Vec_IntWriteEntry(
p->vEdgeFirst, iObj, Counter );
514 Counter += Vec_IntSize( Vec_WecEntry(
p->vCutFanins, iObj) );
516 p->nEdgeVars = Counter -
p->nCutVars -
p->nNodeVars;
520 Vec_IntWriteEntry(
p->vDelayFirst, iObj, Counter );
521 Counter +=
p->nLevels;
523 p->nDelayVars = Counter -
p->nEdgeVars -
p->nCutVars -
p->nNodeVars;
524 p->nVarsTotal = Counter;
540static inline int Sle_ManCheckContained(
int * pCutLeaves,
int nCutLeaves,
int * pLutFanins,
int nLutFanins )
543 if ( nCutLeaves > nLutFanins )
545 for ( i = 0; i < nCutLeaves; i++ )
547 for ( k = 0; k < nLutFanins; k++ )
548 if ( pCutLeaves[i] == pLutFanins[k] )
550 if ( k == nLutFanins )
558 int i, iObj, iFanin, iEdge;
559 if ( !Gia_ManHasMapping(
p->pGia) )
562 Vec_IntClear(
p->vPolars );
565 int nFanins, * pFanins, * pCut, * pList, iFound = -1;
566 if ( !Gia_ObjIsLut(
p->pGia, iObj) )
568 Vec_IntPush(
p->vPolars, iObj );
569 nFanins = Gia_ObjLutSize(
p->pGia, iObj );
570 pFanins = Gia_ObjLutFanins(
p->pGia, iObj );
572 pList = Sle_ManList(
p, iObj );
574 if ( Sle_ManCheckContained( Sle_CutLeaves(pCut), Sle_CutSize(pCut), pFanins, nFanins ) )
581 printf(
"Cannot find the following cut at node %d: {", iObj );
582 for ( i = 0; i < nFanins; i++ )
583 printf(
" %d", pFanins[i] );
589 Vec_IntPush(
p->vPolars, Vec_IntEntry(
p->vCutFirst, iObj) + iFound );
592 Vec_IntPush(
p->vPolars, Vec_IntEntry(
p->vDelayFirst, iObj) );
594 Vec_IntSort(
p->vPolars, 0 );
596 if ( !
p->pGia->vEdge1 )
602 assert( Gia_ObjIsLut(
p->pGia, iFanin) );
603 assert( Gia_ObjIsLut(
p->pGia, iObj) );
604 assert( Gia_ObjIsAnd(Gia_ManObj(
p->pGia, iFanin)) );
605 assert( Gia_ObjIsAnd(Gia_ManObj(
p->pGia, iObj)) );
607 iEdge = Vec_IntFind( Vec_WecEntry(
p->vCutFanins, iObj), iFanin );
611 Vec_IntPush(
p->vPolars, Vec_IntEntry(
p->vEdgeFirst, iObj) + iEdge );
613 Vec_IntFree( vEdges );
637 sat_solver_set_runtime_limit(
p->pSat, nTimeOut ? nTimeOut * CLOCKS_PER_SEC + Abc_Clock(): 0 );
638 sat_solver_set_random(
p->pSat, 1 );
639 sat_solver_set_polarity(
p->pSat, Vec_IntArray(
p->vPolars), Vec_IntSize(
p->vPolars) );
644 if ( Vec_BitEntry(
p->vMask, iObj) )
646 Vec_IntFill(
p->vLits, 1, Abc_Var2Lit(iObj, 0) );
654 int e, iEdge, nEdges = 0, Entry;
655 int iCutVar0 = Vec_IntEntry(
p->vCutFirst, iObj );
656 int iEdgeVar0 = Vec_IntEntry(
p->vEdgeFirst, iObj );
657 int * pCut, * pList = Sle_ManList(
p, iObj );
658 Vec_Int_t * vCutFans = Vec_WecEntry(
p->vCutFanins, iObj );
659 assert( iCutVar0 > 0 && iEdgeVar0 > 0 );
661 Vec_IntFill(
p->vLits, 1, Abc_Var2Lit(iObj, 1) );
662 for ( i = 0; i < Sle_ListCutNum(pList); i++ )
663 Vec_IntPush(
p->vLits, Abc_Var2Lit(iCutVar0 + i, 0) );
667 for ( i = 0; i < Sle_ListCutNum(pList); i++ )
668 for ( e = i+1; e < Sle_ListCutNum(pList); e++ )
670 Vec_IntFillTwo(
p->vLits, 2, Abc_Var2Lit(iCutVar0 + i, 1), Abc_Var2Lit(iCutVar0 + e, 1) );
675 Vec_WecInit(
p->vEdgeCuts, Vec_IntSize(vCutFans) );
678 int nSize = Sle_CutSize(pCut);
679 int k, * pC = Sle_CutLeaves(pCut);
681 for ( k = 0; k < nSize; k++ )
683 if ( !Vec_BitEntry(
p->vMask, pC[k]) )
685 Vec_IntFillTwo(
p->vLits, 2, Abc_Var2Lit(iCutVar0 + i, 1), Abc_Var2Lit(pC[k], 0) );
689 iEdge = Vec_IntEntry(
p->vObjMap, pC[k]);
692 Vec_IntWriteEntry(
p->vObjMap, pC[k], (iEdge = nEdges++) );
693 Vec_WecPush(
p->vFanoutEdges, pC[k], iEdgeVar0 + iEdge );
695 Vec_WecPush(
p->vEdgeCuts, iEdge, iCutVar0 + i );
699 Vec_IntFillTwo(
p->vLits, 2, Abc_Var2Lit(iCutVar0 + i, 1), Abc_Var2Lit(iObj, 0) );
703 assert( nEdges == Vec_IntSize(vCutFans) );
708 assert( Vec_IntSize(vArray) > 0 );
709 Vec_IntFill(
p->vLits, 1, Abc_Var2Lit(iEdgeVar0 + e, 1) );
711 Vec_IntPush(
p->vLits, Abc_Var2Lit(Entry, 0) );
719 Vec_IntWriteEntry(
p->vObjMap, Entry, -1 );
725 int j, k, EdgeJ, EdgeK;
726 int iEdgeVar0 = Vec_IntEntry(
p->vEdgeFirst, iObj );
727 Vec_Int_t * vCutFans = Vec_WecEntry(
p->vCutFanins, iObj );
729 for ( i = 0; i < Vec_IntSize(vCutFans); i++ )
730 Vec_IntPush( vArray, iEdgeVar0 + i );
737 Vec_IntFillTwo(
p->vLits, 2, Abc_Var2Lit(EdgeJ, 1), Abc_Var2Lit(EdgeK, 1) );
741 p->nEdgeClas2 += Vec_IntSize(vArray) * (Vec_IntSize(vArray) - 1) / 2;
748 int iEdgeVar0 = Vec_IntEntry(
p->vEdgeFirst, iObj );
749 int iDelayVar0 = Vec_IntEntry(
p->vDelayFirst, iObj );
750 Vec_Int_t * vCutFans = Vec_WecEntry(
p->vCutFanins, iObj );
752 int * pCut, * pList = Sle_ManList(
p, iObj );
756 Vec_IntFill(
p->vLits, 1, Abc_Var2Lit(iDelayVar0, 0) );
767 int d, iDelayVarIn = Vec_IntEntry(
p->vDelayFirst, iFanin );
768 for ( d = 0; d <
p->nLevels; d++ )
770 Vec_IntClear(
p->vLits );
771 Vec_IntPush(
p->vLits, Abc_Var2Lit(iObj, 1) );
772 Vec_IntPush(
p->vLits, Abc_Var2Lit(iFanin, 1) );
773 Vec_IntPush(
p->vLits, Abc_Var2Lit(iDelayVarIn + d, 1) );
774 Vec_IntPush(
p->vLits, Abc_Var2Lit(iEdgeVar0 + e, 0) );
775 if ( d < p->nLevels-1 )
776 Vec_IntPush(
p->vLits, Abc_Var2Lit(iDelayVar0 + d+1, 0) );
780 Vec_IntClear(
p->vLits );
781 Vec_IntPush(
p->vLits, Abc_Var2Lit(iObj, 1) );
782 Vec_IntPush(
p->vLits, Abc_Var2Lit(iFanin, 1) );
783 Vec_IntPush(
p->vLits, Abc_Var2Lit(iDelayVarIn + d, 1) );
784 if ( d < p->nLevels-1 )
785 Vec_IntPush(
p->vLits, Abc_Var2Lit(iEdgeVar0 + e, 1) );
786 Vec_IntPush(
p->vLits, Abc_Var2Lit(iDelayVar0 + d, 0) );
790 p->nDelayClas += 2*
p->nLevels;
810 int value, iObj, nAdded = 0;
811 assert( nEdges == 1 || nEdges == 2 );
814 int j, k, EdgeJ, EdgeK;
816 Vec_IntClear( vTemp );
818 if ( sat_solver_var_value(
p->pSat, EdgeJ) )
819 Vec_IntPush( vTemp, EdgeJ );
820 if ( Vec_IntSize(vTemp) <= nEdges )
829 Vec_IntFillTwo(
p->vLits, 2, Abc_Var2Lit(EdgeJ, 1), Abc_Var2Lit(EdgeK, 1) );
833 p->nEdgeClas2 += Vec_IntSize(vTemp) * (Vec_IntSize(vTemp) - 1) / 2;
835 else if ( nEdges == 2 )
843 Vec_IntFillTwo(
p->vLits, 2, Abc_Var2Lit(EdgeJ, 1), Abc_Var2Lit(EdgeK, 1) );
844 Vec_IntPush(
p->vLits, Abc_Var2Lit(EdgeM, 1) );
848 p->nEdgeClas2 += Vec_IntSize(vTemp) * (Vec_IntSize(vTemp) - 1) * (Vec_IntSize(vTemp) - 2) / 6;
852 Vec_IntFree( vTemp );
873 Vec_IntFill( vMapping, Gia_ManObjNum(
p->pGia), 0 );
876 int i, iCut, iCutVar0 = Vec_IntEntry(
p->vCutFirst, iObj );
877 int * pCut, * pCutThis = NULL, * pList = Sle_ManList(
p, iObj );
878 if ( !sat_solver_var_value(
p->pSat, iObj) )
881 if ( sat_solver_var_value(
p->pSat, iCutVar0 + iCut) )
883 assert( pCutThis == NULL );
886 assert( pCutThis != NULL );
887 Vec_IntWriteEntry( vMapping, iObj, Vec_IntSize(vMapping) );
888 Vec_IntPush( vMapping, Sle_CutSize(pCutThis) );
889 for ( i = 0; i < Sle_CutSize(pCutThis); i++ )
890 Vec_IntPush( vMapping, Sle_CutLeaves(pCutThis)[i] );
891 Vec_IntPush( vMapping, iObj );
893 vMapTemp =
p->pGia->vMapping;
894 p->pGia->vMapping = vMapping;
896 Vec_IntClear( vEdge2 );
899 int i, iFanin, iEdgeVar0 = Vec_IntEntry(
p->vEdgeFirst, iObj );
900 Vec_Int_t * vCutFans = Vec_WecEntry(
p->vCutFanins, iObj );
903 if ( !sat_solver_var_value(
p->pSat, iObj) )
909 if ( sat_solver_var_value(
p->pSat, iFanin) && sat_solver_var_value(
p->pSat, iEdgeVar0 + i) )
912 int * pFanins = Gia_ObjLutFanins(
p->pGia, iObj );
913 int k, nFanins = Gia_ObjLutSize(
p->pGia, iObj );
914 for ( k = 0; k < nFanins; k++ )
917 if ( pFanins[k] == iFanin )
924 Vec_IntPushTwo( vEdge2, iFanin, iObj );
927 p->pGia->vMapping = vMapTemp;
943 int fVeryVerbose = 0;
945 Vec_Int_t * vEdges2 = Vec_IntAlloc(1000);
946 Vec_Int_t * vMapping = Vec_IntAlloc(1000);
947 int i, iLut, nConfs, status, Delay, iFirstVar;
948 int DelayStart = (DelayInit || !Gia_ManHasMapping(pGia)) ? DelayInit :
Gia_ManLutLevel(pGia, NULL);
951 printf(
"Running solver with %d conflicts, %d initial delay, and %d edges. Dynamic constraints = %s.\n", nBTLimit, DelayInit, 1+fTwoEdges, fDynamic?
"yes":
"no" );
954 printf(
"Vars: Total = %d. Node = %d. Cut = %d. Edge = %d. Delay = %d.\n",
955 p->nVarsTotal,
p->nNodeVars,
p->nCutVars,
p->nEdgeVars,
p->nDelayVars );
959 printf(
"Clas: Total = %d. Cut = %d. Edge = %d. EdgeEx = %d. Delay = %d.\n",
962 for ( Delay =
p->nLevels; Delay >= 0; Delay-- )
965 if ( Delay < p->nLevels )
968 if ( Vec_BitEntry(
p->vMask, iLut) )
970 iFirstVar = Vec_IntEntry(
p->vDelayFirst, iLut );
974 if ( i < Gia_ManCoNum(
p->pGia) )
978 printf(
"Proved UNSAT for delay %d. ", Delay );
979 Abc_PrintTime( 1,
"Time", Abc_Clock() - clk );
1001 int nNodes = 0, nEdges = 0;
1002 for ( i = 0; i <
p->nNodeVars; i++ )
1003 nNodes += sat_solver_var_value(
p->pSat, i);
1004 for ( i = 0; i <
p->nEdgeVars; i++ )
1005 nEdges += sat_solver_var_value(
p->pSat,
p->nNodeVars +
p->nCutVars + i);
1006 printf(
"Solution with delay %2d, node count %5d, and edge count %5d exists. Conf = %8d. ", Delay, nNodes, nEdges, nConfs );
1007 Abc_PrintTime( 1,
"Time", Abc_Clock() - clk );
1013 printf(
"Nodes: " );
1014 for ( i = 0; i <
p->nNodeVars; i++ )
1015 if ( sat_solver_var_value(
p->pSat, i) )
1020 Vec_IntPrint(
p->vCutFirst );
1022 for ( i = 0; i <
p->nCutVars; i++ )
1023 if ( sat_solver_var_value(
p->pSat,
p->nNodeVars + i) )
1024 printf(
"%d ",
p->nNodeVars + i );
1028 Vec_IntPrint(
p->vEdgeFirst );
1029 printf(
"Edges: " );
1030 for ( i = 0; i <
p->nEdgeVars; i++ )
1031 if ( sat_solver_var_value(
p->pSat,
p->nNodeVars +
p->nCutVars + i) )
1032 printf(
"%d ",
p->nNodeVars +
p->nCutVars + i );
1036 Vec_IntPrint(
p->vDelayFirst );
1037 printf(
"Delays: " );
1038 for ( i = 0; i <
p->nDelayVars; i++ )
1039 if ( sat_solver_var_value(
p->pSat,
p->nNodeVars +
p->nCutVars +
p->nEdgeVars + i) )
1040 printf(
"%d ",
p->nNodeVars +
p->nCutVars +
p->nEdgeVars + i );
1050 printf(
"Proved UNSAT for delay %d. Conf = %8d. ", Delay, nConfs );
1052 printf(
"Resource limit reached for delay %d. Conf = %8d. ", Delay, nConfs );
1053 Abc_PrintTime( 1,
"Time", Abc_Clock() - clk );
1059 printf(
"Clas: Total = %d. Cut = %d. Edge = %d. EdgeEx = %d. Delay = %d. Calls = %d.\n",
1061 if ( Vec_IntSize(vMapping) > 0 )
1064 Vec_IntFree( vEdges2 );
1065 Vec_IntFreeP( &
p->pGia->vMapping );
1066 p->pGia->vMapping = vMapping;
1070 Vec_IntFree( vEdges2 );
1071 Vec_IntFree( vMapping );
1073 Vec_IntFreeP( &
p->pGia->vPacking );
#define ABC_INFINITY
MACRO DEFINITIONS ///.
#define ABC_CALLOC(type, num)
#define ABC_NAMESPACE_IMPL_START
#define ABC_NAMESPACE_IMPL_END
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
ABC_NAMESPACE_IMPL_START typedef signed char value
#define sat_solver_addclause
int Sle_ManCutMerge(Gia_Man_t *p, int iObj, Vec_Int_t *vCuts, Vec_Int_t *vTemp, int nLutSize)
void Sle_ManMarkupVariables(Sle_Man_t *p)
struct Sle_Man_t_ Sle_Man_t
void Sle_ManExplore(Gia_Man_t *pGia, int nBTLimit, int DelayInit, int fDynamic, int fTwoEdges, int fVerbose)
#define Sle_ForEachCut(pList, pCut, i)
int Sle_ManComputeDelayOne(Gia_Man_t *p, int iObj, Vec_Int_t *vCuts, Vec_Int_t *vTime)
#define Sle_ForEachCut1(pList, pCut, i)
void Sle_ManPrintCuts(Gia_Man_t *p, Vec_Int_t *vCuts, int iObj)
int Sle_ManAddEdgeConstraints(Sle_Man_t *p, int nEdges)
Vec_Bit_t * Sle_ManInternalNodeMask(Gia_Man_t *pGia)
void Sle_ManDeriveCnf(Sle_Man_t *p, int nBTLimit, int fDynamic)
int Sle_ManCutHasPisOnly(int *pCut, Vec_Bit_t *vMask)
int Sle_ManComputeDelay(Gia_Man_t *p, Vec_Int_t *vCuts)
void Sle_ManPrintCut(int *pCut)
int Sle_ManComputeDelayCut(Gia_Man_t *p, int *pCut, Vec_Int_t *vTime)
void Sle_ManDeriveResult(Sle_Man_t *p, Vec_Int_t *vEdge2, Vec_Int_t *vMapping)
Sle_Man_t * Sle_ManAlloc(Gia_Man_t *pGia, int nLevels, int fVerbose)
void Sle_ManComputeCutsTest(Gia_Man_t *p)
Vec_Wec_t * Sle_ManCollectCutFanins(Gia_Man_t *pGia, Vec_Int_t *vCuts, Vec_Bit_t *vMask)
void Sle_ManDeriveInit(Sle_Man_t *p)
void Sle_ManStop(Sle_Man_t *p)
void Sle_ManPrintCutsAll(Gia_Man_t *p, Vec_Int_t *vCuts)
Vec_Int_t * Sle_ManComputeCuts(Gia_Man_t *p, int nLutSize, int fVerbose)
void Sle_ManCollectCutFaninsOne(Gia_Man_t *pGia, int iObj, Vec_Int_t *vCuts, Vec_Bit_t *vMask, Vec_Int_t *vCutFanins, Vec_Bit_t *vMap)
int Gia_ManLutLevel(Gia_Man_t *p, int **ppLevels)
Vec_Int_t * Gia_ManEdgeToArray(Gia_Man_t *p)
#define Gia_ManForEachCoDriverId(p, DriverId, i)
struct Gia_Obj_t_ Gia_Obj_t
struct Gia_Man_t_ Gia_Man_t
void Gia_ManEdgeFromArray(Gia_Man_t *p, Vec_Int_t *vArray)
FUNCTION DEFINITIONS ///.
#define Gia_ManForEachAndId(p, i)
#define Gia_ManForEachCiId(p, Id, i)
sat_solver * sat_solver_new(void)
int sat_solver_solve_internal(sat_solver *s)
int sat_solver_nconflicts(sat_solver *s)
int sat_solver_nclauses(sat_solver *s)
void sat_solver_setnvars(sat_solver *s, int n)
int sat_solver_push(sat_solver *s, int p)
void sat_solver_set_resource_limits(sat_solver *s, ABC_INT64_T nConfLimit, ABC_INT64_T nInsLimit, ABC_INT64_T nConfLimitGlobal, ABC_INT64_T nInsLimitGlobal)
void sat_solver_delete(sat_solver *s)
typedefABC_NAMESPACE_HEADER_START struct Vec_Bit_t_ Vec_Bit_t
INCLUDES ///.
#define Vec_IntForEachEntryDouble(vVec, Entry1, Entry2, i)
#define Vec_IntForEachEntry(vVec, Entry, i)
MACRO DEFINITIONS ///.
#define Vec_IntForEachEntryStart(vVec, Entry, i, Start)
#define Vec_WecForEachLevel(vGlob, vVec, i)
MACRO DEFINITIONS ///.
typedefABC_NAMESPACE_HEADER_START struct Vec_Wec_t_ Vec_Wec_t
INCLUDES ///.