diff options
author | Alan Mishchenko <alanmi@berkeley.edu> | 2008-07-17 08:01:00 -0700 |
---|---|---|
committer | Alan Mishchenko <alanmi@berkeley.edu> | 2008-07-17 08:01:00 -0700 |
commit | d63a0cbbfd3979bb1423946fd1853411fbc66210 (patch) | |
tree | f3e981717d69b3f725ccbdd9a0ad70c9fe9f320e /src/aig/nwk | |
parent | 05772a795bf5808ff30008fc2a36ec965e18c50e (diff) | |
download | abc-d63a0cbbfd3979bb1423946fd1853411fbc66210.tar.gz abc-d63a0cbbfd3979bb1423946fd1853411fbc66210.tar.bz2 abc-d63a0cbbfd3979bb1423946fd1853411fbc66210.zip |
Version abc80717
Diffstat (limited to 'src/aig/nwk')
-rw-r--r-- | src/aig/nwk/nwk.h | 7 | ||||
-rw-r--r-- | src/aig/nwk/nwkMan.c | 2 | ||||
-rw-r--r-- | src/aig/nwk/nwkMerge.c | 43 |
3 files changed, 49 insertions, 3 deletions
diff --git a/src/aig/nwk/nwk.h b/src/aig/nwk/nwk.h index e3d0a061..222130f3 100644 --- a/src/aig/nwk/nwk.h +++ b/src/aig/nwk/nwk.h @@ -24,7 +24,7 @@ #ifdef __cplusplus extern "C" { #endif - + //////////////////////////////////////////////////////////////////////// /// INCLUDES /// //////////////////////////////////////////////////////////////////////// @@ -86,7 +86,10 @@ struct Nwk_Obj_t_ Nwk_Man_t * pMan; // the manager Hop_Obj_t * pFunc; // functionality void * pCopy; // temporary pointer - void * pNext; // temporary pointer + union { + void * pNext; // temporary pointer + int iTemp; // temporary number + }; // node information unsigned Type : 3; // object type unsigned fInvert : 1; // complemented attribute diff --git a/src/aig/nwk/nwkMan.c b/src/aig/nwk/nwkMan.c index d9a41849..252546e8 100644 --- a/src/aig/nwk/nwkMan.c +++ b/src/aig/nwk/nwkMan.c @@ -153,7 +153,7 @@ int Nwk_ManCompareAndSaveBest( Nwk_Man_t * pNtk, void * pNtl ) ParsBest.Nodes = ParsNew.Nodes; ParsBest.nPis = ParsNew.nPis; ParsBest.nPos = ParsNew.nPos; - // writ the network + // write the network Ioa_WriteBlifLogic( pNtk, pNtl, "best.blif" ); // Nwk_ManDumpBlif( pNtk, "best_map.blif", NULL, NULL ); return 1; diff --git a/src/aig/nwk/nwkMerge.c b/src/aig/nwk/nwkMerge.c index 1a5255d3..531bc1c0 100644 --- a/src/aig/nwk/nwkMerge.c +++ b/src/aig/nwk/nwkMerge.c @@ -348,6 +348,45 @@ void Nwk_ManGraphPrepare( Nwk_Grf_t * p ) /**Function************************************************************* + Synopsis [Sort pairs by the first vertex in the topological order.] + + Description [] + + SideEffects [] + + SeeAlso [] + +***********************************************************************/ +void Nwk_ManGraphSortPairs( Nwk_Grf_t * p ) +{ + int nSize = Vec_IntSize(p->vPairs); + int * pIdToPair, i; + // allocate storage + pIdToPair = ALLOC( int, p->nObjs+1 ); + for ( i = 0; i <= p->nObjs; i++ ) + pIdToPair[i] = -1; + // create mapping + for ( i = 0; i < p->vPairs->nSize; i += 2 ) + { + assert( pIdToPair[ p->vPairs->pArray[i] ] == -1 ); + pIdToPair[ p->vPairs->pArray[i] ] = p->vPairs->pArray[i+1]; + } + // recreate pairs + Vec_IntClear( p->vPairs ); + for ( i = 0; i <= p->nObjs; i++ ) + if ( pIdToPair[i] >= 0 ) + { + assert( i < pIdToPair[i] ); + Vec_IntPush( p->vPairs, i ); + Vec_IntPush( p->vPairs, pIdToPair[i] ); + } + assert( nSize == Vec_IntSize(p->vPairs) ); + free( pIdToPair ); +} + + +/**Function************************************************************* + Synopsis [Updates the problem after pulling out one edge.] Description [] @@ -615,6 +654,7 @@ void Nwk_ManGraphSolve( Nwk_Grf_t * p ) if ( j == NWK_MAX_LIST + 1 ) break; } + Nwk_ManGraphSortPairs( p ); } /**Function************************************************************* @@ -982,6 +1022,9 @@ Vec_Int_t * Nwk_ManLutMerge( Nwk_Man_t * pNtk, Nwk_LMPars_t * pPars ) Nwk_ManGraphReportMemoryUsage( p ); } vResult = p->vPairs; p->vPairs = NULL; + for ( i = 0; i < vResult->nSize; i += 2 ) + printf( "(%d,%d) ", vResult->pArray[i], vResult->pArray[i+1] ); + printf( "\n" ); Nwk_ManGraphFree( p ); return vResult; } |