31#define SBD_MAX_LUTSIZE 6
77static inline int * Sbd_ObjCut(
Sbd_Man_t *
p,
int i ) {
return Vec_IntEntryP(
p->vLutCuts, (
p->pPars->nLutSize + 1) * i ); }
78static inline int * Sbd_ObjCut2(
Sbd_Man_t *
p,
int i ) {
return Vec_IntEntryP(
p->vLutCuts2, (
p->pPars->nLutSize + 1) * i ); }
80static inline word * Sbd_ObjSim0(
Sbd_Man_t *
p,
int i ) {
return Vec_WrdEntryP(
p->vSims[0],
p->pPars->nWords * i ); }
81static inline word * Sbd_ObjSim1(
Sbd_Man_t *
p,
int i ) {
return Vec_WrdEntryP(
p->vSims[1],
p->pPars->nWords * i ); }
82static inline word * Sbd_ObjSim2(
Sbd_Man_t *
p,
int i ) {
return Vec_WrdEntryP(
p->vSims[2],
p->pPars->nWords * i ); }
83static inline word * Sbd_ObjSim3(
Sbd_Man_t *
p,
int i ) {
return Vec_WrdEntryP(
p->vSims[3],
p->pPars->nWords * i ); }
105 pPars->nCutSize = (pPars->nLutSize - 1) * pPars->nLutNum + 1;
106 pPars->nCutNum = 128;
107 pPars->nTfoLevels = 5;
108 pPars->nTfoFanMax = 4;
109 pPars->nWinSizeMax = 2000;
113 pPars->fMoreCuts = 0;
114 pPars->fFindDivs = 0;
119 pPars->fVeryVerbose = 0;
137 Vec_Wec_t * vTfos = Vec_WecStart( Gia_ManObjNum(
p) );
138 Vec_Wec_t * vTemp = Vec_WecStart( Gia_ManObjNum(
p) );
139 Vec_Int_t * vNodes, * vNodes0, * vNodes1;
140 Vec_Bit_t * vPoDrivers = Vec_BitStart( Gia_ManObjNum(
p) );
141 int i, k, k2, Id, Fan;
147 vNodes = Vec_WecEntry( vTemp, Id );
148 Vec_IntGrow( vNodes, 1 );
149 Vec_IntPush( vNodes, Id );
152 Vec_BitWriteEntry( vPoDrivers, Id, 1 );
155 int fAlwaysRoot = Vec_BitEntry(vPoDrivers, Id) || (Gia_ObjRefNumId(
p, Id) >= nTfoFanMax);
156 vNodes0 = Vec_WecEntry( vTemp, Gia_ObjFaninId0(Gia_ManObj(
p, Id), Id) );
157 vNodes1 = Vec_WecEntry( vTemp, Gia_ObjFaninId1(Gia_ManObj(
p, Id), Id) );
158 vNodes = Vec_WecEntry( vTemp, Id );
159 Vec_IntTwoMerge2( vNodes0, vNodes1, vNodes );
163 int fRoot = fAlwaysRoot || (Gia_ObjLevelId(
p, Id) - Gia_ObjLevelId(
p, Fan) >= nTfoLevels);
164 Vec_WecPush( vTfos, Fan, Abc_Var2Lit(Id, fRoot) );
165 if ( !fRoot ) Vec_IntWriteEntry( vNodes, k2++, Fan );
167 Vec_IntShrink( vNodes, k2 );
169 Vec_IntPush( vNodes, Id );
171 Vec_WecFree( vTemp );
172 Vec_BitFree( vPoDrivers );
178 if ( !Gia_ObjIsAnd(Gia_ManObj(
p, i)) )
180 printf(
"Node %3d : ", i );
182 printf(
"%d%s ", Abc_Lit2Var(Fan), Abc_LitIsCompl(Fan)?
"*":
"" );
204 p->timeTotal = Abc_Clock();
208 p->vLutLevs = Vec_IntStart( Gia_ManObjNum(pGia) );
209 p->vLutCuts = Vec_IntStart( Gia_ManObjNum(pGia) * (
p->pPars->nLutSize + 1) );
210 p->vMirrors = Vec_IntStartFull( Gia_ManObjNum(pGia) );
211 for ( i = 0; i < 4; i++ )
212 p->vSims[i] = Vec_WrdStart( Gia_ManObjNum(pGia) *
p->pPars->nWords );
214 p->vCover = Vec_IntAlloc( 100 );
215 p->vLits = Vec_IntAlloc( 100 );
216 p->vLits2 = Vec_IntAlloc( 100 );
217 p->vRoots = Vec_IntAlloc( 100 );
218 p->vWinObjs = Vec_IntAlloc( Gia_ManObjNum(pGia) );
219 p->vObj2Var = Vec_IntStart( Gia_ManObjNum(pGia) );
220 p->vDivSet = Vec_IntAlloc( 100 );
221 p->vDivVars = Vec_IntAlloc( 100 );
222 p->vDivValues = Vec_IntAlloc( 100 );
223 p->vDivLevels = Vec_WecAlloc( 100 );
224 p->vCounts[0] = Vec_IntAlloc( 100 );
225 p->vCounts[1] = Vec_IntAlloc( 100 );
226 p->vMatrix = Vec_WrdAlloc( 100 );
230 int * pCut = Sbd_ObjCut(
p, Id );
237 for ( w = 0; w <
p->pPars->nWords; w++ )
240 if ( pPars->fMoreCuts )
241 p->pSto =
Sbd_StoAlloc( pGia,
p->vMirrors, pPars->nLutSize, pPars->nCutSize, pPars->nCutNum, !pPars->fMapping, 1 );
244 p->pSto =
Sbd_StoAlloc( pGia,
p->vMirrors, pPars->nLutSize, pPars->nLutSize, pPars->nCutNum, !pPars->fMapping, 1 );
245 p->pSrv =
Sbd_ManCutServerStart( pGia,
p->vMirrors,
p->vLutLevs, NULL, NULL, pPars->nLutSize, pPars->nCutSize, pPars->nCutNum, 0 );
252 Vec_WecFree(
p->vTfos );
253 Vec_IntFree(
p->vLutLevs );
254 Vec_IntFree(
p->vLutCuts );
255 Vec_IntFree(
p->vMirrors );
256 for ( i = 0; i < 4; i++ )
257 Vec_WrdFree(
p->vSims[i] );
258 Vec_IntFree(
p->vCover );
259 Vec_IntFree(
p->vLits );
260 Vec_IntFree(
p->vLits2 );
261 Vec_IntFree(
p->vRoots );
262 Vec_IntFree(
p->vWinObjs );
263 Vec_IntFree(
p->vObj2Var );
264 Vec_IntFree(
p->vDivSet );
265 Vec_IntFree(
p->vDivVars );
266 Vec_IntFree(
p->vDivValues );
267 Vec_WecFree(
p->vDivLevels );
268 Vec_IntFree(
p->vCounts[0] );
269 Vec_IntFree(
p->vCounts[1] );
270 Vec_WrdFree(
p->vMatrix );
271 sat_solver_delete_p( &
p->pSat );
291 Gia_Obj_t * pNode = Gia_ManObj(
p->pGia, Node);
int w;
292 int iObj0 = Gia_ObjFaninId0(pNode, Node);
293 int iObj1 = Gia_ObjFaninId1(pNode, Node);
299 word * pCtrl = Sbd_ObjSim2(
p, Node);
300 word * pCtrl0 = Sbd_ObjSim2(
p, iObj0);
301 word * pCtrl1 = Sbd_ObjSim2(
p, iObj1);
303 word * pDtrl = Sbd_ObjSim3(
p, Node);
304 word * pDtrl0 = Sbd_ObjSim3(
p, iObj0);
305 word * pDtrl1 = Sbd_ObjSim3(
p, iObj1);
310 for ( w = 0; w <
p->pPars->nWords; w++ )
315 pCtrl0[w] |= pCtrl[w];
316 pCtrl1[w] |= pCtrl[w];
318 pDtrl0[w] |= pDtrl[w];
319 pDtrl1[w] |= pDtrl[w];
326 Abc_TtCopy( Sbd_ObjSim3(
p, Pivot), Sbd_ObjSim2(
p, Pivot),
p->pPars->nWords, 0 );
328 for ( i = 0; i < Vec_IntEntry(
p->vObj2Var, Pivot) && ((Node = Vec_IntEntry(
p->vWinObjs, i)), 1); i++ )
330 Abc_TtClear( Sbd_ObjSim2(
p, Node),
p->pPars->nWords );
331 Abc_TtClear( Sbd_ObjSim3(
p, Node),
p->pPars->nWords );
335 for ( i = Vec_IntEntry(
p->vObj2Var, Pivot); i >= 0 && ((Node = Vec_IntEntry(
p->vWinObjs, i)), 1); i-- )
336 if ( Gia_ObjIsAnd(Gia_ManObj(
p->pGia, Node)) )
338 p->timeWin += Abc_Clock() - clk;
344 int nTimeValidDivs = 0;
346 int LevelMax = Vec_IntEntry(
p->vLutLevs, Pivot);
347 Vec_WecClear(
p->vDivLevels );
348 Vec_WecInit(
p->vDivLevels, LevelMax + 1 );
350 Vec_WecPush(
p->vDivLevels, Vec_IntEntry(
p->vLutLevs, Node), Node );
352 Vec_IntClear(
p->vWinObjs );
355 Vec_IntSort( vLevel, 0 );
358 Vec_IntWriteEntry(
p->vObj2Var, Node, Vec_IntSize(
p->vWinObjs) );
359 Vec_IntPush(
p->vWinObjs, Node );
362 if ( i == LevelMax - 2 )
363 nTimeValidDivs = Vec_IntSize(
p->vWinObjs);
365 assert( nTimeValidDivs > 0 );
366 Vec_IntClear(
p->vDivVars );
370 if (
p->DivCutoff == -1 && Vec_IntEntry(
p->vLutLevs, Node) == LevelMax - 2 )
371 p->DivCutoff = Vec_IntSize(
p->vDivVars);
372 Vec_IntPush(
p->vDivVars, i );
374 if (
p->DivCutoff == -1 )
384 Vec_IntFill(
p->vDivValues, Vec_IntSize(
p->vDivVars), 0 );
393 if ( Vec_IntEntry(
p->vMirrors, Node) >= 0 )
394 Node = Abc_Lit2Var( Vec_IntEntry(
p->vMirrors, Node) );
395 if ( Gia_ObjIsTravIdCurrentId(
p->pGia, Node) )
397 Gia_ObjSetTravIdCurrentId(
p->pGia, Node);
398 pObj = Gia_ManObj(
p->pGia, Node );
399 if ( Gia_ObjIsAnd(pObj) )
406 Vec_IntWriteEntry(
p->vObj2Var, Node, Vec_IntSize(
p->vWinObjs) );
407 Vec_IntPush(
p->vWinObjs, Node );
409 if ( Gia_ObjIsCi(pObj) )
412 assert( Gia_ObjIsAnd(pObj) );
413 if ( Gia_ObjIsXor(pObj) )
415 Abc_TtXor( Sbd_ObjSim0(
p, Node),
416 Sbd_ObjSim0(
p, Gia_ObjFaninId0(pObj, Node)),
417 Sbd_ObjSim0(
p, Gia_ObjFaninId1(pObj, Node)),
419 Gia_ObjFaninC0(pObj) ^ Gia_ObjFaninC1(pObj) );
422 Abc_TtXor( Sbd_ObjSim1(
p, Node),
423 Gia_ObjFanin0(pObj)->fMark0 ? Sbd_ObjSim1(
p, Gia_ObjFaninId0(pObj, Node)) : Sbd_ObjSim0(
p, Gia_ObjFaninId0(pObj, Node)),
424 Gia_ObjFanin1(pObj)->fMark0 ? Sbd_ObjSim1(
p, Gia_ObjFaninId1(pObj, Node)) : Sbd_ObjSim0(
p, Gia_ObjFaninId1(pObj, Node)),
426 Gia_ObjFaninC0(pObj) ^ Gia_ObjFaninC1(pObj) );
430 Abc_TtAndCompl( Sbd_ObjSim0(
p, Node),
431 Sbd_ObjSim0(
p, Gia_ObjFaninId0(pObj, Node)), Gia_ObjFaninC0(pObj),
432 Sbd_ObjSim0(
p, Gia_ObjFaninId1(pObj, Node)), Gia_ObjFaninC1(pObj),
436 Abc_TtAndCompl( Sbd_ObjSim1(
p, Node),
437 Gia_ObjFanin0(pObj)->fMark0 ? Sbd_ObjSim1(
p, Gia_ObjFaninId0(pObj, Node)) : Sbd_ObjSim0(
p, Gia_ObjFaninId0(pObj, Node)), Gia_ObjFaninC0(pObj),
438 Gia_ObjFanin1(pObj)->fMark0 ? Sbd_ObjSim1(
p, Gia_ObjFaninId1(pObj, Node)) : Sbd_ObjSim0(
p, Gia_ObjFaninId1(pObj, Node)), Gia_ObjFaninC1(pObj),
441 if ( Node != NodeInit )
442 Abc_TtCopy( Sbd_ObjSim0(
p, NodeInit), Sbd_ObjSim0(
p, Node),
p->pPars->nWords, Abc_LitIsCompl(Vec_IntEntry(
p->vMirrors, NodeInit)) );
450 p->vTfo = Vec_WecEntry(
p->vTfos, Pivot );
452 Vec_IntClear(
p->vWinObjs );
453 Vec_IntWriteEntry(
p->vObj2Var, 0, Vec_IntSize(
p->vWinObjs) );
454 Vec_IntPush(
p->vWinObjs, 0 );
457 Gia_ObjSetTravIdCurrentId(
p->pGia, 0);
459 if (
p->pPars->nWinSizeMax && Vec_IntSize(
p->vWinObjs) >
p->pPars->nWinSizeMax )
461 p->timeWin += Abc_Clock() - clk;
465 assert( Vec_IntSize(
p->vDivVars) == Vec_IntSize(
p->vDivValues) );
466 assert( Vec_IntSize(
p->vDivVars) < Vec_IntSize(
p->vWinObjs) );
468 Gia_ManObj(
p->pGia, Pivot)->fMark0 = 1;
469 Abc_TtCopy( Sbd_ObjSim1(
p, Pivot), Sbd_ObjSim0(
p, Pivot),
p->pPars->nWords, 1 );
471 Vec_IntClear(
p->vRoots );
474 Gia_ManObj(
p->pGia, Abc_Lit2Var(Node))->fMark0 = 1;
475 if ( !Abc_LitIsCompl(Node) )
478 Vec_IntPush(
p->vRoots, Abc_Lit2Var(Node) );
481 Gia_ManObj(
p->pGia, Pivot)->fMark0 = 0;
484 Gia_ManObj(
p->pGia, Abc_Lit2Var(Node))->fMark0 = 0;
485 Vec_IntWriteEntry(
p->vObj2Var, Abc_Lit2Var(Node), Vec_IntSize(
p->vWinObjs) );
486 Vec_IntPush(
p->vWinObjs, Abc_Lit2Var(Node) );
488 if (
p->pPars->nWinSizeMax && Vec_IntSize(
p->vWinObjs) >
p->pPars->nWinSizeMax )
490 p->timeWin += Abc_Clock() - clk;
494 if ( Vec_IntSize(
p->vTfo) == 0 )
495 Abc_TtFill( Sbd_ObjSim2(
p, Pivot),
p->pPars->nWords );
497 Abc_TtClear( Sbd_ObjSim2(
p, Pivot),
p->pPars->nWords );
499 if ( Abc_LitIsCompl(Node) )
500 Abc_TtOrXor( Sbd_ObjSim2(
p, Pivot), Sbd_ObjSim0(
p, Abc_Lit2Var(Node)), Sbd_ObjSim1(
p, Abc_Lit2Var(Node)),
p->pPars->nWords );
501 p->timeWin += Abc_Clock() - clk;
504 assert( Vec_IntSize(
p->vDivValues) <= 64 );
505 return (
int)(Vec_IntSize(
p->vDivValues) <= 64);
523 word * pSims = Sbd_ObjSim0(
p, Pivot );
524 word * pCtrl = Sbd_ObjSim2(
p, Pivot );
525 int PivotVar = Vec_IntEntry(
p->vObj2Var, Pivot);
526 int RetValue, i, iObj, Ind, fFindOnset, nCares[2] = {0};
529 p->pSat =
Sbd_ManSatSolver(
p->pSat,
p->pGia,
p->vMirrors, Pivot,
p->vWinObjs,
p->vObj2Var,
p->vTfo,
p->vRoots, 0 );
530 p->timeCnf += Abc_Clock() - clk;
531 if (
p->pSat == NULL )
535 Vec_IntWriteEntry(
p->vLutLevs, Pivot, 0 );
543 Vec_IntClear(
p->vLits );
544 for ( i = 0; i < 64; i++ )
545 if ( Abc_TtGetBit(pCtrl, i) )
546 nCares[Abc_TtGetBit(pSims, i)]++;
548 Vec_IntPush(
p->vLits, i );
549 fFindOnset = (int)(nCares[0] < nCares[1]);
550 if ( nCares[0] >= nMintCount && nCares[1] >= nMintCount )
553 nCares[0] = nCares[0] < nMintCount ? nMintCount - nCares[0] : 0;
554 nCares[1] = nCares[1] < nMintCount ? nMintCount - nCares[1] : 0;
556 if (
p->pPars->fVeryVerbose )
557 printf(
"Computing %d offset and %d onset minterms for node %d.\n", nCares[0], nCares[1], Pivot );
559 if ( Vec_IntSize(
p->vLits) >= nCares[0] + nCares[1] )
560 Vec_IntShrink(
p->vLits, nCares[0] + nCares[1] );
564 for ( i = 0; i < 64 && Vec_IntSize(
p->vLits) < nCares[0] + nCares[1]; i++ )
565 if ( fFindOnset == Abc_TtGetBit(pSims, i) )
566 Vec_IntPush(
p->vLits, i );
569 vSims = Vec_PtrAlloc( PivotVar + 1 );
572 Vec_PtrPush( vSims, Sbd_ObjSim0(
p, iObj) );
580 if ( 0 && RetValue < 0 )
582 Vec_Int_t * vPis = Vec_WecEntry(
p->vDivLevels, 0);
584 printf(
"Additional minterms:\n" );
587 for ( i = 0; i < Vec_IntSize(vPis); i++ )
588 printf(
"%d", Abc_TtGetBit( (
word *)Vec_PtrEntry(vSims, Vec_IntEntry(
p->vWinObjs, i)), Ind ) );
592 Vec_PtrFree( vSims );
595 if (
p->pPars->fVeryVerbose )
596 printf(
"Found stuck-at-%d node %d.\n", RetValue, Pivot );
597 Vec_IntWriteEntry(
p->vLutLevs, Pivot, 0 );
603 Abc_TtSetBit( pCtrl, Ind );
607 for ( i = 0; i < 64; i++ )
608 if ( Abc_TtGetBit(pCtrl, i) )
609 nCares[Abc_TtGetBit(pSims, i)]++;
610 assert( nCares[0] >= nMintCount && nCares[1] >= nMintCount );
625static inline void Sbd_TransposeMatrix64(
word A[64] )
628 word t, m = 0x00000000FFFFFFFF;
629 for ( j = 32; j != 0; j = j >> 1, m = m ^ (m << j) )
631 for ( k = 0; k < 64; k = (k + j + 1) & ~j )
633 t = (A[k] ^ (A[k+j] >> j)) & m;
635 A[k+j] = A[k+j] ^ (t << j);
639static inline void Sbd_PrintMatrix64(
word A[64] )
642 for ( j = 0; j < 64; j++, printf(
"\n") )
643 for ( k = 0; k < 64; k++ )
644 printf(
"%d", (
int)((A[j] >> k) & 1) );
661 int nDivs = Vec_IntEntry(
p->vObj2Var, Pivot) + 1;
662 int i, k, k0, k1, Id, Bit0, Bit1;
665 printf(
"%3d : ", Id ),
Extra_PrintBinary( stdout, (
unsigned *)Sbd_ObjSim0(
p, Id), 64 ), printf(
"\n" );
668 Vec_IntClear(
p->vCounts[0] );
669 Vec_IntClear(
p->vCounts[1] );
671 printf(
"Node %d. Useful divisors = %d.\n", Pivot, Vec_IntSize(
p->vDivValues) );
677 printf(
"%d", Vec_IntEntry(
p->vLutLevs, Id) );
689 printf(
"%d", Id / 100 );
700 printf(
"%d", (Id % 100) / 10 );
711 printf(
"%d", Id % 10 );
718 for ( k = 0; k <
p->pPars->nWords * 64; k++ )
720 if ( !Abc_TtGetBit(Sbd_ObjSim2(
p, Pivot), k) )
723 printf(
"%3d : ", k );
726 word * pSims = Sbd_ObjSim0(
p, Id );
727 word * pCtrl = Sbd_ObjSim2(
p, Id );
730 if ( Abc_TtGetBit(pCtrl, k) )
731 Vec_IntPush(
p->vCounts[Abc_TtGetBit(pSims, k)], k );
734 printf(
"%c", Abc_TtGetBit(pCtrl, k) ?
'0' + Abc_TtGetBit(pSims, k) :
'.' );
738 printf(
"%3d : ", k );
741 word * pSims = Sbd_ObjSim0(
p, Id );
742 word * pCtrl = Sbd_ObjSim3(
p, Id );
745 if ( Abc_TtGetBit(pCtrl, k) )
746 Vec_IntPush(
p->vCounts[Abc_TtGetBit(pSims, k)], k );
749 printf(
"%c", Abc_TtGetBit(pCtrl, k) ?
'0' + Abc_TtGetBit(pSims, k) :
'.' );
756 word * pSims = Sbd_ObjSim0(
p, Id );
760 printf(
"%c",
'0' + Abc_TtGetBit(pSims, k) );
768 word * pCtrl = Sbd_ObjSim2(
p, Id );
771 printf(
"%c",
'0' + Abc_TtGetBit(pCtrl, k) );
779 printf(
"Exploring %d x %d covering table.\n", Vec_IntSize(
p->vCounts[0]), Vec_IntSize(
p->vCounts[1]) );
796 Vec_WrdClear(
p->vMatrix );
803 word * pSims = Sbd_ObjSim0(
p, Id );
804 word * pCtrl = Sbd_ObjSim2(
p, Id );
805 if ( Abc_TtGetBit(pCtrl, Bit0) && Abc_TtGetBit(pCtrl, Bit1) && Abc_TtGetBit(pSims, Bit0) != Abc_TtGetBit(pSims, Bit1) )
806 Abc_TtXorBit( &Row, i );
808 if ( Vec_WrdPushUnique(
p->vMatrix, Row ) )
810 for ( i = 0; i < nDivs; i++ )
811 printf(
"%d", (
int)((Row >> i) & 1) );
819 for ( i = 0; i <= nCol; i++ )
821 printf(
"%2d : ", i );
822 printf(
"%d ", i == nCol ? Vec_IntEntry(
p->vLutLevs,
p->Pivot) : Vec_IntEntry(
p->vLutLevs, Vec_IntEntry(
p->vWinObjs, Vec_IntEntry(
p->vDivVars, i))) );
823 for ( k = 0; k < nRows; k++ )
824 printf(
"%d", (
int)((Cover[i] >> k) & 1) );
829static inline void Sbd_ManCoverReverseOrder(
word Cover[64] )
832 for ( i = 0; i < 32; i++ )
835 Cover[i] = Cover[63-i];
840static inline int Sbd_ManAddCube1(
int nRowLimit,
word Cover[],
int nRows,
word Cube )
845 printf(
"Adding cube: " );
846 for ( n = 0; n < nRowLimit; n++ )
847 printf(
"%d", (
int)((
Cube >> n) & 1) );
851 assert( nRows <= nRowLimit );
852 for ( n = 0; n < nRows; n++ )
853 if ( (Cover[n] &
Cube) == Cover[n] )
856 for ( n = m = 0; n < nRows; n++ )
858 Cover[m++] = Cover[n];
861 for ( n = m; n < nRows; n++ )
866static inline int Sbd_ManAddCube2(
word Cover[2][64],
int nRows,
word Cube[2] )
871 for ( n = 0; n < nRows; n++ )
872 if ( (Cover[0][n] &
Cube[0]) == Cover[0][n] && (Cover[1][n] &
Cube[1]) == Cover[1][n] )
875 for ( n = m = 0; n < nRows; n++ )
876 if ( (Cover[0][n] &
Cube[0]) !=
Cube[0] || (Cover[1][n] &
Cube[1]) !=
Cube[1] )
878 Cover[0][m] = Cover[0][n];
879 Cover[1][m] = Cover[1][n];
884 Cover[0][m] =
Cube[0];
885 Cover[1][m] =
Cube[1];
888 for ( n = m; n < nRows; n++ )
889 Cover[0][n] = Cover[1][n] = 0;
894static inline int Sbd_ManFindCandsSimple(
Sbd_Man_t *
p,
word Cover[],
int nDivs )
897 word Target = Cover[nDivs];
898 Vec_IntClear(
p->vDivSet );
899 for ( c0 = 0; c0 < nDivs; c0++ )
900 if ( Cover[c0] == Target )
902 Vec_IntPush(
p->vDivSet, c0 );
906 for ( c0 = 0; c0 < nDivs; c0++ )
907 for ( c1 = c0+1; c1 < nDivs; c1++ )
908 if ( (Cover[c0] | Cover[c1]) == Target )
910 Vec_IntPush(
p->vDivSet, c0 );
911 Vec_IntPush(
p->vDivSet, c1 );
915 for ( c0 = 0; c0 < nDivs; c0++ )
916 for ( c1 = c0+1; c1 < nDivs; c1++ )
917 for ( c2 = c1+1; c2 < nDivs; c2++ )
918 if ( (Cover[c0] | Cover[c1] | Cover[c2]) == Target )
920 Vec_IntPush(
p->vDivSet, c0 );
921 Vec_IntPush(
p->vDivSet, c1 );
922 Vec_IntPush(
p->vDivSet, c2 );
926 for ( c0 = 0; c0 < nDivs; c0++ )
927 for ( c1 = c0+1; c1 < nDivs; c1++ )
928 for ( c2 = c1+1; c2 < nDivs; c2++ )
929 for ( c3 = c2+1; c3 < nDivs; c3++ )
931 if ( (Cover[c0] | Cover[c1] | Cover[c2] | Cover[c3]) == Target )
933 Vec_IntPush(
p->vDivSet, c0 );
934 Vec_IntPush(
p->vDivSet, c1 );
935 Vec_IntPush(
p->vDivSet, c2 );
936 Vec_IntPush(
p->vDivSet, c3 );
943static inline int Sbd_ManFindCands(
Sbd_Man_t *
p,
word Cover[64],
int nDivs )
945 int Ones[64], Order[64];
946 int Limits[4] = { nDivs/4+1, nDivs/3+2, nDivs/2+3, nDivs };
948 word Target = Cover[nDivs];
950 if ( nDivs < 8 || p->pPars->fCover )
951 return Sbd_ManFindCandsSimple(
p, Cover, nDivs );
953 Vec_IntClear(
p->vDivSet );
954 for ( c0 = 0; c0 < nDivs; c0++ )
955 if ( Cover[c0] == Target )
957 Vec_IntPush(
p->vDivSet, c0 );
961 for ( c0 = 0; c0 < nDivs; c0++ )
962 for ( c1 = c0+1; c1 < nDivs; c1++ )
963 if ( (Cover[c0] | Cover[c1]) == Target )
965 Vec_IntPush(
p->vDivSet, c0 );
966 Vec_IntPush(
p->vDivSet, c1 );
971 for ( c0 = 0; c0 < nDivs; c0++ )
972 Ones[c0] = Abc_TtCountOnes( Cover[c0] );
975 for ( c0 = 0; c0 < nDivs; c0++ )
977 Vec_IntSelectSortCost2Reverse( Order, nDivs, Ones );
980 for ( c0 = 0; c0 < Limits[0]; c0++ )
981 for ( c1 = c0+1; c1 < Limits[1]; c1++ )
982 for ( c2 = c1+1; c2 < Limits[2]; c2++ )
983 if ( (Cover[Order[c0]] | Cover[Order[c1]] | Cover[Order[c2]]) == Target )
985 Vec_IntPush(
p->vDivSet, Order[c0] );
986 Vec_IntPush(
p->vDivSet, Order[c1] );
987 Vec_IntPush(
p->vDivSet, Order[c2] );
991 for ( c0 = 0; c0 < Limits[0]; c0++ )
992 for ( c1 = c0+1; c1 < Limits[1]; c1++ )
993 for ( c2 = c1+1; c2 < Limits[2]; c2++ )
994 for ( c3 = c2+1; c3 < Limits[3]; c3++ )
996 if ( (Cover[Order[c0]] | Cover[Order[c1]] | Cover[Order[c2]] | Cover[Order[c3]]) == Target )
998 Vec_IntPush(
p->vDivSet, Order[c0] );
999 Vec_IntPush(
p->vDivSet, Order[c1] );
1000 Vec_IntPush(
p->vDivSet, Order[c2] );
1001 Vec_IntPush(
p->vDivSet, Order[c3] );
1013 int nIters, nItersMax = 32;
1015 word MatrS[64] = {0}, MatrC[2][64] = {{0}}, Cubes[2][2][64] = {{{0}}}, Cover[64] = {0},
Cube, CubeNew[2];
1016 int i, k, n, Node, Index, nCubes[2] = {0}, nRows = 0, nRowsOld;
1018 int nDivs = Vec_IntSize(
p->vDivValues);
1019 int PivotVar = Vec_IntEntry(
p->vObj2Var, Pivot);
1020 int FreeVar = Vec_IntSize(
p->vWinObjs) + Vec_IntSize(
p->vTfo) + Vec_IntSize(
p->vRoots);
1023 if (
p->pPars->fVerbose )
1024 printf(
"Node %d. Useful divisors = %d.\n", Pivot, nDivs );
1032 MatrS[63-i] = *Sbd_ObjSim0(
p, Vec_IntEntry(
p->vWinObjs, Node) );
1033 MatrC[0][63-i] = *Sbd_ObjSim2(
p, Vec_IntEntry(
p->vWinObjs, Node) );
1034 MatrC[1][63-i] = *Sbd_ObjSim3(
p, Vec_IntEntry(
p->vWinObjs, Node) );
1036 MatrS[63-i] = *Sbd_ObjSim0(
p, Pivot );
1037 MatrC[0][63-i] = *Sbd_ObjSim2(
p, Pivot );
1038 MatrC[1][63-i] = *Sbd_ObjSim3(
p, Pivot );
1041 Sbd_TransposeMatrix64( MatrS );
1042 Sbd_TransposeMatrix64( MatrC[0] );
1043 Sbd_TransposeMatrix64( MatrC[1] );
1047 for ( i = 0; i < 64; i++ )
1049 assert( Abc_TtGetBit(&MatrC[0][i], nDivs) == Abc_TtGetBit(&MatrC[1][i], nDivs) );
1050 if ( !Abc_TtGetBit(&MatrC[0][i], nDivs) )
1052 Index = Abc_TtGetBit(&MatrS[i], nDivs);
1053 for ( n = 0; n < 2; n++ )
1055 if ( n && MatrC[0][i] == MatrC[1][i] )
1058 CubeNew[0] = ~MatrS[i] & MatrC[n][i];
1059 CubeNew[1] = MatrS[i] & MatrC[n][i];
1060 assert( CubeNew[0] || CubeNew[1] );
1061 nCubes[Index] = Sbd_ManAddCube2( Cubes[Index], nCubes[Index], CubeNew );
1065 if (
p->pPars->fVerbose )
1066 printf(
"Generated matrix with %d x %d entries.\n", nCubes[0], nCubes[1] );
1068 if (
p->pPars->fVerbose )
1069 for ( n = 0; n < 2; n++ )
1071 printf(
"%s:\n", n ?
"Onset" :
"Offset" );
1072 for ( i = 0; i < nCubes[n]; i++, printf(
"\n" ) )
1073 for ( k = 0; k < 64; k++ )
1074 if ( Abc_TtGetBit(&Cubes[n][0][i], k) )
1076 else if ( Abc_TtGetBit(&Cubes[n][1][i], k) )
1085 for ( i = 0; i < nCubes[0] && nRows < 32; i++ )
1086 for ( k = 0; k < nCubes[1] && nRows < 32; k++ )
1088 Cube = (Cubes[0][1][i] & Cubes[1][0][k]) | (Cubes[0][0][i] & Cubes[1][1][k]);
1090 nRows = Sbd_ManAddCube1( 64, Cover, nRows,
Cube );
1093 Sbd_ManCoverReverseOrder( Cover );
1095 if (
p->pPars->fVerbose )
1096 printf(
"Generated cover with %d entries.\n", nRows );
1100 Sbd_TransposeMatrix64( Cover );
1104 Sbd_ManCoverReverseOrder( Cover );
1107 for ( nIters = 0; nIters < nItersMax && nRows < 64; nIters++ )
1109 if (
p->pPars->fVerbose )
1113 if ( !Sbd_ManFindCands(
p, Cover, nDivs ) )
1115 if (
p->pPars->fVerbose )
1116 printf(
"Cannot find a feasible cover.\n" );
1117 p->timeCov += Abc_Clock() - clk;
1120 p->timeCov += Abc_Clock() - clk;
1122 if (
p->pPars->fVerbose )
1123 printf(
"Candidate support: " ),
1124 Vec_IntPrint(
p->vDivSet );
1127 *pTruth =
Sbd_ManSolve(
p->pSat, PivotVar, FreeVar+nIters,
p->vDivSet,
p->vDivVars,
p->vDivValues,
p->vLits );
1128 p->timeSat += Abc_Clock() - clk;
1131 printf(
"Node %d: Undecided.\n", Pivot );
1134 if (
p->pPars->fVerbose )
1137 printf(
"Node %d: SAT.\n", Pivot );
1138 for ( i = 0; i < nDivs; i++ )
1139 printf(
"%d", i % 10 );
1141 for ( i = 0; i < nDivs; i++ )
1142 printf(
"%c", (Vec_IntEntry(
p->vDivValues, i) & 0x4) ?
'0' + (Vec_IntEntry(
p->vDivValues, i) & 1) :
'x' );
1144 for ( i = 0; i < nDivs; i++ )
1145 printf(
"%c", (Vec_IntEntry(
p->vDivValues, i) & 0x8) ?
'0' + ((Vec_IntEntry(
p->vDivValues, i) >> 1) & 1) :
'x' );
1149 for ( i = 0; i < nDivs; i++ )
1150 if ( Vec_IntEntry(
p->vDivValues, i) == 0xE || Vec_IntEntry(
p->vDivValues, i) == 0xD )
1151 Cover[i] |= ((
word)1 << nRows);
1152 Cover[nDivs] |= ((
word)1 << nRows);
1157 if (
p->pPars->fVerbose )
1159 printf(
"Node %d: UNSAT.\n", Pivot );
1160 Extra_PrintBinary( stdout, (
unsigned *)pTruth, 1 << Vec_IntSize(
p->vDivSet) ), printf(
"\n" );
1173 word Onset[64] = {0}, Offset[64] = {0},
Cube;
1174 word CoverRows[64] = {0}, CoverCols[64] = {0};
1175 int nIters, nItersMax = 32;
1176 int i, k, nRows = 0;
1178 int PivotVar = Vec_IntEntry(
p->vObj2Var, Pivot);
1179 int FreeVar = Vec_IntSize(
p->vWinObjs) + Vec_IntSize(
p->vTfo) + Vec_IntSize(
p->vRoots);
1180 int nDivs = Vec_IntSize(
p->vDivVars );
1186 p->pSat =
Sbd_ManSatSolver(
p->pSat,
p->pGia,
p->vMirrors, Pivot,
p->vWinObjs,
p->vObj2Var,
p->vTfo,
p->vRoots, 0 );
1187 p->timeCnf += Abc_Clock() - clk;
1192 p->timeSat += Abc_Clock() - clk;
1193 if ( RetValue >= 0 )
1195 if (
p->pPars->fVeryVerbose )
1196 printf(
"Found stuck-at-%d node %d.\n", RetValue, Pivot );
1197 Vec_IntWriteEntry(
p->vLutLevs, Pivot, 0 );
1205 for ( i = 0; i < nConsts; i++ )
1206 for ( k = 0; k < nConsts; k++ )
1208 Cube = Onset[i] ^ Offset[k];
1210 nRows = Sbd_ManAddCube1( 256, CoverRows, nRows,
Cube );
1215 for ( i = 0; i < nRows; i++ )
1216 for ( k = 0; k <= nDivs; k++ )
1217 if ( (CoverRows[i] >> k) & 1 )
1218 Abc_TtXorBit(&CoverCols[k], i);
1221 for ( nIters = 0; nIters < nItersMax && nRows < 64; nIters++ )
1223 if (
p->pPars->fVeryVerbose )
1227 if ( !Sbd_ManFindCands(
p, CoverCols, nDivs ) )
1229 if (
p->pPars->fVeryVerbose )
1230 printf(
"Cannot find a feasible cover.\n" );
1231 p->timeCov += Abc_Clock() - clk;
1234 p->timeCov += Abc_Clock() - clk;
1236 if (
p->pPars->fVeryVerbose )
1237 printf(
"Candidate support: " ),
1238 Vec_IntPrint(
p->vDivSet );
1241 *pTruth =
Sbd_ManSolve(
p->pSat, PivotVar, FreeVar+nIters,
p->vDivSet,
p->vDivVars,
p->vDivValues,
p->vLits );
1242 p->timeSat += Abc_Clock() - clk;
1245 printf(
"Node %d: Undecided.\n", Pivot );
1248 if (
p->pPars->fVeryVerbose )
1251 printf(
"Node %d: SAT.\n", Pivot );
1252 for ( i = 0; i < nDivs; i++ )
1253 printf(
"%d", Vec_IntEntry(
p->vLutLevs, Vec_IntEntry(
p->vWinObjs, Vec_IntEntry(
p->vDivVars, i))) );
1255 for ( i = 0; i < nDivs; i++ )
1256 printf(
"%d", i % 10 );
1258 for ( i = 0; i < nDivs; i++ )
1259 printf(
"%c", (Vec_IntEntry(
p->vDivValues, i) & 0x4) ?
'0' + (Vec_IntEntry(
p->vDivValues, i) & 1) :
'x' );
1261 for ( i = 0; i < nDivs; i++ )
1262 printf(
"%c", (Vec_IntEntry(
p->vDivValues, i) & 0x8) ?
'0' + ((Vec_IntEntry(
p->vDivValues, i) >> 1) & 1) :
'x' );
1266 for ( i = 0; i < nDivs; i++ )
1267 if ( Vec_IntEntry(
p->vDivValues, i) == 0xE || Vec_IntEntry(
p->vDivValues, i) == 0xD )
1268 CoverCols[i] |= ((
word)1 << nRows);
1269 CoverCols[nDivs] |= ((
word)1 << nRows);
1274 if (
p->pPars->fVeryVerbose )
1276 printf(
"Node %d: UNSAT. ", Pivot );
1277 Extra_PrintBinary( stdout, (
unsigned *)pTruth, 1 << Vec_IntSize(
p->vDivSet) ), printf(
"\n" );
1290 int PivotVar = Vec_IntEntry(
p->vObj2Var, Pivot);
1291 int Delay = Vec_IntEntry(
p->vLutLevs, Pivot );
1293 int nNodesTop = 0, nNodesBot = 0, nNodesBot1 = 0, nNodesBot2 = 0, nNodesDiff = 0, nNodesDiff1 = 0, nNodesDiff2 = 0;
1294 int i, k, iObj, nIters, RetValue = 0;
1297 for ( nIters = 0; nIters < nLeaves; nIters++ )
1301 Vec_IntClear(
p->vDivSet );
1302 for ( i = 0; i < nLeaves; i++ )
1303 if ( i != nLeaves-1-nIters && pLeaves[i] != -1 )
1304 Vec_IntPush(
p->vDivSet, Vec_IntEntry(
p->vObj2Var, pLeaves[i]) );
1305 assert( Vec_IntSize(
p->vDivSet) < nLeaves );
1308 Truth =
Sbd_ManSolve(
p->pSat, PivotVar, (*pFreeVar)++,
p->vDivSet,
p->vDivVars,
p->vDivValues,
p->vLits );
1309 p->timeSat += Abc_Clock() - clk;
1311 printf(
"Node %d: Undecided.\n", Pivot );
1314 int DelayDiff = Vec_IntEntry(
p->vLutLevs, pLeaves[nLeaves-1-nIters]) - Delay;
1315 if ( DelayDiff > -2 )
1319 pLeaves[nLeaves-1-nIters] = -1;
1321 Vec_IntClear(
p->vDivSet );
1322 for ( i = 0; i < nLeaves; i++ )
1323 if ( pLeaves[i] != -1 )
1324 Vec_IntPush(
p->vDivSet, pLeaves[i] );
1326 if ( Vec_IntSize(
p->vDivSet) <=
p->pPars->nLutSize )
1332 Vec_IntWriteEntry(
p->vDivSet, i, Vec_IntEntry(
p->vObj2Var, iObj) );
1335 Truth =
Sbd_ManSolve(
p->pSat, PivotVar, (*pFreeVar)++,
p->vDivSet,
p->vDivVars,
p->vDivValues,
p->vLits );
1336 p->timeSat += Abc_Clock() - clk;
1339 printf(
"The cut at node %d is not topological.\n",
p->Pivot );
1345 Strs->
nVarIns = Vec_IntSize(
p->vDivSet );
1346 for ( i = 0; i < Strs->
nVarIns; i++ )
1353 assert( Vec_IntSize(
p->vDivSet) >
p->pPars->nLutSize );
1356 nNodesTop = nNodesBot = nNodesBot1 = nNodesBot2 = 0;
1359 int DelayDiff = Vec_IntEntry(
p->vLutLevs, iObj) - Delay;
1360 if ( DelayDiff > -2 )
1362 if ( DelayDiff == -2 )
1363 pNodesTop[nNodesTop++] = i;
1366 pNodesBot[nNodesBot++] = i;
1367 if ( DelayDiff == -3 )
1368 pNodesBot1[nNodesBot1++] = i;
1370 pNodesBot2[nNodesBot2++] = i;
1372 Vec_IntWriteEntry(
p->vDivSet, i, Vec_IntEntry(
p->vObj2Var, iObj) );
1374 assert( nNodesBot == nNodesBot1 + nNodesBot2 );
1375 if ( i < Vec_IntSize(
p->vDivSet) )
1377 if ( nNodesTop >
p->pPars->nLutSize-1 )
1381 if ( Vec_IntSize(
p->vDivSet) <= 2*
p->pPars->nLutSize-1 )
1384 if ( nNodesBot >
p->pPars->nLutSize )
1386 while ( nNodesBot >
p->pPars->nLutSize )
1387 pNodesTop[nNodesTop++] = pNodesBot[--nNodesBot], nMoved++;
1388 assert( nNodesBot ==
p->pPars->nLutSize );
1390 assert( nNodesBot <= p->pPars->nLutSize );
1391 assert( nNodesTop <= p->pPars->nLutSize-1 );
1394 Strs[0].
nVarIns =
p->pPars->nLutSize;
1395 for ( i = 0; i < nNodesTop; i++ )
1396 Strs[0].VarIns[i] = pNodesTop[i];
1397 for ( ; i <
p->pPars->nLutSize; i++ )
1398 Strs[0].VarIns[i] = Vec_IntSize(
p->vDivSet)+1 + i-nNodesTop;
1403 for ( i = 0; i < nNodesBot; i++ )
1404 Strs[1].VarIns[i] = pNodesBot[i];
1407 nNodesDiff =
p->pPars->nLutSize-1 - nNodesTop;
1408 assert( nNodesDiff >= 0 && nNodesDiff <= 3 );
1409 for ( k = 0; k < nNodesDiff; k++ )
1412 Strs[2+k].
nVarIns = nNodesBot;
1413 for ( i = 0; i < nNodesBot; i++ )
1414 Strs[2+k].VarIns[i] = pNodesBot[i];
1418 *pnStrs = 2 + nNodesDiff;
1420 RetValue =
Sbd_ProblemSolve(
p->pGia,
p->vMirrors, Pivot,
p->vWinObjs,
p->vObj2Var,
p->vTfo,
p->vRoots,
p->vDivSet, *pnStrs, Strs );
1421 p->timeQbf += Abc_Clock() - clk;
1426 pNodesBot[nNodesBot++] = pNodesTop[--nNodesTop];
1431 if (
p->pPars->nLutNum < 3 )
1433 if ( Vec_IntSize(
p->vDivSet) < 2*
p->pPars->nLutSize-1 )
1437 if ( nNodesTop <= p->pPars->nLutSize-2 )
1440 if ( nNodesBot > 2*
p->pPars->nLutSize )
1442 while ( nNodesBot > 2*
p->pPars->nLutSize )
1443 pNodesTop[nNodesTop++] = pNodesBot[--nNodesBot], nMoved++;
1444 assert( nNodesBot == 2*
p->pPars->nLutSize );
1446 assert( nNodesBot >
p->pPars->nLutSize );
1447 assert( nNodesBot <= 2*p->pPars->nLutSize );
1448 assert( nNodesTop <= p->pPars->nLutSize-2 );
1451 Strs[0].
nVarIns =
p->pPars->nLutSize;
1452 for ( i = 0; i < nNodesTop; i++ )
1453 Strs[0].VarIns[i] = pNodesTop[i];
1454 for ( ; i <
p->pPars->nLutSize; i++ )
1455 Strs[0].VarIns[i] = Vec_IntSize(
p->vDivSet)+1 + i-nNodesTop;
1459 Strs[1].
nVarIns =
p->pPars->nLutSize;
1460 for ( i = 0; i < Strs[1].
nVarIns; i++ )
1461 Strs[1].VarIns[i] = pNodesBot[i];
1465 Strs[2].
nVarIns =
p->pPars->nLutSize;
1466 for ( i = 0; i < Strs[2].
nVarIns; i++ )
1467 Strs[2].VarIns[i] = pNodesBot[nNodesBot-
p->pPars->nLutSize+i];
1470 nNodesDiff =
p->pPars->nLutSize-2 - nNodesTop;
1471 assert( nNodesDiff >= 0 && nNodesDiff <= 2 );
1472 for ( k = 0; k < nNodesDiff; k++ )
1475 Strs[3+k].
nVarIns = nNodesBot;
1476 for ( i = 0; i < nNodesBot; i++ )
1477 Strs[3+k].VarIns[i] = pNodesBot[i];
1481 *pnStrs = 3 + nNodesDiff;
1483 RetValue =
Sbd_ProblemSolve(
p->pGia,
p->vMirrors, Pivot,
p->vWinObjs,
p->vObj2Var,
p->vTfo,
p->vRoots,
p->vDivSet, *pnStrs, Strs );
1484 p->timeQbf += Abc_Clock() - clk;
1489 pNodesBot[nNodesBot++] = pNodesTop[--nNodesTop];
1495 if ( nNodesBot1 + nNodesTop <= 2*p->pPars->nLutSize-2 )
1497 if ( nNodesBot2 >
p->pPars->nLutSize )
1499 while ( nNodesBot2 >
p->pPars->nLutSize )
1500 pNodesBot1[nNodesBot1++] = pNodesBot2[--nNodesBot2];
1501 assert( nNodesBot2 ==
p->pPars->nLutSize );
1503 if ( nNodesBot1 >
p->pPars->nLutSize-1 )
1505 while ( nNodesBot1 >
p->pPars->nLutSize-1 )
1506 pNodesTop[nNodesTop++] = pNodesBot1[--nNodesBot1];
1507 assert( nNodesBot1 ==
p->pPars->nLutSize-1 );
1509 assert( nNodesBot2 <= p->pPars->nLutSize );
1510 assert( nNodesBot1 <= p->pPars->nLutSize-1 );
1511 assert( nNodesTop <= p->pPars->nLutSize-1 );
1514 Strs[0].
nVarIns =
p->pPars->nLutSize;
1515 for ( i = 0; i < nNodesTop; i++ )
1516 Strs[0].VarIns[i] = pNodesTop[i];
1517 Strs[0].
VarIns[i++] = Vec_IntSize(
p->vDivSet)+1;
1518 for ( ; i <
p->pPars->nLutSize; i++ )
1519 Strs[0].VarIns[i] = Vec_IntSize(
p->vDivSet)+2 + i-nNodesTop;
1521 nNodesDiff1 =
p->pPars->nLutSize-1 - nNodesTop;
1524 Strs[1].
nVarIns =
p->pPars->nLutSize;
1525 for ( i = 0; i < nNodesBot1; i++ )
1526 Strs[1].VarIns[i] = pNodesBot1[i];
1527 Strs[1].
VarIns[i++] = Vec_IntSize(
p->vDivSet)+2;
1528 for ( ; i <
p->pPars->nLutSize; i++ )
1529 Strs[1].VarIns[i] = Vec_IntSize(
p->vDivSet)+2+nNodesDiff1 + i-nNodesBot1;
1531 nNodesDiff2 =
p->pPars->nLutSize-1 - nNodesBot1;
1535 for ( i = 0; i < Strs[2].
nVarIns; i++ )
1536 Strs[2].VarIns[i] = pNodesBot2[i];
1539 nNodesDiff = nNodesDiff1 + nNodesDiff2;
1540 assert( nNodesDiff >= 0 && nNodesDiff <= 3 );
1541 for ( k = 0; k < nNodesDiff; k++ )
1544 Strs[3+k].
nVarIns = nNodesBot2;
1545 for ( i = 0; i < nNodesBot2; i++ )
1546 Strs[3+k].VarIns[i] = pNodesBot2[i];
1548 if ( k >= nNodesDiff1 )
1550 Strs[3+k].
nVarIns += nNodesBot1;
1551 for ( i = 0; i < nNodesBot1; i++ )
1552 Strs[3+k].VarIns[nNodesBot2 + i] = pNodesBot1[i];
1555 *pnStrs = 3 + nNodesDiff;
1557 RetValue =
Sbd_ProblemSolve(
p->pGia,
p->vMirrors, Pivot,
p->vWinObjs,
p->vObj2Var,
p->vTfo,
p->vRoots,
p->vDivSet, *pnStrs, Strs );
1558 p->timeQbf += Abc_Clock() - clk;
1566 int FreeVar = Vec_IntSize(
p->vWinObjs) + Vec_IntSize(
p->vTfo) + Vec_IntSize(
p->vRoots);
1567 int FreeVarStart = FreeVar;
1571 p->pSat =
Sbd_ManSatSolver(
p->pSat,
p->pGia,
p->vMirrors, Pivot,
p->vWinObjs,
p->vObj2Var,
p->vTfo,
p->vRoots, 0 );
1572 p->timeCnf += Abc_Clock() - clk;
1577 if ( nLeaves == -1 )
1579 assert( nLeaves <= p->pPars->nCutSize );
1585 for ( nSize =
p->pPars->nLutSize + 1; nSize <= p->pPars->nCutSize; nSize++ )
1588 if ( nLeaves == -1 )
1590 assert( nLeaves == nSize );
1612 int * pBeg = pCut + 1;
1613 int * pBeg1 = pCut1 + 1;
1614 int * pBeg2 = pCut2 + 1;
1615 int * pEnd1 = pCut1 + 1 + pCut1[0];
1616 int * pEnd2 = pCut2 + 1 + pCut2[0];
1617 while ( pBeg1 < pEnd1 && pBeg2 < pEnd2 )
1619 if ( *pBeg1 == *pBeg2 )
1620 *pBeg++ = *pBeg1++, pBeg2++;
1621 else if ( *pBeg1 < *pBeg2 )
1626 while ( pBeg1 < pEnd1 )
1628 while ( pBeg2 < pEnd2 )
1630 return (pCut[0] = pBeg - pCut - 1);
1676 int iFan0 = Gia_ObjFaninId0( Gia_ManObj(
p->pGia, Node), Node );
1677 int iFan1 = Gia_ObjFaninId1( Gia_ManObj(
p->pGia, Node), Node );
1678 int Level0 = Vec_IntEntry(
p->vLutLevs, iFan0 ) ? Vec_IntEntry(
p->vLutLevs, iFan0 ) : 1;
1679 int Level1 = Vec_IntEntry(
p->vLutLevs, iFan1 ) ? Vec_IntEntry(
p->vLutLevs, iFan1 ) : 1;
1680 int * pCut0 = Sbd_ObjCut(
p, iFan0 );
1681 int * pCut1 = Sbd_ObjCut(
p, iFan1 );
1682 int Cut0[2] = {1, iFan0};
1683 int Cut1[2] = {1, iFan1};
1688 int Lev11 = nSize11 <=
p->pPars->nLutSize ? Abc_MaxInt(Level0, Level1) :
ABC_INFINITY;
1689 int Lev01 = nSize01 <=
p->pPars->nLutSize ? Abc_MaxInt(Level0+1, Level1) :
ABC_INFINITY;
1690 int Lev10 = nSize10 <=
p->pPars->nLutSize ? Abc_MaxInt(Level0, Level1+1) :
ABC_INFINITY;
1691 int Lev00 = nSize00 <=
p->pPars->nLutSize ? Abc_MaxInt(Level0+1, Level1+1) :
ABC_INFINITY;
1692 int * pCutRes = pCut11;
1694 if ( Lev01 < LevCur || (Lev01 == LevCur && pCut01[0] < pCutRes[0]) )
1699 if ( Lev10 < LevCur || (Lev10 == LevCur && pCut10[0] < pCutRes[0]) )
1704 if ( Lev00 < LevCur || (Lev00 == LevCur && pCut00[0] < pCutRes[0]) )
1709 assert( iFan0 != iFan1 );
1710 assert( Vec_IntEntry(
p->vLutLevs, Node) == 0 );
1711 Vec_IntWriteEntry(
p->vLutLevs, Node, LevCur );
1713 assert( pCutRes[0] <=
p->pPars->nLutSize );
1714 memcpy( Sbd_ObjCut(
p, Node), pCutRes,
sizeof(
int) * (pCutRes[0] + 1) );
1720 int i, Id, Delay = 0;
1722 Delay = Abc_MaxInt( Delay, Vec_IntEntry(
p->vLutLevs, Id) );
1740 assert( Gia_ObjIsAnd(pObj) );
1751 assert( Gia_ObjIsAnd(pObj) );
1758 int i, LevelMax = 0;
1760 Gia_Obj_t * pTemp, * pObj = Gia_ManObj(
p->pGia, Node);
1767 LevelMax = Abc_MaxInt( LevelMax, Vec_IntEntry(
p->vLutLevs, Gia_ObjId(
p->pGia, pTemp)) );
1768 pCut[1+pCut[0]++] = Gia_ObjId(
p->pGia, pTemp);
1770 assert( pCut[0] <=
p->pPars->nLutSize );
1774 assert( Vec_IntEntry(
p->vLutLevs, Node) == 0 );
1775 Vec_IntWriteEntry(
p->vLutLevs, Node, LevelMax+1 );
1777 memcpy( Sbd_ObjCut(
p, Node), pCut,
sizeof(
int) * (pCut[0] + 1) );
1783 int i, k, w, iLit, Entry, Node;
1784 int iObjLast = Gia_ManObjNum(
p->pGia);
1785 int iCurLev = Vec_IntEntry(
p->vLutLevs, Pivot);
1788 Vec_IntClear(
p->vLits );
1791 Node = Vec_IntEntry(
p->vWinObjs, Node );
1792 if ( Vec_IntEntry(
p->vMirrors, Node) >= 0 )
1793 Vec_IntPush(
p->vLits, Vec_IntEntry(
p->vMirrors, Node) );
1795 Vec_IntPush(
p->vLits, Abc_Var2Lit(Node, 0) );
1799 if (
p->pGia->nXors &&
p->pGia->pMuxes == NULL )
1800 p->pGia->pMuxes = (
unsigned *)
p;
1803 if (
p->pGia->pMuxes == (
unsigned *)
p )
1804 p->pGia->pMuxes = NULL;
1806 assert( Vec_IntEntry(
p->vMirrors, Pivot) == -1 );
1807 Vec_IntWriteEntry(
p->vMirrors, Pivot, iLit );
1808 if (
p->pPars->fVerbose )
1809 printf(
"Replacing node %d by literal %d.\n", Pivot, iLit );
1812 Vec_IntWriteEntry(
p->vLits, i, Abc_Lit2Var(Entry) );
1817 assert( Vec_IntSize(
p->vLutLevs) == iObjLast );
1818 for ( i = iObjLast; i < Gia_ManObjNum(
p->pGia); i++ )
1820 Vec_IntPush(
p->vLutLevs, 0 );
1821 Vec_IntPush(
p->vObj2Var, 0 );
1822 Vec_IntPush(
p->vMirrors, -1 );
1823 Vec_IntFillExtra(
p->vLutCuts, Vec_IntSize(
p->vLutCuts) +
p->pPars->nLutSize + 1, 0 );
1825 for ( k = 0; k < 4; k++ )
1826 for ( w = 0; w <
p->pPars->nWords; w++ )
1827 Vec_WrdPush(
p->vSims[k], 0 );
1833 iNewLev = Vec_IntEntry(
p->vLutLevs, Abc_Lit2Var(iLit) );
1834 assert( iNewLev < iCurLev );
1836 assert( Vec_IntEntry(
p->vLutLevs, Pivot) == iCurLev );
1837 Vec_IntWriteEntry(
p->vLutLevs, Pivot, iNewLev );
1845 int i, k, w, iLit, Node;
1846 int iObjLast = Gia_ManObjNum(
p->pGia);
1847 int iCurLev = Vec_IntEntry(
p->vLutLevs, Pivot);
1850 Vec_IntClear(
p->vLits );
1853 Node = Vec_IntEntry(
p->vWinObjs, Node );
1854 if ( Vec_IntEntry(
p->vMirrors, Node) >= 0 )
1855 Vec_IntPush(
p->vLits, Vec_IntEntry(
p->vMirrors, Node) );
1857 Vec_IntPush(
p->vLits, Abc_Var2Lit(Node, 0) );
1860 for ( i = 0; i < nStrs; i++ )
1861 Vec_IntPush(
p->vLits, -1 );
1863 for ( i = nStrs-1; i >= 0; i-- )
1865 if ( pStrs[i].fLut )
1868 Vec_IntClear(
p->vLits2 );
1869 for ( k = 0; k < (int)pStrs[i].
nVarIns; k++ )
1870 Vec_IntPush(
p->vLits2, Vec_IntEntry(
p->vLits, pStrs[i].
VarIns[k]) );
1873 if (
p->pGia->nXors &&
p->pGia->pMuxes == NULL )
1874 p->pGia->pMuxes = (
unsigned *)
p;
1877 if (
p->pGia->pMuxes == (
unsigned *)
p )
1878 p->pGia->pMuxes = NULL;
1882 iLit = Vec_IntEntry(
p->vLits, (
int)pStrs[i].
Res );
1886 assert( Vec_IntEntry(
p->vLits, Vec_IntSize(
p->vLits)-nStrs+i) == -1 );
1887 Vec_IntWriteEntry(
p->vLits, Vec_IntSize(
p->vLits)-nStrs+i, iLit );
1889 iLit = Vec_IntEntry(
p->vLits, Vec_IntSize(
p->vDivSet) );
1892 assert( Vec_IntEntry(
p->vMirrors, Pivot) == -1 );
1893 Vec_IntWriteEntry(
p->vMirrors, Pivot, iLit );
1894 if (
p->pPars->fVeryVerbose )
1895 printf(
"Replacing node %d by literal %d.\n", Pivot, iLit );
1898 assert( Vec_IntSize(
p->vLutLevs) == iObjLast );
1899 for ( i = iObjLast; i < Gia_ManObjNum(
p->pGia); i++ )
1901 assert( i == Vec_IntSize(
p->vMirrors) );
1902 Vec_IntPush(
p->vMirrors, -1 );
1903 Sbd_StoRefObj(
p->pSto, i, i == Gia_ManObjNum(
p->pGia)-1 ? Pivot : -1 );
1906 for ( i = iObjLast; i < Gia_ManObjNum(
p->pGia); i++ )
1911 p->timeCut += Abc_Clock() - clk;
1912 assert( i == Vec_IntSize(
p->vLutLevs) );
1913 Vec_IntPush(
p->vLutLevs, Delay );
1915 Vec_IntPush(
p->vObj2Var, 0 );
1916 Vec_IntFillExtra(
p->vLutCuts, Vec_IntSize(
p->vLutCuts) +
p->pPars->nLutSize + 1, 0 );
1919 for ( k = 0; k < 4; k++ )
1920 for ( w = 0; w <
p->pPars->nWords; w++ )
1921 Vec_WrdPush(
p->vSims[k], 0 );
1924 iNewLev = Vec_IntEntry(
p->vLutLevs, Abc_Lit2Var(iLit) );
1925 assert( !iNewLev || iNewLev < iCurLev );
1928 assert( Vec_IntEntry(
p->vLutLevs, Pivot) == iCurLev );
1929 Vec_IntWriteEntry(
p->vLutLevs, Pivot, iNewLev );
1948 if ( !iObj || Gia_ObjIsTravIdCurrentId(pNew, iObj) )
1950 Gia_ObjSetTravIdCurrentId(pNew, iObj);
1951 pObj = Gia_ManObj( pNew, iObj );
1952 if ( Gia_ObjIsCi(pObj) )
1954 assert( Gia_ObjIsAnd(pObj) );
1955 pCut = Sbd_ObjCut2(
p, iObj );
1956 for ( k = 1; k <= pCut[0]; k++ )
1960 for ( k = 0; k <= pCut[0]; k++ )
1961 Vec_IntPush( pNew->
vMapping, pCut[k] );
1962 Vec_IntPush( pNew->
vMapping, iObj );
1967 int i, k, iFan, iObjNew, iFanNew, * pCut, * pCutNew;
1968 Vec_Int_t * vLeaves = Vec_IntAlloc( 100 );
1970 p->vLutCuts2 = Vec_IntStart( Gia_ManObjNum(pNew) * (
p->pPars->nLutSize + 1) );
1973 if ( Vec_IntEntry(
p->vMirrors, i) >= 0 )
1975 if ( pObj->
Value == ~0 )
1977 iObjNew = Abc_Lit2Var( pObj->
Value );
1978 if ( !Gia_ObjIsAnd(Gia_ManObj(pNew, iObjNew)) )
1980 pCutNew = Sbd_ObjCut2(
p, iObjNew );
1981 pCut = Sbd_ObjCut(
p, i );
1982 Vec_IntClear( vLeaves );
1983 for ( k = 1; k <= pCut[0]; k++ )
1985 iFan = Vec_IntEntry(
p->vMirrors, pCut[k]) >= 0 ? Abc_Lit2Var(Vec_IntEntry(
p->vMirrors, pCut[k])) : pCut[k];
1986 pFan = Gia_ManObj(
p->pGia, iFan );
1987 if ( pFan->
Value == ~0 )
1989 iFanNew = Abc_Lit2Var( pFan->
Value );
1990 if ( iFanNew == 0 || iFanNew == iObjNew )
1992 Vec_IntPushUniqueOrder( vLeaves, iFanNew );
1994 assert( Vec_IntSize(vLeaves) <=
p->pPars->nLutSize );
1996 pCutNew[0] = Vec_IntSize(vLeaves);
1997 memcpy( pCutNew+1, Vec_IntArray(vLeaves),
sizeof(
int) * Vec_IntSize(vLeaves) );
1999 Vec_IntFree( vLeaves );
2002 pNew->
vMapping = Vec_IntAlloc( (
p->pPars->nLutSize + 2) * Gia_ManObjNum(pNew) );
2003 Vec_IntFill( pNew->
vMapping, Gia_ManObjNum(pNew), 0 );
2007 Vec_IntFreeP( &
p->vLutCuts2 );
2013 if ( Vec_IntEntry(vMirrors, Node) >= 0 )
2014 Obj = Abc_Lit2Var( Vec_IntEntry(vMirrors, Node) );
2015 pObj = Gia_ManObj(
p, Obj );
2016 if ( !~pObj->
Value )
2018 assert( Gia_ObjIsAnd(pObj) );
2021 if ( Gia_ObjIsXor(pObj) )
2028 Gia_ManObj(
p, Node)->Value = Abc_LitNotCond( pObj->
Value, Abc_LitIsCompl(Vec_IntEntry(vMirrors, Node)) );
2037 pNew->
pName = Abc_UtilStrsav(
p->pName );
2038 pNew->
pSpec = Abc_UtilStrsav(
p->pSpec );
2041 Gia_ManConst0(
p)->Value = 0;
2044 pObj->
Value = Gia_ManAppendCi(pNew);
2048 pObj->
Value = Gia_ManAppendCo( pNew, Gia_ObjFanin0Copy(pObj) );
2052 if ( pMan->
pPars->fMapping )
2076 int RetValue, nStrs = 0;
2086 if ( RetValue >= 0 )
2088 Vec_IntWriteEntry(
p->vMirrors, Pivot, RetValue );
2091 else if (
p->pPars->fFindDivs &&
p->pPars->nLutNum >= 1 &&
Sbd_ManExplore2(
p, Pivot, &Truth ) )
2095 Strs->
nVarIns = Vec_IntSize(
p->vDivSet );
2096 for ( i = 0; i < Strs->
nVarIns; i++ )
2105 if ( !
p->pPars->fVerbose )
2123 int nNodesOld = Gia_ManObjNum(pGia);
2125 assert( pPars->nLutSize <= 6 );
2140 Pivot = Gia_ObjId( pGia, pObj );
2141 if ( Pivot >= nNodesOld )
2143 if ( Gia_ObjIsAnd(pObj) )
2148 p->timeCut += Abc_Clock() - clk;
2149 Vec_IntWriteEntry(
p->vLutLevs, Pivot, Delay );
2150 if ( Delay > 1 && (!vPath || Vec_BitEntry(vPath, Pivot)) )
2153 else if ( Gia_ObjIsCi(pObj) )
2156 Vec_IntWriteEntry(
p->vLutLevs, Pivot, arrTime );
2159 else if ( Gia_ObjIsCo(pObj) )
2161 int arrTime = Vec_IntEntry(
p->vLutLevs, Gia_ObjFaninId0(pObj, Pivot) );
2164 else if ( Gia_ObjIsConst0(pObj) )
2170 Vec_IntFree( vNodes );
2177 if ( Pivot >= nNodesOld )
2179 if ( Gia_ObjIsCi(pObj) )
2181 else if ( Gia_ObjIsAnd(pObj) )
2186 p->timeCut += Abc_Clock() - clk;
2187 Vec_IntWriteEntry(
p->vLutLevs, Pivot, Delay );
2188 if ( Delay > 1 && (!vPath || Vec_BitEntry(vPath, Pivot)) )
2195 Vec_BitFreeP( &vPath );
2196 p->timeTotal = Abc_Clock() -
p->timeTotal;
2197 if (
p->pPars->fVerbose )
2199 printf(
"K = %d. S = %d. N = %d. P = %d. ",
2200 p->pPars->nLutSize,
p->pPars->nLutNum,
p->pPars->nCutSize,
p->pPars->nCutNum );
2201 printf(
"Try = %d. Use = %d. C = %d. 1 = %d. 2 = %d. 3a = %d. 3b = %d. Lev = %d. ",
2202 p->nTried,
p->nUsed,
p->nLuts[0],
p->nLuts[1],
p->nLuts[2],
p->nLuts[3],
p->nLuts[4],
Sbd_ManDelay(
p) );
2203 Abc_PrintTime( 1,
"Time",
p->timeTotal );
2207 p->timeOther =
p->timeTotal -
p->timeWin -
p->timeCut -
p->timeCov -
p->timeCnf -
p->timeSat -
p->timeQbf;
2208 if (
p->pPars->fVerbose )
2210 ABC_PRTP(
"Win",
p->timeWin ,
p->timeTotal );
2211 ABC_PRTP(
"Cut",
p->timeCut ,
p->timeTotal );
2212 ABC_PRTP(
"Cov",
p->timeCov ,
p->timeTotal );
2213 ABC_PRTP(
"Cnf",
p->timeCnf ,
p->timeTotal );
2214 ABC_PRTP(
"Sat",
p->timeSat ,
p->timeTotal );
2215 ABC_PRTP(
"Qbf",
p->timeQbf ,
p->timeTotal );
2216 ABC_PRTP(
"Oth",
p->timeOther,
p->timeTotal );
2217 ABC_PRTP(
"ALL",
p->timeTotal,
p->timeTotal );
#define ABC_PRTP(a, t, T)
#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 ///.
int Dsm_ManTruthToGia(void *p, word *pTruth, Vec_Int_t *vLeaves, Vec_Int_t *vCover)
void Gia_ManStop(Gia_Man_t *p)
#define Gia_ManForEachAnd(p, pObj, i)
word Gia_ManRandomW(int fReset)
void Gia_ManSetRegNum(Gia_Man_t *p, int nRegs)
#define Gia_ManForEachCoDriverId(p, DriverId, i)
void Gia_ManHashAlloc(Gia_Man_t *p)
Gia_Man_t * Gia_ManStart(int nObjsMax)
FUNCTION DEFINITIONS ///.
struct Gia_Obj_t_ Gia_Obj_t
void Gia_ManFillValue(Gia_Man_t *p)
struct Gia_Man_t_ Gia_Man_t
#define Gia_ManForEachObjVec(vVec, p, pObj, i)
Gia_Man_t * Gia_ManCleanup(Gia_Man_t *p)
void Gia_ManCleanMark0(Gia_Man_t *p)
void Gia_ManTransferTiming(Gia_Man_t *p, Gia_Man_t *pGia)
void Gia_ManCreateRefs(Gia_Man_t *p)
int Gia_ManHashAnd(Gia_Man_t *p, int iLit0, int iLit1)
void Gia_ManIncrementTravId(Gia_Man_t *p)
int Gia_ManHashXorReal(Gia_Man_t *p, int iLit0, int iLit1)
#define Gia_ManForEachObj(p, pObj, i)
MACRO DEFINITIONS ///.
#define Gia_ManForEachCo(p, pObj, i)
Vec_Int_t * Gia_ManOrderWithBoxes(Gia_Man_t *p)
#define Gia_ManForEachCi(p, pObj, i)
void Gia_ManHashStop(Gia_Man_t *p)
int Gia_ManLevelNum(Gia_Man_t *p)
void Gia_ManTransferMapping(Gia_Man_t *p, Gia_Man_t *pGia)
#define Gia_ManForEachAndId(p, i)
unsigned Gia_ManRandom(int fReset)
FUNCTION DEFINITIONS ///.
#define Gia_ManForEachCiId(p, Id, i)
void Extra_PrintBinary(FILE *pFile, unsigned Sign[], int nBits)
unsigned __int64 word
DECLARATIONS ///.
int Sbd_ManWindow(Sbd_Man_t *p, int Pivot)
void Sbd_ManFindCut_rec(Gia_Man_t *p, Gia_Obj_t *pObj)
void Sbd_ManPrintObj(Sbd_Man_t *p, int Pivot)
void Sbd_ManPropagateControl(Sbd_Man_t *p, int Pivot)
Sbd_Man_t * Sbd_ManStart(Gia_Man_t *pGia, Sbd_Par_t *pPars)
void Sbd_ManDeriveMapping(Sbd_Man_t *p, Gia_Man_t *pNew)
int Sbd_ManCheckConst(Sbd_Man_t *p, int Pivot)
int Sbd_ManExplore2(Sbd_Man_t *p, int Pivot, word *pTruth)
void Sbd_ManFindCutUnmark_rec(Gia_Man_t *p, Gia_Obj_t *pObj)
#define SBD_MAX_LUTSIZE
DECLARATIONS ///.
void Sbd_ManDeriveMapping_rec(Sbd_Man_t *p, Gia_Man_t *pNew, int iObj)
int Sbd_CutMergeSimple(Sbd_Man_t *p, int *pCut1, int *pCut2, int *pCut)
void Sbd_ManFindCut(Sbd_Man_t *p, int Node, Vec_Int_t *vCutLits)
int Sbd_ManExplore(Sbd_Man_t *p, int Pivot, word *pTruth)
int Sbd_ManDelay(Sbd_Man_t *p)
int Sbd_ManExplore3(Sbd_Man_t *p, int Pivot, int *pnStrs, Sbd_Str_t *Strs)
void Sbd_ManDerive_rec(Gia_Man_t *pNew, Gia_Man_t *p, int Node, Vec_Int_t *vMirrors)
void Sbd_ManMergeTest(Sbd_Man_t *p)
void Sbd_NtkPerformOne(Sbd_Man_t *p, int Pivot)
int Sbd_ManMergeCuts(Sbd_Man_t *p, int Node)
void Sbd_ManStop(Sbd_Man_t *p)
int Sbd_ManImplement(Sbd_Man_t *p, int Pivot, word Truth)
void Sbd_ParSetDefault(Sbd_Par_t *pPars)
FUNCTION DEFINITIONS ///.
void Sbd_ManUpdateOrder(Sbd_Man_t *p, int Pivot)
int Sbd_ManExploreCut(Sbd_Man_t *p, int Pivot, int nLeaves, int *pLeaves, int *pnStrs, Sbd_Str_t *Strs, int *pFreeVar)
void Sbd_ManWindowSim_rec(Sbd_Man_t *p, int NodeInit)
Vec_Wec_t * Sbd_ManWindowRoots(Gia_Man_t *p, int nTfoLevels, int nTfoFanMax)
struct Sbd_Man_t_ Sbd_Man_t
void Sbd_ManMatrPrint(Sbd_Man_t *p, word Cover[], int nCol, int nRows)
int Sbd_ManImplement2(Sbd_Man_t *p, int Pivot, int nStrs, Sbd_Str_t *pStrs)
void Sbd_ManPropagateControlOne(Sbd_Man_t *p, int Node)
Gia_Man_t * Sbd_ManDerive(Sbd_Man_t *pMan, Gia_Man_t *p, Vec_Int_t *vMirrors)
Gia_Man_t * Sbd_NtkPerform(Gia_Man_t *pGia, Sbd_Par_t *pPars)
void Sbd_ManCutServerStop(Sbd_Srv_t *p)
int Sbd_ManCutServerFirst(Sbd_Srv_t *p, int iObj, int *pLeaves)
Sbd_Srv_t * Sbd_ManCutServerStart(Gia_Man_t *pGia, Vec_Int_t *vMirrors, Vec_Int_t *vLutLevs, Vec_Int_t *vLevs, Vec_Int_t *vRefs, int nLutSize, int nCutSize, int nCutNum, int fVerbose)
FUNCTION DEFINITIONS ///.
Sbd_Sto_t * Sbd_StoAlloc(Gia_Man_t *pGia, Vec_Int_t *vMirrors, int nLutSize, int nCutSize, int nCutNum, int fCutMin, int fVerbose)
MACRO DEFINITIONS ///.
void Sbd_StoFree(Sbd_Sto_t *p)
int Sbd_StoComputeCutsNode(Sbd_Sto_t *p, int iObj)
void Sbd_StoSaveBestDelayCut(Sbd_Sto_t *p, int iObj, int *pCut)
void Sbd_StoComputeCutsConst0(Sbd_Sto_t *p, int iObj)
void Sbd_StoRefObj(Sbd_Sto_t *p, int iObj, int iMirror)
void Sbd_StoDerefObj(Sbd_Sto_t *p, int iObj)
int Sbd_StoObjBestCut(Sbd_Sto_t *p, int iObj, int nSize, int *pLeaves)
void Sbd_StoComputeCutsCi(Sbd_Sto_t *p, int iObj, int Delay, int Level)
struct Sbd_Sto_t_ Sbd_Sto_t
BASIC TYPES ///.
struct Sbd_Srv_t_ Sbd_Srv_t
word Sbd_ManSolve(sat_solver *pSat, int PivotVar, int FreeVar, Vec_Int_t *vDivSet, Vec_Int_t *vDivVars, Vec_Int_t *vDivValues, Vec_Int_t *vTemp)
sat_solver * Sbd_ManSatSolver(sat_solver *pSat, Gia_Man_t *p, Vec_Int_t *vMirrors, int Pivot, Vec_Int_t *vWinObjs, Vec_Int_t *vObj2Var, Vec_Int_t *vTfo, Vec_Int_t *vRoots, int fQbf)
DECLARATIONS ///.
#define SBD_SAT_UNDEC
INCLUDES ///.
int Sbd_ManCollectConstants(sat_solver *pSat, int nCareMints[2], int PivotVar, word *pVarSims[], Vec_Int_t *vInds)
int Sbd_ManCollectConstantsNew(sat_solver *pSat, Vec_Int_t *vDivVars, int nConsts, int PivotVar, word *pOnset, word *pOffset)
int Sbd_ProblemSolve(Gia_Man_t *p, Vec_Int_t *vMirrors, int Pivot, Vec_Int_t *vWinObjs, Vec_Int_t *vObj2Var, Vec_Int_t *vTfo, Vec_Int_t *vRoots, Vec_Int_t *vDivSet, int nStrs, Sbd_Str_t *pStr0)
Vec_Bit_t * Sbc_ManCriticalPath(Gia_Man_t *p)
struct Sbd_Str_t_ Sbd_Str_t
typedefABC_NAMESPACE_HEADER_START struct Sbd_Par_t_ Sbd_Par_t
INCLUDES ///.
void Tim_ManSetCoArrival(Tim_Man_t *p, int iCo, float Delay)
int Tim_ManBoxNum(Tim_Man_t *p)
typedefABC_NAMESPACE_HEADER_START struct Tim_Man_t_ Tim_Man_t
INCLUDES ///.
void Tim_ManIncrementTravId(Tim_Man_t *p)
DECLARATIONS ///.
void Tim_ManStop(Tim_Man_t *p)
Tim_Man_t * Tim_ManDup(Tim_Man_t *p, int fUnitDelay)
float Tim_ManGetCiArrival(Tim_Man_t *p, int iCi)
typedefABC_NAMESPACE_HEADER_START struct Vec_Bit_t_ Vec_Bit_t
INCLUDES ///.
#define Vec_IntForEachEntry(vVec, Entry, i)
MACRO DEFINITIONS ///.
#define Vec_IntForEachEntryStop(vVec, Entry, i, Stop)
#define Vec_IntForEachEntryStartStop(vVec, Entry, i, Start, Stop)
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
#define Vec_WecForEachLevel(vGlob, vVec, i)
MACRO DEFINITIONS ///.
typedefABC_NAMESPACE_HEADER_START struct Vec_Wec_t_ Vec_Wec_t
INCLUDES ///.
typedefABC_NAMESPACE_HEADER_START struct Vec_Wrd_t_ Vec_Wrd_t
INCLUDES ///.