diff options
author | Alan Mishchenko <alanmi@berkeley.edu> | 2013-09-25 15:29:01 -0700 |
---|---|---|
committer | Alan Mishchenko <alanmi@berkeley.edu> | 2013-09-25 15:29:01 -0700 |
commit | 531657105b2d41d0ad4652dce3cca32a3f5b0194 (patch) | |
tree | 1b4854f5ad58f877269303c95833d8c1380d9973 /src | |
parent | a55b178729aed0cee447b7a0a6df57e00062adbe (diff) | |
download | abc-531657105b2d41d0ad4652dce3cca32a3f5b0194.tar.gz abc-531657105b2d41d0ad4652dce3cca32a3f5b0194.tar.bz2 abc-531657105b2d41d0ad4652dce3cca32a3f5b0194.zip |
Improving DAG-aware unmapping.
Diffstat (limited to 'src')
-rw-r--r-- | src/aig/gia/giaShrink7.c | 165 | ||||
-rw-r--r-- | src/aig/gia/module.make | 1 | ||||
-rw-r--r-- | src/base/abci/abc.c | 8 | ||||
-rw-r--r-- | src/misc/extra/extraUtilDsd.c | 7 | ||||
-rw-r--r-- | src/misc/vec/vecHsh4.h | 3 |
5 files changed, 178 insertions, 6 deletions
diff --git a/src/aig/gia/giaShrink7.c b/src/aig/gia/giaShrink7.c new file mode 100644 index 00000000..1747a79e --- /dev/null +++ b/src/aig/gia/giaShrink7.c @@ -0,0 +1,165 @@ +/**CFile**************************************************************** + + FileName [giaShrink7.c] + + SystemName [ABC: Logic synthesis and verification system.] + + PackageName [Scalable AIG package.] + + Synopsis [Implementation of DAG-aware unmapping for 6-input cuts.] + + Author [Alan Mishchenko] + + Affiliation [UC Berkeley] + + Date [Ver. 1.0. Started - June 20, 2005.] + + Revision [$Id: giaShrink6.c,v 1.00 2005/06/20 00:00:00 alanmi Exp $] + +***********************************************************************/ + +#include "gia.h" +#include "misc/vec/vecHsh4.h" +#include "misc/util/utilTruth.h" + + +ABC_NAMESPACE_IMPL_START + +//////////////////////////////////////////////////////////////////////// +/// DECLARATIONS /// +//////////////////////////////////////////////////////////////////////// + +// operation manager +typedef struct Unm_Man_t_ Unm_Man_t; +struct Unm_Man_t_ +{ + Gia_Man_t * pGia; // user's AIG + Gia_Man_t * pNew; // constructed AIG + Hsh_Int4Man_t * pHash; // hash table + int nNewSize; // expected size of new manager + Vec_Wrd_t * vTruths; // truth tables + Vec_Int_t * vLeaves; // temporary storage for leaves + abctime clkStart; // starting the clock +}; + +extern word Shr_ManComputeTruth6( Gia_Man_t * p, Gia_Obj_t * pObj, Vec_Int_t * vLeaves, Vec_Wrd_t * vTruths ); + +//////////////////////////////////////////////////////////////////////// +/// FUNCTION DEFINITIONS /// +//////////////////////////////////////////////////////////////////////// + +/**Function************************************************************* + + Synopsis [] + + Description [] + + SideEffects [] + + SeeAlso [] + +***********************************************************************/ +Unm_Man_t * Unm_ManAlloc( Gia_Man_t * pGia ) +{ + Unm_Man_t * p; + p = ABC_CALLOC( Unm_Man_t, 1 ); + p->clkStart = Abc_Clock(); + p->nNewSize = 3 * Gia_ManObjNum(pGia) / 2; + p->pGia = pGia; + p->pNew = Gia_ManStart( p->nNewSize ); + p->pNew->pName = Abc_UtilStrsav( pGia->pName ); + p->pNew->pSpec = Abc_UtilStrsav( pGia->pSpec ); + Gia_ManHashAlloc( p->pNew ); + Gia_ManCleanLevels( p->pNew, p->nNewSize ); + // allocate traversal IDs + p->pNew->nObjs = p->nNewSize; + Gia_ManIncrementTravId( p->pNew ); + p->pNew->nObjs = 1; + // start hashing + p->pHash = Hsh_Int4ManStart( 10 ); + // truth tables + p->vTruths = Vec_WrdStart( Gia_ManObjNum(pGia) ); + p->vLeaves = Vec_IntStart( 10 ); + return p; +} +Gia_Man_t * Unm_ManFree( Unm_Man_t * p ) +{ + Gia_Man_t * pTemp = p->pNew; p->pNew = NULL; + Gia_ManHashStop( pTemp ); + Vec_IntFreeP( &pTemp->vLevels ); + Gia_ManSetRegNum( pTemp, Gia_ManRegNum(p->pGia) ); + // truth tables + Vec_WrdFreeP( &p->vTruths ); + Vec_IntFreeP( &p->vLeaves ); + // free data structures + Hsh_Int4ManStop( p->pHash ); + ABC_FREE( p ); + + Gia_ManStop( pTemp ); + pTemp = NULL; + + return pTemp; +} + +/**Function************************************************************* + + Synopsis [] + + Description [] + + SideEffects [] + + SeeAlso [] + +***********************************************************************/ +void Unm_ManComputeTruths( Unm_Man_t * p ) +{ + Vec_Wrd_t * vTruths2; + Gia_Obj_t * pObj; + int i, k, iNode; + word uTruth; + vTruths2 = Vec_WrdStart( Gia_ManObjNum(p->pGia) ); + Gia_ManForEachLut( p->pGia, i ) + { + pObj = Gia_ManObj( p->pGia, i ); + // collect leaves of this gate + Vec_IntClear( p->vLeaves ); + Gia_LutForEachFanin( p->pGia, i, iNode, k ) + Vec_IntPush( p->vLeaves, iNode ); + assert( Vec_IntSize(p->vLeaves) <= 6 ); + // compute truth table + uTruth = Shr_ManComputeTruth6( p->pGia, pObj, p->vLeaves, vTruths2 ); + Vec_WrdWriteEntry( p->vTruths, i, uTruth ); + if ( i % 100 == 0 ) + Kit_DsdPrintFromTruth( (unsigned *)&uTruth, 6 ), printf( "\n" ); + } + Vec_WrdFreeP( &vTruths2 ); +} + +/**Function************************************************************* + + Synopsis [] + + Description [] + + SideEffects [] + + SeeAlso [] + +***********************************************************************/ +Gia_Man_t * Unm_ManTest( Gia_Man_t * pGia ) +{ + Unm_Man_t * p; + p = Unm_ManAlloc( pGia ); + Unm_ManComputeTruths( p ); + Abc_PrintTime( 1, "Time", Abc_Clock() - p->clkStart ); + return Unm_ManFree( p ); +} + +//////////////////////////////////////////////////////////////////////// +/// END OF FILE /// +//////////////////////////////////////////////////////////////////////// + + +ABC_NAMESPACE_IMPL_END + diff --git a/src/aig/gia/module.make b/src/aig/gia/module.make index 37e4bccb..e28c9ad1 100644 --- a/src/aig/gia/module.make +++ b/src/aig/gia/module.make @@ -36,6 +36,7 @@ SRC += src/aig/gia/giaAig.c \ src/aig/gia/giaScl.c \ src/aig/gia/giaShrink.c \ src/aig/gia/giaShrink6.c \ + src/aig/gia/giaShrink7.c \ src/aig/gia/giaSim.c \ src/aig/gia/giaSim2.c \ src/aig/gia/giaSort.c \ diff --git a/src/base/abci/abc.c b/src/base/abci/abc.c index b979ad67..30be411f 100644 --- a/src/base/abci/abc.c +++ b/src/base/abci/abc.c @@ -33403,7 +33403,8 @@ int Abc_CommandAbc9Test( Abc_Frame_t * pAbc, int argc, char ** argv ) // extern void Gia_ManMuxProfiling( Gia_Man_t * p ); // extern Gia_Man_t * Mig_ManTest( Gia_Man_t * pGia ); // extern Gia_Man_t * Gia_ManInterTest( Gia_Man_t * p ); - extern Gia_Man_t * Llb_ReachableStatesGia( Gia_Man_t * p ); +// extern Gia_Man_t * Llb_ReachableStatesGia( Gia_Man_t * p ); + extern Gia_Man_t * Unm_ManTest( Gia_Man_t * pGia ); Extra_UtilGetoptReset(); while ( ( c = Extra_UtilGetopt( argc, argv, "Fsvh" ) ) != EOF ) @@ -33477,8 +33478,9 @@ int Abc_CommandAbc9Test( Abc_Frame_t * pAbc, int argc, char ** argv ) // Abc_FrameUpdateGia( pAbc, pTemp ); // pTemp = Gia_ManInterTest( pAbc->pGia ); // Abc_FrameUpdateGia( pAbc, pTemp ); - pTemp = Llb_ReachableStatesGia( pAbc->pGia ); - Abc_FrameUpdateGia( pAbc, pTemp ); +// pTemp = Llb_ReachableStatesGia( pAbc->pGia ); +// Abc_FrameUpdateGia( pAbc, pTemp ); + Unm_ManTest( pAbc->pGia ); return 0; usage: Abc_Print( -2, "usage: &test [-F num] [-svh]\n" ); diff --git a/src/misc/extra/extraUtilDsd.c b/src/misc/extra/extraUtilDsd.c index cf1d3ade..ea95598b 100644 --- a/src/misc/extra/extraUtilDsd.c +++ b/src/misc/extra/extraUtilDsd.c @@ -1214,14 +1214,15 @@ void Sdm_ManDivTest() Vec_WrdForEachEntry( vDivs, u, i ) { printf( "%2d : ", i ); - Kit_DsdPrintFromTruth( (unsigned *)&u, 6 ); printf( "\n" ); +// Kit_DsdPrintFromTruth( (unsigned *)&u, 6 ); + printf( "\n" ); } RetValue = Rsb_ManPerformResub6( pManRsb, 6, t, vDivs, &t0, &t1, 1 ); if ( RetValue ) { - Kit_DsdPrintFromTruth( (unsigned *)&t0, 6 ); printf( "\n" ); - Kit_DsdPrintFromTruth( (unsigned *)&t1, 6 ); printf( "\n" ); +// Kit_DsdPrintFromTruth( (unsigned *)&t0, 6 ); printf( "\n" ); +// Kit_DsdPrintFromTruth( (unsigned *)&t1, 6 ); printf( "\n" ); printf( "Decomposition exits.\n" ); } diff --git a/src/misc/vec/vecHsh4.h b/src/misc/vec/vecHsh4.h index bd44f35e..af48f32b 100644 --- a/src/misc/vec/vecHsh4.h +++ b/src/misc/vec/vecHsh4.h @@ -60,6 +60,9 @@ struct Hsh_Int4Man_t_ //////////////////////////////////////////////////////////////////////// static inline Hsh_Int4Obj_t * Hsh_Int4Obj( Hsh_Int4Man_t * p, int iObj ) { return iObj ? (Hsh_Int4Obj_t *)Vec_IntEntryP(p->vObjs, 4*iObj) : NULL; } +static inline int Hsh_Int4ObjRes( Hsh_Int4Man_t * p, int i ) { return Hsh_Int4Obj(p, i)->iRes; } +static inline void Hsh_Int4ObjInc( Hsh_Int4Man_t * p, int i ) { Hsh_Int4Obj(p, i)->iRes++; } +static inline void Hsh_Int4ObjDec( Hsh_Int4Man_t * p, int i ) { Hsh_Int4Obj(p, i)->iRes--; } //////////////////////////////////////////////////////////////////////// /// FUNCTION DEFINITIONS /// |