ABC: A System for Sequential Synthesis and Verification
 
Loading...
Searching...
No Matches
aigCanon.c File Reference
#include "aig.h"
#include "bool/kit/kit.h"
#include "bool/bdc/bdc.h"
#include "aig/ioa/ioa.h"
Include dependency graph for aigCanon.c:

Go to the source code of this file.

Classes

struct  Aig_VSig_t_
 
struct  Aig_Tru_t_
 
struct  Aig_RMan_t_
 

Macros

#define RMAN_MAXVARS   12
 DECLARATIONS ///.
 
#define RMAX_MAXWORD   (RMAN_MAXVARS <= 5 ? 1 : (1 << (RMAN_MAXVARS - 5)))
 

Typedefs

typedef struct Aig_VSig_t_ Aig_VSig_t
 
typedef struct Aig_Tru_t_ Aig_Tru_t
 
typedef struct Aig_RMan_t_ Aig_RMan_t
 

Functions

Aig_RMan_tAig_RManStart ()
 FUNCTION DEFINITIONS ///.
 
Aig_Tru_t ** Aig_RManTableLookup (Aig_RMan_t *p, unsigned *pTruth, int nVars)
 
void Aig_RManTableResize (Aig_RMan_t *p)
 
int Aig_RManTableFindOrAdd (Aig_RMan_t *p, unsigned *pTruth, int nVars)
 
void Aig_RManStop (Aig_RMan_t *p)
 
void Aig_RManQuit ()
 
void Aig_RManPrintVarProfile (unsigned *pTruth, int nVars, unsigned *pTruthAux)
 
void Aig_RManSortNums (int *pArray, int nVars)
 
void Aig_RManPrintSigs (Aig_VSig_t *pSigs, int nVars)
 
void Aig_RManComputeVSigs (unsigned *pTruth, int nVars, Aig_VSig_t *pSigs, unsigned *pAux)
 
int Aig_RManVarsAreUnique (Aig_VSig_t *pMints, int nVars)
 
void Aig_RManPrintUniqueVars (Aig_VSig_t *pMints, int nVars)
 
unsigned Aig_RManSemiCanonicize (unsigned *pOut, unsigned *pIn, int nVars, char *pCanonPerm, Aig_VSig_t *pSigs, int fReturnIn)
 
void Aig_RManSaveOne (Aig_RMan_t *p, unsigned *pTruth, int nVars)
 
void Aig_RManRecord (unsigned *pTruth, int nVarsInit)
 

Macro Definition Documentation

◆ RMAN_MAXVARS

#define RMAN_MAXVARS   12

DECLARATIONS ///.

CFile****************************************************************

FileName [aigCanon.c]

SystemName [ABC: Logic synthesis and verification system.]

PackageName [AIG package.]

Synopsis [Processing the library of semi-canonical AIGs.]

Author [Alan Mishchenko]

Affiliation [UC Berkeley]

Date [Ver. 1.0. Started - April 28, 2007.]

Revision [

Id
aigCanon.c,v 1.00 2007/04/28 00:00:00 alanmi Exp

]

Definition at line 33 of file aigCanon.c.

◆ RMAX_MAXWORD

#define RMAX_MAXWORD   (RMAN_MAXVARS <= 5 ? 1 : (1 << (RMAN_MAXVARS - 5)))

Definition at line 34 of file aigCanon.c.

Typedef Documentation

◆ Aig_RMan_t

typedef struct Aig_RMan_t_ Aig_RMan_t

Definition at line 53 of file aigCanon.c.

◆ Aig_Tru_t

typedef struct Aig_Tru_t_ Aig_Tru_t

Definition at line 43 of file aigCanon.c.

◆ Aig_VSig_t

typedef struct Aig_VSig_t_ Aig_VSig_t

Definition at line 36 of file aigCanon.c.

Function Documentation

◆ Aig_RManComputeVSigs()

void Aig_RManComputeVSigs ( unsigned * pTruth,
int nVars,
Aig_VSig_t * pSigs,
unsigned * pAux )

Function*************************************************************

Synopsis [Computes signatures for all variables.]

Description []

SideEffects []

SeeAlso []

Definition at line 382 of file aigCanon.c.

383{
384 int v;
385 for ( v = 0; v < nVars; v++ )
386 {
387 Kit_TruthCofactor0New( pAux, pTruth, nVars, v );
388 pSigs[2*v+0].nOnes = Kit_TruthCountOnes( pAux, nVars );
389 Kit_TruthCountOnesInCofs0( pAux, nVars, pSigs[2*v+0].nCofOnes );
390 Aig_RManSortNums( pSigs[2*v+0].nCofOnes, nVars );
391
392 Kit_TruthCofactor1New( pAux, pTruth, nVars, v );
393 pSigs[2*v+1].nOnes = Kit_TruthCountOnes( pAux, nVars );
394 Kit_TruthCountOnesInCofs0( pAux, nVars, pSigs[2*v+1].nCofOnes );
395 Aig_RManSortNums( pSigs[2*v+1].nCofOnes, nVars );
396 }
397}
void Aig_RManSortNums(int *pArray, int nVars)
Definition aigCanon.c:329
void Kit_TruthCofactor1New(unsigned *pOut, unsigned *pIn, int nVars, int iVar)
Definition kitTruth.c:573
void Kit_TruthCofactor0New(unsigned *pOut, unsigned *pIn, int nVars, int iVar)
Definition kitTruth.c:521
void Kit_TruthCountOnesInCofs0(unsigned *pTruth, int nVars, int *pStore)
Definition kitTruth.c:1486
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Aig_RManPrintSigs()

void Aig_RManPrintSigs ( Aig_VSig_t * pSigs,
int nVars )

Function*************************************************************

Synopsis [Prints signatures for all variables.]

Description []

SideEffects []

SeeAlso []

Definition at line 353 of file aigCanon.c.

354{
355 int v, i, k;
356 for ( v = 0; v < nVars; v++ )
357 {
358 printf( "%2d : ", v );
359 for ( k = 0; k < 2; k++ )
360 {
361 printf( "%5d ", pSigs[2*v+k].nOnes );
362 printf( "(" );
363 for ( i = 0; i < nVars; i++ )
364 printf( "%4d ", pSigs[2*v+k].nCofOnes[i] );
365 printf( ") " );
366 }
367 printf( "\n" );
368 }
369}

◆ Aig_RManPrintUniqueVars()

void Aig_RManPrintUniqueVars ( Aig_VSig_t * pMints,
int nVars )

Function*************************************************************

Synopsis [Returns 1 if all variables are unique.]

Description []

SideEffects []

SeeAlso []

Definition at line 447 of file aigCanon.c.

448{
449 int i;
450 for ( i = 0; i < nVars; i++ )
451 if ( Aig_RManCompareSigs( &pMints[2*i], &pMints[2*i+1], nVars ) == 0 )
452 printf( "=" );
453 else
454 printf( "x" );
455 printf( "\n" );
456
457 printf( "0" );
458 for ( i = 1; i < nVars; i++ )
459 if ( Aig_RManCompareSigs( &pMints[2*(i-1)], &pMints[2*i], nVars ) == 0 )
460 printf( "-" );
461 else if ( i < 10 )
462 printf( "%c", '0' + i );
463 else
464 printf( "%c", 'A' + i-10 );
465 printf( "\n" );
466}

◆ Aig_RManPrintVarProfile()

void Aig_RManPrintVarProfile ( unsigned * pTruth,
int nVars,
unsigned * pTruthAux )

Function*************************************************************

Synopsis [Returns 1 if all variables are unique.]

Description []

SideEffects []

SeeAlso []

Definition at line 308 of file aigCanon.c.

309{
310 int pStore2[32];
311 int i;
312 Kit_TruthCountOnesInCofsSlow( pTruth, nVars, pStore2, pTruthAux );
313 for ( i = 0; i < nVars; i++ )
314 printf( "%2d/%2d ", pStore2[2*i], pStore2[2*i+1] );
315 printf( "\n" );
316}
void Kit_TruthCountOnesInCofsSlow(unsigned *pTruth, int nVars, int *pStore, unsigned *pAux)
Definition kitTruth.c:1537
Here is the call graph for this function:

◆ Aig_RManQuit()

void Aig_RManQuit ( )

Function*************************************************************

Synopsis [Stops recording.]

Description []

SideEffects []

SeeAlso []

Definition at line 283 of file aigCanon.c.

284{
285// extern void Ioa_WriteAiger( Aig_Man_t * pMan, char * pFileName, int fWriteSymbols, int fCompact );
286 char Buffer[20];
287 if ( s_pRMan == NULL )
288 return;
289 // dump the library file
290 sprintf( Buffer, "aiglib%02d.aig", s_pRMan->nVars );
291 Ioa_WriteAiger( s_pRMan->pAig, Buffer, 0, 1 );
292 // quit the manager
293 Aig_RManStop( s_pRMan );
294 s_pRMan = NULL;
295}
void Aig_RManStop(Aig_RMan_t *p)
Definition aigCanon.c:252
void Ioa_WriteAiger(Aig_Man_t *pMan, char *pFileName, int fWriteSymbols, int fCompact)
char * sprintf()
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Aig_RManRecord()

void Aig_RManRecord ( unsigned * pTruth,
int nVarsInit )

Function*************************************************************

Synopsis [Records one function.]

Description []

SideEffects []

SeeAlso []

Definition at line 598 of file aigCanon.c.

599{
600 int fVerify = 1;
601 Kit_DsdNtk_t * pNtk;
602 Kit_DsdObj_t * pObj;
603 unsigned uPhaseC;
604 int i, nVars, nWords;
605 int fUniqueVars;
606
607 if ( nVarsInit > RMAN_MAXVARS )
608 {
609 printf( "The number of variables in too large.\n" );
610 return;
611 }
612
613 if ( s_pRMan == NULL )
614 s_pRMan = Aig_RManStart();
615 s_pRMan->nTotal++;
616 // canonicize the function
617 pNtk = Kit_DsdDecompose( pTruth, nVarsInit );
618 pObj = Kit_DsdNonDsdPrimeMax( pNtk );
619 if ( pObj == NULL || pObj->nFans == 3 )
620 {
621 s_pRMan->nTtDsd++;
622 Kit_DsdNtkFree( pNtk );
623 return;
624 }
625 nVars = pObj->nFans;
626 s_pRMan->nVarFuncs[nVars]++;
627 if ( nVars < nVarsInit )
628 s_pRMan->nTtDsdPart++;
629 else
630 s_pRMan->nTtDsdNot++;
631 // compute the number of words
632 nWords = Abc_TruthWordNum( nVars );
633 // copy the function
634 memcpy( s_pRMan->pTruthInit, Kit_DsdObjTruth(pObj), (size_t)(4*nWords) );
635 Kit_DsdNtkFree( pNtk );
636 // canonicize the output
637 if ( s_pRMan->pTruthInit[0] & 1 )
638 Kit_TruthNot( s_pRMan->pTruthInit, s_pRMan->pTruthInit, nVars );
639 memcpy( s_pRMan->pTruth, s_pRMan->pTruthInit, 4*nWords );
640
641 // canonize the function
642 for ( i = 0; i < nVars; i++ )
643 s_pRMan->pPerm[i] = i;
644 uPhaseC = Aig_RManSemiCanonicize( s_pRMan->pTruthTemp, s_pRMan->pTruth, nVars, s_pRMan->pPerm, s_pRMan->pMints, 1 );
645 // check unique variables
646 fUniqueVars = Aig_RManVarsAreUnique( s_pRMan->pMints, nVars );
647 s_pRMan->nUniqueVars += fUniqueVars;
648
649/*
650 printf( "%4d : ", s_pRMan->nTotal );
651 printf( "%2d %2d ", nVarsInit, nVars );
652 Extra_PrintBinary( stdout, &uPhaseC, nVars );
653 printf( " " );
654 for ( i = 0; i < nVars; i++ )
655 printf( "%2d/%2d ", s_pRMan->pMints[2*i], s_pRMan->pMints[2*i+1] );
656 printf( "\n" );
657 Aig_RManPrintUniqueVars( s_pRMan->pMints, nVars );
658Extra_PrintBinary( stdout, s_pRMan->pTruth, 1<<nVars ); printf( "\n\n" );
659*/
660/*
661 printf( "\n" );
662 printf( "%4d : ", s_pRMan->nTotal );
663 printf( "%2d %2d ", nVarsInit, nVars );
664 printf( " " );
665 printf( "\n" );
666 Aig_RManPrintUniqueVars( s_pRMan->pMints, nVars );
667// Aig_RManPrintSigs( s_pRMan->pMints, nVars );
668*/
669
670//Extra_PrintBinary( stdout, s_pRMan->pTruth, 1<<nVars ); printf( "\n\n" );
671
672 if ( Aig_RManTableFindOrAdd( s_pRMan, s_pRMan->pTruth, nVars ) )
673 Aig_RManSaveOne( s_pRMan, s_pRMan->pTruth, nVars );
674
675 if ( fVerify )
676 {
677 // derive reverse permutation
678 for ( i = 0; i < nVars; i++ )
679 s_pRMan->pPermR[i] = s_pRMan->pPerm[i];
680 // implement permutation
681 Kit_TruthPermute( s_pRMan->pTruthTemp, s_pRMan->pTruth, nVars, s_pRMan->pPermR, 1 );
682 // implement polarity
683 for ( i = 0; i < nVars; i++ )
684 if ( uPhaseC & (1 << i) )
685 Kit_TruthChangePhase( s_pRMan->pTruth, nVars, i );
686
687 // perform verification
688 if ( fUniqueVars && !Kit_TruthIsEqual( s_pRMan->pTruth, s_pRMan->pTruthInit, nVars ) )
689 printf( "Verification failed.\n" );
690 }
691//Aig_RManPrintVarProfile( s_pRMan->pTruth, nVars, s_pRMan->pTruthTemp );
692//Extra_PrintBinary( stdout, s_pRMan->pTruth, 1<<nVars ); printf( "\n" );
693}
int nWords
Definition abcNpn.c:127
int Aig_RManTableFindOrAdd(Aig_RMan_t *p, unsigned *pTruth, int nVars)
Definition aigCanon.c:218
unsigned Aig_RManSemiCanonicize(unsigned *pOut, unsigned *pIn, int nVars, char *pCanonPerm, Aig_VSig_t *pSigs, int fReturnIn)
Definition aigCanon.c:479
#define RMAN_MAXVARS
DECLARATIONS ///.
Definition aigCanon.c:33
Aig_RMan_t * Aig_RManStart()
FUNCTION DEFINITIONS ///.
Definition aigCanon.c:99
void Aig_RManSaveOne(Aig_RMan_t *p, unsigned *pTruth, int nVars)
Definition aigCanon.c:558
int Aig_RManVarsAreUnique(Aig_VSig_t *pMints, int nVars)
Definition aigCanon.c:427
Kit_DsdNtk_t * Kit_DsdDecompose(unsigned *pTruth, int nVars)
Definition kitDsd.c:2315
void Kit_TruthChangePhase(unsigned *pTruth, int nVars, int iVar)
Definition kitTruth.c:1259
void Kit_DsdNtkFree(Kit_DsdNtk_t *pNtk)
Definition kitDsd.c:164
struct Kit_DsdObj_t_ Kit_DsdObj_t
Definition kit.h:111
struct Kit_DsdNtk_t_ Kit_DsdNtk_t
Definition kit.h:124
void Kit_TruthPermute(unsigned *pOut, unsigned *pIn, int nVars, char *pPerm, int fReturnIn)
Definition kitTruth.c:233
Kit_DsdObj_t * Kit_DsdNonDsdPrimeMax(Kit_DsdNtk_t *pNtk)
Definition kitDsd.c:1237
unsigned nFans
Definition kit.h:119
char * memcpy()
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Aig_RManSaveOne()

void Aig_RManSaveOne ( Aig_RMan_t * p,
unsigned * pTruth,
int nVars )

Function*************************************************************

Synopsis [Records one function.]

Description []

SideEffects []

SeeAlso []

Definition at line 558 of file aigCanon.c.

559{
560 int i, nNodes, RetValue;
561 Bdc_Fun_t * pFunc;
562 Aig_Obj_t * pTerm;
563 // perform decomposition
564 RetValue = Bdc_ManDecompose( p->pBidec, pTruth, NULL, nVars, NULL, 1000 );
565 if ( RetValue < 0 )
566 {
567 printf( "Decomposition failed.\n" );
568 return;
569 }
570 // convert back into HOP
571 Bdc_FuncSetCopy( Bdc_ManFunc( p->pBidec, 0 ), Aig_ManConst1(p->pAig) );
572 for ( i = 0; i < nVars; i++ )
573 Bdc_FuncSetCopy( Bdc_ManFunc( p->pBidec, i+1 ), Aig_IthVar(p->pAig, i) );
574 nNodes = Bdc_ManNodeNum(p->pBidec);
575 for ( i = nVars + 1; i < nNodes; i++ )
576 {
577 pFunc = Bdc_ManFunc( p->pBidec, i );
578 Bdc_FuncSetCopy( pFunc, Aig_And( p->pAig,
579 Bdc_FunCopyHop(Bdc_FuncFanin0(pFunc)),
580 Bdc_FunCopyHop(Bdc_FuncFanin1(pFunc)) ) );
581 }
582 pTerm = Bdc_FunCopyHop( Bdc_ManRoot(p->pBidec) );
583 pTerm = Aig_ObjCreateCo( p->pAig, pTerm );
584// assert( pTerm->fPhase == 0 );
585}
Aig_Obj_t * Aig_And(Aig_Man_t *p, Aig_Obj_t *p0, Aig_Obj_t *p1)
Definition aigOper.c:104
Aig_Obj_t * Aig_ObjCreateCo(Aig_Man_t *p, Aig_Obj_t *pDriver)
Definition aigObj.c:66
struct Aig_Obj_t_ Aig_Obj_t
Definition aig.h:51
Aig_Obj_t * Aig_IthVar(Aig_Man_t *p, int i)
FUNCTION DEFINITIONS ///.
Definition aigOper.c:63
int Bdc_ManNodeNum(Bdc_Man_t *p)
Definition bdcCore.c:48
Bdc_Fun_t * Bdc_FuncFanin0(Bdc_Fun_t *p)
Definition bdcCore.c:50
Bdc_Fun_t * Bdc_ManRoot(Bdc_Man_t *p)
Definition bdcCore.c:47
typedefABC_NAMESPACE_HEADER_START struct Bdc_Fun_t_ Bdc_Fun_t
INCLUDES ///.
Definition bdc.h:42
void Bdc_FuncSetCopy(Bdc_Fun_t *p, void *pCopy)
Definition bdcCore.c:54
Bdc_Fun_t * Bdc_FuncFanin1(Bdc_Fun_t *p)
Definition bdcCore.c:51
int Bdc_ManDecompose(Bdc_Man_t *p, unsigned *puFunc, unsigned *puCare, int nVars, Vec_Ptr_t *vDivs, int nNodesMax)
Definition bdcCore.c:291
Bdc_Fun_t * Bdc_ManFunc(Bdc_Man_t *p, int i)
DECLARATIONS ///.
Definition bdcCore.c:46
Cube * p
Definition exorList.c:222
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Aig_RManSemiCanonicize()

unsigned Aig_RManSemiCanonicize ( unsigned * pOut,
unsigned * pIn,
int nVars,
char * pCanonPerm,
Aig_VSig_t * pSigs,
int fReturnIn )

Function*************************************************************

Synopsis [Canonicize the truth table.]

Description [Returns the phase. ]

SideEffects []

SeeAlso []

Definition at line 479 of file aigCanon.c.

480{
481 Aig_VSig_t TempSig;
482 int i, Temp, fChange, Counter;
483 unsigned * pTemp, uCanonPhase = 0;
484 // collect signatures
485 Aig_RManComputeVSigs( pIn, nVars, pSigs, pOut );
486 // canonicize phase
487 for ( i = 0; i < nVars; i++ )
488 {
489// if ( pStore[2*i+0] <= pStore[2*i+1] )
490 if ( Aig_RManCompareSigs( &pSigs[2*i+0], &pSigs[2*i+1], nVars ) <= 0 )
491 continue;
492 uCanonPhase |= (1 << i);
493 TempSig = pSigs[2*i+0];
494 pSigs[2*i+0] = pSigs[2*i+1];
495 pSigs[2*i+1] = TempSig;
496 Kit_TruthChangePhase( pIn, nVars, i );
497 }
498 // permute
499 Counter = 0;
500 do {
501 fChange = 0;
502 for ( i = 0; i < nVars-1; i++ )
503 {
504// if ( pStore[2*i] <= pStore[2*(i+1)] )
505 if ( Aig_RManCompareSigs( &pSigs[2*i], &pSigs[2*(i+1)], nVars ) <= 0 )
506 continue;
507 Counter++;
508 fChange = 1;
509
510 Temp = pCanonPerm[i];
511 pCanonPerm[i] = pCanonPerm[i+1];
512 pCanonPerm[i+1] = Temp;
513
514 TempSig = pSigs[2*i];
515 pSigs[2*i] = pSigs[2*(i+1)];
516 pSigs[2*(i+1)] = TempSig;
517
518 TempSig = pSigs[2*i+1];
519 pSigs[2*i+1] = pSigs[2*(i+1)+1];
520 pSigs[2*(i+1)+1] = TempSig;
521
522 Kit_TruthSwapAdjacentVars( pOut, pIn, nVars, i );
523 pTemp = pIn; pIn = pOut; pOut = pTemp;
524 }
525 } while ( fChange );
526
527 // swap if it was moved an even number of times
528 if ( fReturnIn ^ !(Counter & 1) )
529 Kit_TruthCopy( pOut, pIn, nVars );
530 return uCanonPhase;
531}
struct Aig_VSig_t_ Aig_VSig_t
Definition aigCanon.c:36
void Aig_RManComputeVSigs(unsigned *pTruth, int nVars, Aig_VSig_t *pSigs, unsigned *pAux)
Definition aigCanon.c:382
void Kit_TruthSwapAdjacentVars(unsigned *pOut, unsigned *pIn, int nVars, int Start)
DECLARATIONS ///.
Definition kitTruth.c:46
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Aig_RManSortNums()

void Aig_RManSortNums ( int * pArray,
int nVars )

Function*************************************************************

Synopsis [Sorts numbers in the increasing order.]

Description []

SideEffects []

SeeAlso []

Definition at line 329 of file aigCanon.c.

330{
331 int i, j, best_i, tmp;
332 for ( i = 0; i < nVars-1; i++ )
333 {
334 best_i = i;
335 for ( j = i+1; j < nVars; j++ )
336 if ( pArray[j] > pArray[best_i] )
337 best_i = j;
338 tmp = pArray[i]; pArray[i] = pArray[best_i]; pArray[best_i] = tmp;
339 }
340}
Here is the caller graph for this function:

◆ Aig_RManStart()

Aig_RMan_t * Aig_RManStart ( )

FUNCTION DEFINITIONS ///.

Function*************************************************************

Synopsis [Allocates recording manager.]

Description []

SideEffects []

SeeAlso []

Definition at line 99 of file aigCanon.c.

100{
101 static Bdc_Par_t Pars = {0}, * pPars = &Pars;
102 Aig_RMan_t * p;
103 p = ABC_ALLOC( Aig_RMan_t, 1 );
104 memset( p, 0, sizeof(Aig_RMan_t) );
105 p->nVars = RMAN_MAXVARS;
106 p->pAig = Aig_ManStart( 1000000 );
107 Aig_IthVar( p->pAig, p->nVars-1 );
108 // create hash table
109 p->nBins = Abc_PrimeCudd(5000);
110 p->pBins = ABC_CALLOC( Aig_Tru_t *, p->nBins );
111 p->pMemTrus = Aig_MmFlexStart();
112 // bi-decomposition manager
113 pPars->nVarsMax = p->nVars;
114 pPars->fVerbose = 0;
115 p->pBidec = Bdc_ManAlloc( pPars );
116 return p;
117}
#define ABC_ALLOC(type, num)
Definition abc_global.h:264
#define ABC_CALLOC(type, num)
Definition abc_global.h:265
struct Aig_RMan_t_ Aig_RMan_t
Definition aigCanon.c:53
struct Aig_Tru_t_ Aig_Tru_t
Definition aigCanon.c:43
Aig_Man_t * Aig_ManStart(int nNodesMax)
DECLARATIONS ///.
Definition aigMan.c:47
Aig_MmFlex_t * Aig_MmFlexStart()
Definition aigMem.c:305
struct Bdc_Par_t_ Bdc_Par_t
Definition bdc.h:44
Bdc_Man_t * Bdc_ManAlloc(Bdc_Par_t *pPars)
MACRO DEFINITIONS ///.
Definition bdcCore.c:68
char * memset()
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Aig_RManStop()

void Aig_RManStop ( Aig_RMan_t * p)

Function*************************************************************

Synopsis [Deallocates recording manager.]

Description []

SideEffects []

SeeAlso []

Definition at line 252 of file aigCanon.c.

253{
254 int i;
255 printf( "Total funcs = %10d\n", p->nTotal );
256 printf( "Full DSD funcs = %10d\n", p->nTtDsd );
257 printf( "Part DSD funcs = %10d\n", p->nTtDsdPart );
258 printf( "Non- DSD funcs = %10d\n", p->nTtDsdNot );
259 printf( "Uniq-var funcs = %10d\n", p->nUniqueVars );
260 printf( "Unique funcs = %10d\n", p->nEntries );
261 printf( "Distribution of functions:\n" );
262 for ( i = 5; i <= p->nVars; i++ )
263 printf( "%2d = %8d\n", i, p->nVarFuncs[i] );
264 Aig_MmFlexStop( p->pMemTrus, 0 );
265 Aig_ManStop( p->pAig );
266 Bdc_ManFree( p->pBidec );
267 ABC_FREE( p->pBins );
268 ABC_FREE( p );
269}
#define ABC_FREE(obj)
Definition abc_global.h:267
void Aig_MmFlexStop(Aig_MmFlex_t *p, int fVerbose)
Definition aigMem.c:337
void Aig_ManStop(Aig_Man_t *p)
Definition aigMan.c:187
void Bdc_ManFree(Bdc_Man_t *p)
Definition bdcCore.c:113
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Aig_RManTableFindOrAdd()

int Aig_RManTableFindOrAdd ( Aig_RMan_t * p,
unsigned * pTruth,
int nVars )

Function*************************************************************

Synopsis [Find or add new entry.]

Description [Returns 1 if this is a new entry.]

SideEffects []

SeeAlso []

Definition at line 218 of file aigCanon.c.

219{
220 Aig_Tru_t ** ppSpot, * pEntry;
221 int nBytes;
222 ppSpot = Aig_RManTableLookup( p, pTruth, nVars );
223 if ( *ppSpot )
224 {
225 (*ppSpot)->nVisits++;
226 return 0;
227 }
228 nBytes = sizeof(Aig_Tru_t) + sizeof(unsigned) * Kit_TruthWordNum(nVars);
229 if ( p->nEntries == 3*p->nBins )
231 pEntry = (Aig_Tru_t *)Aig_MmFlexEntryFetch( p->pMemTrus, nBytes );
232 pEntry->Id = p->nEntries++;
233 pEntry->nVars = nVars;
234 pEntry->nVisits = 1;
235 pEntry->pNext = NULL;
236 memcpy( pEntry->pTruth, pTruth, sizeof(unsigned) * Kit_TruthWordNum(nVars) );
237 *ppSpot = pEntry;
238 return 1;
239}
void Aig_RManTableResize(Aig_RMan_t *p)
Definition aigCanon.c:174
Aig_Tru_t ** Aig_RManTableLookup(Aig_RMan_t *p, unsigned *pTruth, int nVars)
Definition aigCanon.c:150
char * Aig_MmFlexEntryFetch(Aig_MmFlex_t *p, int nBytes)
Definition aigMem.c:366
unsigned nVars
Definition aigCanon.c:49
unsigned nVisits
Definition aigCanon.c:48
unsigned pTruth[0]
Definition aigCanon.c:50
Aig_Tru_t * pNext
Definition aigCanon.c:46
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Aig_RManTableLookup()

Aig_Tru_t ** Aig_RManTableLookup ( Aig_RMan_t * p,
unsigned * pTruth,
int nVars )

Function*************************************************************

Synopsis [Returns the given record.]

Description []

SideEffects []

SeeAlso []

Definition at line 150 of file aigCanon.c.

151{
152 static int s_Primes[16] = {
153 1291, 1699, 1999, 2357, 2953, 3313, 3907, 4177,
154 4831, 5147, 5647, 6343, 6899, 7103, 7873, 8147 };
155 Aig_Tru_t ** ppSpot, * pEntry;
156 ppSpot = p->pBins + Aig_RManTableHash( pTruth, nVars, p->nBins, s_Primes );
157 for ( pEntry = *ppSpot; pEntry; ppSpot = &pEntry->pNext, pEntry = pEntry->pNext )
158 if ( Kit_TruthIsEqual( pEntry->pTruth, pTruth, nVars ) )
159 return ppSpot;
160 return ppSpot;
161}
Here is the caller graph for this function:

◆ Aig_RManTableResize()

void Aig_RManTableResize ( Aig_RMan_t * p)

Function*************************************************************

Synopsis [Find or add new entry.]

Description []

SideEffects []

SeeAlso []

Definition at line 174 of file aigCanon.c.

175{
176 Aig_Tru_t * pEntry, * pNext;
177 Aig_Tru_t ** pBinsOld, ** ppPlace;
178 int nBinsOld, Counter, i;
179 abctime clk;
180 assert( p->pBins != NULL );
181clk = Abc_Clock();
182 // save the old Bins
183 pBinsOld = p->pBins;
184 nBinsOld = p->nBins;
185 // get the new Bins
186 p->nBins = Abc_PrimeCudd( 3 * nBinsOld );
187 p->pBins = ABC_CALLOC( Aig_Tru_t *, p->nBins );
188 // rehash the entries from the old table
189 Counter = 0;
190 for ( i = 0; i < nBinsOld; i++ )
191 for ( pEntry = pBinsOld[i], pNext = pEntry? pEntry->pNext : NULL;
192 pEntry; pEntry = pNext, pNext = pEntry? pEntry->pNext : NULL )
193 {
194 // get the place where this entry goes in the Bins
195 ppPlace = Aig_RManTableLookup( p, pEntry->pTruth, pEntry->nVars );
196 assert( *ppPlace == NULL ); // should not be there
197 // add the entry to the list
198 *ppPlace = pEntry;
199 pEntry->pNext = NULL;
200 Counter++;
201 }
202 assert( Counter == p->nEntries );
203// ABC_PRT( "Time", Abc_Clock() - clk );
204 ABC_FREE( pBinsOld );
205}
ABC_INT64_T abctime
Definition abc_global.h:332
#define assert(ex)
Definition util_old.h:213
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Aig_RManVarsAreUnique()

int Aig_RManVarsAreUnique ( Aig_VSig_t * pMints,
int nVars )

Function*************************************************************

Synopsis [Returns 1 if all variables are unique.]

Description []

SideEffects []

SeeAlso []

Definition at line 427 of file aigCanon.c.

428{
429 int i;
430 for ( i = 0; i < nVars - 1; i++ )
431 if ( Aig_RManCompareSigs( &pMints[2*i], &pMints[2*(i+1)], nVars ) == 0 )
432 return 0;
433 return 1;
434}
Here is the caller graph for this function: