ABC: A System for Sequential Synthesis and Verification
 
Loading...
Searching...
No Matches
giaHash.c
Go to the documentation of this file.
1
20
21#include "gia.h"
22
24
25
29
33
45static inline int Gia_ManHashOne( int iLit0, int iLit1, int iLitC, int TableSize )
46{
47 unsigned Key = iLitC * 2011;
48 Key += Abc_Lit2Var(iLit0) * 7937;
49 Key += Abc_Lit2Var(iLit1) * 2971;
50 Key += Abc_LitIsCompl(iLit0) * 911;
51 Key += Abc_LitIsCompl(iLit1) * 353;
52 return (int)(Key % TableSize);
53}
54static inline int * Gia_ManHashFind( Gia_Man_t * p, int iLit0, int iLit1, int iLitC )
55{
56 int iThis, * pPlace = Vec_IntEntryP( &p->vHTable, Gia_ManHashOne( iLit0, iLit1, iLitC, Vec_IntSize(&p->vHTable) ) );
57 assert( Vec_IntSize(&p->vHash) == Gia_ManObjNum(p) );
58 assert( p->pMuxes || iLit0 < iLit1 );
59 assert( iLit0 < iLit1 || (!Abc_LitIsCompl(iLit0) && !Abc_LitIsCompl(iLit1)) );
60 assert( iLitC == -1 || !Abc_LitIsCompl(iLit1) );
61 for ( ; (iThis = *pPlace); pPlace = Vec_IntEntryP(&p->vHash, iThis) )
62 {
63 Gia_Obj_t * pThis = Gia_ManObj( p, iThis );
64 if ( Gia_ObjFaninLit0(pThis, iThis) == iLit0 && Gia_ObjFaninLit1(pThis, iThis) == iLit1 && (p->pMuxes == NULL || Gia_ObjFaninLit2p(p, pThis) == iLitC) )
65 break;
66 }
67 return pPlace;
68}
69
81int Gia_ManHashLookupInt( Gia_Man_t * p, int iLit0, int iLit1 )
82{
83 if ( iLit0 > iLit1 )
84 iLit0 ^= iLit1, iLit1 ^= iLit0, iLit0 ^= iLit1;
85 return Abc_Var2Lit( *Gia_ManHashFind( p, iLit0, iLit1, -1 ), 0 );
86}
88{
89 int iLit0 = Gia_ObjToLit( p, p0 );
90 int iLit1 = Gia_ObjToLit( p, p1 );
91 return Gia_ManHashLookupInt( p, iLit0, iLit1 );
92}
93
106{
107 assert( Vec_IntSize(&p->vHTable) == 0 );
108 Vec_IntFill( &p->vHTable, Abc_PrimeCudd( Gia_ManAndNum(p) ? Gia_ManAndNum(p) + 1000 : p->nObjsAlloc ), 0 );
109 Vec_IntGrow( &p->vHash, Abc_MaxInt(Vec_IntSize(&p->vHTable), Gia_ManObjNum(p)) );
110 Vec_IntFill( &p->vHash, Gia_ManObjNum(p), 0 );
111//printf( "Alloced table with %d entries.\n", Vec_IntSize(&p->vHTable) );
112}
113
126{
127 Gia_Obj_t * pObj;
128 int * pPlace, i;
130 Gia_ManForEachAnd( p, pObj, i )
131 {
132 pPlace = Gia_ManHashFind( p, Gia_ObjFaninLit0(pObj, i), Gia_ObjFaninLit1(pObj, i), Gia_ObjFaninLit2(p, i) );
133 assert( *pPlace == 0 );
134 *pPlace = i;
135 }
136}
137
150{
151 Vec_IntErase( &p->vHTable );
152 Vec_IntErase( &p->vHash );
153}
154
167{
168 int i, iThis, iNext, Counter, Counter2, * pPlace;
169 Vec_Int_t vOld = p->vHTable;
170 assert( Vec_IntSize(&vOld) > 0 );
171 // replace the table
172 Vec_IntZero( &p->vHTable );
173 Vec_IntFill( &p->vHTable, Abc_PrimeCudd( 2 * Gia_ManAndNum(p) ), 0 );
174 // rehash the entries from the old table
175 Counter = 0;
176 Vec_IntForEachEntry( &vOld, iThis, i )
177 for ( iNext = Vec_IntEntry(&p->vHash, iThis);
178 iThis; iThis = iNext,
179 iNext = Vec_IntEntry(&p->vHash, iThis) )
180 {
181 Gia_Obj_t * pThis0 = Gia_ManObj( p, iThis );
182 Vec_IntWriteEntry( &p->vHash, iThis, 0 );
183 pPlace = Gia_ManHashFind( p, Gia_ObjFaninLit0(pThis0, iThis), Gia_ObjFaninLit1(pThis0, iThis), Gia_ObjFaninLit2p(p, pThis0) );
184 assert( *pPlace == 0 ); // should not be there
185 *pPlace = iThis;
186 assert( *pPlace != 0 );
187 Counter++;
188 }
189 Counter2 = Gia_ManAndNum(p) - Gia_ManBufNum(p);
190 assert( Counter == Counter2 );
191// if ( p->fVerbose )
192// printf( "Resizing GIA hash table: %d -> %d.\n", Vec_IntSize(&vOld), Vec_IntSize(&p->vHTable) );
193 Vec_IntErase( &vOld );
194}
195
208{
209 int iEntry;
210 int i, Counter, Limit;
211 printf( "Table size = %d. Entries = %d. ", Vec_IntSize(&p->vHTable), Gia_ManAndNum(p) );
212 printf( "Hits = %d. Misses = %d.\n", (int)p->nHashHit, (int)p->nHashMiss );
213 Limit = Abc_MinInt( 1000, Vec_IntSize(&p->vHTable) );
214 for ( i = 0; i < Limit; i++ )
215 {
216 Counter = 0;
217 for ( iEntry = Vec_IntEntry(&p->vHTable, i);
218 iEntry;
219 iEntry = iEntry? Vec_IntEntry(&p->vHash, iEntry) : 0 )
220 Counter++;
221 if ( Counter )
222 printf( "%d ", Counter );
223 }
224 printf( "\n" );
225}
226
241static inline Gia_Obj_t * Gia_ObjRecognizeMuxTwo( Gia_Obj_t * pNode0, Gia_Obj_t * pNode1, Gia_Obj_t ** ppNodeT, Gia_Obj_t ** ppNodeE )
242{
243 assert( !Gia_IsComplement(pNode0) );
244 assert( !Gia_IsComplement(pNode1) );
245 // find the control variable
246 if ( Gia_ObjFanin1(pNode0) == Gia_ObjFanin1(pNode1) && (Gia_ObjFaninC1(pNode0) ^ Gia_ObjFaninC1(pNode1)) )
247 {
248// if ( FrGia_IsComplement(pNode1->p2) )
249 if ( Gia_ObjFaninC1(pNode0) )
250 { // pNode2->p2 is positive phase of C
251 *ppNodeT = Gia_Not(Gia_ObjChild0(pNode1));//pNode2->p1);
252 *ppNodeE = Gia_Not(Gia_ObjChild0(pNode0));//pNode1->p1);
253 return Gia_ObjChild1(pNode1);//pNode2->p2;
254 }
255 else
256 { // pNode1->p2 is positive phase of C
257 *ppNodeT = Gia_Not(Gia_ObjChild0(pNode0));//pNode1->p1);
258 *ppNodeE = Gia_Not(Gia_ObjChild0(pNode1));//pNode2->p1);
259 return Gia_ObjChild1(pNode0);//pNode1->p2;
260 }
261 }
262 else if ( Gia_ObjFanin0(pNode0) == Gia_ObjFanin0(pNode1) && (Gia_ObjFaninC0(pNode0) ^ Gia_ObjFaninC0(pNode1)) )
263 {
264// if ( FrGia_IsComplement(pNode1->p1) )
265 if ( Gia_ObjFaninC0(pNode0) )
266 { // pNode2->p1 is positive phase of C
267 *ppNodeT = Gia_Not(Gia_ObjChild1(pNode1));//pNode2->p2);
268 *ppNodeE = Gia_Not(Gia_ObjChild1(pNode0));//pNode1->p2);
269 return Gia_ObjChild0(pNode1);//pNode2->p1;
270 }
271 else
272 { // pNode1->p1 is positive phase of C
273 *ppNodeT = Gia_Not(Gia_ObjChild1(pNode0));//pNode1->p2);
274 *ppNodeE = Gia_Not(Gia_ObjChild1(pNode1));//pNode2->p2);
275 return Gia_ObjChild0(pNode0);//pNode1->p1;
276 }
277 }
278 else if ( Gia_ObjFanin0(pNode0) == Gia_ObjFanin1(pNode1) && (Gia_ObjFaninC0(pNode0) ^ Gia_ObjFaninC1(pNode1)) )
279 {
280// if ( FrGia_IsComplement(pNode1->p1) )
281 if ( Gia_ObjFaninC0(pNode0) )
282 { // pNode2->p2 is positive phase of C
283 *ppNodeT = Gia_Not(Gia_ObjChild0(pNode1));//pNode2->p1);
284 *ppNodeE = Gia_Not(Gia_ObjChild1(pNode0));//pNode1->p2);
285 return Gia_ObjChild1(pNode1);//pNode2->p2;
286 }
287 else
288 { // pNode1->p1 is positive phase of C
289 *ppNodeT = Gia_Not(Gia_ObjChild1(pNode0));//pNode1->p2);
290 *ppNodeE = Gia_Not(Gia_ObjChild0(pNode1));//pNode2->p1);
291 return Gia_ObjChild0(pNode0);//pNode1->p1;
292 }
293 }
294 else if ( Gia_ObjFanin1(pNode0) == Gia_ObjFanin0(pNode1) && (Gia_ObjFaninC1(pNode0) ^ Gia_ObjFaninC0(pNode1)) )
295 {
296// if ( FrGia_IsComplement(pNode1->p2) )
297 if ( Gia_ObjFaninC1(pNode0) )
298 { // pNode2->p1 is positive phase of C
299 *ppNodeT = Gia_Not(Gia_ObjChild1(pNode1));//pNode2->p2);
300 *ppNodeE = Gia_Not(Gia_ObjChild0(pNode0));//pNode1->p1);
301 return Gia_ObjChild0(pNode1);//pNode2->p1;
302 }
303 else
304 { // pNode1->p2 is positive phase of C
305 *ppNodeT = Gia_Not(Gia_ObjChild0(pNode0));//pNode1->p1);
306 *ppNodeE = Gia_Not(Gia_ObjChild1(pNode1));//pNode2->p2);
307 return Gia_ObjChild1(pNode0);//pNode1->p2;
308 }
309 }
310 assert( 0 ); // this is not MUX
311 return NULL;
312}
313
314
326static inline Gia_Obj_t * Gia_ManHashAndP( Gia_Man_t * p, Gia_Obj_t * p0, Gia_Obj_t * p1 )
327{
328 return Gia_ObjFromLit( p, Gia_ManHashAnd( p, Gia_ObjToLit(p, p0), Gia_ObjToLit(p, p1) ) );
329}
330
342static inline Gia_Obj_t * Gia_ManAddStrash( Gia_Man_t * p, Gia_Obj_t * p0, Gia_Obj_t * p1 )
343{
344 Gia_Obj_t * pNode0, * pNode1, * pFanA, * pFanB, * pFanC, * pFanD;
345 assert( p->fAddStrash );
346 pNode0 = Gia_Regular(p0);
347 pNode1 = Gia_Regular(p1);
348 if ( !Gia_ObjIsAnd(pNode0) && !Gia_ObjIsAnd(pNode1) )
349 return NULL;
350 pFanA = Gia_ObjIsAnd(pNode0) ? Gia_ObjChild0(pNode0) : NULL;
351 pFanB = Gia_ObjIsAnd(pNode0) ? Gia_ObjChild1(pNode0) : NULL;
352 pFanC = Gia_ObjIsAnd(pNode1) ? Gia_ObjChild0(pNode1) : NULL;
353 pFanD = Gia_ObjIsAnd(pNode1) ? Gia_ObjChild1(pNode1) : NULL;
354 if ( Gia_IsComplement(p0) )
355 {
356 if ( pFanA == Gia_Not(p1) || pFanB == Gia_Not(p1) )
357 return p1;
358 if ( pFanB == p1 )
359 return Gia_ManHashAndP( p, Gia_Not(pFanA), pFanB );
360 if ( pFanA == p1 )
361 return Gia_ManHashAndP( p, Gia_Not(pFanB), pFanA );
362 }
363 else
364 {
365 if ( pFanA == Gia_Not(p1) || pFanB == Gia_Not(p1) )
366 return Gia_ManConst0(p);
367 if ( pFanA == p1 || pFanB == p1 )
368 return p0;
369 }
370 if ( Gia_IsComplement(p1) )
371 {
372 if ( pFanC == Gia_Not(p0) || pFanD == Gia_Not(p0) )
373 return p0;
374 if ( pFanD == p0 )
375 return Gia_ManHashAndP( p, Gia_Not(pFanC), pFanD );
376 if ( pFanC == p0 )
377 return Gia_ManHashAndP( p, Gia_Not(pFanD), pFanC );
378 }
379 else
380 {
381 if ( pFanC == Gia_Not(p0) || pFanD == Gia_Not(p0) )
382 return Gia_ManConst0(p);
383 if ( pFanC == p0 || pFanD == p0 )
384 return p1;
385 }
386 if ( !Gia_IsComplement(p0) && !Gia_IsComplement(p1) )
387 {
388 if ( pFanA == Gia_Not(pFanC) || pFanA == Gia_Not(pFanD) || pFanB == Gia_Not(pFanC) || pFanB == Gia_Not(pFanD) )
389 return Gia_ManConst0(p);
390 if ( pFanA == pFanC || pFanB == pFanC )
391 return Gia_ManHashAndP( p, p0, pFanD );
392 if ( pFanB == pFanC || pFanB == pFanD )
393 return Gia_ManHashAndP( p, pFanA, p1 );
394 if ( pFanA == pFanD || pFanB == pFanD )
395 return Gia_ManHashAndP( p, p0, pFanC );
396 if ( pFanA == pFanC || pFanA == pFanD )
397 return Gia_ManHashAndP( p, pFanB, p1 );
398 }
399 else if ( Gia_IsComplement(p0) && !Gia_IsComplement(p1) )
400 {
401 if ( pFanA == Gia_Not(pFanC) || pFanA == Gia_Not(pFanD) || pFanB == Gia_Not(pFanC) || pFanB == Gia_Not(pFanD) )
402 return p1;
403 if ( pFanB == pFanC || pFanB == pFanD )
404 return Gia_ManHashAndP( p, Gia_Not(pFanA), p1 );
405 if ( pFanA == pFanC || pFanA == pFanD )
406 return Gia_ManHashAndP( p, Gia_Not(pFanB), p1 );
407 }
408 else if ( !Gia_IsComplement(p0) && Gia_IsComplement(p1) )
409 {
410 if ( pFanC == Gia_Not(pFanA) || pFanC == Gia_Not(pFanB) || pFanD == Gia_Not(pFanA) || pFanD == Gia_Not(pFanB) )
411 return p0;
412 if ( pFanD == pFanA || pFanD == pFanB )
413 return Gia_ManHashAndP( p, Gia_Not(pFanC), p0 );
414 if ( pFanC == pFanA || pFanC == pFanB )
415 return Gia_ManHashAndP( p, Gia_Not(pFanD), p0 );
416 }
417 else // if ( Gia_IsComplement(p0) && Gia_IsComplement(p1) )
418 {
419 if ( pFanA == pFanD && pFanB == Gia_Not(pFanC) )
420 return Gia_Not(pFanA);
421 if ( pFanB == pFanC && pFanA == Gia_Not(pFanD) )
422 return Gia_Not(pFanB);
423 if ( pFanA == pFanC && pFanB == Gia_Not(pFanD) )
424 return Gia_Not(pFanA);
425 if ( pFanB == pFanD && pFanA == Gia_Not(pFanC) )
426 return Gia_Not(pFanB);
427 }
428/*
429 if ( !Gia_IsComplement(p0) || !Gia_IsComplement(p1) )
430 return NULL;
431 if ( !Gia_ObjIsAnd(pNode0) || !Gia_ObjIsAnd(pNode1) )
432 return NULL;
433 if ( (Gia_ObjFanin0(pNode0) == Gia_ObjFanin0(pNode1) && (Gia_ObjFaninC0(pNode0) ^ Gia_ObjFaninC0(pNode1))) ||
434 (Gia_ObjFanin0(pNode0) == Gia_ObjFanin1(pNode1) && (Gia_ObjFaninC0(pNode0) ^ Gia_ObjFaninC1(pNode1))) ||
435 (Gia_ObjFanin1(pNode0) == Gia_ObjFanin0(pNode1) && (Gia_ObjFaninC1(pNode0) ^ Gia_ObjFaninC0(pNode1))) ||
436 (Gia_ObjFanin1(pNode0) == Gia_ObjFanin1(pNode1) && (Gia_ObjFaninC1(pNode0) ^ Gia_ObjFaninC1(pNode1))) )
437 {
438 Gia_Obj_t * pNodeC, * pNodeT, * pNodeE;
439 int fCompl;
440 pNodeC = Gia_ObjRecognizeMuxTwo( pNode0, pNode1, &pNodeT, &pNodeE );
441 // using non-standard canonical rule for MUX (d0 is not compl; d1 may be compl)
442 if ( (fCompl = Gia_IsComplement(pNodeE)) )
443 {
444 pNodeE = Gia_Not(pNodeE);
445 pNodeT = Gia_Not(pNodeT);
446 }
447 pNode0 = Gia_ManHashAndP( p, Gia_Not(pNodeC), pNodeE );
448 pNode1 = Gia_ManHashAndP( p, pNodeC, pNodeT );
449 p->fAddStrash = 0;
450 pNodeC = Gia_NotCond( Gia_ManHashAndP( p, Gia_Not(pNode0), Gia_Not(pNode1) ), !fCompl );
451 p->fAddStrash = 1;
452 return pNodeC;
453 }
454*/
455 return NULL;
456}
457
469int Gia_ManHashXorReal( Gia_Man_t * p, int iLit0, int iLit1 )
470{
471 int fCompl = 0;
472 assert( p->fAddStrash == 0 );
473 if ( iLit0 < 2 )
474 return iLit0 ? Abc_LitNot(iLit1) : iLit1;
475 if ( iLit1 < 2 )
476 return iLit1 ? Abc_LitNot(iLit0) : iLit0;
477 if ( iLit0 == iLit1 )
478 return 0;
479 if ( iLit0 == Abc_LitNot(iLit1) )
480 return 1;
481 if ( (p->nObjs & 0xFF) == 0 && 2 * Vec_IntSize(&p->vHTable) < Gia_ManAndNum(p) )
483 if ( iLit0 < iLit1 )
484 iLit0 ^= iLit1, iLit1 ^= iLit0, iLit0 ^= iLit1;
485 if ( Abc_LitIsCompl(iLit0) )
486 iLit0 = Abc_LitNot(iLit0), fCompl ^= 1;
487 if ( Abc_LitIsCompl(iLit1) )
488 iLit1 = Abc_LitNot(iLit1), fCompl ^= 1;
489 {
490 int *pPlace = Gia_ManHashFind( p, iLit0, iLit1, -1 );
491 if ( *pPlace )
492 {
493 p->nHashHit++;
494 return Abc_Var2Lit( *pPlace, fCompl );
495 }
496 p->nHashMiss++;
497 if ( Vec_IntSize(&p->vHash) < Vec_IntCap(&p->vHash) )
498 *pPlace = Abc_Lit2Var( Gia_ManAppendXorReal( p, iLit0, iLit1 ) );
499 else
500 {
501 int iNode = Gia_ManAppendXorReal( p, iLit0, iLit1 );
502 pPlace = Gia_ManHashFind( p, iLit0, iLit1, -1 );
503 assert( *pPlace == 0 );
504 *pPlace = Abc_Lit2Var( iNode );
505 }
506 return Abc_Var2Lit( *pPlace, fCompl );
507 }
508}
509
521int Gia_ManHashMuxReal( Gia_Man_t * p, int iLitC, int iLit1, int iLit0 )
522{
523 int fCompl = 0;
524 assert( p->fAddStrash == 0 );
525 if ( iLitC < 2 )
526 return iLitC ? iLit1 : iLit0;
527 if ( iLit0 < 2 )
528 return iLit0 ? Gia_ManHashOr(p, Abc_LitNot(iLitC), iLit1) : Gia_ManHashAnd(p, iLitC, iLit1);
529 if ( iLit1 < 2 )
530 return iLit1 ? Gia_ManHashOr(p, iLitC, iLit0) : Gia_ManHashAnd(p, Abc_LitNot(iLitC), iLit0);
531 assert( iLit0 > 1 && iLit1 > 1 && iLitC > 1 );
532 if ( iLit0 == iLit1 )
533 return iLit0;
534 if ( iLitC == iLit0 || iLitC == Abc_LitNot(iLit1) )
535 return Gia_ManHashAnd(p, iLit0, iLit1);
536 if ( iLitC == iLit1 || iLitC == Abc_LitNot(iLit0) )
537 return Gia_ManHashOr(p, iLit0, iLit1);
538 if ( Abc_Lit2Var(iLit0) == Abc_Lit2Var(iLit1) )
539 return Gia_ManHashXorReal( p, iLitC, iLit0 );
540 if ( iLit0 > iLit1 )
541 iLit0 ^= iLit1, iLit1 ^= iLit0, iLit0 ^= iLit1, iLitC = Abc_LitNot(iLitC);
542 if ( Abc_LitIsCompl(iLit1) )
543 iLit0 = Abc_LitNot(iLit0), iLit1 = Abc_LitNot(iLit1), fCompl = 1;
544 {
545 int *pPlace = Gia_ManHashFind( p, iLit0, iLit1, iLitC );
546 if ( *pPlace )
547 {
548 p->nHashHit++;
549 return Abc_Var2Lit( *pPlace, fCompl );
550 }
551 p->nHashMiss++;
552 if ( Vec_IntSize(&p->vHash) < Vec_IntCap(&p->vHash) )
553 *pPlace = Abc_Lit2Var( Gia_ManAppendMuxReal( p, iLitC, iLit1, iLit0 ) );
554 else
555 {
556 int iNode = Gia_ManAppendMuxReal( p, iLitC, iLit1, iLit0 );
557 pPlace = Gia_ManHashFind( p, iLit0, iLit1, iLitC );
558 assert( *pPlace == 0 );
559 *pPlace = Abc_Lit2Var( iNode );
560 }
561 return Abc_Var2Lit( *pPlace, fCompl );
562 }
563}
564
576int Gia_ManHashAnd( Gia_Man_t * p, int iLit0, int iLit1 )
577{
578 if ( iLit0 < 2 )
579 return iLit0 ? iLit1 : 0;
580 if ( iLit1 < 2 )
581 return iLit1 ? iLit0 : 0;
582 if ( iLit0 == iLit1 )
583 return iLit1;
584 if ( iLit0 == Abc_LitNot(iLit1) )
585 return 0;
586 if ( p->fGiaSimple )
587 {
588 assert( Vec_IntSize(&p->vHTable) == 0 );
589 return Gia_ManAppendAnd( p, iLit0, iLit1 );
590 }
591 if ( (p->nObjs & 0xFF) == 0 && 2 * Vec_IntSize(&p->vHTable) < Gia_ManAndNum(p) )
593 if ( p->fAddStrash )
594 {
595 Gia_Obj_t * pObj = Gia_ManAddStrash( p, Gia_ObjFromLit(p, iLit0), Gia_ObjFromLit(p, iLit1) );
596 if ( pObj != NULL )
597 return Gia_ObjToLit( p, pObj );
598 }
599 if ( iLit0 > iLit1 )
600 iLit0 ^= iLit1, iLit1 ^= iLit0, iLit0 ^= iLit1;
601 {
602 int * pPlace = Gia_ManHashFind( p, iLit0, iLit1, -1 );
603 if ( *pPlace )
604 {
605 p->nHashHit++;
606 return Abc_Var2Lit( *pPlace, 0 );
607 }
608 p->nHashMiss++;
609 if ( Vec_IntSize(&p->vHash) < Vec_IntCap(&p->vHash) )
610 *pPlace = Abc_Lit2Var( Gia_ManAppendAnd( p, iLit0, iLit1 ) );
611 else
612 {
613 int iNode = Gia_ManAppendAnd( p, iLit0, iLit1 );
614 pPlace = Gia_ManHashFind( p, iLit0, iLit1, -1 );
615 assert( *pPlace == 0 );
616 *pPlace = Abc_Lit2Var( iNode );
617 }
618 return Abc_Var2Lit( *pPlace, 0 );
619 }
620}
621int Gia_ManHashOr( Gia_Man_t * p, int iLit0, int iLit1 )
622{
623 return Abc_LitNot(Gia_ManHashAnd( p, Abc_LitNot(iLit0), Abc_LitNot(iLit1) ));
624}
625
637int Gia_ManHashAndTry( Gia_Man_t * p, int iLit0, int iLit1 )
638{
639 if ( iLit0 < 2 )
640 return iLit0 ? iLit1 : 0;
641 if ( iLit1 < 2 )
642 return iLit1 ? iLit0 : 0;
643 if ( iLit0 == iLit1 )
644 return iLit1;
645 if ( iLit0 == Abc_LitNot(iLit1) )
646 return 0;
647 if ( iLit0 > iLit1 )
648 iLit0 ^= iLit1, iLit1 ^= iLit0, iLit0 ^= iLit1;
649 {
650 int * pPlace = Gia_ManHashFind( p, iLit0, iLit1, -1 );
651 if ( *pPlace )
652 return Abc_Var2Lit( *pPlace, 0 );
653 return -1;
654 }
655}
656
668int Gia_ManHashXor( Gia_Man_t * p, int iLit0, int iLit1 )
669{
670 if ( p->fGiaSimple )
671 return Gia_ManHashOr(p, Gia_ManHashAnd(p, iLit0, Abc_LitNot(iLit1)), Gia_ManHashAnd(p, Abc_LitNot(iLit0), iLit1) );
672 else
673 {
674 int fCompl = Abc_LitIsCompl(iLit0) ^ Abc_LitIsCompl(iLit1);
675 int iTemp0 = Gia_ManHashAnd( p, Abc_LitRegular(iLit0), Abc_LitNot(Abc_LitRegular(iLit1)) );
676 int iTemp1 = Gia_ManHashAnd( p, Abc_LitRegular(iLit1), Abc_LitNot(Abc_LitRegular(iLit0)) );
677 return Abc_LitNotCond( Gia_ManHashAnd( p, Abc_LitNot(iTemp0), Abc_LitNot(iTemp1) ), !fCompl );
678 }
679}
680
692int Gia_ManHashMux( Gia_Man_t * p, int iCtrl, int iData1, int iData0 )
693{
694 if ( p->fGiaSimple )
695 return Gia_ManHashOr(p, Gia_ManHashAnd(p, iCtrl, iData1), Gia_ManHashAnd(p, Abc_LitNot(iCtrl), iData0) );
696 else
697 {
698 int iTemp0, iTemp1, fCompl = 0;
699 if ( iData0 > iData1 )
700 iData0 ^= iData1, iData1 ^= iData0, iData0 ^= iData1, iCtrl = Abc_LitNot(iCtrl);
701 if ( Abc_LitIsCompl(iData1) )
702 iData0 = Abc_LitNot(iData0), iData1 = Abc_LitNot(iData1), fCompl = 1;
703 iTemp0 = Gia_ManHashAnd( p, Abc_LitNot(iCtrl), iData0 );
704 iTemp1 = Gia_ManHashAnd( p, iCtrl, iData1 );
705 return Abc_LitNotCond( Gia_ManHashAnd( p, Abc_LitNot(iTemp0), Abc_LitNot(iTemp1) ), !fCompl );
706 }
707}
708
720int Gia_ManHashMaj( Gia_Man_t * p, int iData0, int iData1, int iData2 )
721{
722 int iTemp0 = Gia_ManHashOr( p, iData1, iData2 );
723 int iTemp1 = Gia_ManHashAnd( p, iData0, iTemp0 );
724 int iTemp2 = Gia_ManHashAnd( p, iData1, iData2 );
725 return Gia_ManHashOr( p, iTemp1, iTemp2 );
726}
727
739Gia_Man_t * Gia_ManRehash( Gia_Man_t * p, int fAddStrash )
740{
741 Gia_Man_t * pNew, * pTemp;
742 Gia_Obj_t * pObj;
743 int i;
744 pNew = Gia_ManStart( Gia_ManObjNum(p) );
745 pNew->pName = Abc_UtilStrsav( p->pName );
746 pNew->pSpec = Abc_UtilStrsav( p->pSpec );
747 pNew->fAddStrash = fAddStrash;
748 Gia_ManHashAlloc( pNew );
749 Gia_ManConst0(p)->Value = 0;
750 Gia_ManForEachObj( p, pObj, i )
751 {
752 //if ( Gia_ObjIsBuf(pObj) )
753 // pObj->Value = Gia_ManAppendBuf( pNew, Gia_ObjFanin0Copy(pObj) );
754 //else
755 if ( Gia_ObjIsAnd(pObj) )
756 pObj->Value = Gia_ManHashAnd( pNew, Gia_ObjFanin0Copy(pObj), Gia_ObjFanin1Copy(pObj) );
757 else if ( Gia_ObjIsCi(pObj) )
758 pObj->Value = Gia_ManAppendCi( pNew );
759 else if ( Gia_ObjIsCo(pObj) )
760 pObj->Value = Gia_ManAppendCo( pNew, Gia_ObjFanin0Copy(pObj) );
761 }
762 Gia_ManHashStop( pNew );
763 pNew->fAddStrash = 0;
764 Gia_ManSetRegNum( pNew, Gia_ManRegNum(p) );
765// printf( "Top gate is %s\n", Gia_ObjFaninC0(Gia_ManCo(pNew, 0))? "OR" : "AND" );
766 pNew = Gia_ManCleanup( pTemp = pNew );
767 Gia_ManStop( pTemp );
768 return pNew;
769}
770
771
784{
785 if ( Vec_IntSize(vLits) == 0 )
786 return 0;
787 while ( Vec_IntSize(vLits) > 1 )
788 {
789 int i, k = 0, Lit1, Lit2, LitRes;
790 Vec_IntForEachEntryDouble( vLits, Lit1, Lit2, i )
791 {
792 LitRes = Gia_ManHashAnd( p, Lit1, Lit2 );
793 Vec_IntWriteEntry( vLits, k++, LitRes );
794 }
795 if ( Vec_IntSize(vLits) & 1 )
796 Vec_IntWriteEntry( vLits, k++, Vec_IntEntryLast(vLits) );
797 Vec_IntShrink( vLits, k );
798 }
799 assert( Vec_IntSize(vLits) == 1 );
800 return Vec_IntEntry(vLits, 0);
801}
803{
804 int i, iLit, iRes = 1;
805 Vec_IntForEachEntry( vLits, iLit, i )
806 iRes = Gia_ManHashAnd( p, iRes, iLit );
807 return iRes;
808}
810{
811 int i, iLit0, iLit1, iRes = 0;
812 Vec_IntForEachEntryDouble( vOuts, iLit0, iLit1, i )
813 iRes = Gia_ManHashOr( p, iRes, Gia_ManHashXor(p, iLit0, iLit1) );
814 return iRes;
815}
816
817
818
830int * Gia_ManCollectLiterals( int nVars )
831{
832 int i, * pRes = ABC_CALLOC( int, nVars );
833 for ( i = 0; i < nVars; i++ )
834 pRes[i] = Abc_Var2Lit( i+1, 0 );
835 return pRes;
836}
837int * Gia_ManGenZero( int nBits )
838{
839 return ABC_CALLOC( int, nBits );
840}
841int * Gia_ManGenPerm( int nBits )
842{
843 int i, * pRes = ABC_CALLOC( int, nBits );
844 srand( time(NULL) );
845 for ( i = 0; i < nBits; i++ )
846 pRes[i] = i;
847 for ( i = 0; i < nBits; i++ )
848 {
849 int iPerm = rand() % nBits;
850 ABC_SWAP( int, pRes[i], pRes[iPerm] );
851 }
852 return pRes;
853}
854int * Gia_ManGenPerm2( int nBits )
855{
856 int i, * pRes = ABC_CALLOC( int, nBits );
857 srand( time(NULL) );
858 for ( i = 0; i < nBits; i++ )
859 pRes[i] = rand() % nBits;
860 return pRes;
861}
862int Gia_ManMultiCheck( int * pPerm, int nPerm )
863{
864 int i;
865 for ( i = 1; i < nPerm; i++ )
866 if ( pPerm[i-1] <= pPerm[i] )
867 return 0;
868 return 1;
869}
870int Gia_ManMultiInputPerm( Gia_Man_t * pNew, int * pVars, int nVars, int * pPerm, int fOr, int fXor )
871{
872 int fPrint = 1;
873 int i, iLit;
874 if ( fPrint )
875 {
876 for ( i = 0; i < nVars; i++ )
877 printf( "%d ", pPerm[i] );
878 printf( "\n" );
879 }
880 while ( 1 )
881 {
882 for ( i = 1; i < nVars; i++ )
883 if ( pPerm[i-1] >= pPerm[i] )
884 break;
885 if ( i == nVars )
886 break;
887 assert( pPerm[i-1] >= pPerm[i] );
888 if ( pPerm[i-1] > pPerm[i] )
889 {
890 ABC_SWAP( int, pPerm[i-1], pPerm[i] );
891 ABC_SWAP( int, pVars[i-1], pVars[i] );
892 }
893 else
894 {
895 assert( pPerm[i-1] == pPerm[i] );
896 pPerm[i-1]++;
897 if ( fXor )
898 pVars[i-1] = Gia_ManHashXor( pNew, pVars[i-1], pVars[i] );
899 else if ( fOr )
900 pVars[i-1] = Gia_ManHashOr( pNew, pVars[i-1], pVars[i] );
901 else
902 pVars[i-1] = Gia_ManHashAnd( pNew, pVars[i-1], pVars[i] );
903 for ( i = i+1; i < nVars; i++ )
904 {
905 pPerm[i-1] = pPerm[i];
906 pVars[i-1] = pVars[i];
907 }
908 nVars--;
909 }
910 if ( fPrint )
911 {
912 for ( i = 0; i < nVars; i++ )
913 printf( "%d ", pPerm[i] );
914 printf( "\n" );
915 }
916 }
917 iLit = pVars[0];
918 for ( i = 1; i < nVars; i++ )
919 if ( fXor )
920 iLit = Gia_ManHashXor( pNew, iLit, pVars[i] );
921 else if ( fOr )
922 iLit = Gia_ManHashOr( pNew, iLit, pVars[i] );
923 else
924 iLit = Gia_ManHashAnd( pNew, iLit, pVars[i] );
925 return iLit;
926}
928{
929 Gia_Man_t * pNew;
930 int i, iRes, * pPerm;
931 int * pMulti = Gia_ManCollectLiterals( nBits );
932 pNew = Gia_ManStart( 1000 );
933 pNew->pName = Abc_UtilStrsav( "multi" );
934 for ( i = 0; i < nBits; i++ )
935 Gia_ManAppendCi( pNew );
936 Gia_ManHashAlloc( pNew );
937 pPerm = Gia_ManGenPerm2( nBits );
938 //pPerm = Gia_ManGenZero( nBits );
939 iRes = Gia_ManMultiInputPerm( pNew, pMulti, nBits, pPerm, 0, 0 );
940 Gia_ManAppendCo( pNew, iRes );
941 ABC_FREE( pPerm );
942 ABC_FREE( pMulti );
943 return pNew;
944}
945
946
958int Gia_ManCube( Gia_Man_t * pNew, int Vars, int nVars, int * pLits )
959{
960 int i, iLit = 1;
961 for ( i = 0; i < nVars; i++ )
962 iLit = Gia_ManHashAnd( pNew, iLit, Abc_LitNotCond(pLits[i], !((Vars >> i) & 1)) );
963 return iLit;
964}
965int Gia_ManMuxTree_rec( Gia_Man_t * pNew, int * pCtrl, int nCtrl, int * pData )
966{
967 int iLit0, iLit1;
968 if ( nCtrl == 0 )
969 return pData[0];
970 iLit0 = Gia_ManMuxTree_rec( pNew, pCtrl, nCtrl-1, pData );
971 iLit1 = Gia_ManMuxTree_rec( pNew, pCtrl, nCtrl-1, pData + (1<<(nCtrl-1)) );
972 return Gia_ManHashMux( pNew, pCtrl[nCtrl-1], iLit1, iLit0 );
973}
974void Gia_ManUsePerm( int * pTree, int nBits, int * pPerm )
975{
976 int fPrint = 0;
977 int i, k, m, nVars = nBits + (1 << nBits);
978 if ( fPrint )
979 {
980 for ( i = 0; i < nVars; i++ )
981 printf( "%d ", pPerm[i] );
982 printf( "\n" );
983 }
984 for ( i = 0; i < nBits; i++ )
985 {
986 for ( k = i+1; k < nBits; k++ )
987 if ( pPerm[i] > pPerm[k] )
988 break;
989 if ( k == nBits )
990 break;
991 assert( pPerm[i] > pPerm[k] );
992 ABC_SWAP( int, pPerm[i], pPerm[k] );
993 ABC_SWAP( int, pTree[i], pTree[k] );
994 for ( m = 0; m < (1 << nBits); m++ )
995 if ( ((m >> i) & 1) && !((m >> k) & 1) )
996 {
997 ABC_SWAP( int, pTree[nBits+m], pTree[nBits+(m^(1<<i)^(1<<k))] );
998 ABC_SWAP( int, pPerm[nBits+m], pPerm[nBits+(m^(1<<i)^(1<<k))] );
999 }
1000 }
1001 if ( fPrint )
1002 {
1003 for ( i = 0; i < nVars; i++ )
1004 printf( "%d ", pPerm[i] );
1005 printf( "\n" );
1006 }
1007}
1008int Gia_ManFindCond( int * pLits, int nBits, int iLate1, int iLate2 )
1009{
1010 int i;
1011 assert( iLate1 != iLate2 );
1012 for ( i = 0; i < nBits; i++ )
1013 if ( (((iLate1 ^ iLate2) >> i) & 1) )
1014 return Abc_LitNotCond( pLits[i], (iLate1 >> i) & 1 );
1015 return -1;
1016}
1017int Gia_ManLatest( int * pPerm, int nVars, int iPrev1, int iPrev2, int iPrev3 )
1018{
1019 int i, Value = -1, iLate = -1;
1020 for ( i = 0; i < nVars; i++ )
1021 if ( Value < pPerm[i] && i != iPrev1 && i != iPrev2 && i != iPrev3 )
1022 {
1023 Value = pPerm[i];
1024 iLate = i;
1025 }
1026 return iLate;
1027}
1028int Gia_ManEarliest( int * pPerm, int nVars )
1029{
1030 int i, Value = ABC_INFINITY, iLate = -1;
1031 for ( i = 0; i < nVars; i++ )
1032 if ( Value > pPerm[i] )
1033 {
1034 Value = pPerm[i];
1035 iLate = i;
1036 }
1037 return iLate;
1038}
1039int Gia_ManDecompOne( Gia_Man_t * pNew, int * pTree, int nBits, int * pPerm, int iLate )
1040{
1041 int iRes, iData;
1042 assert( iLate >= 0 && iLate < (1<<nBits) );
1043 iData = pTree[nBits+iLate];
1044 pTree[nBits+iLate] = pTree[nBits+(iLate^1)];
1045 iRes = Gia_ManMuxTree_rec( pNew, pTree, nBits, pTree+nBits );
1046 return Gia_ManHashMux( pNew, Gia_ManCube(pNew, iLate, nBits, pTree), iData, iRes );
1047}
1048int Gia_ManDecompTwo( Gia_Man_t * pNew, int * pTree, int nBits, int * pPerm, int iLate1, int iLate2 )
1049{
1050 int iRes, iData1, iData2, iData, iCond, iCond2;
1051 assert( iLate1 != iLate2 );
1052 assert( iLate1 >= 0 && iLate1 < (1<<nBits) );
1053 assert( iLate2 >= 0 && iLate2 < (1<<nBits) );
1054 iData1 = pTree[nBits+iLate1];
1055 iData2 = pTree[nBits+iLate2];
1056 pTree[nBits+iLate1] = pTree[nBits+(iLate1^1)];
1057 pTree[nBits+iLate2] = pTree[nBits+(iLate2^1)];
1058 iRes = Gia_ManMuxTree_rec( pNew, pTree, nBits, pTree+nBits );
1059 iCond = Gia_ManHashOr( pNew, Gia_ManCube(pNew, iLate1, nBits, pTree), Gia_ManCube(pNew, iLate2, nBits, pTree) );
1060 iCond2 = Gia_ManFindCond( pTree, nBits, iLate1, iLate2 );
1061 iData = Gia_ManHashMux( pNew, iCond2, iData2, iData1 );
1062 return Gia_ManHashMux( pNew, iCond, iData, iRes );
1063}
1064int Gia_ManDecompThree( Gia_Man_t * pNew, int * pTree, int nBits, int * pPerm, int iLate1, int iLate2, int iLate3 )
1065{
1066 int iRes, iData1, iData2, iData3, iCube1, iCube2, iCube3, iCtrl0, iCtrl1, iMux10, iMux11;
1067 assert( iLate1 != iLate2 );
1068 assert( iLate1 != iLate3 );
1069 assert( iLate2 != iLate3 );
1070 assert( iLate1 >= 0 && iLate1 < (1<<nBits) );
1071 assert( iLate2 >= 0 && iLate2 < (1<<nBits) );
1072 assert( iLate3 >= 0 && iLate3 < (1<<nBits) );
1073 iData1 = pTree[nBits+iLate1];
1074 iData2 = pTree[nBits+iLate2];
1075 iData3 = pTree[nBits+iLate3];
1076 pTree[nBits+iLate1] = pTree[nBits+(iLate1^1)];
1077 pTree[nBits+iLate2] = pTree[nBits+(iLate2^1)];
1078 pTree[nBits+iLate3] = pTree[nBits+(iLate3^1)];
1079 iRes = Gia_ManMuxTree_rec( pNew, pTree, nBits, pTree+nBits );
1080 iCube1 = Gia_ManCube( pNew, iLate1, nBits, pTree );
1081 iCube2 = Gia_ManCube( pNew, iLate2, nBits, pTree );
1082 iCube3 = Gia_ManCube( pNew, iLate3, nBits, pTree );
1083 iCtrl0 = Gia_ManHashOr( pNew, iCube1, iCube3 );
1084 iCtrl1 = Gia_ManHashOr( pNew, iCube2, iCube3 );
1085 iMux10 = Gia_ManHashMux( pNew, iCtrl0, iData1, iRes );
1086 iMux11 = Gia_ManHashMux( pNew, iCtrl0, iData3, iData2 );
1087 return Gia_ManHashMux( pNew, iCtrl1, iMux11, iMux10 );
1088}
1089int Gia_ManDecomp( Gia_Man_t * pNew, int * pTree, int nBits, int * pPerm )
1090{
1091 if ( nBits == 2 )
1092 return Gia_ManMuxTree_rec( pNew, pTree, nBits, pTree+nBits );
1093 else
1094 {
1095 int iBase = Gia_ManEarliest( pPerm+nBits, 1<<nBits ), BaseValue = pPerm[nBits+iBase];
1096 int iLate1 = Gia_ManLatest( pPerm+nBits, 1<<nBits, -1, -1, -1 );
1097 int iLate2 = Gia_ManLatest( pPerm+nBits, 1<<nBits, iLate1, -1, -1 );
1098 int iLate3 = Gia_ManLatest( pPerm+nBits, 1<<nBits, iLate1, iLate2, -1 );
1099 int iLate4 = Gia_ManLatest( pPerm+nBits, 1<<nBits, iLate1, iLate2, iLate3 );
1100 if ( 0 )
1101 {
1102 int i;
1103 for ( i = 0; i < (1<<nBits); i++ )
1104 printf( "%d ", pPerm[nBits+i] );
1105 printf( "\n" );
1106 }
1107 if ( pPerm[nBits+iLate1] > BaseValue && pPerm[nBits+iLate2] > BaseValue && pPerm[nBits+iLate3] > BaseValue && pPerm[nBits+iLate4] == BaseValue )
1108 return Gia_ManDecompThree( pNew, pTree, nBits, pPerm, iLate1, iLate2, iLate3 );
1109 if ( pPerm[nBits+iLate1] > BaseValue && pPerm[nBits+iLate2] > BaseValue && pPerm[nBits+iLate3] == BaseValue )
1110 return Gia_ManDecompTwo( pNew, pTree, nBits, pPerm, iLate1, iLate2 );
1111 if ( pPerm[nBits+iLate1] > BaseValue && pPerm[nBits+iLate2] == BaseValue )
1112 return Gia_ManDecompOne( pNew, pTree, nBits, pPerm, iLate1 );
1113 return Gia_ManMuxTree_rec( pNew, pTree, nBits, pTree+nBits );
1114 }
1115}
1117{
1118 Gia_Man_t * pNew;
1119 int i, iLit, nVars = nBits + (1 << nBits);
1120 int * pPerm, * pTree = Gia_ManCollectLiterals( nVars );
1121 pNew = Gia_ManStart( 1000 );
1122 pNew->pName = Abc_UtilStrsav( "mux_tree" );
1123 for ( i = 0; i < nVars; i++ )
1124 Gia_ManAppendCi( pNew );
1125 Gia_ManHashAlloc( pNew );
1126 pPerm = Gia_ManGenPerm( nVars );
1127 //pPerm = Gia_ManGenZero( nVars );
1128 pPerm[nBits+1] = 100;
1129 pPerm[nBits+5] = 100;
1130 pPerm[nBits+4] = 100;
1131 Gia_ManUsePerm( pTree, nBits, pPerm );
1132 iLit = Gia_ManDecomp( pNew, pTree, nBits, pPerm );
1133 Gia_ManAppendCo( pNew, iLit );
1134 ABC_FREE( pPerm );
1135 ABC_FREE( pTree );
1136 return pNew;
1137}
1138
1142
1143
1145
#define ABC_SWAP(Type, a, b)
Definition abc_global.h:253
#define ABC_INFINITY
MACRO DEFINITIONS ///.
Definition abc_global.h:250
#define ABC_CALLOC(type, num)
Definition abc_global.h:265
#define ABC_FREE(obj)
Definition abc_global.h:267
#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
Cube * p
Definition exorList.c:222
int Gia_ManCube(Gia_Man_t *pNew, int Vars, int nVars, int *pLits)
Definition giaHash.c:958
int * Gia_ManGenPerm(int nBits)
Definition giaHash.c:841
int Gia_ManMultiCheck(int *pPerm, int nPerm)
Definition giaHash.c:862
void Gia_ManHashStart(Gia_Man_t *p)
Definition giaHash.c:125
int * Gia_ManGenZero(int nBits)
Definition giaHash.c:837
Gia_Man_t * Gia_ManMuxTreeTest(int nBits)
Definition giaHash.c:1116
int Gia_ManEarliest(int *pPerm, int nVars)
Definition giaHash.c:1028
int Gia_ManHashMuxReal(Gia_Man_t *p, int iLitC, int iLit1, int iLit0)
Definition giaHash.c:521
int Gia_ManHashLookup(Gia_Man_t *p, Gia_Obj_t *p0, Gia_Obj_t *p1)
Definition giaHash.c:87
int * Gia_ManGenPerm2(int nBits)
Definition giaHash.c:854
int Gia_ManHashDualMiter(Gia_Man_t *p, Vec_Int_t *vOuts)
Definition giaHash.c:809
int * Gia_ManCollectLiterals(int nVars)
Definition giaHash.c:830
int Gia_ManHashAndMulti(Gia_Man_t *p, Vec_Int_t *vLits)
Definition giaHash.c:783
int Gia_ManDecomp(Gia_Man_t *pNew, int *pTree, int nBits, int *pPerm)
Definition giaHash.c:1089
int Gia_ManDecompOne(Gia_Man_t *pNew, int *pTree, int nBits, int *pPerm, int iLate)
Definition giaHash.c:1039
void Gia_ManHashProfile(Gia_Man_t *p)
Definition giaHash.c:207
int Gia_ManDecompThree(Gia_Man_t *pNew, int *pTree, int nBits, int *pPerm, int iLate1, int iLate2, int iLate3)
Definition giaHash.c:1064
int Gia_ManHashAndMulti2(Gia_Man_t *p, Vec_Int_t *vLits)
Definition giaHash.c:802
void Gia_ManHashAlloc(Gia_Man_t *p)
Definition giaHash.c:105
Gia_Man_t * Gia_ManRehash(Gia_Man_t *p, int fAddStrash)
Definition giaHash.c:739
void Gia_ManUsePerm(int *pTree, int nBits, int *pPerm)
Definition giaHash.c:974
int Gia_ManHashOr(Gia_Man_t *p, int iLit0, int iLit1)
Definition giaHash.c:621
int Gia_ManHashXor(Gia_Man_t *p, int iLit0, int iLit1)
Definition giaHash.c:668
int Gia_ManHashMux(Gia_Man_t *p, int iCtrl, int iData1, int iData0)
Definition giaHash.c:692
int Gia_ManDecompTwo(Gia_Man_t *pNew, int *pTree, int nBits, int *pPerm, int iLate1, int iLate2)
Definition giaHash.c:1048
int Gia_ManFindCond(int *pLits, int nBits, int iLate1, int iLate2)
Definition giaHash.c:1008
int Gia_ManLatest(int *pPerm, int nVars, int iPrev1, int iPrev2, int iPrev3)
Definition giaHash.c:1017
int Gia_ManHashAnd(Gia_Man_t *p, int iLit0, int iLit1)
Definition giaHash.c:576
void Gia_ManHashResize(Gia_Man_t *p)
Definition giaHash.c:166
int Gia_ManHashAndTry(Gia_Man_t *p, int iLit0, int iLit1)
Definition giaHash.c:637
int Gia_ManHashXorReal(Gia_Man_t *p, int iLit0, int iLit1)
Definition giaHash.c:469
int Gia_ManHashLookupInt(Gia_Man_t *p, int iLit0, int iLit1)
Definition giaHash.c:81
void Gia_ManHashStop(Gia_Man_t *p)
Definition giaHash.c:149
int Gia_ManHashMaj(Gia_Man_t *p, int iData0, int iData1, int iData2)
Definition giaHash.c:720
int Gia_ManMuxTree_rec(Gia_Man_t *pNew, int *pCtrl, int nCtrl, int *pData)
Definition giaHash.c:965
int Gia_ManMultiInputPerm(Gia_Man_t *pNew, int *pVars, int nVars, int *pPerm, int fOr, int fXor)
Definition giaHash.c:870
Gia_Man_t * Gia_ManMultiInputTest(int nBits)
Definition giaHash.c:927
void Gia_ManStop(Gia_Man_t *p)
Definition giaMan.c:82
#define Gia_ManForEachAnd(p, pObj, i)
Definition gia.h:1214
void Gia_ManSetRegNum(Gia_Man_t *p, int nRegs)
Definition giaMan.c:764
Gia_Man_t * Gia_ManStart(int nObjsMax)
FUNCTION DEFINITIONS ///.
Definition giaMan.c:57
struct Gia_Obj_t_ Gia_Obj_t
Definition gia.h:76
struct Gia_Man_t_ Gia_Man_t
Definition gia.h:96
Gia_Man_t * Gia_ManCleanup(Gia_Man_t *p)
Definition giaScl.c:84
#define Gia_ManForEachObj(p, pObj, i)
MACRO DEFINITIONS ///.
Definition gia.h:1190
char * pSpec
Definition gia.h:100
int fAddStrash
Definition gia.h:114
char * pName
Definition gia.h:99
unsigned Value
Definition gia.h:89
#define assert(ex)
Definition util_old.h:213
#define Vec_IntForEachEntryDouble(vVec, Entry1, Entry2, i)
Definition vecInt.h:72
#define Vec_IntForEachEntry(vVec, Entry, i)
MACRO DEFINITIONS ///.
Definition vecInt.h:54