diff options
author | Alan Mishchenko <alanmi@berkeley.edu> | 2016-04-07 19:16:51 -0700 |
---|---|---|
committer | Alan Mishchenko <alanmi@berkeley.edu> | 2016-04-07 19:16:51 -0700 |
commit | 26ec3868f602d1b2bc03956628a9d78a1aef0df5 (patch) | |
tree | cadc1eb07cff636d93b9947be2294d797dc6e9e1 /src/aig/gia/giaIf.c | |
parent | 887f3c21cc69f4625228cca05016a97d6927aac1 (diff) | |
download | abc-26ec3868f602d1b2bc03956628a9d78a1aef0df5.tar.gz abc-26ec3868f602d1b2bc03956628a9d78a1aef0df5.tar.bz2 abc-26ec3868f602d1b2bc03956628a9d78a1aef0df5.zip |
Adding AIG rehashing after LUT mapping in Gia.
Diffstat (limited to 'src/aig/gia/giaIf.c')
-rw-r--r-- | src/aig/gia/giaIf.c | 57 |
1 files changed, 56 insertions, 1 deletions
diff --git a/src/aig/gia/giaIf.c b/src/aig/gia/giaIf.c index f5071929..e6e326e3 100644 --- a/src/aig/gia/giaIf.c +++ b/src/aig/gia/giaIf.c @@ -2183,9 +2183,15 @@ Gia_Man_t * Gia_ManPerformMapping( Gia_Man_t * p, void * pp ) } else { - // mapping + int fHashMapping = 1; pNew = Gia_ManPerformMappingInt( p, (If_Par_t *)pp ); Gia_ManTransferTiming( pNew, p ); + if ( fHashMapping ) + { + pNew = Gia_ManDupHashMapping( p = pNew ); + Gia_ManTransferTiming( pNew, p ); + Gia_ManStop( p ); + } } pNew->MappedDelay = (int)((If_Par_t *)pp)->FinalDelay; pNew->MappedArea = (int)((If_Par_t *)pp)->FinalArea; @@ -2313,6 +2319,55 @@ void Gia_ManTestStruct( Gia_Man_t * p ) printf( "\n" ); } +/**Function************************************************************* + + Synopsis [Performs hashing for a mapped AIG.] + + Description [] + + SideEffects [] + + SeeAlso [] + +***********************************************************************/ +Gia_Man_t * Gia_ManDupHashMapping( Gia_Man_t * p ) +{ + Gia_Man_t * pNew; + Vec_Int_t * vMapping; + Gia_Obj_t * pObj, * pFanin; + int i, k; + assert( Gia_ManHasMapping(p) ); + // copy the old manager with hashing + pNew = Gia_ManStart( Gia_ManObjNum(p) ); + pNew->pName = Abc_UtilStrsav( p->pName ); + pNew->pSpec = Abc_UtilStrsav( p->pSpec ); + Gia_ManHashAlloc( pNew ); + Gia_ManFillValue( p ); + Gia_ManConst0(p)->Value = 0; + Gia_ManForEachCi( p, pObj, i ) + pObj->Value = Gia_ManAppendCi( pNew ); + Gia_ManForEachAnd( p, pObj, i ) + pObj->Value = Gia_ManHashAnd( pNew, Gia_ObjFanin0Copy(pObj), Gia_ObjFanin1Copy(pObj) ); + Gia_ManForEachCo( p, pObj, i ) + Gia_ManAppendCo( pNew, Gia_ObjFanin0Copy(pObj) ); + Gia_ManHashStop( pNew ); + Gia_ManSetRegNum( pNew, Gia_ManRegNum(p) ); + // recreate mapping + vMapping = Vec_IntAlloc( Vec_IntSize(p->vMapping) ); + Vec_IntFill( vMapping, Gia_ManObjNum(p), 0 ); + Gia_ManForEachLut( p, i ) + { + pObj = Gia_ManObj( p, i ); + Vec_IntWriteEntry( vMapping, Abc_Lit2Var(pObj->Value), Vec_IntSize(vMapping) ); + Vec_IntPush( vMapping, Gia_ObjLutSize(p, i) ); + Gia_LutForEachFaninObj( p, i, pFanin, k ) + Vec_IntPush( vMapping, Abc_Lit2Var(pFanin->Value) ); + Vec_IntPush( vMapping, Abc_Lit2Var(pObj->Value) ); + } + pNew->vMapping = vMapping; + return pNew; +} + //////////////////////////////////////////////////////////////////////// /// END OF FILE /// |