96 word Diff0 = pComps[Gia_ObjFaninC0(pObj)];
97 word Diff1 = pComps[Gia_ObjFaninC1(pObj)];
98 word * pSims = Vec_WrdArray(vSims);
99 word * pSims0 = pSims +
nWords*Gia_ObjFaninId0(pObj, i);
100 word * pSims1 = pSims +
nWords*Gia_ObjFaninId1(pObj, i);
102 if ( Gia_ObjIsXor(pObj) )
103 for ( w = 0; w <
nWords; w++ )
104 pSims2[w] = (pSims0[w] ^ Diff0) ^ (pSims1[w] ^ Diff1);
106 for ( w = 0; w <
nWords; w++ )
107 pSims2[w] = (pSims0[w] ^ Diff0) & (pSims1[w] ^ Diff1);
112 word Diff0 = pComps[Gia_ObjFaninC0(pObj)];
113 word * pSims = Vec_WrdArray(vSims);
114 word * pSims0 = pSims +
nWords*Gia_ObjFaninId0(pObj, i);
116 for ( w = 0; w <
nWords; w++ )
117 pSims2[w] = (pSims0[w] ^ Diff0);
121 word * pSims = Vec_WrdArray(vSims) +
nWords*i;
int w;
122 for ( w = 0; w <
nWords; w++ )
123 pSims[w] = ~pSims[w];
128 int i,
nWords = Vec_WrdSize(pGia->
vSimsPi) / Gia_ManCiNum(pGia);
130 assert( Vec_WrdSize(pGia->
vSimsPi) % Gia_ManCiNum(pGia) == 0 );
133 Gia_ManSimPatSimAnd( pGia, i, pObj,
nWords, vSims );
135 Gia_ManSimPatSimPo( pGia, Gia_ObjId(pGia, pObj), pObj,
nWords, vSims );
141 int i,
nWords = Vec_WrdSize(vSimsPi) / Gia_ManCiNum(pGia);
142 Vec_Wrd_t * vSimsCo = fOuts ? Vec_WrdStart( Gia_ManCoNum(pGia) *
nWords ) : NULL;
144 assert( Vec_WrdSize(vSimsPi) % Gia_ManCiNum(pGia) == 0 );
147 Gia_ManSimPatSimAnd( pGia, i, pObj,
nWords, vSims );
149 Gia_ManSimPatSimPo( pGia, Gia_ObjId(pGia, pObj), pObj,
nWords, vSims );
154 Vec_WrdFree( vSims );
160 word Diff0 = pComps[Gia_ObjFaninC0(pObj)];
161 word Diff1 = pComps[Gia_ObjFaninC1(pObj)];
162 word * pSims0 = Vec_WrdArray(vSims) +
nWords*Gia_ObjFaninId0(pObj, i);
163 word * pSims1 = Vec_WrdArray(vSims) +
nWords*Gia_ObjFaninId1(pObj, i);
164 word * pSims2 = Vec_WrdArray(vSims) +
nWords*i;
165 word * pSimsC0 = Vec_WrdArray(vSimsC) +
nWords*Gia_ObjFaninId0(pObj, i);
166 word * pSimsC1 = Vec_WrdArray(vSimsC) +
nWords*Gia_ObjFaninId1(pObj, i);
167 word * pSimsC2 = Vec_WrdArray(vSimsC) +
nWords*i;
int w;
168 if ( Gia_ObjIsXor(pObj) )
169 for ( w = 0; w <
nWords; w++ )
171 pSimsC0[w] |= pSimsC2[w];
172 pSimsC1[w] |= pSimsC2[w];
175 for ( w = 0; w <
nWords; w++ )
177 pSimsC0[w] |= (pSims2[w] | (pSims0[w] ^ Diff0)) & pSimsC2[w];
178 pSimsC1[w] |= (pSims2[w] | (pSims1[w] ^ Diff1)) & pSimsC2[w];
184 int i, Id,
nWords = Vec_WrdSize(vSims) / Gia_ManObjNum(pGia);
185 Vec_Wrd_t * vSimsCi = fIns ? Vec_WrdStart( Gia_ManCiNum(pGia) *
nWords ) : NULL;
186 Vec_Wrd_t * vSimsC = Vec_WrdStart( Vec_WrdSize(vSims) );
187 assert( Vec_WrdSize(vSims) % Gia_ManObjNum(pGia) == 0 );
195 Gia_ManSimPatSimAnd3( pGia, i, pObj,
nWords, vSims, vSimsC );
200 Vec_WrdFree( vSimsC );
206 Vec_Wrd_t * vSimsCi = Vec_WrdStartRandom( Gia_ManCiNum(pGia) *
nWords );
209 int nOnes = Abc_TtCountOnesVec( Vec_WrdArray(vSims2), Vec_WrdSize(vSims2) );
211 printf(
"Ratio = %6.2f %%\n", 100.0*nOnes/
nTotal );
212 Vec_WrdFree( vSims );
213 Vec_WrdFree( vSims2 );
214 Vec_WrdFree( vSimsCi );
219 word Diff0 = pComps[Gia_ObjFaninC0(pObj)];
220 word Diff1 = pComps[Gia_ObjFaninC1(pObj)];
221 word * pSims0 = Vec_WrdArray(vSims) +
nWords*Gia_ObjFaninId0(pObj, i);
222 word * pSims1 = Vec_WrdArray(vSims) +
nWords*Gia_ObjFaninId1(pObj, i);
223 word * pSimsC0 = Vec_WrdArray(vSimsC) +
nWords*Gia_ObjFaninId0(pObj, i);
224 word * pSimsC1 = Vec_WrdArray(vSimsC) +
nWords*Gia_ObjFaninId1(pObj, i);
225 word * pSimsC2 = Vec_WrdArray(vSimsC) +
nWords*i;
int w;
226 if ( Gia_ObjIsXor(pObj) )
227 for ( w = 0; w <
nWords; w++ )
228 pSimsC2[w] = pSimsC0[w] & pSimsC1[w];
230 for ( w = 0; w <
nWords; w++ )
231 pSimsC2[w] = (pSimsC0[w] & pSimsC1[w]) | ((pSims0[w] ^ Diff0) & pSimsC0[w]) | ((pSims1[w] ^ Diff1) & pSimsC1[w]);
236 int i, Id,
nWords = Vec_WrdSize(vSims) / Gia_ManObjNum(pGia);
237 Vec_Wrd_t * vSimsC = Vec_WrdStart( Vec_WrdSize(vSims) );
238 assert( Vec_WrdSize(vSims) % Gia_ManObjNum(pGia) == 0 );
243 Gia_ManSimPatSimAnd4( pGia, i, pObj,
nWords, vSims, vSimsC );
249 Vec_Wrd_t * vSimsCi = Vec_WrdStartRandom( Gia_ManCiNum(pGia) *
nWords );
254 int nOnes2 = Abc_TtCountOnesVec( Vec_WrdArray(vSims2), Vec_WrdSize(vSims2) );
255 int nOnes3 = Abc_TtCountOnesVec( Vec_WrdArray(vSims3), Vec_WrdSize(vSims3) );
257 printf(
"Ratio = %6.2f %% Ratio = %6.2f %%\n", 100.0*nOnes2/
nTotal, 100.0*nOnes3/
nTotal );
258 Vec_WrdFree( vSims );
259 Vec_WrdFree( vSims2 );
260 Vec_WrdFree( vSims3 );
261 Vec_WrdFree( vSimsCi );
262 Vec_WrdFree( vSimsCi2 );
269 Gia_ManSimPatSimNot( pGia, Gia_ObjId(pGia, pObj), pObj,
nWords, vSims );
270 else if ( Gia_ObjIsAnd(pObj) )
271 Gia_ManSimPatSimAnd( pGia, Gia_ObjId(pGia, pObj), pObj,
nWords, vSims );
272 else if ( !Gia_ObjIsCo(pObj) )
assert(0);
276 Vec_WrdDumpHex( pFileName, vSimsIn,
nWords, 0 );
293 int nWords = Abc_Truth6WordNum( Gia_ManCiNum(
p) );
297 assert( Gia_ObjId(
p, pObj) == i+1 );
298 Vec_Ptr_t * vTruths = Vec_PtrAllocTruthTables( Gia_ManCiNum(
p) );
300 Abc_TtCopy( Vec_WrdEntryP(vSims,
nWords*(i+1)), (
word *)Vec_PtrEntry(vTruths, i),
nWords, 0 );
301 Vec_PtrFree( vTruths );
303 Gia_ManSimPatSimAnd(
p, i, pObj,
nWords, vSims );
308 int nVars2 = (Gia_ManCiNum(
p) + 6)/2;
309 int nVars3 = Gia_ManCiNum(
p) - nVars2;
310 int nWords = Abc_Truth6WordNum( Gia_ManCiNum(
p) );
311 int nWords2 = Abc_Truth6WordNum( nVars2 );
313 Vec_Wrd_t * vSims = Vec_WrdStart( nWords2 * Gia_ManObjNum(
p) );
314 Vec_Ptr_t * vTruths = Vec_PtrAllocTruthTables( nVars2 );
317 assert( Gia_ObjId(
p, pObj) == i+1 );
318 for ( i = 0; i < nVars2; i++ )
319 Abc_TtCopy( Vec_WrdEntryP(vSims, nWords2*(i+1)), (
word *)Vec_PtrEntry(vTruths, i), nWords2, 0 );
320 Vec_PtrFree( vTruths );
321 for ( m = 0; m < (1 << nVars3); m++ )
323 for ( v = 0; v < nVars3; v++ )
324 Abc_TtConst( Vec_WrdEntryP(vSims, nWords2*(nVars2+v+1)), nWords2, (m >> v) & 1 );
326 Gia_ManSimPatSimAnd(
p, i, pObj, nWords2, vSims );
328 Gia_ManSimPatSimPo(
p, Gia_ObjId(
p, pObj), pObj, nWords2, vSims );
330 Abc_TtCopy( pRes + i*
nWords + m*nWords2, Vec_WrdEntryP(vSims, nWords2*Gia_ObjId(
p, pObj)), nWords2, 0 );
332 Vec_WrdFree( vSims );
339 int nWords = Abc_Truth6WordNum( Gia_ManCiNum(
p) );
340 int nCofs = 1 << (Gia_ManCiNum(
p) - 6);
342 Vec_Int_t * vMemory = Vec_IntAlloc( 1 << 16 );
344 Vec_Int_t * vCtrls = Vec_IntAlloc( nCofs );
345 Vec_Int_t * vDatas = Vec_IntAlloc( Gia_ManCoNum(
p) );
348 pNew->
pName = Abc_UtilStrsav(
p->pName );
349 pNew->
pSpec = Abc_UtilStrsav(
p->pSpec );
350 Gia_ManConst0(
p)->Value = 0;
351 for ( i = 0; i < Gia_ManCiNum(
p); i++ )
352 Vec_IntPush( i < 6 ? vLeaves : vCtrls, Gia_ManAppendCi(pNew) );
354 for ( o = 0; o < Gia_ManCoNum(
p); o++ )
356 Vec_IntClear( vDatas );
357 for ( i = 0; i <
nWords; i++ )
358 Vec_IntPush( vDatas,
Kit_TruthToGia(pNew, (
unsigned *)(pRes+o*
nWords+i), 6, vMemory, vLeaves, 1) );
359 Gia_ManAppendCo( pNew,
Gia_ManFindMuxTree_rec(pNew, Vec_IntArray(vCtrls), Vec_IntSize(vCtrls), vDatas, 0) );
363 Vec_IntFree( vMemory );
364 Vec_IntFree( vLeaves );
365 Vec_IntFree( vCtrls );
366 Vec_IntFree( vDatas );
388 if ( Gia_ObjIsTravIdPreviousId(
p, iObj) )
390 if ( Gia_ObjIsTravIdCurrentId(
p, iObj) )
392 pObj = Gia_ManObj(
p, iObj );
393 if ( !Gia_ObjIsAnd(pObj) )
398 Gia_ObjSetTravIdPreviousId(
p, iObj);
399 Vec_IntPush( vNode, iObj );
402 Gia_ObjSetTravIdCurrentId(
p, iObj);
407 Vec_Wec_t * vNodes = Vec_WecStart( Gia_ManCiNum(
p) );
409 int i, o, IdCi, IdCo;
412 Vec_Int_t * vNode = Vec_WecEntry( vNodes, i );
415 Gia_ObjSetTravIdPreviousId(
p, IdCi);
416 Vec_IntPush( vNode, IdCi );
417 Vec_IntClear( vTemp );
420 Vec_IntPush( vTemp, Gia_ManObjNum(
p) + (o >> 1) );
421 Vec_IntUniqify( vTemp );
422 Vec_IntAppend( vNode, vTemp );
424 Vec_IntFree( vTemp );
425 Vec_WecSort( vNodes, 1 );
432 int iVar, Target = 1 << 28;
433 for ( iVar = 6; iVar < Gia_ManCiNum(
p); iVar++ )
434 if ( (1 << (iVar-3)) * Gia_ManObjNum(
p) > Target )
436 if ( iVar == Gia_ManCiNum(
p) )
437 iVar = Gia_ManCiNum(
p) - 1;
439 printf(
"Split var = %d. Rounds = %d. Bytes per node = %d. Total = %.2f MB.\n", iVar, 1 << (Gia_ManCiNum(
p) - iVar), 1 << (iVar-3), 1.0*(1 << (iVar-3)) * Gia_ManObjNum(
p)/(1<<20) );
446 word * pSim0 = Vec_WrdEntryP( vSims, nWords2*Gia_ObjId(
p, pObj0) );
447 word * pSim1 = Vec_WrdEntryP( vSims, nWords2*Gia_ObjId(
p, pObj1) );
448 Gia_ManSimPatSimPo(
p, Gia_ObjId(
p, pObj0), pObj0, nWords2, vSims );
449 Gia_ManSimPatSimPo(
p, Gia_ObjId(
p, pObj1), pObj1, nWords2, vSims );
450 return Abc_TtEqual( pSim0, pSim1, nWords2 );
454 abctime clk = Abc_Clock();
int fWarning = 0;
457 int nVars3 = Gia_ManCiNum(
p) - nVars2;
458 int nWords2 = Abc_Truth6WordNum( nVars2 );
459 Vec_Wrd_t * vSims = Vec_WrdStart( nWords2 * Gia_ManObjNum(
p) );
461 Vec_Ptr_t * vTruths = Vec_PtrAllocTruthTables( nVars2 );
464 Abc_TtCopy( Vec_WrdEntryP(vSims, nWords2*Vec_IntEntry(vNode,0)), (
word *)Vec_PtrEntry(vTruths, i), nWords2, 0 );
465 Vec_PtrFree( vTruths );
467 Gia_ManSimPatSimAnd(
p, i, pObj, nWords2, vSims );
468 for ( i = 0; i < Gia_ManCoNum(
p)/2; i++ )
472 printf(
"Miter is asserted for output %d.\n", i );
473 Vec_WecFree( vNodes );
474 Vec_WrdFree( vSims );
478 for ( m = 0; m < (1 << nVars3); m++ )
480 int iVar = m ? Abc_TtSuppFindFirst( m ^ (m >> 1) ^ (m-1) ^ ((m-1) >> 1) ) : 0;
481 vNode = Vec_WecEntry( vNodes, nVars2+iVar );
482 Abc_TtNot( Vec_WrdEntryP(vSims, nWords2*Vec_IntEntry(vNode,0)), nWords2 );
485 if ( iObj < Gia_ManObjNum(
p) )
487 pObj = Gia_ManObj(
p, iObj );
488 assert( Gia_ObjIsAnd(pObj) );
489 Gia_ManSimPatSimAnd(
p, iObj, pObj, nWords2, vSims );
493 printf(
"Miter is asserted for output %d.\n", iObj - Gia_ManObjNum(
p) );
494 Vec_WecFree( vNodes );
495 Vec_WrdFree( vSims );
501 if ( !fWarning && Abc_Clock() > clk + 5*CLOCKS_PER_SEC )
502 printf(
"The computation is expected to take about %.2f sec.\n", 5.0*(1 << nVars3)/m ), fWarning = 1;
504 if ( fVerbose && (m & 0xFF) == 0xFF )
505 printf(
"Finished %6d (out of %6d)...\n", m, 1 << nVars3 );
507 Vec_WecFree( vNodes );
508 Vec_WrdFree( vSims );
526 assert( Vec_WrdSize(vSims) == 2 *
nWords * Gia_ManObjNum(
p) );
530 Abc_TtCopy( Vec_WrdEntryP(vSims, 2*Id*
nWords+0), Vec_WrdEntryP(vSimsIn, i*
nWords),
nWords, 0 );
531 Abc_TtCopy( Vec_WrdEntryP(vSims, 2*Id*
nWords+1), Vec_WrdEntryP(vSimsIn, i*
nWords),
nWords, 1 );
536 word * pSims = Vec_WrdArray(vSims);
537 word * pSims0 = pSims +
nWords*Gia_ObjFaninLit0(pObj, i);
538 word * pSims1 = pSims +
nWords*Gia_ObjFaninLit1(pObj, i);
540 word * pSims3 = pSims +
nWords*(2*i+1);
int w;
541 assert( !Gia_ObjIsXor(pObj) );
546 for ( w = 0; w <
nWords; w++ )
548 pSims2[w] = pSims0[w] & pSims1[w];
549 pSims3[w] = ~pSims2[w];
555 word * pSims = Vec_WrdArray(vSims);
556 word * pSims0 = pSims +
nWords*Gia_ObjFaninLit0(pObj, i);
558 for ( w = 0; w <
nWords; w++ )
559 pSims2[w] = pSims0[w];
564 int i,
nWords = Vec_WrdSize(pGia->
vSimsPi) / Gia_ManCiNum(pGia);
566 assert( Vec_WrdSize(pGia->
vSimsPi) % Gia_ManCiNum(pGia) == 0 );
569 Gia_ManSimPatSimAnd2( pGia, i, pObj,
nWords, vSims );
571 Gia_ManSimPatSimPo2( pGia, Gia_ObjId(pGia, pObj), pObj,
nWords, vSims );
596 int i, Id,
nWords = Vec_WrdSize(
p->vSimsPi) / Gia_ManCiNum(
p);
604 Vec_WrdFree( vSims );
622 int nWordsBase = Vec_WrdSize(vBase) / nInputs;
623 int nWordsAddOn = Vec_WrdSize(vAddOn) / nInputs;
int i, w;
624 Vec_Wrd_t * vSimsIn = Vec_WrdAlloc( nInputs * (nWordsBase + nWordsUse) );
625 assert( Vec_WrdSize(vBase) % nInputs == 0 );
626 assert( Vec_WrdSize(vAddOn) % nInputs == 0 );
627 assert( nWordsUse <= nWordsAddOn );
628 for ( i = 0; i < nInputs; i++ )
630 word * pSimsB = nWordsBase ? Vec_WrdEntryP( vBase, i * nWordsBase ) : NULL;
631 word * pSimsA = nWordsAddOn ? Vec_WrdEntryP( vAddOn, i * nWordsAddOn ) : NULL;
632 for ( w = 0; w < nWordsBase; w++ )
633 Vec_WrdPush( vSimsIn, pSimsB[w] );
634 for ( w = 0; w < nWordsUse; w++ )
635 Vec_WrdPush( vSimsIn, pSimsA[w] );
637 assert( Vec_WrdSize(vSimsIn) == Vec_WrdCap(vSimsIn) || Vec_WrdSize(vSimsIn) < 16 );
642 word * pSimsI, * pSimsC;
int i, k;
643 for ( i = 0; i < iPat; i++ )
645 for ( k = 0; k < nLits; k++ )
647 int iVar = Abc_Lit2Var( pLits[k] );
648 pSimsI = Vec_WrdEntryP( vSimsIn,
nWords * iVar );
649 pSimsC = Vec_WrdEntryP( vSimsCare,
nWords * iVar );
650 if ( Abc_TtGetBit(pSimsC, i) && (Abc_TtGetBit(pSimsI, i) == Abc_LitIsCompl(pLits[k])) )
656 for ( k = 0; k < nLits; k++ )
658 int iVar = Abc_Lit2Var( pLits[k] );
659 pSimsI = Vec_WrdEntryP( vSimsIn,
nWords * iVar );
660 pSimsC = Vec_WrdEntryP( vSimsCare,
nWords * iVar );
661 if ( !Abc_TtGetBit(pSimsC, i) && Abc_TtGetBit(pSimsI, i) == Abc_LitIsCompl(pLits[k]) )
662 Abc_TtXorBit( pSimsI, i );
663 Abc_TtSetBit( pSimsC, i );
664 assert( Abc_TtGetBit(pSimsC, i) && (Abc_TtGetBit(pSimsI, i) != Abc_LitIsCompl(pLits[k])) );
666 return (
int)(i == iPat);
670 int c, iCur = 0, iPat = 0;
671 int nWordsMax = Abc_Bit6WordNum( nCexes );
672 Vec_Wrd_t * vSimsIn = Vec_WrdStartRandom( Gia_ManCiNum(
p) * nWordsMax );
673 Vec_Wrd_t * vSimsCare = Vec_WrdStart( Gia_ManCiNum(
p) * nWordsMax );
675 for ( c = 0; c < nCexes + nUnDecs; c++ )
677 int Out = Vec_IntEntry( vCexStore, iCur++ );
678 int Size = Vec_IntEntry( vCexStore, iCur++ );
681 iPat +=
Gia_ManSimBitPackOne( nWordsMax, vSimsIn, vSimsCare, iPat, Vec_IntEntryP(vCexStore, iCur), Size );
683 assert( iPat <= nCexes + nUnDecs );
686 assert( iCur == Vec_IntSize(vCexStore) );
687 vSimsRes =
Gia_ManSimCombine( Gia_ManCiNum(
p),
p->vSimsPi, vSimsIn, Abc_Bit6WordNum(iPat+1) );
688 printf(
"Compressed %d CEXes into %d patterns and added %d words to available %d words.\n",
689 nCexes, iPat, Abc_Bit6WordNum(iPat+1), Vec_WrdSize(
p->vSimsPi) / Gia_ManCiNum(
p) );
690 Vec_WrdFree( vSimsIn );
691 Vec_WrdFree( vSimsCare );
711 vStore = Vec_MemAlloc(
nWords, 12 );
712 Vec_MemHashAlloc( vStore, 1 << 12 );
716 if ( pnC0 && Abc_TtIsConst0(pSim,
nWords) )
718 if ( pnC1 && Abc_TtIsConst1(pSim,
nWords) )
720 Vec_MemHashInsert( vStore, pSim );
722 nUnique = Vec_MemEntryNum( vStore );
723 Vec_MemHashFree( vStore );
724 Vec_MemFree( vStore );
731 int i,
nWords = Vec_WrdSize(vSims) / Gia_ManObjNum(
p);
734 Gia_ManConst0(
p)->Value = 0;
736 pObj->
Value = Gia_ManAppendCi( pNew );
742 if ( Abc_TtIsConst0(pSim,
nWords) )
743 Gia_ManAppendCo( pNew, Abc_LitNotCond(pObj->
Value, 0) );
744 if ( Abc_TtIsConst1(pSim,
nWords) )
745 Gia_ManAppendCo( pNew, Abc_LitNotCond(pObj->
Value, 1) );
767 int nWords = Vec_WrdSize(vSims) / Gia_ManObjNum(pGia);
769 printf(
"Simulating %d patterns leads to %d unique objects (%.2f %% out of %d). Const0 = %d. Const1 = %d.\n",
770 64*
nWords, nUnique, 100.0*nUnique/Gia_ManCandNum(pGia), Gia_ManCandNum(pGia), nC0s, nC1s );
771 Vec_WrdFree( vSims );
776 int i, Status, Counts[3] = {0};
788 assert( Status >= -1 && Status <= 1 );
792 printf(
"Total = %d : SAT = %d. UNSAT = %d. UNDEC = %d.\n", Counts[1]+Counts[2]+Counts[0], Counts[1], Counts[2], Counts[0] );
793 if ( Counts[1] == 0 )
794 printf(
"There are no counter-examples. No need for more simulation.\n" );
798 Vec_WrdFreeP( &
p->vSimsPi );
799 p->vSimsPi = vSimsIn;
802 Vec_StrFree( vStatus );
803 Vec_IntFree( vCexStore );
804 Vec_WrdFree( vSims );
825 p->nWords = Vec_WrdSize(pGia->
vSimsPi) / Gia_ManCiNum(pGia);
assert( Vec_WrdSize(pGia->
vSimsPi) % Gia_ManCiNum(pGia) == 0 );
829 p->vTfo = Vec_IntAlloc( 1000 );
830 p->vCands = Vec_IntAlloc( 1000 );
831 p->vFanins = Vec_IntAlloc( 10 );
832 p->vFanins2 = Vec_IntAlloc( 10 );
834 p->vSimsObj2 = Vec_WrdStart( Vec_WrdSize(
p->vSimsObj) );
835 assert(
p->nWords == Vec_WrdSize(
p->vSimsObj) / Gia_ManObjNum(pGia) );
842 Vec_IntFree(
p->vTfo );
843 Vec_IntFree(
p->vCands );
844 Vec_IntFree(
p->vFanins );
845 Vec_IntFree(
p->vFanins2 );
846 Vec_WrdFree(
p->vSimsObj );
847 Vec_WrdFree(
p->vSimsObj2 );
868 if ( Gia_ObjIsTravIdCurrentId(
p, iObj) )
870 Gia_ObjSetTravIdCurrentId(
p, iObj);
872 if ( iFanout == -1 || iFan == iFanout )
874 Vec_IntPush( vTfo, iObj );
879 Vec_IntClear(
p->vTfo );
882 assert( Vec_IntEntryLast(
p->vTfo) == iObj );
883 Vec_IntPop(
p->vTfo );
884 Vec_IntReverseOrder(
p->vTfo );
885 Vec_IntSort(
p->vTfo, 0 );
902 int nTruthWords = Abc_Truth6WordNum( Vec_IntSize(vFanins) );
904 word * pFunc = Vec_WrdEntryP(
p->vSimsObj,
p->nWords*iObj );
905 word * pFanins[16] = {NULL};
int s, b, iMint, i, iFanin;
906 assert( Vec_IntSize(vFanins) <= 16 );
908 pFanins[i] = Vec_WrdEntryP(
p->vSimsObj,
p->nWords*iFanin );
909 for ( s = 0; s < 64*
p->nWords; s++ )
911 if ( !Abc_TtGetBit(
p->pFunc[2], s) || Abc_TtGetBit(pFunc, s) != fOnSet )
914 for ( b = 0; b < Vec_IntSize(vFanins); b++ )
915 if ( Abc_TtGetBit(pFanins[b], s) )
917 Abc_TtSetBit( pTruth, iMint );
925 int Res = !Abc_TtIntersect( pTruth0, pTruth1,
p->nWords, 0 );
945 word Diff0 = pComps[Gia_ObjFaninC0(pObj)];
946 word Diff1 = pComps[Gia_ObjFaninC1(pObj)];
947 Vec_Wrd_t * vSims0 = Gia_ObjIsTravIdCurrentId(
p, Gia_ObjFaninId0(pObj, i)) ? vSims2 : vSims;
948 Vec_Wrd_t * vSims1 = Gia_ObjIsTravIdCurrentId(
p, Gia_ObjFaninId1(pObj, i)) ? vSims2 : vSims;
949 word * pSims0 = Vec_WrdEntryP( vSims0,
nWords*Gia_ObjFaninId0(pObj, i) );
950 word * pSims1 = Vec_WrdEntryP( vSims1,
nWords*Gia_ObjFaninId1(pObj, i) );
951 word * pSims2 = Vec_WrdEntryP( vSims2,
nWords*i );
int w;
952 if ( Gia_ObjIsXor(pObj) )
953 for ( w = 0; w <
nWords; w++ )
954 pSims2[w] = (pSims0[w] ^ Diff0) ^ (pSims1[w] ^ Diff1);
956 for ( w = 0; w <
nWords; w++ )
957 pSims2[w] = (pSims0[w] ^ Diff0) & (pSims1[w] ^ Diff1);
961 word * pSims = Vec_WrdEntryP(
p->vSimsObj,
p->nWords*iObj );
962 word * pSims2 = Vec_WrdEntryP(
p->vSimsObj2,
p->nWords*iObj );
int iNode, i;
963 Abc_TtCopy( pSims2, pSims,
p->nWords, 1 );
964 Abc_TtClear(
p->pFunc[2],
p->nWords );
967 Gia_Obj_t * pNode = Gia_ManObj(
p->pGia, iNode);
968 if ( Gia_ObjIsAnd(pNode) )
969 Gia_SimRsbSimAndCareSet(
p->pGia, iNode, pNode,
p->nWords,
p->vSimsObj,
p->vSimsObj2 );
970 else if ( Gia_ObjIsCo(pNode) )
972 word * pSimsA = Vec_WrdEntryP(
p->vSimsObj,
p->nWords*Gia_ObjFaninId0p(
p->pGia, pNode) );
973 word * pSimsB = Vec_WrdEntryP(
p->vSimsObj2,
p->nWords*Gia_ObjFaninId0p(
p->pGia, pNode) );
974 Abc_TtOrXor(
p->pFunc[2], pSimsA, pSimsB,
p->nWords );
995 int i, k, iTemp, iFanout;
996 Vec_IntClear(
p->vFanins2 );
997 assert( Vec_IntSize(
p->vFanins) > 0 );
1000 Gia_Obj_t * pObj = Gia_ManObj(
p->pGia, iTemp );
1001 if ( Gia_ObjIsAnd(pObj) && !Gia_ObjIsTravIdCurrentId(
p->pGia, Gia_ObjFaninId0(pObj, iTemp) ) )
1002 Vec_IntPush(
p->vFanins2, Gia_ObjFaninId0(pObj, iTemp) );
1003 if ( Gia_ObjIsAnd(pObj) && !Gia_ObjIsTravIdCurrentId(
p->pGia, Gia_ObjFaninId1(pObj, iTemp) ) )
1004 Vec_IntPush(
p->vFanins2, Gia_ObjFaninId1(pObj, iTemp) );
1006 if ( Gia_ObjIsAnd(Gia_ManObj(
p->pGia, iFanout)) && !Gia_ObjIsTravIdCurrentId(
p->pGia, iFanout ) )
1007 Vec_IntPush(
p->vFanins2, iFanout );
1013 assert( Gia_ObjIsAnd(Gia_ManObj(
p->pGia, iObj)) );
1014 Vec_IntClear(
p->vCands );
1015 Vec_IntFill(
p->vFanins, 1, iObj );
1016 while ( Vec_IntSize(
p->vFanins) > 0 && Vec_IntSize(
p->vCands) < nCands )
1020 Gia_ObjSetTravIdCurrentId(
p->pGia, iTemp );
1022 Vec_IntAppend(
p->vCands,
p->vFanins2 );
1025 assert( Vec_IntSize(
p->vFanins) == 0 || Vec_IntSize(
p->vCands) >= nCands );
1026 if ( Vec_IntSize(
p->vCands) > nCands )
1027 Vec_IntShrink(
p->vCands, nCands );
1044 int i, iCand, RetValue = 0;
1047 word * pFunc = Vec_WrdEntryP(
p->vSimsObj,
p->nWords*iObj );
1049 Abc_TtAndSharp(
p->pFunc[0], pCareSet, pFunc,
p->nWords, 1 );
1050 Abc_TtAndSharp(
p->pFunc[1], pCareSet, pFunc,
p->nWords, 0 );
1063 word * pDiv = Vec_WrdEntryP(
p->vSimsObj,
p->nWords*iCand );
1064 if ( !Abc_TtIntersect(pDiv,
p->pFunc[0],
p->nWords, 0) &&
1065 !Abc_TtIntersect(pDiv,
p->pFunc[1],
p->nWords, 1) )
1066 { (*pnBufs)++;
if ( fVerbose ) printf(
"Level %3d : %d = buf(%d)\n", Gia_ObjLevelId(
p->pGia, iObj), iObj, iCand ); RetValue = 1; }
1067 if ( !Abc_TtIntersect(pDiv,
p->pFunc[0],
p->nWords, 1) &&
1068 !Abc_TtIntersect(pDiv,
p->pFunc[1],
p->nWords, 0) )
1069 { (*pnInvs)++;
if ( fVerbose ) printf(
"Level %3d : %d = inv(%d)\n", Gia_ObjLevelId(
p->pGia, iObj), iObj, iCand ); RetValue = 1; }
1077 Gia_Obj_t * pObj;
int iObj, nCount = 0, nBufs = 0, nInvs = 0;
1083 nCount +=
Gia_ObjSimRsb(
p, iObj, nCands, fVerbose, &nBufs, &nInvs );
1084 printf(
"Can resubstitute %d nodes (%.2f %% out of %d) (Bufs = %d Invs = %d) ",
1085 nCount, 100.0*nCount/Gia_ManAndNum(pGia), Gia_ManAndNum(pGia), nBufs, nInvs );
1086 Abc_PrintTime( 1,
"Time", Abc_Clock() - clk );
1107 int i, m, Id, nMints =
nWords / nWordsIn;
1109 assert( Vec_WrdSize(vSimsIn) == nWordsIn * Gia_ManCiNum(
p) );
1111 for ( m = 0; m < nMints; m++ )
1112 memcpy( Vec_WrdEntryP(vSims, Id *
nWords + nWordsIn * m),
1113 Vec_WrdEntryP(vSimsIn, i * nWordsIn),
sizeof(
word) * nWordsIn );
1120 word * pSim = Vec_WrdEntryP( vSims,
nWords * Id + iMint * nWordsOut );
1121 word * pSimOut = Vec_WrdEntryP( vSimsOut, nWordsOut * i );
1131 if ( Abc_TtGetBit(pSim, iPat) != Abc_TtGetBit(pSimOut, iPat) )
1138 int i, m, nMints =
nWords / nWordsOut, Count = 0;
1140 assert( Vec_WrdSize(vSimsOut) == nWordsOut * Gia_ManCoNum(
p) );
1141 assert( Vec_WrdSize(vRel) == nWordsOut * nMints );
1142 for ( i = 0; i < 64 * nWordsOut; i++ )
1145 for ( m = 0; m < nMints; m++ )
1147 Abc_TtSetBit( Vec_WrdArray(vRel), i*nMints+m ), CountMints++;
1148 Count += CountMints == 0;
1151 printf(
"The relation is not well-defined for %d (out of %d) patterns.\n", Count, 64 * nWordsOut );
1156 int nWords = Vec_WrdSize(
p->vSimsPi) / Gia_ManCiNum(
p);
1157 int nMints = 1 << Vec_IntSize(vObjs), i, m, iObj;
1163 for ( m = 0; m < nMints; m++ )
1173 Gia_ManSimPatSimAnd(
p, i, pObj,
nWords * nMints, vSims );
1176 Gia_ManSimPatSimPo(
p, Gia_ObjId(
p, pObj), pObj,
nWords * nMints, vSims );
1180 Vec_WrdFreeP( &vRel );
1181 Vec_WrdFree( vSims );
1198 int i, k, m, Values[32], nErrors = 0, nMints = 1 << nOuts,
nWords = Vec_WrdSize(vRel) / nMints;
1201 for ( i = 0; i < 64 *
nWords; i++ )
1203 for ( k = 0; k < nOuts; k++ )
1205 int Value0 = Abc_TtGetBit( Vec_WrdEntryP(vFuncs, (2*k+0)*
nWords), i );
1206 int Value1 = Abc_TtGetBit( Vec_WrdEntryP(vFuncs, (2*k+1)*
nWords), i );
1207 if ( Value0 && !Value1 )
1209 else if ( !Value0 && Value1 )
1211 else if ( !Value0 && !Value1 )
1215 for ( m = 0; m < nMints; m++ )
1217 for ( k = 0; k < nOuts; k++ )
1218 if ( ((Values[k] >> ((m >> k) & 1)) & 1) == 0 )
1222 if ( Abc_TtGetBit( Vec_WrdArray(vRel), i*nMints+m ) )
1224 if ( nErrors++ == 0 )
1225 printf(
"For pattern %d, minterm %d produced by function is not in the relation.\n", i, m );
1229 printf(
"Total number of similar errors = %d.\n", nErrors );
1231 printf(
"The function agrees with the relation.\n" );
1235 int i, k, m, Count = 0, nMints = 1 << nOuts,
nWords = Vec_WrdSize(vRel) / nMints;
1237 assert( Vec_WrdSize(vRel) % nMints == 0 );
1238 for ( i = 0; i < 64 *
nWords; i++ )
1240 for ( m = 0; m < nMints; m++ )
1241 if ( Abc_TtGetBit( Vec_WrdArray(vRel), i*nMints+m ) )
1243 Count += m == nMints;
1244 for ( k = 0; k < nOuts; k++ )
1246 Abc_TtSetBit( Vec_WrdEntryP(vFuncs, (2*k+1)*
nWords), i );
1248 Abc_TtSetBit( Vec_WrdEntryP(vFuncs, (2*k+0)*
nWords), i );
1251 printf(
"The relation is not well-defined for %d (out of %d) patterns.\n", Count, 64 *
nWords );
1253 printf(
"The relation was successfully determized without don't-cares for %d patterns.\n", 64 *
nWords );
1259 int i, k, m, nDCs[32] = {0}, Count = 0, nMints = 1 << nOuts,
nWords = Vec_WrdSize(vRel) / nMints;
1261 assert( Vec_WrdSize(vRel) % nMints == 0 );
1263 for ( i = 0; i < 64 *
nWords; i++ )
1265 for ( m = 0; m < nMints; m++ )
1266 if ( Abc_TtGetBit( Vec_WrdArray(vRel), i*nMints+m ) )
1268 Count += m == nMints;
1269 for ( k = 0; k < nOuts; k++ )
1271 if ( Abc_TtGetBit( Vec_WrdArray(vRel), i*nMints+(m^(1<<k)) ) )
1277 Abc_TtSetBit( Vec_WrdEntryP(vFuncs, (2*k+1)*
nWords), i );
1279 Abc_TtSetBit( Vec_WrdEntryP(vFuncs, (2*k+0)*
nWords), i );
1283 for ( m = 0; m < nMints; m++ )
1284 printf(
"%d", Abc_TtGetBit( Vec_WrdArray(vRel), i*nMints+m ) );
1286 for ( k = 0; k < nOuts; k++ )
1288 if ( Abc_TtGetBit( Vec_WrdEntryP(vFuncs, (2*k+0)*
nWords), i ) )
1290 else if ( Abc_TtGetBit( Vec_WrdEntryP(vFuncs, (2*k+1)*
nWords), i ) )
1299 printf(
"The relation is not well-defined for %d (out of %d) patterns.\n", Count, 64 *
nWords );
1302 printf(
"The relation was successfully determized with don't-cares for %d patterns.\n", 64 *
nWords );
1303 for ( k = 0; k < nOuts; k++ )
1305 int nOffs = Abc_TtCountOnesVec( Vec_WrdEntryP(vFuncs, (2*k+0)*
nWords),
nWords );
1306 int nOns = Abc_TtCountOnesVec( Vec_WrdEntryP(vFuncs, (2*k+1)*
nWords),
nWords );
1307 printf(
"%4d : Off = %6d On = %6d Dc = %6d (%6.2f %%)\n", k, nOffs, nOns, nDCs[k], 100.0*nDCs[k]/(64*
nWords) );
1328 int nWords = Vec_WrdSize(
p->vSimsPi) / Gia_ManCiNum(
p);
1329 int nMints = Vec_WrdSize(vRel) /
nWords;
1366 for ( i = 0; i < 64 *
nWords; i++ )
1369 for ( m = 0; m < nMints; m++ )
1371 printf(
"%d", Abc_TtGetBit( Vec_WrdArray(vRel), i*nMints+m ) );
1372 Count += Abc_TtGetBit( Vec_WrdArray(vRel), i*nMints+m );
1374 printf(
" Count = %2d \n", Count );
1379 Vec_Int_t * vValues = Vec_IntAlloc( nItems );
1380 Vec_IntPush( vValues, 17 );
1381 Vec_IntPush( vValues, 39 );
1382 Vec_IntPush( vValues, 56 );
1383 Vec_IntPush( vValues, 221 );
1394 Vec_IntFree( vObjs );
1395 Vec_WrdFree( vVals );
1396 Vec_WrdFree( vRel );
1415 for ( i = 0; i < 64*
nWords; i++ )
1416 if ( Abc_TtGetBit( pOffSet, i ) )
1417 Vec_IntPush( vBits, 0 ), Count[0]++;
1418 else if ( Abc_TtGetBit( pOnSet, i ) )
1419 Vec_IntPush( vBits, 1 ), Count[1]++;
1421 Vec_IntPush( vBits, -1 );
1429 p->pSet[0] = pOffSet;
1430 p->pSet[1] = pOnSet;
1431 p->nCands = Vec_WrdSize(vSims)/
nWords;
1435 p->fVerbose = fVerbose;
1437 p->vPatPairs = Vec_IntAlloc( 100 );
1438 p->vCoverTable = Vec_WrdAlloc( 10000 );
1439 p->vTtMints = Vec_IntAlloc( 100 );
1445 Vec_IntFree(
p->vValues );
1446 Vec_IntFree(
p->vPatPairs );
1447 Vec_WrdFree(
p->vCoverTable );
1448 Vec_IntFree(
p->vTtMints );
1466 int x, y, z, w, fFound = 0;
1467 assert( Vec_WrdSize(
p->vCoverTable) ==
p->nWordsTable * (
p->nCands+1) );
1469 Abc_TtClear(
p->pTableTemp,
p->nWordsTable );
1470 for ( x = 0; x < Vec_IntSize(
p->vPatPairs)/2; x++ )
1471 Abc_TtXorBit(
p->pTableTemp, x );
1473 for ( x = 0; x <
p->nCands; x++ )
1475 word * pSimTableX = Vec_WrdEntryP(
p->vCoverTable,
p->nWordsTable * x );
1476 for ( w = 0; w <
p->nWordsTable; w++ )
1477 if (
p->pTableTemp[w] != pSimTableX[w] )
1479 if ( w ==
p->nWordsTable )
1481 printf(
"Found solution { %d }\n", x );
1488 for ( x = 0; x <
p->nCands; x++ )
1489 for ( y = 0; y < x; y++ )
1491 word * pSimTableX = Vec_WrdEntryP(
p->vCoverTable,
p->nWordsTable * x );
1492 word * pSimTableY = Vec_WrdEntryP(
p->vCoverTable,
p->nWordsTable * y );
1493 for ( w = 0; w <
p->nWordsTable; w++ )
1494 if (
p->pTableTemp[w] != (pSimTableX[w] | pSimTableY[w]) )
1496 if ( w ==
p->nWordsTable )
1498 printf(
"Found solution { %d %d }\n", y, x );
1505 for ( x = 0; x <
p->nCands; x++ )
1506 for ( y = 0; y < x; y++ )
1507 for ( z = 0; z < y; z++ )
1509 word * pSimTableX = Vec_WrdEntryP(
p->vCoverTable,
p->nWordsTable * x );
1510 word * pSimTableY = Vec_WrdEntryP(
p->vCoverTable,
p->nWordsTable * y );
1511 word * pSimTableZ = Vec_WrdEntryP(
p->vCoverTable,
p->nWordsTable * z );
1512 for ( w = 0; w <
p->nWordsTable; w++ )
1513 if (
p->pTableTemp[w] != (pSimTableX[w] | pSimTableY[w] | pSimTableZ[w]) )
1515 if ( w ==
p->nWordsTable )
1516 printf(
"Found solution { %d %d %d }\n", z, y, x );
1523 int i, k, iPat, iPat2;
1531 p->nWordsTable = Abc_Bit6WordNum( Vec_IntSize(
p->vPatPairs)/2 );
1532 Vec_WrdFill(
p->vCoverTable,
p->nWordsTable * (
p->nCands + 1), 0 );
1533 p->pTableTemp = Vec_WrdEntryP(
p->vCoverTable,
p->nWordsTable *
p->nCands );
1534 for ( i = 0; i <
p->nCands; i++ )
1536 word * pSimCand = Vec_WrdEntryP(
p->vSims,
p->nWords * i );
1537 word * pSimTable = Vec_WrdEntryP(
p->vCoverTable,
p->nWordsTable * i );
1542 assert( Vec_IntEntry(
p->vValues, iPat) == 0 );
1543 assert( Vec_IntEntry(
p->vValues, iPat2) == 1 );
1544 if ( Abc_TtGetBit(pSimCand, iPat) != Abc_TtGetBit(pSimCand, iPat2) )
1545 Abc_TtXorBit(pSimTable, k/2);
1547 assert( k == Vec_IntSize(
p->vPatPairs) );
1553 for ( i = 0; i <
p->nCands; i++ )
1554 printf(
"%d", i % 10 );
1559 printf(
"%4d ", i/2 );
1560 printf(
"%4d ", iPat );
1561 printf(
"%4d ", iPat2 );
1562 for ( k = 0; k <
p->nCands; k++ )
1564 word * pSimTable = Vec_WrdEntryP(
p->vCoverTable,
p->nWordsTable * k );
1565 printf(
"%c", Abc_TtGetBit(pSimTable, i/2) ?
'*' :
' ' );
1573 Vec_IntClear(
p->vResub );
1574 Abc_TtClear(
p->pTableTemp,
p->nWordsTable );
1575 for ( i = 0; i < Vec_IntSize(
p->vPatPairs)/2; i++ )
1576 Abc_TtXorBit(
p->pTableTemp, i );
1578 while ( !Abc_TtIsConst0(
p->pTableTemp,
p->nWordsTable) )
1581 int iArgMax = -1, CostThis, CostMax = -1;
1583 for ( i = 0; i <
p->nCands; i++ )
1585 pSimTable = Vec_WrdEntryP(
p->vCoverTable,
p->nWordsTable * i );
1586 CostThis = Abc_TtCountOnesVecMask( pSimTable,
p->pTableTemp,
p->nWordsTable, 0 );
1587 if ( CostMax >= CostThis )
1593 Vec_IntPush(
p->vResub, iArgMax );
1595 pSimTable = Vec_WrdEntryP(
p->vCoverTable,
p->nWordsTable * iArgMax );
1596 Abc_TtSharp(
p->pTableTemp,
p->pTableTemp, pSimTable,
p->nWordsTable );
1600 printf(
"Solution %2d for covering problem [%5d x %5d]: ", Vec_IntSize(
p->vResub), Vec_IntSize(
p->vPatPairs)/2,
p->nCands );
1602 printf(
"%6d ", iPat );
1603 for ( ; i < 12; i++ )
1606 Abc_PrintTime( 1,
"Time", Abc_Clock() - clk );
1611 int i, b, Value, iPat, iMint, iObj, Count = 0;
1613 assert( Vec_IntSize(
p->vResub) > 0 );
1615 pFanins[b] = Vec_WrdEntryP(
p->vSims,
p->nWords * iObj );
1616 Vec_IntFill(
p->vTtMints, 1 << Vec_IntSize(
p->vResub), -1 );
1622 for ( b = 0; b < Vec_IntSize(
p->vResub); b++ )
1623 if ( Abc_TtGetBit(pFanins[b], i) )
1625 iPat = Vec_IntEntry(
p->vTtMints, iMint );
1628 Vec_IntWriteEntry(
p->vTtMints, iMint, i );
1631 assert( Abc_TtGetBit(
p->pSet[Value], i) );
1632 if ( Abc_TtGetBit(
p->pSet[Value], iPat) )
1634 assert( Abc_TtGetBit(
p->pSet[!Value], iPat) );
1635 Vec_IntPushTwo(
p->vPatPairs, Value ? iPat : i, Value ? i : iPat );
1650 Vec_Int_t * vSubset = Vec_IntAlloc( 100 );
int i, Entry;
1652 if ( Entry == Value )
1653 Vec_IntPush( vSubset, i );
1658 int n, nPairsInit = 64;
1661 Vec_IntClear(
p->vPatPairs );
1662 printf(
"There are %d offset and %d onset minterms (%d pairs) and %d divisors.\n",
1663 Vec_IntSize(vValue0), Vec_IntSize(vValue1), Vec_IntSize(vValue0)*Vec_IntSize(vValue1),
p->nCands );
1665 assert( Vec_IntSize(vValue0) > 0 );
1666 assert( Vec_IntSize(vValue1) > 0 );
1667 for ( n = 0; n < nPairsInit; n++ )
1668 Vec_IntPushTwo(
p->vPatPairs,
1669 Vec_IntEntry(vValue0,
Abc_Random(0) % Vec_IntSize(vValue0)),
1670 Vec_IntEntry(vValue1,
Abc_Random(0) % Vec_IntSize(vValue1)) );
1671 Vec_IntFree( vValue0 );
1672 Vec_IntFree( vValue1 );
1689 Vec_Int_t * vResub = Vec_IntAlloc( 10 );
1699 Abc_PrintTime( 1,
"Resubstitution time", Abc_Clock() - clk );
1740 assert( Vec_WrdSize(vSims) == Vec_WrdSize(vSimsT) );
1742 p->pOffSet = pOffSet;
1745 p->nWordsT = nWordsT;
1749 p->vObjs = Vec_IntAlloc( 100 );
1750 p->vObjs2 = Vec_IntAlloc( 100 );
1751 p->vSets[0] = Vec_WecAlloc( 1024 );
1752 p->vSets[1] = Vec_WecAlloc( 1024 );
1756 p->vActive = Vec_IntAlloc( 100 );
1759 assert( iObj < nWordsT * 64 );
1760 Abc_TtSetBit(
p->pSet[0], iObj );
1762 Vec_WecPushLevel(
p->vSets[0] );
1763 Vec_WecPushLevel(
p->vSets[1] );
1764 for ( i = 0; i < 64*
nWords; i++ )
1766 int Value0 = Abc_TtGetBit( pOffSet, i );
1767 int Value1 = Abc_TtGetBit( pOnSet, i );
1768 if ( Value0 && !Value1 )
1769 Vec_WecPush(
p->vSets[0], 0, i );
1770 else if ( !Value0 && Value1 )
1771 Vec_WecPush(
p->vSets[1], 0, i );
1772 else assert( !Value0 || !Value1 );
1774 assert( Vec_WecSize(
p->vSets[0]) == 1 );
1775 assert( Vec_WecSize(
p->vSets[1]) == 1 );
1783 Vec_IntFree(
p->vActive );
1784 Vec_IntFree(
p->vObjs );
1785 Vec_IntFree(
p->vObjs2 );
1786 Vec_WecFree(
p->vSets[0] );
1787 Vec_WecFree(
p->vSets[1] );
1799 Cost += Vec_IntSize(vLevel[0]) * Vec_IntSize(vLevel[1]);
1805 int n, i, nLeaves = 1 << Vec_IntSize(
p->vObjs);
1806 assert( Vec_WecSize(
p->vSets[0]) == nLeaves );
1807 assert( Vec_WecSize(
p->vSets[1]) == nLeaves );
1808 printf(
"Database for %d objects and cost %d:\n", Vec_IntSize(
p->vObjs),
Gia_RsbCost(
p) );
1811 for ( n = 0; n < 2; n++ )
1813 printf(
"%5d : ", i );
1815 Vec_IntPrint( vLevel[n] );
1821 int n, i, nLeaves = 1 << Vec_IntSize(
p->vObjs);
1822 assert( Vec_WecSize(
p->vSets[0]) == nLeaves );
1823 assert( Vec_WecSize(
p->vSets[1]) == nLeaves );
1824 for ( i = 0; i < nLeaves; i++ )
1826 for ( n = 0; n < 2; n++ )
1828 Vec_Int_t * vLevelN = Vec_WecPushLevel(
p->vSets[n]);
1829 Vec_Int_t * vLevel = Vec_WecEntry(
p->vSets[n], i);
1830 int iMint, j, k = 0;
1833 if ( Abc_TtGetBit(Vec_WrdEntryP(
p->vSims,
p->nWords*iObj), iMint) )
1834 Vec_IntPush( vLevelN, iMint );
1836 Vec_IntWriteEntry( vLevel, k++, iMint );
1838 Vec_IntShrink( vLevel, k );
1841 Vec_IntPush(
p->vObjs, iObj );
1842 assert( Vec_WecSize(
p->vSets[0]) == 2*nLeaves );
1843 assert( Vec_WecSize(
p->vSets[1]) == 2*nLeaves );
1848 int k = 0, m, m2, nLeaves = 1 << Vec_IntSize(
p->vObjs);
1849 assert( Index < Vec_IntSize(
p->vObjs) );
1850 assert( Vec_WecSize(
p->vSets[0]) == nLeaves );
1851 assert( Vec_WecSize(
p->vSets[1]) == nLeaves );
1852 for ( m = 0; m < nLeaves; m++ )
1854 if ( m & (1 << Index) )
1856 m2 = m ^ (1 << Index);
1857 vTemp[0][0] = Vec_WecEntry(
p->vSets[0], m);
1858 vTemp[0][1] = Vec_WecEntry(
p->vSets[1], m);
1859 vTemp[1][0] = Vec_WecEntry(
p->vSets[0], m2);
1860 vTemp[1][1] = Vec_WecEntry(
p->vSets[1], m2);
1861 Vec_IntAppend( vTemp[0][0], vTemp[1][0] );
1862 Vec_IntAppend( vTemp[0][1], vTemp[1][1] );
1863 Vec_IntClear( vTemp[1][0] );
1864 Vec_IntClear( vTemp[1][1] );
1866 Vec_IntDrop(
p->vObjs, Index );
1869 if ( m & (1 << Index) )
1875 assert( k == nLeaves/2 );
1876 Vec_WecShrink(
p->vSets[0], k );
1877 Vec_WecShrink(
p->vSets[1], k );
1883 int m, m2, Cost = 0, nLeaves = 1 << Vec_IntSize(
p->vObjs);
1884 assert( Vec_WecSize(
p->vSets[0]) == (1 << Vec_IntSize(
p->vObjs)) );
1885 assert( Vec_WecSize(
p->vSets[1]) == (1 << Vec_IntSize(
p->vObjs)) );
1886 for ( m = 0; m < nLeaves; m++ )
1888 if ( m & (1 << Index) )
1890 m2 = m ^ (1 << Index);
1891 vTemp[0][0] = Vec_WecEntry(
p->vSets[0], m);
1892 vTemp[0][1] = Vec_WecEntry(
p->vSets[1], m);
1893 vTemp[1][0] = Vec_WecEntry(
p->vSets[0], m2);
1894 vTemp[1][1] = Vec_WecEntry(
p->vSets[1], m2);
1895 Cost += (Vec_IntSize(vTemp[0][0]) + Vec_IntSize(vTemp[1][0])) * (Vec_IntSize(vTemp[0][1]) + Vec_IntSize(vTemp[1][1]));
1905 if ( CostMin > Cost )
1912 *pMinCost = CostMin;
1918 int iSetI =
Abc_Random(0) % Vec_IntSize(
p->vActive);
1919 int iSet = Vec_IntEntry(
p->vActive, iSetI );
1920 Vec_Int_t * vArray0 = Vec_WecEntry(
p->vSets[0], iSet);
1921 Vec_Int_t * vArray1 = Vec_WecEntry(
p->vSets[1], iSet);
1922 int iMint0i =
Abc_Random(0) % Vec_IntSize(vArray0);
1923 int iMint1i =
Abc_Random(0) % Vec_IntSize(vArray1);
1924 int iMint0 = Vec_IntEntry( vArray0, iMint0i );
1925 int iMint1 = Vec_IntEntry( vArray1, iMint1i );
1931 int i, iObj, nNodes, nNodesNew = -1, nNodesOld = -1, Mint0, Mint1, Shift;
1932 Abc_TtCopy(
p->pSet[1],
p->pSet[0],
p->nWordsT, 0 );
1935 assert( Abc_TtGetBit(
p->pSet[1], iObj) );
1936 Abc_TtXorBit(
p->pSet[1], iObj);
1938 Abc_TtCopy(
p->pSet[2],
p->pSet[1],
p->nWordsT, 0 );
1940 nNodes = Abc_TtAndXorSum(
p->pSet[1], Vec_WrdEntryP(
p->vSimsT,
p->nWordsT*Mint0), Vec_WrdEntryP(
p->vSimsT,
p->nWordsT*Mint1),
p->nWordsT );
1941 for ( i = 0; i < 5 && nNodes > 1; i++ )
1944 Abc_TtCopy(
p->pSet[2],
p->pSet[1],
p->nWordsT, 0 );
1946 nNodesNew = Abc_TtAndXorSum(
p->pSet[1], Vec_WrdEntryP(
p->vSimsT,
p->nWordsT*Mint0), Vec_WrdEntryP(
p->vSimsT,
p->nWordsT*Mint1),
p->nWordsT );
1947 assert( nNodesNew <= nNodes );
1948 if ( nNodesNew < nNodes )
1953 for ( i = 0; i < 64*
p->nWordsT; i++ )
1955 int Index = (i+Shift) % (64*
p->nWordsT);
1956 if ( Abc_TtGetBit(
p->pSet[2], Index ) )
1965 Vec_IntClear(
p->vActive );
1966 assert( Vec_WecSize(
p->vSets[0]) == Vec_WecSize(
p->vSets[1]) );
1968 if ( Vec_IntSize(vLevel[0]) && Vec_IntSize(vLevel[1]) )
1969 Vec_IntPush(
p->vActive, i );
1970 if ( Vec_IntSize(
p->vActive) == 0 )
1977 Vec_IntClear(
p->vObjs );
1980 for ( i = 0; i < 100; i++ )
1982 int k, nUndo = 1 +
Abc_Random(0) % Vec_IntSize(
p->vObjs);
1983 for ( k = 0; k < nUndo; k++ )
1990 if ( Vec_IntSize(
p->vObjs2) == 0 || Vec_IntSize(
p->vObjs2) > Vec_IntSize(
p->vObjs) )
1992 Vec_IntClear(
p->vObjs2 );
1993 Vec_IntAppend(
p->vObjs2,
p->vObjs );
1997 return Vec_IntDup(
p->vObjs2 );
2004 Vec_IntSort( vObjs, 0 );
2021 int i, Id, Value,
nWords = Abc_Bit6WordNum( 1+Gia_ManCiNum(
p) );
2022 Vec_Wrd_t * vTemp, * vSims, * vSimsPi = Vec_WrdStart( Gia_ManCiNum(
p) *
nWords );
2024 assert( Vec_IntSize(vPat) == Gia_ManCiNum(
p) );
2027 word * pSim = Vec_WrdEntryP( vSimsPi, i*
nWords );
2029 Abc_TtFill( pSim,
nWords );
2030 Abc_TtXorBit( pSim, i+1 );
2033 p->vSimsPi = vSimsPi;
2038 vRes = Vec_IntStart( Gia_ManCoNum(
p) );
2041 word * pSim = Vec_WrdEntryP( vSims, Id*
nWords );
2043 Abc_TtNot( pSim,
nWords );
2044 Vec_IntWriteEntry( vRes, i, Abc_TtCountOnesVec(pSim,
nWords) );
2046 assert( Vec_IntSize(vRes) == Gia_ManCoNum(
p) );
2050 vRes = Vec_IntStart( Gia_ManObjNum(
p) );
2053 word * pSim = Vec_WrdEntryP( vSims, Id*
nWords );
2055 Abc_TtNot( pSim,
nWords );
2056 Vec_IntWriteEntry( vRes, Id, Abc_TtCountOnesVec(pSim,
nWords) );
2058 assert( Vec_IntSize(vRes) == Gia_ManObjNum(
p) );
2060 Vec_WrdFree( vSims );
2061 Vec_WrdFree( vSimsPi );
2067 int k, m, nMints = (1 << Gia_ManCiNum(
p));
2068 assert( Gia_ManCiNum(
p) <= 10 );
2069 for ( m = 0; m < nMints; m++ )
2071 printf(
"%d : ", m );
2074 vPat = Vec_IntAlloc( Gia_ManCiNum(
p) );
2075 for ( k = 0; k < Gia_ManCiNum(
p); k++ )
2076 Vec_IntPush( vPat, (m >> k) & 1 );
2078 printf(
"%d ", Vec_IntSum(vRes) );
2079 Vec_IntFree( vRes );
2080 Vec_IntFree( vPat );
2086 Vec_Int_t * vTotal = Vec_IntStart( Gia_ManObjNum(
p) );
2090 for ( i = 0; i < 1000; i++ )
2092 vPat = Vec_IntAlloc( Gia_ManCiNum(
p) );
2093 for ( k = 0; k < Gia_ManCiNum(
p); k++ )
2096 assert( Vec_IntSize(vRes) == Gia_ManObjNum(
p) );
2098 Vec_IntAddToEntry( vTotal, k, Value );
2099 Vec_IntFree( vRes );
2100 Vec_IntFree( vPat );
2107 double TotalScore = 0;
2109 assert( Vec_IntSize(vTotal) == Vec_IntSize(vThis) );
2114 TotalScore += 1000.0*This/Total;
2116 return TotalScore == 0 ? 1.0 : TotalScore/Gia_ManAndNum(
p);
2121 Vec_Int_t * vTries = Vec_IntAlloc( 100 );
2124 Vec_IntFree( vRes );
2127 printf(
"Iter %5d : Init = %6.3f ", Iter, InitValue );
2129 for ( k = 0; k < Gia_ManCiNum(
p); k++ )
2131 Vec_IntArray(vPat)[k] ^= 1;
2136 if ( MaxValue <= Value )
2138 if ( MaxValue < Value )
2139 Vec_IntClear( vTries );
2140 Vec_IntPush( vTries, k );
2144 Vec_IntFree( vRes );
2146 Vec_IntArray(vPat)[k] ^= 1;
2148 MaxIn = Vec_IntSize(vTries) ? Vec_IntEntry( vTries, rand()%Vec_IntSize(vTries) ) : -1;
2151 printf(
"Final = %6.3f Ratio = %4.2f Tries = %5d ", MaxValue, MaxValue/InitValue, Vec_IntSize(vTries) );
2152 printf(
"Choosing %5d\r", MaxIn );
2154 Vec_IntFree( vTries );
2159 Vec_Int_t * vPat = Vec_IntAlloc( Gia_ManCiNum(
p) );
int k;
2160 for ( k = 0; k < Gia_ManCiNum(
p); k++ )
2161 Vec_IntPush( vPat, Abc_TtGetBit( Vec_WrdEntryP(vPatterns, k*
nWords), n ) );
2169 word * pSim = Vec_WrdEntryP( vPatterns, k*
nWords );
2170 if ( Abc_TtGetBit(pSim, n) != Value )
2171 Abc_TtXorBit( pSim, n );
2176 int n, k,
nWords = Vec_WrdSize(
p->vSimsPi) / Gia_ManCiNum(
p);
2177 double InitValue, InitTotal = 0, FinalValue, FinalTotal = 0;
2179 Vec_Wrd_t * vPatterns =
p->vSimsPi;
p->vSimsPi = NULL;
2181 for ( n = 0; n < 64*
nWords; n++ )
2190 InitTotal += InitValue;
2191 Vec_IntFree( vRes );
2193 for ( k = 0; k < 100; k++ )
2198 assert( MaxIn >= 0 && MaxIn < Gia_ManCiNum(
p) );
2199 Vec_IntArray(vPat)[MaxIn] ^= 1;
2205 FinalTotal += FinalValue;
2206 Vec_IntFree( vRes );
2210 printf(
"Pat %5d : Tries = %5d InitValue = %6.3f FinalValue = %6.3f Ratio = %4.2f ",
2211 n, k, InitValue, FinalValue, FinalValue/InitValue );
2212 Abc_PrintTime( 1,
"Time", Abc_Clock() - clk );
2216 Vec_IntFree( vPat );
2218 Vec_IntFree( vStats );
2221 printf(
"Improved %d patterns with average init value %.2f and average final value %.2f.\n",
2223 p->vSimsPi = vPatterns;
2239 Vec_Int_t * vRareCounts = Vec_IntAlloc( 100 );
2240 int Id,
nWords = Vec_WrdSize(vPatterns) / Gia_ManCiNum(
p), TotalBits = 64*
nWords;
2242 assert( Vec_WrdSize(vPatterns) % Gia_ManCiNum(
p) == 0 );
2243 p->vSimsPi = vPatterns;
2248 word * pSim = Vec_WrdEntryP( vSims, Id*
nWords );
2249 int Count = Abc_TtCountOnesVec( pSim,
nWords );
2250 int fRareOne = Count < TotalBits/2;
2251 int CountRare = fRareOne ? Count : TotalBits - Count;
2252 assert( CountRare <= TotalBits/2 );
2253 if ( CountRare <= RareLimit )
2254 Vec_IntPushTwo( vRareCounts, Abc_Var2Lit(Id, fRareOne), CountRare );
2256 Vec_WrdFree( vSims );
2261 Vec_Flt_t * vQuoIncs = Vec_FltStart( Gia_ManCiNum(
p) );
2262 int nWordsNew = Abc_Bit6WordNum( 1+Gia_ManCiNum(
p) );
2263 Vec_Wrd_t * vSimsPiNew = Vec_WrdStart( Gia_ManCiNum(
p) * nWordsNew );
2265 int i, k, Value, RareLit, RareCount;
2266 assert( Vec_IntSize(vPat) == Gia_ManCiNum(
p) );
2269 word * pSim = Vec_WrdEntryP( vSimsPiNew, i*nWordsNew );
2271 Abc_TtFill( pSim, nWordsNew );
2272 Abc_TtXorBit( pSim, i+1 );
2275 p->vSimsPi = vSimsPiNew;
2280 float Incrm = (float)1.0/(RareCount+1);
2281 int RareObj = Abc_Lit2Var(RareLit);
2282 int RareVal = Abc_LitIsCompl(RareLit);
2283 word * pSim = Vec_WrdEntryP( vSims, RareObj*nWordsNew );
2284 int OrigVal = pSim[0] & 1;
2286 Abc_TtNot( pSim, nWordsNew );
2287 for ( k = 0; k < Gia_ManCiNum(
p); k++ )
2288 if ( Abc_TtGetBit(pSim, k+1) )
2289 Vec_FltAddToEntry( vQuoIncs, k, OrigVal != RareVal ? Incrm : -Incrm );
2291 Vec_WrdFree( vSims );
2292 Vec_WrdFree( vSimsPiNew );
2298 float Value, ValueMax = Vec_FltFindMax( vQuo );
2299 if ( ValueMax <= 0 )
2301 vRes = Vec_IntAlloc( 100 );
2303 if ( Value == ValueMax )
2304 Vec_IntPush( vRes, i );
2310 int RareLit, RareCount, i;
2311 assert( Vec_WrdSize(vSims) == Gia_ManObjNum(
p) );
2314 float Incrm = (float)1.0/(RareCount+1);
2315 int RareObj = Abc_Lit2Var(RareLit);
2316 int RareVal = Abc_LitIsCompl(RareLit);
2317 word * pSim = Vec_WrdEntryP( vSims, RareObj*
nWords );
2318 if ( Abc_TtGetBit(pSim, n) == RareVal )
2325 float Total = 0;
int n;
2328 p->vSimsPi = vPatterns;
2331 for ( n = 0; n < 64*
nWords; n++ )
2333 Vec_IntFree( vRareCounts );
2334 Vec_WrdFree( vSims );
2342 p->vSimsPi = vPatterns;
2346 Vec_IntFree( vRareCounts );
2347 Vec_WrdFree( vSims );
2353 float FinalTotal, InitTotal;
2354 int n, nRares = 0, nChanges = 0,
nWords = Vec_WrdSize(
p->vSimsPi) / Gia_ManCiNum(
p);
2355 Vec_Wrd_t * vPatterns =
p->vSimsPi;
p->vSimsPi = NULL;
2357 for ( n = 0; n < 64*
nWords; n++ )
2367 printf(
"Pat %5d : Rare = %4d Cands = %3d Value = %8.3f Change = %8.3f ",
2368 n, Vec_IntSize(vRareCounts)/2, vBest ? Vec_IntSize(vBest) : 0,
2369 PatQuo, vBest ? Vec_FltEntry(vQuoIncs, Vec_IntEntry(vBest,0)) : 0 );
2370 Abc_PrintTime( 1,
"Time", Abc_Clock() - clk );
2372 if ( vBest != NULL )
2374 int VarBest = Vec_IntEntry( vBest, rand()%Vec_IntSize(vBest) );
2375 Abc_TtXorBit( Vec_WrdEntryP(vPatterns, VarBest*
nWords), n );
2378 nRares = Vec_IntSize(vRareCounts)/2;
2379 Vec_IntFree( vRareCounts );
2380 Vec_IntFree( vPat );
2381 Vec_FltFree( vQuoIncs );
2382 Vec_IntFreeP( &vBest );
2387 p->vSimsPi = vPatterns;
2389 printf(
"Improved %d out of %d patterns using %d rare nodes: %.2f -> %.2f. ",
2390 nChanges, 64*
nWords, nRares, InitTotal, FinalTotal );
2391 Abc_PrintTime( 1,
"Time", Abc_Clock() - clk );
2409 Vec_Wrd_t * vSim0 = Vec_WrdStartRandom( Gia_ManCiNum(pGia) *
nWords );
2413 for ( n = 0; n < 20; n++ )
2416 Vec_WrdFree( vSim1 );
2418 Abc_PrintTime( 1,
"Time1", Abc_Clock() - clk );
2421 for ( n = 0; n < 20; n++ )
2424 Vec_WrdFree( vSim2 );
2426 Abc_PrintTime( 1,
"Time2", Abc_Clock() - clk );
2429 Vec_WrdFree( vSim0 );
2447 Vec_Wrd_t * vSim0 = Vec_WrdStartRandom( Gia_ManCiNum(pGia) *
nWords );
2448 FILE * pFile = fopen(
"comp_sim.c",
"wb" );
2450 fprintf( pFile,
"#include <stdio.h>\n" );
2451 fprintf( pFile,
"#include <stdlib.h>\n" );
2452 fprintf( pFile,
"#include <time.h>\n" );
2453 fprintf( pFile,
"int main()\n" );
2454 fprintf( pFile,
"{\n" );
2455 fprintf( pFile,
" clock_t clkThis = clock();\n" );
2456 fprintf( pFile,
" unsigned long Res = 0;\n" );
2457 fprintf( pFile,
" int i;\n" );
2458 fprintf( pFile,
" srand(time(NULL));\n" );
2459 fprintf( pFile,
" for ( i = 0; i < 2000; i++ )\n" );
2460 fprintf( pFile,
" {\n" );
2461 for ( k = 0; k <
nWords; k++ )
2462 fprintf( pFile,
" unsigned long s%07d_%d = 0x%08x%08x;\n", 0, k, 0, 0 );
2467 for ( k = 0; k <
nWords; k++ )
2468 fprintf( pFile,
" unsigned long s%07d_%d = ((unsigned long)rand() << 48) | ((unsigned long)rand() << 32) | ((unsigned long)rand() << 16) | (unsigned long)rand();\n", Id, k );
2472 for ( k = 0; k <
nWords; k++ )
2473 fprintf( pFile,
" unsigned long s%07d_%d = %cs%07d_%d & %cs%07d_%d;\n", Id, k,
2474 Gia_ObjFaninC0(pObj) ?
'~' :
' ', Gia_ObjFaninId0(pObj, Id), k,
2475 Gia_ObjFaninC1(pObj) ?
' ' :
'~', Gia_ObjFaninId1(pObj, Id), k );
2479 pObj = Gia_ManObj(pGia, Id);
2480 for ( k = 0; k <
nWords; k++ )
2481 fprintf( pFile,
" Res ^= %cs%07d_%d;\n", Gia_ObjFaninC0(pObj) ?
'~' :
' ', Gia_ObjFaninId0(pObj, Id), k );
2483 Vec_WrdFree( vSim0 );
2484 fprintf( pFile,
" }\n" );
2485 fprintf( pFile,
" printf( \"Res = 0x%%08x \", (unsigned)Res );\n" );
2486 fprintf( pFile,
" printf( \"Time = %%6.2f sec\\n\", (float)(clock() - clkThis)/CLOCKS_PER_SEC );\n" );
2487 fprintf( pFile,
" return 1;\n" );
2488 fprintf( pFile,
"}\n" );
2508 int n, i, RetValue = 1;
2509 int TimeStop = TimeLimit ? TimeLimit * CLOCKS_PER_SEC + Abc_Clock() : 0;
2510 printf(
"Simulating %d round with %d machine words.\n", nRounds,
nWords );
2512 for ( n = 0; RetValue && n < nRounds; n++ )
2514 if ( TimeStop && Abc_Clock() > TimeStop )
2516 printf(
"Computation timed out after %d seconds and %d rounds.\n", TimeLimit, n );
2519 vSim0 = Vec_WrdStartRandom( Gia_ManCiNum(p0) *
nWords );
2521 p1->vSimsPi = vSim0;
2524 for ( i = 0; i < Gia_ManCoNum(p0); i++ )
2526 word * pSim1 = Vec_WrdEntryP(vSim1, Gia_ObjId(p0, Gia_ManCo(p0, i))*
nWords);
2527 word * pSim2 = Vec_WrdEntryP(vSim2, Gia_ObjId(p1, Gia_ManCo(p1, i))*
nWords);
2530 printf(
"Output %d failed simulation at round %d. ", i, n );
2535 Vec_WrdFree( vSim1 );
2536 Vec_WrdFree( vSim2 );
2537 Vec_WrdFree( vSim0 );
2541 if ( RetValue == 1 )
2542 printf(
"Simulation did not detect a bug. " );
2543 Abc_PrintTime( 1,
"Time", Abc_Clock() - clk );
2560 word * pInfo = Vec_WrdArray(vSimsPi);
int w, i;
2561 word * pCare = pInfo + Vec_WrdSize(vSimsPi);
2562 Vec_IntClear( vRes );
2563 for ( w = 0; w < Vec_WrdSize(vSimsPi); w++ )
2565 for ( i = 0; i < 64; i++ )
2566 if ( Abc_TtGetBit(pCare, w*64+i) )
2567 Vec_IntPush( vRes, Abc_Var2Lit(w*64+i, Abc_TtGetBit(pInfo, w*64+i)) );
2568 Vec_IntPush( vRes, Vec_WrdSize(vSimsPi) );
2572 Vec_Wec_t * vRes = Vec_WecStart( Vec_PtrSize(vSims) );
2581 int i, iLit,
nWords = Vec_IntEntryLast(vRes);
2583 word * pInfo = Vec_WrdArray(vSimsPi);
2588 Abc_TtXorBit( pCare, Abc_Lit2Var(iLit) );
2589 if ( Abc_LitIsCompl(iLit) )
2590 Abc_TtXorBit( pInfo, Abc_Lit2Var(iLit) );
2592 Vec_IntPush( vRes,
nWords );
2593 Vec_WrdShrink( vSimsPi, Vec_WrdSize(vSimsPi)/2 );
2598 Vec_Ptr_t * vSims = Vec_PtrAlloc( Vec_WecSize(vRes) );
2608 Vec_PtrPushTwo( vTemp, vSimsPi, vSimsPi );
2611 Vec_WecDumpBin(
"temp.sims", vRes, 1 );
2613 Vec_Wec_t * vRes = Vec_WecReadBin(
"temp.sims", 1 );
2618 Abc_TtAnd( Vec_WrdArray(vSimsPi), Vec_WrdArray(vSimsPi), Vec_WrdArray(vSimsPi)+Vec_WrdSize(vSimsPi), Vec_WrdSize(vSimsPi), 0 );
2620 vSimsPi->nSize *= 2;
2621 vSimsPi2->nSize *= 2;
2622 vSimsPi3->nSize *= 2;
2623 Vec_WrdDumpHex(
"test1.hex", vSimsPi, 1, 1 );
2624 Vec_WrdDumpHex(
"test2.hex", vSimsPi2, 1, 1 );
2625 Vec_WrdDumpHex(
"test3.hex", vSimsPi3, 1, 1 );
2626 vSimsPi->nSize /= 2;
2627 vSimsPi2->nSize /= 2;
2628 vSimsPi3->nSize /= 2;
2630 if ( Vec_WrdEqual( vSimsPi, vSimsPi2 ) )
2631 printf(
"Success.\n" );
2633 printf(
"Failure.\n" );
2634 if ( Vec_WrdEqual( vSimsPi, vSimsPi3 ) )
2635 printf(
"Success.\n" );
2637 printf(
"Failure.\n" );
2638 Vec_WrdFree( vSimsPi2 );
2639 Vec_WrdFree( vSimsPi3 );
2640 Vec_PtrFree( vTemp2 );
2641 Vec_WecFree( vRes );
2643 Vec_WecFree( vRes );
2645 Vec_PtrFree( vTemp );
2663 int i, nSize, RetValue;
2664 FILE * pFile = fopen( pFileName,
"wb" );
2665 if ( pFile == NULL )
2667 printf(
"Cannot open file \"%s\" for writing.\n", pFileName );
2670 nSize = Vec_PtrSize(
p);
2671 RetValue = fwrite( &nSize, 1,
sizeof(
int), pFile );
2674 nSize = Vec_WrdSize(vLevel);
2675 RetValue += fwrite( &nSize, 1,
sizeof(
int), pFile );
2676 RetValue += fwrite( Vec_WrdArray(vLevel), 1,
sizeof(
word)*nSize, pFile );
2680 printf(
"Written %d arrays into file \"%s\".\n", Vec_PtrSize(
p), pFileName );
2685 FILE * pFile = fopen( pFileName,
"rb" );
2686 if ( pFile == NULL )
2688 printf(
"Cannot open file \"%s\" for reading.\n", pFileName );
2692 nSize = ftell( pFile );
2695 printf(
"The input file is empty.\n" );
2699 if ( nSize % (
int)
sizeof(
int) > 0 )
2701 printf(
"Cannot read file with integers because it is not aligned at 4 bytes (remainder = %d).\n", nSize % (
int)
sizeof(
int) );
2706 RetValue = fread( &nSize, 1,
sizeof(
int), pFile );
2708 p = Vec_PtrAlloc( nSize );
2709 for ( i = 0; i < nSize; i++ )
2710 Vec_PtrPush(
p, Vec_WrdAlloc(100) );
2713 RetValue = fread( &nSize, 1,
sizeof(
int), pFile );
2715 Vec_WrdFill( vLevel, nSize, 0 );
2716 RetValue = fread( Vec_WrdArray(vLevel), 1,
sizeof(
word)*nSize, pFile );
2717 assert( RetValue == 8*nSize );
2721 printf(
"Read %d arrays from file \"%s\".\n", Vec_PtrSize(
p), pFileName );
2738 Vec_Int_t * vPoSigs = Vec_IntAlloc( Gia_ManBufNum(pHie) );
2740 Vec_Wec_t * vNodes = Vec_WecStart( Gia_ManBufNum(pHie) );
2744 word * pSim = Vec_WrdEntryP(vSimsH, Gia_ObjId(pHie, pObj)*
nWords);
2745 int fCompl = pSim[0] & 1;
2747 Abc_TtNot( pSim,
nWords );
2748 Vec_IntPush( vPoSigs, Vec_MemHashInsert(vStore, pSim) );
2750 Abc_TtNot( pSim,
nWords );
2752 Vec_IntPrint( vPoSigs );
2753 vMap = Vec_IntStartFull( Vec_MemEntryNum(vStore) );
2756 assert( Vec_IntEntry(vMap, Sig) == -1 );
2757 Vec_IntWriteEntry( vMap, Sig, i );
2763 Value = Vec_IntEntry(vMap, Sig);
2766 assert( Value >= 0 && Value < Gia_ManBufNum(pHie) );
2767 Vec_WecPush( vNodes, Value, i );
2769 Vec_WecPrint( vNodes, 0 );
2770 Vec_WecFree( vNodes );
2771 Vec_IntFree( vMap );
2772 Vec_IntFree( vPoSigs );
2793 if ( pObj->
fPhase ^ Gia_ManCo(pOld, i)->fPhase )
2795 printf(
"Updating out %d.\n", i );
2796 Gia_ObjFlipFaninC0( pObj );
2817 Vec_Int_t * vLabels = Vec_IntStartFull( Gia_ManObjNum(pFlat) );
2818 Gia_Obj_t * pObj;
int fCompl, Value, * pSpot, * pSpot2, i, nC0s = 0, nC1s = 0, nUnique = 0, nFound[3] = {0}, nBoundary = 0, nMatched = 0;
2822 Vec_WrdFree( vSims );
2824 printf(
"Comparing two AIGs using %d simulation words.\n",
nWords );
2828 Vec_MemHashAlloc( vStore, 1 << 12 );
2831 word * pSim = Vec_WrdEntryP(vSims0, i*
nWords);
2832 nC0s += Abc_TtIsConst0(pSim,
nWords);
2833 nC1s += Abc_TtIsConst1(pSim,
nWords);
2834 fCompl = pSim[0] & 1;
2836 Abc_TtNot( pSim,
nWords );
2837 Value = Vec_MemHashInsert( vStore, pSim );
2839 Abc_TtNot( pSim,
nWords );
2840 Vec_IntWriteEntry( vLabels, i, Value );
2842 nUnique = Vec_MemEntryNum( vStore );
2843 printf(
"Simulating %d patterns through the second (flat) AIG leads to %d unique objects (%.2f %% out of %d). Const0 = %d. Const1 = %d.\n",
2844 64*
nWords, nUnique, 100.0*nUnique/Gia_ManCandNum(pFlat), Gia_ManCandNum(pFlat), nC0s, nC1s );
2846 assert( Gia_ManCiNum(pFlat) == Gia_ManCiNum(pHie) );
2849 word * pSim = Vec_WrdEntryP(vSims1, i*
nWords);
2850 pSpot = Vec_MemHashLookup( vStore, pSim );
2851 Abc_TtNot( pSim,
nWords );
2852 pSpot2 = Vec_MemHashLookup( vStore, pSim );
2853 Abc_TtNot( pSim,
nWords );
2854 nBoundary += Gia_ObjIsBuf(pObj);
2855 if ( *pSpot != -1 || *pSpot2 != -1 )
2861 nFound[1] += Gia_ObjIsBuf(pObj);
2867 Vec_MemHashFree( vStore );
2868 Vec_MemFree( vStore );
2869 Vec_WrdFree( vSims0 );
2870 Vec_WrdFree( vSims1 );
2871 Vec_IntFree( vLabels );
2873 printf(
"The first (hierarchical) AIG has %d (%.2f %%) matches, %d (%.2f %%) mismatches, including %d (%.2f %%) on the boundary. ",
2874 nMatched, 100.0*nMatched /Abc_MaxInt(1, Gia_ManCandNum(pHie)),
2875 nFound[2], 100.0*nFound[2]/Abc_MaxInt(1, Gia_ManCandNum(pHie)),
2876 nFound[1], 100.0*nFound[1]/Abc_MaxInt(1, nBoundary) );
2877 Abc_PrintTime( 1,
"Time", Abc_Clock() - clk );
2894 Vec_Wec_t * vNodes = Vec_WecStart( Vec_IntSize(vObjs)+1 );
2895 Vec_Int_t * vSigns = Vec_IntStart( Gia_ManObjNum(
p) );
2896 int n, k, i, iObj, * pSigns = Vec_IntArray(vSigns);
2897 assert( Vec_IntSize(vObjs) < 32 );
2899 pSigns[iObj] |= 1 << i;
2902 if ( pSigns[i] == 0 )
2903 for ( n = 0; n < 2; n++ )
2904 pSigns[i] |= pSigns[Gia_ObjFaninId(pObj, i, n)];
2905 if ( pSigns[i] == 0 )
2907 Vec_WecPush( vNodes, Vec_IntSize(vObjs), i );
2908 for ( k = 0; k < Vec_IntSize(vObjs); k++ )
2909 if ( (pSigns[i] >> k) & 1 )
2910 Vec_WecPush( vNodes, k, i );
2912 Vec_IntFree( vSigns );
2918 int i, m, iVar, iMint = 0, nMints = 1 << Vec_IntSize(vObjs);
2922 Vec_WecPrint( vNodes, 0 );
2927 vLevel = Vec_WecEntry( vNodes, Vec_IntSize(vObjs) );
2930 Abc_TtClear( Vec_WrdEntryP(vCopy, Gia_ObjId(
p, pObj)*
nWords),
nWords );
2932 Gia_ManSimPatSimAnd(
p, Gia_ObjId(
p, pObj), pObj,
nWords, vCopy );
2933 for ( m = 0; m < nMints; m++ )
2937 word * pSimO = Vec_WrdEntryP(vCopy, Gia_ObjId(
p, pObj)*
nWords);
2938 word * pSimF = Vec_WrdEntryP(vCopy, Gia_ObjFaninId0p(
p, pObj)*
nWords);
2939 word * pSimR = Vec_WrdEntryP(vRel, (iMint*Gia_ManCoNum(
p) + i)*
nWords);
2940 Abc_TtXor( pSimR, pSimF, pSimO,
nWords, Gia_ObjFaninC0(pObj) );
2942 if ( m == nMints-1 )
2944 iVar = Abc_TtSuppFindFirst( (m+1) ^ ((m+1) >> 1) ^ (m) ^ ((m) >> 1) );
2945 vLevel = Vec_WecEntry( vNodes, iVar );
2946 assert( Vec_IntEntry(vLevel, 0) == Vec_IntEntry(vObjs, iVar) );
2947 Abc_TtNot( Vec_WrdEntryP(vCopy, Vec_IntEntry(vObjs, iVar)*
nWords),
nWords );
2950 Gia_ManSimPatSimAnd(
p, Gia_ObjId(
p, pObj), pObj,
nWords, vCopy );
2955 Vec_WrdFree( vCopy );
2956 Vec_WecFree( vNodes );
2962 int i, Id, m, Index, nMints = 1 << Vec_IntSize(vObjs);
2963 Vec_Wrd_t * vPos, * vRel = Vec_WrdStart( Gia_ManCoNum(
p) *
nWords * nMints );
2964 for ( m = 0; m < nMints; m++ )
2969 if ( (Index = Vec_IntFind(vObjs, Gia_ObjFaninId0(pObj, i))) >= 0 )
2971 if ( (Index = Vec_IntFind(vObjs, Gia_ObjFaninId1(pObj, i))) >= 0 )
2976 Abc_TtXor( Vec_WrdEntryP(vRel, (m*Gia_ManCoNum(
p) + i)*
nWords), Vec_WrdEntryP(vPos, i*
nWords), Vec_WrdEntryP(vSims, Id*
nWords),
nWords, 0 );
2977 Vec_WrdFree( vPos );
2984 int w,
nWords = Vec_WrdSize(
p->vSimsPi) / Gia_ManCiNum(
p);
2985 int i, Id, m, nMints = 1 << Vec_IntSize(vObjs);
2986 printf(
"Relation has %d inputs and %d outputs:\n", Gia_ManCiNum(
p), Vec_IntSize(vObjs) );
2987 for ( w = 0; w < 64*
nWords; w++ )
2990 printf(
"%d", Abc_TtGetBit(Vec_WrdEntryP(vSims, Id*
nWords), w) );
2993 printf(
"%d", Abc_TtGetBit(Vec_WrdEntryP(vSims, Id*
nWords), w) );
2996 printf(
"%d", Abc_TtGetBit(Vec_WrdEntryP(vSims, Id*
nWords), w) );
2998 for ( m = 0; m < nMints; m++ )
3001 for ( i = 0; i < Vec_IntSize(vObjs); i++ )
3002 printf(
"%d", (m >> i) & 1 );
3005 printf(
"%d", Abc_TtGetBit(Vec_WrdEntryP(vRel, (m*Gia_ManCoNum(
p)+i)*
nWords), w) );
3012 int w,
nWords = Vec_WrdSize(
p->vSimsPi) / Gia_ManCiNum(
p);
3013 int i, Id, m, nMints = 1 << Vec_IntSize(vObjs);
3014 int nWordsM = Abc_Truth6WordNum(Vec_IntSize(vObjs));
3016 printf(
"Relation has %d inputs and %d outputs:\n", Gia_ManCiNum(
p), Vec_IntSize(vObjs) );
3017 for ( w = 0; w < 64*
nWords; w++ )
3022 printf(
"%d", Abc_TtGetBit(Vec_WrdEntryP(vSims, Id*
nWords), w) );
3026 printf(
"%d", Abc_TtGetBit(Vec_WrdEntryP(vSims, Id*
nWords), w) );
3027 if ( Abc_TtGetBit(Vec_WrdEntryP(vSims, Id*
nWords), w) )
3032 printf(
"%d", Abc_TtGetBit(Vec_WrdEntryP(vSims, Id*
nWords), w) );
3034 for ( m = 0; m < nMints; m++ )
3038 Count += Abc_TtGetBit(Vec_WrdEntryP(vRel, (m*Gia_ManCoNum(
p)+i)*
nWords), w);
3039 printf(
"%d", Count == 0 );
3040 nValid += Count > 0;
3042 Abc_TtSetBit( Vec_WrdEntryP(vRes, w*nWordsM), m );
3045 for ( m = 0; m < nMints; m++ )
3046 printf(
"%d", Abc_TtGetBit(Vec_WrdEntryP(vRes, w*nWordsM), m) );
3048 assert( Abc_TtGetBit(Vec_WrdEntryP(vRes, w*nWordsM), iMint) );
3049 for ( i = 0; i < Vec_IntSize(vObjs); i++ )
3050 if ( Abc_TtGetBit(Vec_WrdEntryP(vRes, w*nWordsM), iMint ^ (1 << i)) )
3053 printf(
"%d", (iMint >> i) & 1 );
3054 printf(
" %d", nMints-nValid );
3057 Vec_WrdFree( vRes );
3081 Vec_IntPush( vRes, 52 );
3082 Vec_IntPush( vRes, 54 );
3083 Vec_IntPrint( vRes );
3090 Vec_WrdFreeP( &
p->vSimsPi );
3091 p->vSimsPi = Vec_WrdStartTruthTables( Gia_ManCiNum(
p) );
3092 nWords = Vec_WrdSize(
p->vSimsPi) / Gia_ManCiNum(
p);
3098 Vec_WrdFree( vRel2 );
3099 Vec_WrdFree( vRel );
3100 Vec_WrdFree( vSims );
3101 Vec_IntFree( vObjs );
3118 Vec_IntPush( vRes, 12 );
3119 Vec_IntPush( vRes, 18 );
3120 Vec_IntPush( vRes, 21 );
3121 Vec_IntPush( vRes, 34 );
3122 Vec_IntPush( vRes, 45 );
3123 Vec_IntPush( vRes, 59 );
3129 Vec_IntPush( vRes, 65 );
3130 Vec_IntPush( vRes, 66 );
3137 Vec_IntSort( vOuts, 0 );
3140 Gia_ObjSetTravIdCurrent(
p, pObj );
3143 if ( !Gia_ObjIsTravIdPrevious(
p, Gia_ObjFanin0(pObj)) )
3144 Gia_ObjSetTravIdCurrent(
p, Gia_ObjFanin0(pObj) );
3146 if ( Gia_ObjIsTravIdPrevious(
p, pObj) )
3148 else if ( Gia_ObjIsTravIdCurrent(
p, pObj) )
3150 if ( !Gia_ObjIsTravIdPrevious(
p, Gia_ObjFanin0(pObj)) )
3151 Gia_ObjSetTravIdCurrent(
p, Gia_ObjFanin0(pObj) );
3152 if ( !Gia_ObjIsTravIdPrevious(
p, Gia_ObjFanin1(pObj)) )
3153 Gia_ObjSetTravIdCurrent(
p, Gia_ObjFanin1(pObj) );
3156 if ( !Gia_ObjIsTravIdCurrent(
p, pObj) )
3157 Vec_IntPush( vRes, i );
3159 Vec_IntPrint( vRes );
3167 Vec_IntSort( vIns, 0 );
3171 Gia_ObjSetTravIdCurrent(
p, pObj );
3172 Vec_IntFree( vMffc );
3174 Vec_IntPush( vRes, 0 );
3175 Vec_IntAppend( vRes, vIns );
3179 Gia_ObjSetTravIdCurrent(
p, pObj );
3182 if ( Gia_ObjIsTravIdCurrent(
p, pObj) )
3184 else if ( Gia_ObjIsTravIdCurrent(
p, Gia_ObjFanin0(pObj)) && Gia_ObjIsTravIdCurrent(
p, Gia_ObjFanin1(pObj)) )
3186 if ( !Gia_ObjIsTravIdPrevious(
p, pObj) )
3187 Vec_IntPush( vRes, i );
3188 Gia_ObjSetTravIdCurrent(
p, pObj );
3190 printf(
"Divisors: " );
3191 Vec_IntPrint( vRes );
3197 Vec_Int_t * vRes = Vec_IntStartFull( 1 << Vec_IntSize(vIns) );
3198 int w,
nWords = Vec_WrdSize(
p->vSimsPi) / Gia_ManCiNum(
p);
3199 for ( w = 0; w < 64*
nWords; w++ )
3201 int i, iObj, iMint = 0, iMint2 = 0;
3203 if ( Abc_TtGetBit(Vec_WrdEntryP(vSims, iObj*
nWords), w) )
3205 if ( Vec_IntEntry(vRes, iMint) >= 0 )
3208 if ( Abc_TtGetBit(Vec_WrdEntryP(vSims, iObj*
nWords), w) )
3210 Vec_IntWriteEntry( vRes, iMint, iMint2 );
3217 extern Mini_Aig_t *
Exa4_ManGenTest(
Vec_Wrd_t * vSimsIn,
Vec_Wrd_t * vSimsOut,
int nIns,
int nDivs,
int nOuts,
int nNodes,
int TimeOut,
int fOnlyAnd,
int fFancy,
int fOrderNodes,
int fUniqFans,
int fVerbose,
int fCard,
char * pGuide );
3219 int i, m, iObj, Entry, iMint = 0, nMints = Vec_IntSize(vRel) - Vec_IntCountEntry(vRel, -1);
3220 Vec_Wrd_t * vSimsIn = Vec_WrdStart( nMints );
3221 Vec_Wrd_t * vSimsOut = Vec_WrdStart( nMints );
3222 int Entry0 = Vec_IntEntry( vRel, 0 );
3224 word Value, Phase = 0;
3225 int nWords = Vec_WrdSize(
p->vSimsPi) / Gia_ManCiNum(
p);
3227 if ( Vec_WrdEntry(vSims, iObj*
nWords) & 1 )
3231 printf(
"Entry0 = %d\n", Entry0 );
3238 Abc_TtSetBit( Vec_WrdEntryP(vSimsOut, iMint), Entry0 ^ Entry );
3242 if ( Abc_TtGetBit(Vec_WrdEntryP(vSims, iObj*
nWords), m) )
3243 Abc_TtSetBit( &Value, i );
3244 Vec_WrdEntryP(vSimsOut, iMint)[0] = Value ^ Phase;
3248 assert( iMint == nMints );
3249 printf(
"Created %d minterms.\n", iMint );
3250 Exa4_ManGenTest( vSimsIn, vSimsOut, Vec_IntSize(vIns), Vec_IntSize(vDivs), Vec_IntSize(vOuts), 10, 0, 0, 0, 0, 0, 1, 0, NULL );
3251 Vec_WrdFree( vSimsIn );
3252 Vec_WrdFree( vSimsOut );
3259 Vec_WrdFreeP( &
p->vSimsPi );
3260 p->vSimsPi = Vec_WrdStartTruthTables( Gia_ManCiNum(
p) );
3261 nWords = Vec_WrdSize(
p->vSimsPi) / Gia_ManCiNum(
p);
3269 Vec_IntFree( vDivs );
3270 Vec_IntPrint( vRel );
3271 Vec_IntFree( vRel );
3272 Vec_WrdFree( vSims );
3273 Vec_IntFree( vIns );
3274 Vec_IntFree( vOuts );
3291 if ( Gia_ObjIsTravIdPrevious(
p, pObj) )
3293 if ( Gia_ObjIsTravIdCurrent(
p, pObj) )
3297 Gia_ObjSetTravIdPrevious(
p, pObj);
3300 if ( Gia_ObjIsAnd(pObj) )
3306 Gia_ObjSetTravIdPrevious(
p, pObj);
3307 Vec_IntPush( vTfo, Gia_ObjId(
p, pObj) );
3311 Gia_ObjSetTravIdCurrent(
p, pObj);
3320 Gia_ObjSetTravIdCurrentId(
p, 0 );
3326 Vec_IntPush( vTfo, Gia_ObjId(
p, pObj) );
3335 int i,
nWords = Vec_WrdSize(
p->vSimsPi) / Gia_ManCiNum(
p);
3337 if ( Gia_ObjIsAnd(pObj) )
3338 Gia_ManSimPatSimAnd(
p, Gia_ObjId(
p, pObj), pObj,
nWords, vSims );
3340 Gia_ManSimPatSimPo(
p, Gia_ObjId(
p, pObj), pObj,
nWords, vSims );
3346 Abc_TtOrXor( pSims, Vec_WrdEntryP(vSims, Gia_ObjId(
p, pObj)*
nWords), Vec_WrdEntryP(vSims2, Gia_ObjId(
p, pObj)*
nWords),
nWords );
3347 Abc_TtNot( pSims,
nWords );
3352 int i, o, iObj, nMintsO = 1 << Vec_IntSize(vOuts);
3353 int nWords = Vec_WrdSize(
p->vSimsPi) / Gia_ManCiNum(
p);
3354 Vec_Wrd_t * vSims2 = Vec_WrdDup( vSims );
3358 assert( 1 + Vec_IntSize(vIns) + Vec_IntSize(vDivs) + nMintsO <= 64 );
3359 assert( Vec_WrdSize(
p->vSimsPi) % Gia_ManCiNum(
p) == 0 );
3364 for ( o = 0; o < nMintsO; o++ )
3366 word * pRes = Vec_WrdEntryP(vRel,
nWords*(Vec_IntSize(vIns)+Vec_IntSize(vDivs)+o));
3373 Vec_IntFree( vTfo );
3374 Vec_WrdFree( vSims2 );
3375 Vec_WrdFree( vRel );
3380 Vec_Wrd_t * vVals = Vec_WrdStartFull( 1 << Vec_IntSize(vIns) );
3381 Vec_Wrd_t * vSets = Vec_WrdStartFull( 1 << Vec_IntSize(vIns) );
3382 int m, nMints = 1 << Gia_ManCiNum(
p), nCares = 0;
3383 int nMintsI = 1 << Vec_IntSize(vIns);
3384 int nShift = Vec_IntSize(vIns) + Vec_IntSize(vDivs);
3385 int MaskI = Abc_Tt6Mask( Vec_IntSize(vIns) );
3386 int MaskD = Abc_Tt6Mask( nShift );
3387 for ( m = 0; m < nMints; m++ )
3389 word Sign = Vec_WrdEntry( vRel, m );
3390 *Vec_WrdEntryP( vVals, (
int)Sign & MaskI ) = (int)Sign & MaskD;
3391 *Vec_WrdEntryP( vSets, (
int)Sign & MaskI ) &= Sign >> nShift;
3393 for ( m = 0; m < nMintsI; m++ )
3394 if ( ~Vec_WrdEntry(vSets, m) )
3396 assert( *pvSimsIn == NULL );
3397 assert( *pvSimsOut == NULL );
3398 *pvSimsIn = Vec_WrdAlloc( nCares );
3399 *pvSimsOut = Vec_WrdAlloc( nCares );
3400 for ( m = 0; m < nMintsI; m++ )
3401 if ( ~Vec_WrdEntry(vSets, m) )
3403 Vec_WrdPush( *pvSimsIn, Vec_WrdEntry(vVals, m) << 1 );
3404 Vec_WrdPush( *pvSimsOut, Vec_WrdEntry(vSets, m) );
3406 assert( Vec_WrdSize(*pvSimsIn) == nCares );
3407 Vec_WrdFree( vSets );
3408 Vec_WrdFree( vVals );
3413 if ( Gia_ObjIsTravIdPrevious(
p, pObj) )
3415 if ( Gia_ObjIsTravIdCurrent(
p, pObj) )
3419 Gia_ObjSetTravIdPrevious(
p, pObj);
3422 if ( Gia_ObjIsAnd(pObj) )
3428 Gia_ObjSetTravIdPrevious(
p, pObj);
3432 Gia_ObjSetTravIdCurrent(
p, pObj);
3440 Gia_ObjSetTravIdCurrentId(
p, 0 );
3459 Vec_WrdFreeP( &
p->vSimsPi );
3460 p->vSimsPi = Vec_WrdStartTruthTables( Gia_ManCiNum(
p) );
3463 printf(
"Window is NOT consistent.\n" );
3465 printf(
"Window is consistent.\n" );
3472 Vec_WrdFree( vRel );
3473 Vec_WrdFree( vSims );
3474 Vec_WrdFreeP( &
p->vSimsPi );
3518 Vec_IntPush( vRes, 22 );
3519 Vec_IntPush( vRes, 25 );
3520 Vec_IntPush( vRes, 42 );
3521 Vec_IntPush( vRes, 59 );
3527 Vec_IntPush( vRes, 43 );
3528 Vec_IntPush( vRes, 44 );
3529 Vec_IntPush( vRes, 45 );
3530 Vec_IntPush( vRes, 46 );
3536 Vec_IntPush( vRes, 60 );
3537 Vec_IntPush( vRes, 61 );
3606 Vec_Wrd_t * vSimsDiv = NULL, * vSimsOut = NULL;
3609 printf(
"Inputs:\n" );
3611 Abc_TtPrintBits( &Entry, 1 + Vec_IntSize(vIns) + Vec_IntSize(vDivs) );
3612 printf(
"Outputs:\n" );
3614 Abc_TtPrintBits( &Entry, 1 << Vec_IntSize(vOuts) );
3617 Exa6_WriteFile2(
"mul44_i5_n0_t3_s11.rel", Vec_IntSize(vIns), Vec_IntSize(vDivs), Vec_IntSize(vOuts), vSimsDiv, vSimsOut );
3619 Vec_WrdFree( vSimsDiv );
3620 Vec_WrdFree( vSimsOut );
3622 Vec_IntFree( vIns );
3623 Vec_IntFree( vDivs );
3624 Vec_IntFree( vOuts );
3653 Vec_Wrd_t * vSimsDiv = NULL, * vSimsOut = NULL;
3655 Exa_ManExactPrint( vSimsDiv, vSimsOut, 1 + Vec_IntSize(vIns) + Vec_IntSize(vDivs), Vec_IntSize(vOuts) );
3657 pMini =
Exa_ManExactSynthesis6Int( vSimsDiv, vSimsOut, Vec_IntSize(vIns), Vec_IntSize(vDivs), Vec_IntSize(vOuts), nNodes, 1, 1, NULL );
3661 Mini_AigStop( pMini );
3663 Vec_WrdFree( vSimsDiv );
3664 Vec_WrdFree( vSimsOut );
3666 Vec_IntFree( vIns );
3667 Vec_IntFree( vDivs );
3668 Vec_IntFree( vOuts );
3687 Vec_Wrd_t * vSimsPi = Vec_WrdStartTruthTables( Gia_ManCiNum(
p) );
3689 int n,
nWords = Vec_WrdSize(vSimsPi) / Gia_ManCiNum(
p);
3690 int i, nLimit = Gia_ManCiNum(
p) < 6 ? 1 << Gia_ManCiNum(
p) : 64*
nWords;
3691 Vec_Str_t * vOut = Vec_StrAlloc( nLimit*(Gia_ManCoNum(
p) + 3)+1 );
3693 for ( n = 0; n < nLimit; n++ )
3695 for ( i = 0; i < Gia_ManCoNum(
p); i++ )
3696 Vec_StrPush( vOut, (
char)(
'0' + Abc_TtGetBit(Vec_WrdEntryP(vSims, i*
nWords), n)) );
3697 Vec_StrPush( vOut,
' ' );
3698 Vec_StrPush( vOut,
'1' );
3699 Vec_StrPush( vOut,
'\n' );
3701 Vec_StrPush( vOut,
'\0' );
3702 Vec_WrdFree( vSims );
3703 Vec_WrdFree( vSimsPi );
3720 Vec_Wrd_t * vSimsPi = Vec_WrdStartTruthTables( Gia_ManCiNum(
p) );
3723 int i, k,
nWords = Vec_WrdSize(vSimsPi) / Gia_ManCiNum(
p), Count = 0;
3728 word * pSim = Vec_WrdEntryP( vSimsP, i *
nWords );
3729 if ( pSim[0] & 1 ) Abc_TtNot( pSim,
nWords );
3732 word * pSim = Vec_WrdEntryP( vSimsQ, i *
nWords );
3733 if ( pSim[0] & 1 ) Abc_TtNot( pSim,
nWords );
3736 word * pSimQ = Vec_WrdEntryP( vSimsQ, i *
nWords );
3739 word * pSimP = Vec_WrdEntryP( vSimsP, k *
nWords );
3740 if ( !Abc_TtEqual(pSimQ, pSimP,
nWords) )
3743 printf(
"%5d :", i );
3747 printf(
" %5d(%d)", k, pObjQ->
fPhase ^ pObjP->
fPhase );
3752 printf(
"Found %d equivalent nodes.\n", Count );
3753 Vec_WrdFree( vSimsP );
3754 Vec_WrdFree( vSimsQ );
3755 Vec_WrdFree( vSimsPi );
word Abc_RandomW(int fReset)
#define ABC_SWAP(Type, a, b)
#define ABC_ALLOC(type, num)
#define ABC_INFINITY
MACRO DEFINITIONS ///.
unsigned Abc_Random(int fReset)
#define ABC_CALLOC(type, num)
#define ABC_NAMESPACE_IMPL_START
#define ABC_NAMESPACE_IMPL_END
int nTotal
DECLARATIONS ///.
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
struct Vec_Str_t_ Vec_Str_t
void Exa_ManExactPrint(Vec_Wrd_t *vSimsDiv, Vec_Wrd_t *vSimsOut, int nDivs, int nOuts)
Mini_Aig_t * Exa_ManExactSynthesis6Int(Vec_Wrd_t *vSimsDiv, Vec_Wrd_t *vSimsOut, int nVars, int nDivs, int nOuts, int nNodes, int fOnlyAnd, int fVerbose, char *pFileName)
Mini_Aig_t * Exa4_ManGenTest(Vec_Wrd_t *vSimsIn, Vec_Wrd_t *vSimsOut, int nIns, int nDivs, int nOuts, int nNodes, int TimeOut, int fOnlyAnd, int fFancy, int fOrderNodes, int fUniqFans, int fVerbose, int fCard, char *pGuide)
void Exa6_WriteFile2(char *pFileName, int nVars, int nDivs, int nOuts, Vec_Wrd_t *vSimsDiv, Vec_Wrd_t *vSimsOut)
Gia_Man_t * Gia_ManDupMini(Gia_Man_t *p, Vec_Int_t *vIns, Vec_Int_t *vDivs, Vec_Int_t *vOuts, Mini_Aig_t *pMini)
Vec_Int_t * Cbs2_ManSolveMiterNc(Gia_Man_t *pAig, int nConfs, Vec_Str_t **pvStatus, int fVerbose)
ABC_NAMESPACE_IMPL_START void Extra_BitMatrixTransposeP(Vec_Wrd_t *vSimsIn, int nWordsIn, Vec_Wrd_t *vSimsOut, int nWordsOut)
DECLARATIONS ///.
ABC_NAMESPACE_IMPL_START int Kit_TruthToGia(Gia_Man_t *pMan, unsigned *pTruth, int nVars, Vec_Int_t *vMemory, Vec_Int_t *vLeaves, int fHash)
DECLARATIONS ///.
int Gia_ManFindMuxTree_rec(Gia_Man_t *pNew, int *pCtrl, int nCtrl, Vec_Int_t *vData, int Shift)
Vec_Ptr_t * Gia_ManPtrWrdReadBin(char *pFileName, int fVerbose)
Vec_Wrd_t * Gia_ManSimPatSimOut(Gia_Man_t *pGia, Vec_Wrd_t *vSimsPi, int fOuts)
void Gia_ManSimPatAssignInputs(Gia_Man_t *p, int nWords, Vec_Wrd_t *vSims, Vec_Wrd_t *vSimsIn)
FUNCTION DEFINITIONS ///.
void Gia_ObjSimCollect(Gia_SimRsbMan_t *p)
void Gia_RsbUpdateAdd(Gia_RsbMan_t *p, int iObj)
void Gia_ManSimTest(Gia_Man_t *pGia)
float Gia_ManPatGetOneQuo(Gia_Man_t *p, int RareLimit, Vec_Wrd_t *vPatterns, int nWords, int n)
Vec_Int_t * Gia_SimAbsPerformOne(Gia_Man_t *pGia, word *pOffSet, word *pOnSet, Vec_Wrd_t *vSimsCands, int nWords, int fVerbose)
Vec_Int_t * Gia_SimQualityOne(Gia_Man_t *p, Vec_Int_t *vPat, int fPoOnly)
Vec_Int_t * Gia_ManRelOutsTfo(Gia_Man_t *p, Vec_Int_t *vOuts)
int Gia_ManSimRsb(Gia_Man_t *pGia, int nCands, int fVerbose)
int Gia_SimQualityPatternsMax(Gia_Man_t *p, Vec_Int_t *vPat, int Iter, int fVerbose, Vec_Int_t *vStats)
Vec_Int_t * Gia_SimCollectRare(Gia_Man_t *p, Vec_Wrd_t *vPatterns, int RareLimit)
void Gia_RsbFindMints(Gia_RsbMan_t *p, int *pMint0, int *pMint1)
int Gia_ManSimPatHashPatterns(Gia_Man_t *p, int nWords, Vec_Wrd_t *vSims, int *pnC0, int *pnC1)
Vec_Int_t * Gia_ManRelInitOuts()
int Gia_ManSimRelCollectOutputs(Gia_Man_t *p, int nWords, Vec_Wrd_t *vSims, int nWordsOut, Vec_Wrd_t *vSimsOut, Vec_Wrd_t *vRel)
Vec_Wrd_t * Gia_ManRelDeriveRel(Gia_Man_t *p, Vec_Int_t *vIns, Vec_Int_t *vDivs, Vec_Int_t *vOuts, Vec_Wrd_t *vSims)
Vec_Int_t * Gia_ManRelInitOuts1()
void Gia_ManSim2ArrayOne(Vec_Wrd_t *vSimsPi, Vec_Int_t *vRes)
void Gia_ManRelPrint2(Gia_Man_t *p, Vec_Int_t *vObjs, Vec_Wrd_t *vSims, Vec_Wrd_t *vRel)
void Gia_ManPatDistImprove(Gia_Man_t *p, int fVerbose)
word * Gia_SimRsbFunc(Gia_SimRsbMan_t *p, int iObj, Vec_Int_t *vFanins, int fOnSet)
int Gia_SimAbsRefine(Gia_SimAbsMan_t *p)
int Gia_ManSimTwo(Gia_Man_t *p0, Gia_Man_t *p1, int nWords, int nRounds, int TimeLimit, int fVerbose)
void Gia_ManRelDeriveTest(Gia_Man_t *p)
int Gia_ManSimBitPackOne(int nWords, Vec_Wrd_t *vSimsIn, Vec_Wrd_t *vSimsCare, int iPat, int *pLits, int nLits)
Vec_Int_t * Gia_ManPatCollectOne(Gia_Man_t *p, Vec_Wrd_t *vPatterns, int n, int nWords)
Vec_Wec_t * Gia_ManComputeTfos(Gia_Man_t *p)
Vec_Int_t * Gia_ManProcessBuffs(Gia_Man_t *pHie, Vec_Wrd_t *vSimsH, int nWords, Vec_Mem_t *vStore, Vec_Int_t *vLabels)
Vec_Int_t * Gia_ManRelDeriveSimple(Gia_Man_t *p, Vec_Wrd_t *vSims, Vec_Int_t *vIns, Vec_Int_t *vOuts)
Vec_Wec_t * Gia_ManSim2Array(Vec_Ptr_t *vSims)
Gia_SimRsbMan_t * Gia_SimRsbAlloc(Gia_Man_t *pGia)
Vec_Str_t * Gia_ManComputeRange(Gia_Man_t *p)
int Gia_ManCheckSimEquiv(Gia_Man_t *p, int fVerbose)
Vec_Wrd_t * Gia_ManSimPatSimIn(Gia_Man_t *pGia, Vec_Wrd_t *vSims, int fIns, Vec_Int_t *vAnds)
void Gia_ManComparePrint(Gia_Man_t *p, Gia_Man_t *q)
void Gia_ManCompareSims(Gia_Man_t *pHie, Gia_Man_t *pFlat, int nWords, int fVerbose)
void Gia_ManSimRelAssignInputs(Gia_Man_t *p, int nWords, Vec_Wrd_t *vSims, int nWordsIn, Vec_Wrd_t *vSimsIn)
int Gia_RsbRemovalCost(Gia_RsbMan_t *p, int Index)
void Gia_ManRelSolve(Gia_Man_t *p, Vec_Wrd_t *vSims, Vec_Int_t *vIns, Vec_Int_t *vOuts, Vec_Int_t *vRel, Vec_Int_t *vDivs)
void Gia_RsbUpdateRemove(Gia_RsbMan_t *p, int Index)
Vec_Wrd_t * Gia_ManSimCombine(int nInputs, Vec_Wrd_t *vBase, Vec_Wrd_t *vAddOn, int nWordsUse)
void Gia_ManRelDeriveTest2(Gia_Man_t *p)
Vec_Wrd_t * Gia_ManSimRelDeriveFuncs(Gia_Man_t *p, Vec_Wrd_t *vRel, int nOuts)
void Gia_ManPatSatImprove(Gia_Man_t *p, int nWords0, int fVerbose)
int Gia_ManComparePair(Gia_Man_t *p, Vec_Wrd_t *vSims, int iOut, int nWords2)
void Gia_ManSimPatSimTfo(Gia_Man_t *p, Vec_Wrd_t *vSims, Vec_Int_t *vTfo)
Vec_Int_t * Gia_SimGenerateStats(Gia_Man_t *p)
void Gia_ManSimPatAssignInputs2(Gia_Man_t *p, int nWords, Vec_Wrd_t *vSims, Vec_Wrd_t *vSimsIn)
Vec_Wrd_t * Gia_ManSimPatSimC(Gia_Man_t *pGia, Vec_Wrd_t *vSims, Vec_Wrd_t *vSimsCiC)
void Gia_SimRsbFree(Gia_SimRsbMan_t *p)
void Gia_SimAbsSolve(Gia_SimAbsMan_t *p)
Vec_Int_t * Gia_SimAbsFind(Vec_Int_t *vValues, int Value)
Vec_Wrd_t * Gia_ManSimPatSim(Gia_Man_t *pGia)
void Gia_ManSimProfile(Gia_Man_t *pGia)
float Gia_ManPatGetQuo(Gia_Man_t *p, Vec_Int_t *vRareCounts, Vec_Wrd_t *vSims, int n, int nWords)
int Gia_ManRelCheck_rec(Gia_Man_t *p, Gia_Obj_t *pObj)
Gia_SimAbsMan_t * Gia_SimAbsAlloc(Gia_Man_t *pGia, word *pOffSet, word *pOnSet, Vec_Wrd_t *vSims, int nWords, Vec_Int_t *vResub, int fVerbose)
int Gia_ManRelCheck(Gia_Man_t *p, Vec_Int_t *vIns, Vec_Int_t *vDivs, Vec_Int_t *vOuts)
Vec_Wrd_t * Gia_ManRelDerive2(Gia_Man_t *p, Vec_Int_t *vObjs, Vec_Wrd_t *vSims)
void Gia_ManRelPrint(Gia_Man_t *p, Vec_Int_t *vObjs, Vec_Wrd_t *vSims, Vec_Wrd_t *vRel)
Vec_Int_t * Gia_ManRelInitObjs()
struct Gia_SimAbsMan_t_ Gia_SimAbsMan_t
Vec_Int_t * Gia_ManRelInitDivs1()
Vec_Int_t * Gia_ManRelInitMffc(Gia_Man_t *p, Vec_Int_t *vOuts)
int Gia_RsbFindNodeToRemove(Gia_RsbMan_t *p, int *pMinCost)
word * Gia_SimRsbCareSet(Gia_SimRsbMan_t *p, int iObj, Vec_Int_t *vTfo)
Gia_RsbMan_t * Gia_RsbAlloc(Gia_Man_t *pGia, word *pOffSet, word *pOnSet, Vec_Wrd_t *vSims, int nWords, Vec_Wrd_t *vSimsT, int nWordsT, Vec_Int_t *vCands)
void Gia_SimAbsInit(Gia_SimAbsMan_t *p)
void Gia_ManRelDeriveSims(Gia_Man_t *p, Vec_Int_t *vIns, Vec_Int_t *vDivs, Vec_Int_t *vOuts, Vec_Wrd_t *vSims, Vec_Wrd_t *vRel, Vec_Wrd_t **pvSimsIn, Vec_Wrd_t **pvSimsOut)
Vec_Int_t * Gia_SimCollectBest(Vec_Flt_t *vQuo)
Vec_Wrd_t * Gia_ManDeriveNodeFuncs(Gia_Man_t *p)
Vec_Int_t * Gia_ManRelInitIns()
void Gia_ManPatRareImprove(Gia_Man_t *p, int RareLimit, int fVerbose)
void Gia_ManSimGen(Gia_Man_t *pGia)
Vec_Int_t * Gia_RsbSolve(Gia_RsbMan_t *p)
int Gia_RsbFindNode(Gia_RsbMan_t *p)
Vec_Int_t * Gia_ManRelInitIns1()
void Gia_SimAbsCheckSolution(Gia_SimAbsMan_t *p)
void Gia_ManPtrWrdDumpBin(char *pFileName, Vec_Ptr_t *p, int fVerbose)
Vec_Int_t * Gia_ManSimPatStart(int nItems)
int Gia_ManFindDividerVar(Gia_Man_t *p, int fVerbose)
void Gia_SimRsbTfo_rec(Gia_Man_t *p, int iObj, int iFanout, Vec_Int_t *vTfo)
void Gia_ManSimRelPrint(Gia_Man_t *p, Vec_Wrd_t *vRel, Vec_Int_t *vOutMints)
void Gia_ManRelDeriveTest1(Gia_Man_t *p)
void Gia_RsbPrint(Gia_RsbMan_t *p)
void Gia_ManSimPatSimMiter(Gia_Man_t *p, Vec_Wrd_t *vSims, Vec_Wrd_t *vSims2, word *pSims, int nWords)
int Gia_ObjSimRsb(Gia_SimRsbMan_t *p, int iObj, int nCands, int fVerbose, int *pnBufs, int *pnInvs)
typedefABC_NAMESPACE_IMPL_START struct Gia_SimRsbMan_t_ Gia_SimRsbMan_t
DECLARATIONS ///.
Vec_Ptr_t * Gia_ManArray2Sim(Vec_Wec_t *vRes)
Vec_Wrd_t * Gia_ManSimPatValues(Gia_Man_t *p)
Vec_Flt_t * Gia_SimQualityImpact(Gia_Man_t *p, Vec_Int_t *vPat, Vec_Int_t *vRareCounts)
struct Gia_RsbMan_t_ Gia_RsbMan_t
Vec_Wrd_t * Gia_ManArray2SimOne(Vec_Int_t *vRes)
int Gia_ManSimRelCompare(Gia_Man_t *p, int nWords, Vec_Wrd_t *vSims, int nWordsOut, Vec_Wrd_t *vSimsOut, int iPat, int iMint)
Vec_Int_t * Gia_Sim5CollectValues(word *pOffSet, word *pOnSet, int nWords)
void Gia_ManSimPatSimInTest(Gia_Man_t *pGia)
void Gia_ManSimPatWrite(char *pFileName, Vec_Wrd_t *vSimsIn, int nWords)
void Gia_ManSimPatSimCTest(Gia_Man_t *pGia)
void Gia_ManSimRelTest(Gia_Man_t *p)
Gia_Man_t * Gia_ManChangeTest3(Gia_Man_t *p)
Gia_Man_t * Gia_ManSimPatGenMiter(Gia_Man_t *p, Vec_Wrd_t *vSims)
Vec_Wrd_t * Gia_ManSimRel(Gia_Man_t *p, Vec_Int_t *vObjs, Vec_Wrd_t *vVals)
void Gia_RsbFree(Gia_RsbMan_t *p)
double Gia_SimComputeScore(Gia_Man_t *p, Vec_Int_t *vTotal, Vec_Int_t *vThis)
void Gia_ManSimArrayTest(Vec_Wrd_t *vSimsPi)
int Gia_SimRsbResubVerify(Gia_SimRsbMan_t *p, int iObj, Vec_Int_t *vFanins)
void Gia_ManSimPatValuesDerive(Gia_Man_t *p, int nWords, Vec_Wrd_t *vSims, Vec_Wrd_t *vValues)
Vec_Wrd_t * Gia_ManSimPatSim2(Gia_Man_t *pGia)
void Gia_ManUpdateCoPhase(Gia_Man_t *pNew, Gia_Man_t *pOld)
void Gia_SimAbsFree(Gia_SimAbsMan_t *p)
int Gia_RsbCost(Gia_RsbMan_t *p)
Vec_Int_t * Gia_SimRsbTfo(Gia_SimRsbMan_t *p, int iObj, int iFanout)
Vec_Wec_t * Gia_ManRelTfos(Gia_Man_t *p, Vec_Int_t *vObjs)
Vec_Wrd_t * Gia_ManRelDerive(Gia_Man_t *p, Vec_Int_t *vObjs, Vec_Wrd_t *vSims)
int Gia_ManRelOutsTfo_rec(Gia_Man_t *p, Gia_Obj_t *pObj, Vec_Int_t *vTfo)
Vec_Int_t * Gia_ObjSimCands(Gia_SimRsbMan_t *p, int iObj, int nCands)
Gia_Man_t * Gia_ManPerformMuxDec(Gia_Man_t *p)
int Gia_RsbCollectValid(Gia_RsbMan_t *p)
void Gia_SimQualityTest(Gia_Man_t *p)
void Gia_ManRelCompute(Gia_Man_t *p, Vec_Int_t *vIns, Vec_Int_t *vDivs, Vec_Int_t *vOuts, Vec_Wrd_t **pvSimsIn, Vec_Wrd_t **pvSimsOut)
Vec_Int_t * Gia_RsbSetFind(word *pOffSet, word *pOnSet, Vec_Wrd_t *vSims, int nWords, Vec_Wrd_t *vSimsT, int nWordsT, Vec_Int_t *vCands)
Vec_Int_t * Gia_ManRelInitDivs(Gia_Man_t *p, Vec_Int_t *vIns, Vec_Int_t *vOuts)
void Gia_ManSimPatResim(Gia_Man_t *pGia, Vec_Int_t *vObjs, int nWords, Vec_Wrd_t *vSims)
int Gia_ManComputeTfos_rec(Gia_Man_t *p, int iObj, int iRoot, Vec_Int_t *vNode)
Vec_Wrd_t * Gia_ManSimRelDeriveFuncs2(Gia_Man_t *p, Vec_Wrd_t *vRel, int nOuts)
void Gia_ManPatUpdateOne(Gia_Man_t *p, Vec_Wrd_t *vPatterns, int n, int nWords, Vec_Int_t *vPat)
word * Gia_ManDeriveFuncs(Gia_Man_t *p)
float Gia_ManPatGetTotalQuo(Gia_Man_t *p, int RareLimit, Vec_Wrd_t *vPatterns, int nWords)
void Gia_ManSimRelCheckFuncs(Gia_Man_t *p, Vec_Wrd_t *vRel, int nOuts, Vec_Wrd_t *vFuncs)
Vec_Wrd_t * Gia_ManSimBitPacking(Gia_Man_t *p, Vec_Int_t *vCexStore, int nCexes, int nUnDecs)
void Gia_ManStop(Gia_Man_t *p)
Gia_Man_t * Gia_ManDup(Gia_Man_t *p)
void Gia_ManStaticFanoutStart(Gia_Man_t *p)
void Gia_ManHashStart(Gia_Man_t *p)
void Gia_ManStaticFanoutStop(Gia_Man_t *p)
#define Gia_ManForEachBuf(p, pObj, i)
#define Gia_ManForEachAnd(p, pObj, i)
#define Gia_ManForEachCoId(p, Id, i)
#define Gia_ManForEachCand(p, pObj, i)
#define Gia_ManForEachAndReverse(p, pObj, i)
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
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_ManCleanPhase(Gia_Man_t *p)
void Gia_ManTransferTiming(Gia_Man_t *p, Gia_Man_t *pGia)
int Gia_ManHashAnd(Gia_Man_t *p, int iLit0, int iLit1)
void Gia_ManIncrementTravId(Gia_Man_t *p)
#define Gia_ObjForEachFanoutStaticId(p, Id, FanId, i)
#define Gia_ManForEachObj(p, pObj, i)
MACRO DEFINITIONS ///.
#define Gia_ManForEachCo(p, pObj, i)
#define Gia_ManForEachCi(p, pObj, 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)
int Gia_ManLevelNum(Gia_Man_t *p)
#define Gia_ManForEachAndId(p, i)
#define Gia_ManForEachCiId(p, Id, i)
void Extra_PrintBinary(FILE *pFile, unsigned Sign[], int nBits)
unsigned __int64 word
DECLARATIONS ///.
struct Mini_Aig_t_ Mini_Aig_t
BASIC TYPES ///.
typedefABC_NAMESPACE_IMPL_START struct Vec_Mem_t_ Vec_Mem_t
DECLARATIONS ///.
#define Vec_FltForEachEntry(vVec, Entry, i)
MACRO DEFINITIONS ///.
typedefABC_NAMESPACE_HEADER_START struct Vec_Flt_t_ Vec_Flt_t
INCLUDES ///.
#define Vec_IntForEachEntryDouble(vVec, Entry1, Entry2, i)
#define Vec_IntForEachEntry(vVec, Entry, i)
MACRO DEFINITIONS ///.
#define Vec_IntForEachEntryTwo(vVec1, vVec2, Entry1, Entry2, i)
#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 ///.
#define Vec_StrForEachEntry(vVec, Entry, i)
MACRO DEFINITIONS ///.
#define Vec_WecForEachLevel(vGlob, vVec, i)
MACRO DEFINITIONS ///.
typedefABC_NAMESPACE_HEADER_START struct Vec_Wec_t_ Vec_Wec_t
INCLUDES ///.
#define Vec_WecForEachLevelTwo(vGlob1, vGlob2, vVec1, vVec2, i)
#define Vec_WecForEachLevelStop(vGlob, vVec, i, LevelStop)
#define Vec_WrdForEachEntry(vVec, Entry, i)
MACRO DEFINITIONS ///.
typedefABC_NAMESPACE_HEADER_START struct Vec_Wrd_t_ Vec_Wrd_t
INCLUDES ///.