ABC: A System for Sequential Synthesis and Verification
 
Loading...
Searching...
No Matches
giaMulFind.c
Go to the documentation of this file.
1
20
21#include "gia.h"
22
24
25
29
33
46{
47 if ( !Gia_ObjIsAnd(pObj) )
48 return;
49 if ( Gia_ObjIsTravIdCurrent(p, pObj) )
50 return;
51 Gia_ObjSetTravIdCurrent(p, pObj);
52 if ( !pObj->fMark0 )
53 {
54 if ( !Gia_ObjFaninC0(pObj) && !Gia_ObjFaninC1(pObj)
55 && Gia_ObjRefNum(p, Gia_ObjFanin0(pObj)) >= 4
56 && Gia_ObjRefNum(p, Gia_ObjFanin1(pObj)) >= 4 )
57 Vec_IntPushTwo( vXor, Gia_ObjFaninId0p(p, pObj), Gia_ObjFaninId1p(p, pObj) );
58 return;
59 }
60 Gia_Obj_t * pFan0, * pFan1;
61 int RetValue = Gia_ObjRecognizeExor(pObj, &pFan0, &pFan1);
62 assert( RetValue );
63 Gia_ManMulFindXors2_rec( p, Gia_Regular(pFan0), vXor );
64 Gia_ManMulFindXors2_rec( p, Gia_Regular(pFan1), vXor );
65}
67{
68 Vec_Wec_t * vXors = Vec_WecAlloc( 100 );
69 Vec_Int_t * vTemp = Vec_IntAlloc( 100 );
70 Gia_Obj_t * pObj, * pFan0, * pFan1; int i;
73 Gia_ManForEachAnd( p, pObj, i ) {
74 if ( !Gia_ObjRecognizeExor(pObj, &pFan0, &pFan1) )
75 continue;
76 Gia_Regular(pFan0)->fMark1 = 1;
77 Gia_Regular(pFan1)->fMark1 = 1;
78 pObj->fMark0 = 1;
79 }
80 Gia_ManForEachAnd( p, pObj, i ) {
81 if ( pObj->fMark0 && !pObj->fMark1 ) {
83 Vec_IntClear( vTemp );
84 Gia_ManMulFindXors2_rec( p, pObj, vTemp );
85 if ( Vec_IntSize(vTemp) > 0 )
86 Vec_IntAppend( Vec_WecPushLevel(vXors), vTemp );
87 }
88 }
89 Vec_IntFree( vTemp );
90 return vXors;
91}
93{
94 Vec_Int_t * vLevel; int i, iBest = -1, nBestSize = 0;
95 Vec_WecForEachLevel( vXors, vLevel, i )
96 if ( !Vec_IntEntry(vUsed, i) && nBestSize < Vec_IntSize(vLevel) )
97 nBestSize = Vec_IntSize(vLevel), iBest = i;
98 return iBest;
99}
101{
102 int i, k, ObjI, ObjK, Counter = 0;
103 Vec_IntForEachEntry( p1, ObjI, i )
104 Vec_IntForEachEntry( p2, ObjK, k )
105 if ( ObjI == ObjK )
106 Counter++;
107 return Counter;
108}
110{
111 int i, k, ObjI, ObjK, Counter = 0;
112 Vec_IntForEachEntryStart( p1, ObjI, i, 1 )
113 Vec_IntForEachEntry( p2, ObjK, k )
114 if ( ObjI == ObjK )
115 Counter++;
116 return Counter;
117}
118int Gia_ManMulFindMaxOverlap( Vec_Wec_t * vXors, Vec_Int_t * vUsed, Vec_Int_t * vFound )
119{
120 Vec_Int_t * vLevel; int i, iBest = -1, nThisSize, nBestSize = 0;
121 Vec_WecForEachLevel( vXors, vLevel, i )
122 if ( !Vec_IntEntry(vUsed, i) && nBestSize < (nThisSize = Gia_ManMulFindGetOverlap(vFound, vLevel)) )
123 nBestSize = nThisSize, iBest = i;
124 return iBest;
125}
127{
128 Vec_Wec_t * vSets = Vec_WecAlloc( 100 );
129 Vec_Int_t * vUsed = Vec_IntStart( Vec_WecSize(vXors) );
130 Vec_Int_t * vFound = Vec_IntAlloc( 100 ); int Item, k, Obj;
131 while ( (Item = Gia_ManMulFindMaxSize(vXors, vUsed)) != -1 ) {
132 Vec_Int_t * vTemp = Vec_WecEntry(vXors, Item);
133 Vec_Int_t * vNew = Vec_WecPushLevel( vSets );
134 Vec_IntPush( vNew, Item );
135 Vec_IntWriteEntry( vUsed, Item, 1 );
136 Vec_IntClear( vFound );
137 Vec_IntAppend( vFound, vTemp );
138 while ( (Item = Gia_ManMulFindMaxOverlap(vXors, vUsed, vFound)) != -1 ) {
139 Vec_IntPush( vNew, Item );
140 Vec_IntWriteEntry( vUsed, Item, 1 );
141 vTemp = Vec_WecEntry(vXors, Item);
142 Vec_IntForEachEntry( vTemp, Obj, k )
143 Vec_IntPushUnique( vFound, Obj );
144 }
145 }
146 Vec_IntFree( vUsed );
147 Vec_IntFree( vFound );
148 return vSets;
149}
150int Gia_ManMulFindOne( Gia_Man_t * p, Vec_Wec_t * vXors, Vec_Int_t * vSet, Vec_Int_t * vMap, Vec_Int_t * vA, Vec_Int_t * vB, int fVerbose )
151{
152 Vec_Int_t * vObjs = Vec_IntAlloc( 100 ); int i, j, Obj, Obj1, Obj2;
153 Vec_IntForEachEntry( vSet, Obj, i )
154 Vec_IntAppend( vObjs, Vec_WecEntry(vXors, Obj) );
155 Vec_IntForEachEntry( vObjs, Obj, i )
156 Vec_IntAddToEntry( vMap, Obj, 1 );
157 Vec_IntForEachEntry( vSet, Obj, i ) {
158 Vec_Int_t * vTemp = Vec_WecEntry(vXors, Obj); int k = 0;
159 Vec_IntForEachEntryDouble( vTemp, Obj1, Obj2, j )
160 if ( Vec_IntEntry(vMap, Obj1) > 1 || Vec_IntEntry(vMap, Obj2) > 1 )
161 Vec_IntWriteEntry(vTemp, k++, Obj1), Vec_IntWriteEntry(vTemp, k++, Obj2);
162 Vec_IntShrink( vTemp, k );
163 }
164 Vec_IntForEachEntry( vObjs, Obj, i )
165 Vec_IntWriteEntry( vMap, Obj, 0 );
166 Vec_IntClear( vObjs );
167 Vec_IntForEachEntry( vSet, Obj, i )
168 Vec_IntAppend( vObjs, Vec_WecEntry(vXors, Obj) );
169 if ( Vec_IntSize(vObjs) == 0 ) {
170 Vec_IntFree(vObjs);
171 return 0;
172 }
173
174 Vec_IntClear( vA );
175 Vec_IntClear( vB );
176 Vec_IntPush( vA, Vec_IntPop(vObjs) );
177 Vec_IntPush( vB, Vec_IntPop(vObjs) );
178 while ( Vec_IntSize(vObjs) > 0 ) {
179 int k = 0;
180 Vec_IntForEachEntryDouble( vObjs, Obj1, Obj2, j ) {
181 if ( Vec_IntFind(vA, Obj1) >= 0 )
182 Vec_IntPushUnique(vB, Obj2);
183 else if ( Vec_IntFind(vA, Obj2) >= 0 )
184 Vec_IntPushUnique(vB, Obj1);
185 else if ( Vec_IntFind(vB, Obj1) >= 0 )
186 Vec_IntPushUnique(vA, Obj2);
187 else if ( Vec_IntFind(vB, Obj2) >= 0 )
188 Vec_IntPushUnique(vA, Obj1);
189 else {
190 Vec_IntWriteEntry(vObjs, k++, Obj1);
191 Vec_IntWriteEntry(vObjs, k++, Obj2);
192 }
193 }
194 Vec_IntShrink( vObjs, k );
195 }
196 Vec_IntSort( vA, 0 );
197 Vec_IntSort( vB, 0 );
198 Vec_IntClear( vObjs );
199 Vec_IntForEachEntry( vSet, Obj, i )
200 Vec_IntAppend( vObjs, Vec_WecEntry(vXors, Obj) );
201 Vec_IntForEachEntryDouble( vObjs, Obj1, Obj2, j )
202 if ( !((Vec_IntFind(vA, Obj1) >= 0 && Vec_IntFind(vB, Obj2) >= 0) ||
203 (Vec_IntFind(vA, Obj2) >= 0 && Vec_IntFind(vB, Obj1) >= 0)) ) {
204 if ( fVerbose )
205 printf( "Internal verification failed.\n" );
206 Vec_IntFree( vObjs );
207 Vec_IntClear( vA );
208 Vec_IntClear( vB );
209 return 0;
210 }
211 if ( fVerbose )
212 printf( "Generated system with %d+%d+%d=%d variables and %d equations.\n",
213 Vec_IntSize(vA),Vec_IntSize(vB),Vec_IntSize(vSet),
214 Vec_IntSize(vA)+Vec_IntSize(vB)+Vec_IntSize(vSet), Vec_IntSize(vObjs)/2 );
215 Vec_IntFree( vObjs );
216 return 1;
217}
219{
220 Vec_Wec_t * vMuls = Vec_WecAlloc( 10 );
221 Vec_Wec_t * vXors = Gia_ManMulFindXors2( p );
222 Vec_Wec_t * vSets = Gia_ManMulFindSets( p, vXors );
223 Vec_Int_t * vMap = Vec_IntStart( Gia_ManObjNum(p) );
224 Vec_Int_t * vA = Vec_IntAlloc( 100 );
225 Vec_Int_t * vB = Vec_IntAlloc( 100 );
226 Vec_Int_t * vSet; int i;
227 Vec_WecForEachLevel( vSets, vSet, i )
228 {
229 if ( !Gia_ManMulFindOne(p, vXors, vSet, vMap, vA, vB, fVerbose) )
230 continue;
231 Vec_IntAppend( Vec_WecPushLevel(vMuls), vA );
232 Vec_IntAppend( Vec_WecPushLevel(vMuls), vB );
233 Vec_WecPushLevel(vMuls);
234 }
235 Vec_WecFree( vXors );
236 Vec_WecFree( vSets );
237 Vec_IntFree( vMap );
238 Vec_IntFree( vA );
239 Vec_IntFree( vB );
240 return vMuls;
241}
242
243
255void Gia_ManMulFindAddEntry1( Vec_Int_t * vPairs, int Obj )
256{
257 int Entry, Sum, k;
258 Vec_IntForEachEntryDouble( vPairs, Entry, Sum, k )
259 if ( Obj == Entry ) {
260 Vec_IntAddToEntry( vPairs, k+1, 1 );
261 break;
262 }
263 if ( k == Vec_IntSize(vPairs) )
264 Vec_IntPushTwo( vPairs, Obj, 1 );
265}
267{
268 Vec_Int_t * vCounts = Vec_IntAlloc( 10 );
269 int i, k, Obj, Item;
270 Vec_IntForEachEntry( vSet, Item, i ) {
271 Vec_Int_t * vCut = Vec_WecEntry(vCuts4, Item);
272 Vec_IntForEachEntryStart( vCut, Obj, k, 1 )
273 Gia_ManMulFindAddEntry1( vCounts, Obj );
274 }
275 return vCounts;
276}
277int Gia_ManMulFindNextEntry( Vec_Wec_t * vCuts4, Vec_Int_t * vSet, int Entry )
278{
279 int i, Item;
280 Vec_IntForEachEntry( vSet, Item, i ) {
281 Vec_Int_t * vCut = Vec_WecEntry(vCuts4, Item);
282 if ( Vec_IntSize(vCut) == 0 )
283 continue;
284 assert( Vec_IntSize(vCut) == 3 );
285 int RetValue = -1;
286 if ( Vec_IntEntry(vCut, 1) == Entry )
287 RetValue = Vec_IntEntry(vCut, 2);
288 if ( Vec_IntEntry(vCut, 2) == Entry )
289 RetValue = Vec_IntEntry(vCut, 1);
290 if ( RetValue == -1 )
291 continue;
292 Vec_IntClear( vCut );
293 return RetValue;
294 }
295 return -1;
296}
297void Gia_ManMulFindArg1( Vec_Wec_t * vCuts4, Vec_Int_t * vSet, Vec_Int_t * vArg1 )
298{
299 Vec_Int_t * vCounts = Gia_ManMulFindCounts( vCuts4, vSet );
300 int Entry = -1, Sum, k;
301 Vec_IntClear( vArg1 );
302 Vec_IntForEachEntryDouble( vCounts, Entry, Sum, k )
303 if ( Sum == 1 ) {
304 Vec_IntPush( vArg1, Entry );
305 break;
306 }
307 assert( Entry != -1 );
308 while ( (Entry = Gia_ManMulFindNextEntry(vCuts4, vSet, Entry)) != -1 )
309 Vec_IntPush( vArg1, Entry );
310 Vec_IntFree( vCounts );
311}
312int Gia_ManMulFindNextEntryCount( Vec_Int_t * vCounts, int Entry0 )
313{
314 int Entry, Sum, k;
315 Vec_IntForEachEntryDouble( vCounts, Entry, Sum, k )
316 if ( Entry == Entry0 )
317 return Sum;
318 return -1;
319}
320int Gia_ManMulFindNextEntry2( Vec_Wec_t * vCuts4, Vec_Int_t * vSet, int Entry, Vec_Int_t * vCounts, int * pEntry0, int * pEntry1 )
321{
322 int i, Item;
323 Vec_IntForEachEntry( vSet, Item, i ) {
324 Vec_Int_t * vCut = Vec_WecEntry(vCuts4, Item);
325 if ( Vec_IntSize(vCut) == 0 )
326 continue;
327 assert( Vec_IntSize(vCut) == 4 );
328 int Entry0, Entry1, iPlace = Vec_IntFind( vCut, Entry );
329 if ( iPlace == -1 )
330 continue;
331 if ( iPlace == 1 )
332 Entry0 = Vec_IntEntry(vCut, 2), Entry1 = Vec_IntEntry(vCut, 3);
333 else if ( iPlace == 2 )
334 Entry0 = Vec_IntEntry(vCut, 1), Entry1 = Vec_IntEntry(vCut, 3);
335 else if ( iPlace == 3 )
336 Entry0 = Vec_IntEntry(vCut, 1), Entry1 = Vec_IntEntry(vCut, 2);
337 else assert( 0 );
338 int Count0 = Gia_ManMulFindNextEntryCount(vCounts, Entry0);
339 int Count1 = Gia_ManMulFindNextEntryCount(vCounts, Entry1);
340 *pEntry0 = Count0 <= Count1 ? Entry0 : Entry1;
341 *pEntry1 = Count0 <= Count1 ? Entry1 : Entry0;
342 // remove entries
343 Vec_IntForEachEntry( vSet, Item, i ) {
344 Vec_Int_t * vCut = Vec_WecEntry(vCuts4, Item);
345 if ( Vec_IntSize(vCut) == 0 )
346 continue;
347 if ( Vec_IntFind( vCut, Entry ) >= 0 )
348 Vec_IntClear( vCut );
349 }
350 return 1;
351 }
352 return 0;
353}
354void Gia_ManMulFindArg2( Vec_Wec_t * vCuts5, Vec_Int_t * vSet, Vec_Int_t * vArg2, int Entry0, int Entry1 )
355{
356 Vec_Int_t * vCounts = Gia_ManMulFindCounts( vCuts5, vSet );
357 int Entry, Sum, k, SumMin = ABC_INFINITY, SumMax = 0;
358 Vec_IntForEachEntryDouble( vCounts, Entry, Sum, k ) {
359 SumMin = Abc_MinInt( SumMin, Sum );
360 SumMax = Abc_MaxInt( SumMax, Sum );
361 }
362 Vec_IntClear( vArg2 );
363 Vec_IntForEachEntryDouble( vCounts, Entry, Sum, k )
364 if ( Entry == Entry0 || Entry == Entry1 ) {
365 Vec_IntPush( vArg2, Entry == Entry0 ? Entry1 : Entry0 );
366 Vec_IntPush( vArg2, Entry );
367 break;
368 }
369 Entry = Vec_IntEntry(vArg2, 1);
370 while ( Gia_ManMulFindNextEntry2(vCuts5, vSet, Entry, vCounts, &Entry0, &Entry1) )
371 Vec_IntPushTwo( vArg2, Entry0, Entry1 ), Entry = Entry1;
372 Vec_IntFree( vCounts );
373}
374void Gia_ManMulFindAddEntry( Vec_Int_t * vPairs, int Obj0, int Obj1 )
375{
376 int Entry0, Entry1, Sum, k;
377 Vec_IntForEachEntryTriple( vPairs, Entry0, Entry1, Sum, k )
378 if ( Obj0 == Entry0 && Obj1 == Entry1 ) {
379 Vec_IntAddToEntry( vPairs, k+2, 1 );
380 break;
381 }
382 if ( k == Vec_IntSize(vPairs) )
383 Vec_IntPushThree( vPairs, Obj0, Obj1, 1 );
384}
385Vec_Wec_t * Gia_ManMulFindBInputs2( Gia_Man_t * p, Vec_Wec_t * vCuts4, Vec_Wec_t * vCuts5, int fVerbose )
386{
387 Vec_Wec_t * vRes = Vec_WecAlloc( 10 );
388 Vec_Int_t * vPairs = Vec_IntAlloc( 1000 );
389 Vec_Int_t * vSet = Vec_IntAlloc( 100 );
390 Vec_Int_t * vCut, * vArg1, * vArg2;
391 int i, j, k, n, Entry0, Entry1, Sum, Obj0, Obj1;
392 Vec_WecForEachLevel( vCuts4, vCut, i )
393 Vec_IntForEachEntryStart( vCut, Obj0, j, 1 )
394 Vec_IntForEachEntryStart( vCut, Obj1, k, j+1 )
395 Gia_ManMulFindAddEntry( vPairs, Obj0, Obj1 );
396 Vec_IntForEachEntryTriple( vPairs, Entry0, Entry1, Sum, n ) {
397 if ( Sum < 3 )
398 continue;
399 Vec_IntClear( vSet );
400 Vec_WecForEachLevel( vCuts4, vCut, i )
401 Vec_IntForEachEntryStart( vCut, Obj0, j, 1 )
402 Vec_IntForEachEntryStart( vCut, Obj1, k, j+1 )
403 if ( Obj0 == Entry0 && Obj1 == Entry1 ) {
404 Vec_IntPush( vSet, i );
405 Vec_IntDrop( vCut, k );
406 Vec_IntDrop( vCut, j );
407 j = k = Vec_IntSize(vCut);
408 }
409 vArg1 = Vec_WecPushLevel(vRes);
410 vArg2 = Vec_WecPushLevel(vRes);
411 Vec_WecPushLevel(vRes);
412 Gia_ManMulFindArg1( vCuts4, vSet, vArg1 );
413 // find overlapping with arg1 and remove nodes in arg1
414 Vec_IntClear( vSet );
415 Vec_WecForEachLevel( vCuts5, vCut, i )
416 if ( Gia_ManMulFindGetOverlap2(vCut, vArg1) ) {
417 k = 1;
418 Vec_IntForEachEntryStart( vCut, Obj0, j, 1 )
419 if ( Vec_IntFind(vArg1, Obj0) == -1 )
420 Vec_IntWriteEntry( vCut, k++, Obj0 );
421 Vec_IntShrink( vCut, k );
422 Vec_IntPush( vSet, i );
423 }
424 Gia_ManMulFindArg2( vCuts5, vSet, vArg2, Entry0, Entry1 );
425 }
426 Vec_IntFree( vSet );
427 Vec_IntFree( vPairs );
428 return vRes;
429}
430
443{
444 int i, k, ObjI, ObjK, Counter = 0;
445 Vec_IntForEachEntry( p1, ObjI, i )
446 Vec_IntForEachEntry( p2, ObjK, k )
447 if ( ObjI == ObjK )
448 Counter++;
449 return Counter;
450}
451void Gia_ManMulFindAssignGroup( Vec_Int_t * vTemp, int iGroup, Vec_Int_t * vMap )
452{
453 int k, Obj;
454 Vec_IntForEachEntry( vTemp, Obj, k ) {
455 //assert( Vec_IntEntry(vMap, Obj) == -1 || Vec_IntEntry(vMap, Obj) == iGroup );
456 Vec_IntWriteEntry(vMap, Obj, iGroup);
457 }
458 Vec_IntPush( vTemp, iGroup );
459}
460Vec_Int_t * Gia_ManMulFindGroups( Vec_Wec_t * p, int nObjs, int fUseMap )
461{
462 Vec_Int_t * vIndex = Vec_IntAlloc( 100 ), * vTemp;
463 Vec_Int_t * vMap = Vec_IntStartFull( nObjs ); int i, Counter, nGroups = 0;
464 Vec_Int_t * vUngrouped = Vec_IntStartNatural( Vec_WecSize(p) );
465 while ( Vec_IntSize(vUngrouped) ) {
466 int k, Obj, Item = Vec_IntPop(vUngrouped);
467 vTemp = Vec_WecEntry(p, Item);
468 Gia_ManMulFindAssignGroup( vTemp, nGroups, vMap );
469 int fChanges = 1;
470 while ( fChanges ) {
471 fChanges = 0;
472 Vec_IntForEachEntry( vUngrouped, Item, i ) {
473 vTemp = Vec_WecEntry(p, Item);
474 Counter = 0;
475 Vec_IntForEachEntry( vTemp, Obj, k )
476 if ( Vec_IntEntry(vMap, Obj) >= 0 )
477 Counter++;
478 if ( Counter < 1 )
479 continue;
480 Gia_ManMulFindAssignGroup( vTemp, nGroups, vMap );
481 Vec_IntDrop( vUngrouped, i-- );
482 fChanges = 1;
483 }
484 }
485 nGroups++;
486 }
487 Vec_IntFree( vUngrouped );
488 Vec_IntFree( vMap );
489 if ( fUseMap )
490 Vec_WecForEachLevel( p, vTemp, i )
491 Vec_IntPushTwo( vTemp, i, Vec_IntPop(vTemp) );
492 Vec_WecSortByLastInt( p, 0 );
493 Counter = 0;
494 Vec_IntPush( vIndex, 0 );
495 Vec_WecForEachLevel( p, vTemp, i )
496 if ( Vec_IntPop(vTemp) != Counter )
497 Vec_IntPush( vIndex, i ), Counter++;
498 Vec_IntPush( vIndex, Vec_WecSize(p) );
499 assert( Vec_WecSize(p) == 0 || Vec_IntSize(vIndex) == nGroups + 1 );
500 return vIndex;
501}
502Vec_Wec_t * Gia_ManMulFindXors( Gia_Man_t * p, Vec_Wec_t * vCuts3, int fVerbose )
503{
504 Vec_Wec_t * vXors = Vec_WecAlloc( 10 );
505 Vec_Int_t * vIndex = Gia_ManMulFindGroups( vCuts3, Gia_ManObjNum(p), 0 );
506 Vec_Int_t * vAll = Vec_IntAlloc( 100 );
507 Vec_Bit_t * vSigs[2] = { Vec_BitStart(Gia_ManObjNum(p)), Vec_BitStart(Gia_ManObjNum(p)) };
508 Vec_Int_t * vTemp; int g, c, k, Obj, Start;
509 Vec_IntForEachEntryStop( vIndex, Start, g, Vec_IntSize(vIndex)-1 ) {
510 Vec_WecForEachLevelStartStop( vCuts3, vTemp, c, Start, Vec_IntEntry(vIndex, g+1) )
511 Vec_IntForEachEntry( vTemp, Obj, k )
512 if ( !Vec_BitEntry(vSigs[k==0], Obj) ) {
513 Vec_BitWriteEntry( vSigs[k==0], Obj, 1 );
514 Vec_IntPush( vAll, Obj );
515 }
516 Vec_Int_t * vIns = Vec_WecPushLevel( vXors );
517 Vec_Int_t * vOuts = Vec_WecPushLevel( vXors );
518 Vec_IntForEachEntry( vAll, Obj, k ) {
519 if ( Vec_BitEntry(vSigs[0], Obj) && !Vec_BitEntry(vSigs[1], Obj) )
520 Vec_IntPush( vIns, Obj );
521 if ( !Vec_BitEntry(vSigs[0], Obj) && Vec_BitEntry(vSigs[1], Obj) )
522 Vec_IntPush( vOuts, Obj );
523 Vec_BitWriteEntry( vSigs[0], Obj, 0 );
524 Vec_BitWriteEntry( vSigs[1], Obj, 0 );
525 }
526 Vec_IntClear( vAll );
527 }
528 return vXors;
529}
530Vec_Int_t * Gia_ManFindMulDetectOrder( Vec_Wec_t * vAll, int iStart, int iStop )
531{
532 Vec_Int_t * vOrder = Vec_IntAlloc( iStop - iStart );
533 Vec_Int_t * vUsed = Vec_IntStart( iStop ), * vTemp;
534 int i, nMatches = 0, iNext = -1;
535 Vec_WecForEachLevelStartStop( vAll, vTemp, i, iStart, iStop )
536 if ( Vec_IntSize(vTemp) == 2 )
537 nMatches++, iNext = i;
538 if ( nMatches == 1 ) {
539 while ( Vec_IntSize(vOrder) < iStop - iStart ) {
540 Vec_IntPush( vOrder, iNext );
541 Vec_IntWriteEntry( vUsed, iNext, 1 );
542 nMatches = 0;
543 Vec_WecForEachLevelStartStop( vAll, vTemp, i, iStart, iStop ) {
544 if ( Vec_IntEntry(vUsed, i) )
545 continue;
546 Vec_Int_t * vLast = Vec_WecEntry(vAll, Vec_IntEntryLast(vOrder));
547 if ( Gia_ManMulFindOverlap(vTemp, vLast) == Vec_IntSize(vLast) && Vec_IntSize(vTemp) == Vec_IntSize(vLast) + 2 )
548 nMatches++, iNext = i;
549 }
550 if ( nMatches != 1 )
551 break;
552 }
553 }
554 Vec_IntFree( vUsed );
555 if ( Vec_IntSize(vOrder) == 0 )
556 Vec_IntFreeP( &vOrder );
557 return vOrder;
558}
560{
561 Vec_Wec_t * vRes = Vec_WecAlloc( 10 );
562 Vec_Wec_t * vAll = Vec_WecAlloc( Vec_WecSize(vXors)/2 );
563 Gia_Obj_t * pObj; Vec_Int_t * vIns, * vOuts, * vTemp, * vIndex, * vOrder; int i, k, g, Start, Entry, Entry0, Entry1;
565 Vec_WecForEachLevelDouble( vXors, vIns, vOuts, i ) {
566 vTemp = Vec_WecPushLevel( vAll );
567 Gia_ManForEachObjVec( vIns, p, pObj, k )
568 if ( Gia_ObjIsAnd(pObj)
569 && !Gia_ObjFaninC0(pObj) && Gia_ObjRefNum(p, Gia_ObjFanin0(pObj)) >= 4
570 && !Gia_ObjFaninC1(pObj) && Gia_ObjRefNum(p, Gia_ObjFanin1(pObj)) >= 4 )
571 Vec_IntPushTwo( vTemp, Gia_ObjFaninId0p(p, pObj), Gia_ObjFaninId1p(p, pObj) );
572 if ( Vec_IntSize(vTemp) == 0 )
573 Vec_WecShrink(vAll, Vec_WecSize(vAll)-1);
574 }
575 vIndex = Gia_ManMulFindGroups( vAll, Gia_ManObjNum(p), 0 );
576 Vec_IntForEachEntryStop( vIndex, Start, g, Vec_IntSize(vIndex)-1 ) {
577 vOrder = Gia_ManFindMulDetectOrder( vAll, Start, Vec_IntEntry(vIndex, g+1) );
578 if ( vOrder == NULL )
579 continue;
580 Vec_Int_t * vIn0 = Vec_WecPushLevel( vRes );
581 Vec_Int_t * vIn1 = Vec_WecPushLevel( vRes );
582 Vec_Int_t * vOut = Vec_WecPushLevel( vRes );
583 vTemp = Vec_WecEntry( vAll, Vec_IntEntry(vOrder, 0) );
584 assert( Vec_IntSize(vTemp) == 2 );
585 Vec_IntPush( vIn0, Vec_IntEntry(vTemp, 0) );
586 Vec_IntPush( vIn1, Vec_IntEntry(vTemp, 1) );
587 Vec_IntForEachEntryStart( vOrder, Entry, i, 1 ) {
588 vTemp = Vec_WecEntry( vAll, Entry );
589 Vec_IntForEachEntryDouble( vTemp, Entry0, Entry1, k ) {
590 if ( Vec_IntFind(vIn0, Entry0) >= 0 && Vec_IntFind(vIn1, Entry1) == -1 )
591 Vec_IntPush( vIn1, Entry1 );
592 else if ( Vec_IntFind(vIn0, Entry0) == -1 && Vec_IntFind(vIn1, Entry1) >= 0 )
593 Vec_IntPush( vIn0, Entry0 );
594 else
595 assert( (Vec_IntFind(vIn0, Entry0) >= 0 && Vec_IntFind(vIn1, Entry1) >= 0) ||
596 (Vec_IntFind(vIn0, Entry1) >= 0 && Vec_IntFind(vIn1, Entry0) >= 0) );
597 }
598 }
599 Vec_IntReverseOrder( vIn0 );
600 Vec_IntReverseOrder( vIn1 );
601 vOut = NULL;
602 }
603 Vec_IntFree( vIndex );
604 Vec_WecFree( vAll );
605 return vRes;
606}
607Vec_Wec_t * Gia_ManMulFindBInputs( Gia_Man_t * p, Vec_Wec_t * vCuts4, Vec_Wec_t * vCuts5, int fVerbose )
608{
609 Vec_Wec_t * vRes = Vec_WecAlloc( 10 ); Vec_Int_t * vTemp; int g, c, k, Obj, Start;
610 Vec_Int_t * vIndex = Gia_ManMulFindGroups( vCuts4, Gia_ManObjNum(p), 0 );
611 Vec_IntForEachEntryStop( vIndex, Start, g, Vec_IntSize(vIndex)-1 ) {
612 Vec_Int_t * vAll = Vec_IntAlloc ( 100 );
613 Vec_WecForEachLevelStartStop( vCuts4, vTemp, c, Start, Vec_IntEntry(vIndex, g+1) )
614 Vec_IntForEachEntryStart( vTemp, Obj, k, 1 )
615 Vec_IntPush( vAll, Obj );
616 Vec_IntUniqify( vAll );
617 int GroupSize = Vec_IntEntry(vIndex, g+1) - Start;
618 Vec_Int_t * vCnt = Vec_IntStart( Vec_IntSize(vAll) );
619 Vec_WecForEachLevelStartStop( vCuts4, vTemp, c, Start, Vec_IntEntry(vIndex, g+1) )
620 Vec_IntForEachEntryStart( vTemp, Obj, k, 1 )
621 Vec_IntAddToEntry( vCnt, Vec_IntFind(vAll, Obj), 1 );
622 if ( Vec_IntCountEntry(vCnt, 1) != 2 || Vec_IntCountEntry(vCnt, 2) != GroupSize-1 || Vec_IntCountEntry(vCnt, GroupSize) != 2 ) {
623 printf( "Detection of group %d failed.\n", g );
624 continue;
625 }
626 Vec_Int_t * vIn1 = Vec_WecPushLevel( vRes );
627 Vec_Int_t * vIn2 = Vec_WecPushLevel( vRes );
628 Vec_Int_t * vOut = Vec_WecPushLevel( vRes );
629 Vec_IntForEachEntry( vAll, Obj, k )
630 if ( Vec_IntEntry(vCnt, k) <= 2 )
631 Vec_IntPush( vIn1, Obj );
632 else
633 Vec_IntPush( vIn2, Obj );
634 Vec_IntSort( vIn1, 0 );
635 Vec_IntSort( vIn2, 0 );
636 // TODO: check chain in[i] -> in[i+1]
637 Vec_WecForEachLevel( vCuts5, vTemp, c ) {
638 Vec_IntShift( vTemp, 1 );
639 if ( Gia_ManMulFindOverlap(vTemp, vIn1) >= 2 )
640 Vec_IntForEachEntryStart( vTemp, Obj, k, 1 )
641 if ( Vec_IntFind(vIn1, Obj) == -1 ) {
642 Vec_IntPushUnique(vIn2, Obj);
643 }
644 Vec_IntShift( vTemp, -1 );
645 }
646 Vec_IntSort( vIn2, 0 );
647 vOut = NULL;
648 }
649 Vec_IntFree( vIndex );
650 return vRes;
651}
652
665{
666 Vec_Int_t * vTfo = Vec_IntAlloc( 100 );
667 Gia_Obj_t * pObj; int i, Obj;
669 Vec_IntForEachEntry( vIn0, Obj, i )
670 Gia_ObjSetTravIdCurrentId( p, Obj );
671 Vec_IntForEachEntry( vIn1, Obj, i )
672 Gia_ObjSetTravIdCurrentId( p, Obj );
673 Gia_ManForEachAnd( p, pObj, i ) {
674 if ( Gia_ObjIsTravIdCurrentId(p, i) )
675 continue;
676 if ( Gia_ObjIsTravIdCurrentId(p, Gia_ObjFaninId0(pObj, i)) && Gia_ObjIsTravIdCurrentId(p, Gia_ObjFaninId1(pObj, i)) )
677 Gia_ObjSetTravIdCurrentId( p, i ), Vec_IntPush( vTfo, i );
678 }
679 return vTfo;
680}
682{
683 Vec_Wrd_t * vRes = Vec_WrdAlloc( Vec_IntSize(vTfo) );
684 Vec_Wrd_t * vSims = Vec_WrdStart( Gia_ManObjNum(p) );
685 Gia_Obj_t * pObj; int i, Obj;
686 Vec_IntForEachEntry( vIn0, Obj, i )
687 Vec_WrdWriteEntry( vSims, Obj, Vec_WrdEntry(vSim0, i) );
688 Vec_IntForEachEntry( vIn1, Obj, i )
689 Vec_WrdWriteEntry( vSims, Obj, Vec_WrdEntry(vSim1, i) );
690 Gia_ManForEachObjVec( vTfo, p, pObj, i ) {
691 word Sim0 = Vec_WrdEntry(vSims, Gia_ObjFaninId0p(p, pObj) );
692 word Sim1 = Vec_WrdEntry(vSims, Gia_ObjFaninId1p(p, pObj) );
693 Vec_WrdWriteEntry( vSims, Gia_ObjId(p, pObj), (Gia_ObjFaninC0(pObj) ? ~Sim0 : Sim0) & (Gia_ObjFaninC1(pObj) ? ~Sim1 : Sim1) );
694 }
695 Vec_IntForEachEntry( vTfo, Obj, i )
696 Vec_WrdPush( vRes, Vec_WrdEntry(vSims, Obj) );
697 Vec_WrdFree( vSims );
698 return vRes;
699}
700int Gia_ManMulFindGetArg( Vec_Wrd_t * vSim, int i, int fSigned )
701{
702 int w, Res = 0; word Word = 0;
703 Vec_WrdForEachEntry( vSim, Word, w )
704 if ( (Word >> i) & 1 )
705 Res |= (1 << w);
706 if ( fSigned && ((Word >> i) & 1) )
707 Res |= ~0 << Vec_WrdSize(vSim);
708 return Res;
709}
710void Gia_ManMulFindSetArg( Vec_Wrd_t * vSim, int i, int iNum )
711{
712 int w; word * pWords = Vec_WrdArray(vSim);
713 for ( w = 0; w < Vec_WrdSize(vSim); w++ )
714 if ( (iNum >> w) & 1 )
715 pWords[w] |= (word)1 << i;
716}
717Vec_Wrd_t * Gia_ManMulFindSim( Vec_Wrd_t * vSim0, Vec_Wrd_t * vSim1, int fSigned )
718{
719 assert( Vec_WrdSize(vSim0) + Vec_WrdSize(vSim1) <= 30 );
720 Vec_Wrd_t * vRes = Vec_WrdStart( Vec_WrdSize(vSim0) + Vec_WrdSize(vSim1) );
721 for ( int i = 0; i < 64; i++ )
722 {
723 int a = Gia_ManMulFindGetArg( vSim0, i, fSigned );
724 int b = Gia_ManMulFindGetArg( vSim1, i, fSigned );
725 Gia_ManMulFindSetArg( vRes, i, a * b );
726 }
727 return vRes;
728}
729void Gia_ManMulFindOutputs( Gia_Man_t * p, Vec_Wec_t * vTerms, int fVerbose )
730{
731 Abc_Random(1);
732 for ( int m = 0; m < Vec_WecSize(vTerms)/3; m++ ) {
733 Vec_Int_t * vIn0 = Vec_WecEntry(vTerms, 3*m+0);
734 Vec_Int_t * vIn1 = Vec_WecEntry(vTerms, 3*m+1);
735 Vec_Int_t * vOut = Vec_WecEntry(vTerms, 3*m+2);
736 Vec_Wrd_t * vSim0 = Vec_WrdStartRandom( Vec_IntSize(vIn0) );
737 Vec_Wrd_t * vSim1 = Vec_WrdStartRandom( Vec_IntSize(vIn1) );
738 Vec_Wrd_t * vSimU = Gia_ManMulFindSim( vSim0, vSim1, 0 );
739 Vec_Wrd_t * vSimS = Gia_ManMulFindSim( vSim0, vSim1, 1 );
740 Vec_Int_t * vTfo = Gia_ManMulFindTfo( p, vIn0, vIn1 );
741 Vec_Wrd_t * vSims = Gia_ManMulFindSimCone( p, vIn0, vIn1, vSim0, vSim1, vTfo );
742 Vec_Int_t * vOutU = Vec_IntAlloc( 100 );
743 Vec_Int_t * vOutS = Vec_IntAlloc( 100 );
744 word Word; int w, iPlace;
745 Vec_WrdForEachEntry( vSimU, Word, w ) {
746 if ( (iPlace = Vec_WrdFind(vSims, Word)) >= 0 )
747 Vec_IntPush( vOutU, Abc_Var2Lit(Vec_IntEntry(vTfo, iPlace), 0) );
748 else if ( (iPlace = Vec_WrdFind(vSims, ~Word)) >= 0 )
749 Vec_IntPush( vOutU, Abc_Var2Lit(Vec_IntEntry(vTfo, iPlace), 1) );
750 else
751 Vec_IntPush( vOutU, -1 );
752 }
753 Vec_WrdForEachEntry( vSimS, Word, w ) {
754 if ( (iPlace = Vec_WrdFind(vSims, Word)) >= 0 )
755 Vec_IntPush( vOutS, Abc_Var2Lit(Vec_IntEntry(vTfo, iPlace), 0) );
756 else if ( (iPlace = Vec_WrdFind(vSims, ~Word)) >= 0 )
757 Vec_IntPush( vOutS, Abc_Var2Lit(Vec_IntEntry(vTfo, iPlace), 1) );
758 else
759 Vec_IntPush( vOutS, -1 );
760 }
761 assert( Vec_IntSize(vOut) == 0 );
762 if ( Vec_IntCountEntry(vOutU, -1) < Vec_IntSize(vOutU) ||
763 Vec_IntCountEntry(vOutS, -1) < Vec_IntSize(vOutS) )
764 {
765 if ( Vec_IntCountEntry(vOutU, -1) < Vec_IntCountEntry(vOutS, -1) )
766 Vec_IntAppend( vOut, vOutU ), Vec_IntPush(vOut, 0);
767 else
768 Vec_IntAppend( vOut, vOutS ), Vec_IntPush(vOut, 1);
769 }
770 else
771 {
772 Vec_IntClear(vIn0);
773 Vec_IntClear(vIn1);
774 }
775 Vec_WrdFree( vSim0 );
776 Vec_WrdFree( vSim1 );
777 Vec_WrdFree( vSimU );
778 Vec_WrdFree( vSimS );
779 Vec_WrdFree( vSims );
780 Vec_IntFree( vTfo );
781 Vec_IntFree( vOutU );
782 Vec_IntFree( vOutS );
783 }
784 Vec_WecRemoveEmpty( vTerms );
785}
786
798Vec_Ptr_t * Gia_ManMulFindCuts( Gia_Man_t * p, int nCutNum, int fVerbose )
799{
800 extern Vec_Mem_t * Dau_CollectNpnFunctions( word * p, int nVars, int fVerbose );
801 extern Vec_Ptr_t * Gia_ManMatchCutsArray( Vec_Ptr_t * vTtMems, Gia_Man_t * pGia, int nCutSize, int nCutNum, int fVerbose );
802 word pTruths[3] = { ABC_CONST(0x6969696969696969), ABC_CONST(0x35C035C035C035C0), ABC_CONST(0xF335ACC0F335ACC0) };
803 Vec_Ptr_t * vTtMems = Vec_PtrAlloc( 3 ); Vec_Mem_t * vTtMem; int i;
804 for ( i = 0; i < 3; i++ )
805 Vec_PtrPush( vTtMems, Dau_CollectNpnFunctions( pTruths+i, i+3, fVerbose ) );
806 Vec_Ptr_t * vAll = Gia_ManMatchCutsArray( vTtMems, p, 5, nCutNum, fVerbose );
807 Vec_PtrForEachEntry( Vec_Mem_t *, vTtMems, vTtMem, i )
808 Vec_MemHashFree( vTtMem ), Vec_MemFree( vTtMem );
809 Vec_PtrFree( vTtMems );
810 return vAll;
811}
812Vec_Wec_t * Gia_ManMulFindA( Gia_Man_t * p, Vec_Wec_t * vCuts3, int fVerbose )
813{
814 Vec_Wec_t * vXors = Gia_ManMulFindXors( p, vCuts3, fVerbose );
815 Vec_Wec_t * vTerms = Gia_ManMulFindAInputs2( p, fVerbose );
816 if ( Vec_WecSize(vTerms) )
817 Gia_ManMulFindOutputs( p, vTerms, fVerbose );
818 Vec_WecFree( vXors );
819 return vTerms;
820}
821Vec_Wec_t * Gia_ManMulFindB( Gia_Man_t * p, Vec_Wec_t * vCuts4, Vec_Wec_t * vCuts5, int fVerbose )
822{
823 Vec_Wec_t * vTerms = Vec_WecAlloc( 12 );
824 if ( Vec_WecSize(vCuts4) && Vec_WecSize(vCuts5) )
825 vTerms = Gia_ManMulFindBInputs2( p, vCuts4, vCuts5, fVerbose );
826 if ( Vec_WecSize(vTerms) )
827 Gia_ManMulFindOutputs( p, vTerms, fVerbose );
828 return vTerms;
829}
830void Gia_ManMulFindPrintSet( Vec_Int_t * vSet, int fLit, int fSkipLast )
831{
832 int i, Temp, Limit = Vec_IntSize(vSet) - fSkipLast;
833 printf( "{" );
834 Vec_IntForEachEntryStop( vSet, Temp, i, Limit ) {
835 if ( Temp == -1 )
836 printf( "n/a%s", i < Limit-1 ? " ":"" );
837 else
838 printf( "%s%d%s", (fLit & Abc_LitIsCompl(Temp)) ? "~":"", fLit ? Abc_Lit2Var(Temp) : Temp, i < Limit-1 ? " ":"" );
839 }
840 printf( "}" );
841}
842void Gia_ManMulFindPrintOne( Vec_Wec_t * vTerms, int m, int fBooth )
843{
844 Vec_Int_t * vIn0 = Vec_WecEntry(vTerms, 3*m+0);
845 Vec_Int_t * vIn1 = Vec_WecEntry(vTerms, 3*m+1);
846 Vec_Int_t * vOut = Vec_WecEntry(vTerms, 3*m+2);
847 printf( "%sooth %ssigned %d x %d: ", fBooth ? "B" : "Non-b", Vec_IntEntryLast(vOut) ? "" : "un", Vec_IntSize(vIn0), Vec_IntSize(vIn1) );
848 Gia_ManMulFindPrintSet( vIn0, 0, 0 );
849 printf( " * " );
850 Gia_ManMulFindPrintSet( vIn1, 0, 0 );
851 printf( " = " );
852 Gia_ManMulFindPrintSet( vOut, 1, 1 );
853 printf( "\n" );
854}
855void Gia_ManMulFind( Gia_Man_t * p, int nCutNum, int fVerbose )
856{
857 Vec_Ptr_t * vAll = Gia_ManMulFindCuts( p, nCutNum, fVerbose ); int m;
858 Vec_Wec_t * vCuts3 = (Vec_Wec_t *)Vec_PtrEntry(vAll, 0);
859 Vec_Wec_t * vCuts4 = (Vec_Wec_t *)Vec_PtrEntry(vAll, 1);
860 Vec_Wec_t * vCuts5 = (Vec_Wec_t *)Vec_PtrEntry(vAll, 2);
861 Vec_Wec_t * vTermsB = Gia_ManMulFindB( p, vCuts4, vCuts5, fVerbose );
862 Vec_Wec_t * vTermsA = Gia_ManMulFindA( p, vCuts3, fVerbose );
863 printf( "Detected %d booth and %d non-booth multipliers.\n", Vec_WecSize(vTermsB)/3, Vec_WecSize(vTermsA)/3 );
864 for ( m = 0; m < Vec_WecSize(vTermsA)/3; m++ )
865 Gia_ManMulFindPrintOne( vTermsA, m, 0 );
866 for ( m = 0; m < Vec_WecSize(vTermsB)/3; m++ )
867 Gia_ManMulFindPrintOne( vTermsB, m, 1 );
868 Vec_WecFree( vTermsB );
869 Vec_WecFree( vTermsA );
870 Vec_WecFree( vCuts3 );
871 Vec_WecFree( vCuts4 );
872 Vec_WecFree( vCuts5 );
873 Vec_PtrFree( vAll );
874}
875
879
881
#define ABC_INFINITY
MACRO DEFINITIONS ///.
Definition abc_global.h:250
unsigned Abc_Random(int fReset)
Definition utilSort.c:1004
#define ABC_CONST(number)
PARAMETERS ///.
Definition abc_global.h:240
#define ABC_NAMESPACE_IMPL_START
#define ABC_NAMESPACE_IMPL_END
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition bblif.c:37
Vec_Mem_t * Dau_CollectNpnFunctions(word *p, int nVars, int fVerbose)
Definition dauNpn.c:814
Cube * p
Definition exorList.c:222
Vec_Ptr_t * Gia_ManMatchCutsArray(Vec_Ptr_t *vTtMems, Gia_Man_t *pGia, int nCutSize, int nCutNum, int fVerbose)
Definition giaCut.c:1101
Vec_Wec_t * Gia_ManMulFindBInputs(Gia_Man_t *p, Vec_Wec_t *vCuts4, Vec_Wec_t *vCuts5, int fVerbose)
Definition giaMulFind.c:607
Vec_Int_t * Gia_ManMulFindGroups(Vec_Wec_t *p, int nObjs, int fUseMap)
Definition giaMulFind.c:460
Vec_Wec_t * Gia_ManMulFindA(Gia_Man_t *p, Vec_Wec_t *vCuts3, int fVerbose)
Definition giaMulFind.c:812
void Gia_ManMulFindOutputs(Gia_Man_t *p, Vec_Wec_t *vTerms, int fVerbose)
Definition giaMulFind.c:729
void Gia_ManMulFindArg2(Vec_Wec_t *vCuts5, Vec_Int_t *vSet, Vec_Int_t *vArg2, int Entry0, int Entry1)
Definition giaMulFind.c:354
int Gia_ManMulFindGetArg(Vec_Wrd_t *vSim, int i, int fSigned)
Definition giaMulFind.c:700
Vec_Wec_t * Gia_ManMulFindXors(Gia_Man_t *p, Vec_Wec_t *vCuts3, int fVerbose)
Definition giaMulFind.c:502
void Gia_ManMulFindPrintOne(Vec_Wec_t *vTerms, int m, int fBooth)
Definition giaMulFind.c:842
int Gia_ManMulFindGetOverlap(Vec_Int_t *p1, Vec_Int_t *p2)
Definition giaMulFind.c:100
ABC_NAMESPACE_IMPL_START void Gia_ManMulFindXors2_rec(Gia_Man_t *p, Gia_Obj_t *pObj, Vec_Int_t *vXor)
DECLARATIONS ///.
Definition giaMulFind.c:45
void Gia_ManMulFind(Gia_Man_t *p, int nCutNum, int fVerbose)
Definition giaMulFind.c:855
void Gia_ManMulFindAssignGroup(Vec_Int_t *vTemp, int iGroup, Vec_Int_t *vMap)
Definition giaMulFind.c:451
int Gia_ManMulFindMaxOverlap(Vec_Wec_t *vXors, Vec_Int_t *vUsed, Vec_Int_t *vFound)
Definition giaMulFind.c:118
int Gia_ManMulFindOverlap(Vec_Int_t *p1, Vec_Int_t *p2)
Definition giaMulFind.c:442
Vec_Wec_t * Gia_ManMulFindXors2(Gia_Man_t *p)
Definition giaMulFind.c:66
Vec_Wec_t * Gia_ManMulFindBInputs2(Gia_Man_t *p, Vec_Wec_t *vCuts4, Vec_Wec_t *vCuts5, int fVerbose)
Definition giaMulFind.c:385
int Gia_ManMulFindNextEntryCount(Vec_Int_t *vCounts, int Entry0)
Definition giaMulFind.c:312
Vec_Wec_t * Gia_ManMulFindAInputs2(Gia_Man_t *p, int fVerbose)
Definition giaMulFind.c:218
int Gia_ManMulFindNextEntry(Vec_Wec_t *vCuts4, Vec_Int_t *vSet, int Entry)
Definition giaMulFind.c:277
void Gia_ManMulFindPrintSet(Vec_Int_t *vSet, int fLit, int fSkipLast)
Definition giaMulFind.c:830
Vec_Wec_t * Gia_ManMulFindAInputs(Gia_Man_t *p, Vec_Wec_t *vXors, int fVerbose)
Definition giaMulFind.c:559
Vec_Int_t * Gia_ManMulFindCounts(Vec_Wec_t *vCuts4, Vec_Int_t *vSet)
Definition giaMulFind.c:266
Vec_Wrd_t * Gia_ManMulFindSim(Vec_Wrd_t *vSim0, Vec_Wrd_t *vSim1, int fSigned)
Definition giaMulFind.c:717
int Gia_ManMulFindGetOverlap2(Vec_Int_t *p1, Vec_Int_t *p2)
Definition giaMulFind.c:109
Vec_Ptr_t * Gia_ManMulFindCuts(Gia_Man_t *p, int nCutNum, int fVerbose)
Definition giaMulFind.c:798
Vec_Int_t * Gia_ManMulFindTfo(Gia_Man_t *p, Vec_Int_t *vIn0, Vec_Int_t *vIn1)
Definition giaMulFind.c:664
Vec_Wec_t * Gia_ManMulFindSets(Gia_Man_t *p, Vec_Wec_t *vXors)
Definition giaMulFind.c:126
Vec_Wec_t * Gia_ManMulFindB(Gia_Man_t *p, Vec_Wec_t *vCuts4, Vec_Wec_t *vCuts5, int fVerbose)
Definition giaMulFind.c:821
Vec_Wrd_t * Gia_ManMulFindSimCone(Gia_Man_t *p, Vec_Int_t *vIn0, Vec_Int_t *vIn1, Vec_Wrd_t *vSim0, Vec_Wrd_t *vSim1, Vec_Int_t *vTfo)
Definition giaMulFind.c:681
void Gia_ManMulFindSetArg(Vec_Wrd_t *vSim, int i, int iNum)
Definition giaMulFind.c:710
int Gia_ManMulFindOne(Gia_Man_t *p, Vec_Wec_t *vXors, Vec_Int_t *vSet, Vec_Int_t *vMap, Vec_Int_t *vA, Vec_Int_t *vB, int fVerbose)
Definition giaMulFind.c:150
int Gia_ManMulFindMaxSize(Vec_Wec_t *vXors, Vec_Int_t *vUsed)
Definition giaMulFind.c:92
Vec_Int_t * Gia_ManFindMulDetectOrder(Vec_Wec_t *vAll, int iStart, int iStop)
Definition giaMulFind.c:530
void Gia_ManMulFindAddEntry1(Vec_Int_t *vPairs, int Obj)
Definition giaMulFind.c:255
void Gia_ManMulFindAddEntry(Vec_Int_t *vPairs, int Obj0, int Obj1)
Definition giaMulFind.c:374
void Gia_ManMulFindArg1(Vec_Wec_t *vCuts4, Vec_Int_t *vSet, Vec_Int_t *vArg1)
Definition giaMulFind.c:297
int Gia_ManMulFindNextEntry2(Vec_Wec_t *vCuts4, Vec_Int_t *vSet, int Entry, Vec_Int_t *vCounts, int *pEntry0, int *pEntry1)
Definition giaMulFind.c:320
#define Gia_ManForEachAnd(p, pObj, i)
Definition gia.h:1214
struct Gia_Obj_t_ Gia_Obj_t
Definition gia.h:76
struct Gia_Man_t_ Gia_Man_t
Definition gia.h:96
#define Gia_ManForEachObjVec(vVec, p, pObj, i)
Definition gia.h:1194
int Gia_ObjRecognizeExor(Gia_Obj_t *pObj, Gia_Obj_t **ppFan0, Gia_Obj_t **ppFan1)
Definition giaUtil.c:1018
void Gia_ManCreateRefs(Gia_Man_t *p)
Definition giaUtil.c:779
void Gia_ManIncrementTravId(Gia_Man_t *p)
Definition giaUtil.c:190
void Gia_ManCleanMark01(Gia_Man_t *p)
Definition giaUtil.c:218
unsigned __int64 word
DECLARATIONS ///.
Definition kitPerm.c:36
unsigned fMark1
Definition gia.h:86
unsigned fMark0
Definition gia.h:81
typedefABC_NAMESPACE_IMPL_START struct Vec_Mem_t_ Vec_Mem_t
DECLARATIONS ///.
Definition utilMem.c:35
#define assert(ex)
Definition util_old.h:213
typedefABC_NAMESPACE_HEADER_START struct Vec_Bit_t_ Vec_Bit_t
INCLUDES ///.
Definition vecBit.h:42
#define Vec_IntForEachEntryDouble(vVec, Entry1, Entry2, i)
Definition vecInt.h:72
#define Vec_IntForEachEntry(vVec, Entry, i)
MACRO DEFINITIONS ///.
Definition vecInt.h:54
#define Vec_IntForEachEntryStop(vVec, Entry, i, Stop)
Definition vecInt.h:58
#define Vec_IntForEachEntryStart(vVec, Entry, i, Start)
Definition vecInt.h:56
#define Vec_IntForEachEntryTriple(vVec, Entry1, Entry2, Entry3, i)
Definition vecInt.h:76
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition vecPtr.h:42
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.
Definition vecPtr.h:55
#define Vec_WecForEachLevelDouble(vGlob, vVec1, vVec2, i)
Definition vecWec.h:71
#define Vec_WecForEachLevel(vGlob, vVec, i)
MACRO DEFINITIONS ///.
Definition vecWec.h:55
#define Vec_WecForEachLevelStartStop(vGlob, vVec, i, LevelStart, LevelStop)
Definition vecWec.h:63
typedefABC_NAMESPACE_HEADER_START struct Vec_Wec_t_ Vec_Wec_t
INCLUDES ///.
Definition vecWec.h:42
#define Vec_WrdForEachEntry(vVec, Entry, i)
MACRO DEFINITIONS ///.
Definition vecWrd.h:54
typedefABC_NAMESPACE_HEADER_START struct Vec_Wrd_t_ Vec_Wrd_t
INCLUDES ///.
Definition vecWrd.h:42