diff options
author | Alan Mishchenko <alanmi@berkeley.edu> | 2020-03-18 22:34:08 -0700 |
---|---|---|
committer | Alan Mishchenko <alanmi@berkeley.edu> | 2020-03-18 22:34:08 -0700 |
commit | 6a6ffed8c545cd76d479da6a8a1d1e5aa35b1037 (patch) | |
tree | bd13cd66aa186c654d126d25e06a460e3aa28d34 /src/aig | |
parent | e72438b2d3b83d9a5ac646a2499f4374b29ebfbd (diff) | |
download | abc-6a6ffed8c545cd76d479da6a8a1d1e5aa35b1037.tar.gz abc-6a6ffed8c545cd76d479da6a8a1d1e5aa35b1037.tar.bz2 abc-6a6ffed8c545cd76d479da6a8a1d1e5aa35b1037.zip |
Various changes.
Diffstat (limited to 'src/aig')
-rw-r--r-- | src/aig/gia/gia.h | 2 | ||||
-rw-r--r-- | src/aig/gia/giaMan.c | 6 | ||||
-rw-r--r-- | src/aig/gia/giaMuxes.c | 2 | ||||
-rw-r--r-- | src/aig/gia/giaSimBase.c | 114 |
4 files changed, 106 insertions, 18 deletions
diff --git a/src/aig/gia/gia.h b/src/aig/gia/gia.h index c3842fe1..af5c82b8 100644 --- a/src/aig/gia/gia.h +++ b/src/aig/gia/gia.h @@ -233,7 +233,7 @@ struct Gia_Man_t_ Vec_Wrd_t * vSuppWords; // support information Vec_Int_t vCopiesTwo; // intermediate copies Vec_Int_t vSuppVars; // used variables - Gia_Dat_t * pUserData; + Gia_Dat_t * pUData; }; diff --git a/src/aig/gia/giaMan.c b/src/aig/gia/giaMan.c index 0958cdfa..447ecea9 100644 --- a/src/aig/gia/giaMan.c +++ b/src/aig/gia/giaMan.c @@ -82,7 +82,7 @@ Gia_Man_t * Gia_ManStart( int nObjsMax ) void Gia_ManStop( Gia_Man_t * p ) { extern void Gia_DatFree( Gia_Dat_t * p ); - Gia_DatFree( p->pUserData ); + Gia_DatFree( p->pUData ); if ( p->vSeqModelVec ) Vec_PtrFreeFree( p->vSeqModelVec ); Gia_ManStaticFanoutStop( p ); @@ -487,6 +487,7 @@ void Gia_ManLogAigStats( Gia_Man_t * p, char * pDumpFile ) void Gia_ManPrintStats( Gia_Man_t * p, Gps_Par_t * pPars ) { extern float Gia_ManLevelAve( Gia_Man_t * p ); + int fHaveLevels = p->vLevels != NULL; if ( pPars && pPars->fMiter ) { Gia_ManPrintStatsMiter( p, 0 ); @@ -542,7 +543,8 @@ void Gia_ManPrintStats( Gia_Man_t * p, Gps_Par_t * pPars ) Abc_Print( 1, " %s(%.2f)%s", "\033[1;35m", Gia_ManLevelAve(p), "\033[0m" ); #endif } - Vec_IntFreeP( &p->vLevels ); + if ( !fHaveLevels ) + Vec_IntFreeP( &p->vLevels ); if ( pPars && pPars->fCut ) Abc_Print( 1, " cut = %d(%d)", Gia_ManCrossCut(p, 0), Gia_ManCrossCut(p, 1) ); Abc_Print( 1, " mem =%5.2f MB", Gia_ManMemory(p)/(1<<20) ); diff --git a/src/aig/gia/giaMuxes.c b/src/aig/gia/giaMuxes.c index c0414d14..5182336f 100644 --- a/src/aig/gia/giaMuxes.c +++ b/src/aig/gia/giaMuxes.c @@ -162,7 +162,7 @@ Gia_Man_t * Gia_ManDupNoMuxes( Gia_Man_t * p ) Gia_Man_t * pNew, * pTemp; Gia_Obj_t * pObj; int i; - assert( p->pMuxes != NULL ); + assert( p->pMuxes != NULL || Gia_ManXorNum(p) ); // start the new manager pNew = Gia_ManStart( 5000 ); pNew->pName = Abc_UtilStrsav( p->pName ); diff --git a/src/aig/gia/giaSimBase.c b/src/aig/gia/giaSimBase.c index 95508d70..825c01ca 100644 --- a/src/aig/gia/giaSimBase.c +++ b/src/aig/gia/giaSimBase.c @@ -188,7 +188,7 @@ Vec_Wrd_t * Gia_ManSimCombine( int nInputs, Vec_Wrd_t * vBase, Vec_Wrd_t * vAddO for ( w = 0; w < nWordsUse; w++ ) Vec_WrdPush( vSimsIn, pSimsA[w] ); } - assert( Vec_WrdSize(vSimsIn) == Vec_WrdCap(vSimsIn) ); + assert( Vec_WrdSize(vSimsIn) == Vec_WrdCap(vSimsIn) || Vec_WrdSize(vSimsIn) < 16 ); return vSimsIn; } int Gia_ManSimBitPackOne( int nWords, Vec_Wrd_t * vSimsIn, Vec_Wrd_t * vSimsCare, int iPat, int * pLits, int nLits ) @@ -819,13 +819,83 @@ Vec_Wrd_t * Gia_ManSimRel( Gia_Man_t * p, Vec_Int_t * vObjs, Vec_Wrd_t * vVals ) SeeAlso [] ***********************************************************************/ +Vec_Wrd_t * Gia_ManSimRelDeriveFuncs( Gia_Man_t * p, Vec_Wrd_t * vRel, int nOuts ) +{ + int i, k, m, nMints = 1 << nOuts, nWords = Vec_WrdSize(vRel) / nMints; + Vec_Wrd_t * vFuncs = Vec_WrdStart( nOuts * nWords ); + assert( Vec_WrdSize(vRel) % nMints == 0 ); + for ( i = 0; i < 64 * nWords; i++ ) + { + for ( m = 0; m < nMints; m++ ) + if ( Abc_TtGetBit( Vec_WrdArray(vRel), i*nMints+m ) ) + break; + assert( m < nMints ); + for ( k = 0; k < nOuts; k++ ) + if ( (m >> k) & 1 ) + Abc_TtSetBit( Vec_WrdEntryP(vFuncs, k*nWords), i ); + } + return vFuncs; +} +Vec_Wrd_t * Gia_ManSimRelDeriveFuncs2( Gia_Man_t * p, Vec_Wrd_t * vRel, int nOuts ) +{ + int i, k, m, nMints = 1 << nOuts, nWords = Vec_WrdSize(vRel) / nMints; + Vec_Wrd_t * vFuncs = Vec_WrdStart( 2 * nOuts * nWords ); + assert( Vec_WrdSize(vRel) % nMints == 0 ); + for ( i = 0; i < 64 * nWords; i++ ) + { + for ( m = 0; m < nMints; m++ ) + if ( Abc_TtGetBit( Vec_WrdArray(vRel), i*nMints+m ) ) + break; + assert( m < nMints ); + for ( k = 0; k < nOuts; k++ ) + { + if ( Abc_TtGetBit( Vec_WrdArray(vRel), i*nMints+(m^(1<<k)) ) ) + continue; + if ( (m >> k) & 1 ) + Abc_TtSetBit( Vec_WrdEntryP(vFuncs, (2*k+1)*nWords), i ); + else + Abc_TtSetBit( Vec_WrdEntryP(vFuncs, (2*k+0)*nWords), i ); + } + if ( 0 ) + { + for ( m = 0; m < nMints; m++ ) + printf( "%d", Abc_TtGetBit( Vec_WrdArray(vRel), i*nMints+m ) ); + printf( " " ); + for ( k = 0; k < nOuts; k++ ) + { + if ( Abc_TtGetBit( Vec_WrdEntryP(vFuncs, (2*k+0)*nWords), i ) ) + printf( "0" ); + else if ( Abc_TtGetBit( Vec_WrdEntryP(vFuncs, (2*k+1)*nWords), i ) ) + printf( "1" ); + else + printf( "-" ); + } + printf( "\n" ); + } + } + return vFuncs; +} + +/**Function************************************************************* + + Synopsis [] + + Description [] + + SideEffects [] + + SeeAlso [] + +***********************************************************************/ void Gia_ManSimRelPrint( Gia_Man_t * p, Vec_Wrd_t * vRel, Vec_Int_t * vOutMints ) { int nWords = Vec_WrdSize(p->vSimsPi) / Gia_ManCiNum(p); int nMints = Vec_WrdSize(vRel) / nWords; - int i, k, m, Count; + int i, m, Count; +/* for ( i = 0; i < 64 * nWords; i++ ) { + int k; for ( k = 0; k < Gia_ManCiNum(p); k++ ) printf( "%d", Abc_TtGetBit( Vec_WrdEntryP(p->vSimsPi, k), i ) ); printf( " " ); @@ -846,6 +916,27 @@ void Gia_ManSimRelPrint( Gia_Man_t * p, Vec_Wrd_t * vRel, Vec_Int_t * vOutMints } printf( "\n" ); } +*/ +/* + for ( i = 0; i < 64 * nWords; i++ ) + { + Count = 0; + for ( m = 0; m < nMints; m++ ) + Count += Abc_TtGetBit( Vec_WrdArray(vRel), i*nMints+m ); + printf( "%d ", Count ); + } + printf( "\n" ); +*/ + for ( i = 0; i < 64 * nWords; i++ ) + { + Count = 0; + for ( m = 0; m < nMints; m++ ) + { + printf( "%d", Abc_TtGetBit( Vec_WrdArray(vRel), i*nMints+m ) ); + Count += Abc_TtGetBit( Vec_WrdArray(vRel), i*nMints+m ); + } + printf( " Count = %2d \n", Count ); + } } Vec_Int_t * Gia_ManSimPatStart( int nItems ) { @@ -871,11 +962,6 @@ void Gia_ManSimRelTest( Gia_Man_t * p ) - - - - - /**Function************************************************************* Synopsis [] @@ -1074,9 +1160,9 @@ void Gia_SimAbsSolve( Gia_SimAbsMan_t * p ) } printf( "Solution %2d for covering problem [%5d x %5d]: ", Vec_IntSize(p->vResub), Vec_IntSize(p->vPatPairs)/2, p->nCands ); Vec_IntForEachEntry( p->vResub, iPat, i ) - printf( "%4d ", iPat ); - for ( ; i < 16; i++ ) - printf( " " ); + printf( "%6d ", iPat ); + for ( ; i < 12; i++ ) + printf( " " ); printf( " " ); Abc_PrintTime( 1, "Time", Abc_Clock() - clk ); } @@ -1130,14 +1216,14 @@ void Gia_SimAbsInit( Gia_SimAbsMan_t * p ) Vec_Int_t * vValue0 = Gia_SimAbsFind( p->vValues, 0 ); Vec_Int_t * vValue1 = Gia_SimAbsFind( p->vValues, 1 ); Vec_IntClear( p->vPatPairs ); - printf( "There %d offset and %d onset minterms (%d pairs).\n", Vec_IntSize(vValue0), Vec_IntSize(vValue1), Vec_IntSize(vValue0)*Vec_IntSize(vValue1) ); - Gia_ManRandom( 1 ); + printf( "There are %d offset and %d onset minterms (%d pairs).\n", Vec_IntSize(vValue0), Vec_IntSize(vValue1), Vec_IntSize(vValue0)*Vec_IntSize(vValue1) ); + Abc_Random( 1 ); assert( Vec_IntSize(vValue0) > 0 ); assert( Vec_IntSize(vValue1) > 0 ); for ( n = 0; n < nPairsInit; n++ ) Vec_IntPushTwo( p->vPatPairs, - Vec_IntEntry(vValue0, Gia_ManRandom(0) % Vec_IntSize(vValue0)), - Vec_IntEntry(vValue1, Gia_ManRandom(0) % Vec_IntSize(vValue1)) ); + Vec_IntEntry(vValue0, Abc_Random(0) % Vec_IntSize(vValue0)), + Vec_IntEntry(vValue1, Abc_Random(0) % Vec_IntSize(vValue1)) ); Vec_IntFree( vValue0 ); Vec_IntFree( vValue1 ); } |