From e855eaa080c0ac1162ff8a8b5d227dce0c456997 Mon Sep 17 00:00:00 2001 From: Alan Mishchenko Date: Fri, 11 Apr 2014 12:01:36 -0700 Subject: Improvements to DSD in technology mapping. --- src/map/if/if.h | 5 +++-- src/map/if/ifMan.c | 3 --- src/map/if/ifMap.c | 20 ++++++-------------- 3 files changed, 9 insertions(+), 19 deletions(-) (limited to 'src/map/if') diff --git a/src/map/if/if.h b/src/map/if/if.h index 8914b464..7e0edaf8 100644 --- a/src/map/if/if.h +++ b/src/map/if/if.h @@ -385,6 +385,7 @@ static inline void If_ObjSetChoice( If_Obj_t * pObj, If_Obj_t * pEqu ) { p static inline int If_CutLeaveNum( If_Cut_t * pCut ) { return pCut->nLeaves; } static inline int * If_CutLeaves( If_Cut_t * pCut ) { return pCut->pLeaves; } +static inline If_Obj_t * If_CutLeaf( If_Man_t * p, If_Cut_t * pCut, int i ) { assert(i >= 0 && i < (int)pCut->nLeaves); return If_ManObj(p, pCut->pLeaves[i]); } static inline unsigned If_CutSuppMask( If_Cut_t * pCut ) { return (~(unsigned)0) >> (32-pCut->nLeaves); } static inline int If_CutTruthWords( int nVarsMax ) { return nVarsMax <= 5 ? 2 : (1 << (nVarsMax - 5)); } static inline int If_CutPermWords( int nVarsMax ) { return nVarsMax / sizeof(int) + ((nVarsMax % sizeof(int)) > 0); } @@ -413,8 +414,8 @@ static inline unsigned * If_CutTruthUR( If_Man_t * p, If_Cut_t * pCut) { r static inline word * If_CutTruthW( If_Man_t * p, If_Cut_t * pCut ) { if ( p->vTtMem == NULL ) return NULL; assert( pCut->iCutFunc >= 0 ); Abc_TtCopy( p->puTempW, If_CutTruthWR(p, pCut), p->nTruth6Words[pCut->nLeaves], If_CutTruthIsCompl(pCut) ); return p->puTempW; } static inline unsigned * If_CutTruth( If_Man_t * p, If_Cut_t * pCut ) { return (unsigned *)If_CutTruthW(p, pCut); } static inline int If_CutDsdLit( If_Man_t * p, If_Cut_t * pCut ) { return Abc_Lit2LitL( Vec_IntArray(p->vTtDsds[pCut->nLeaves]), If_CutTruthLit(pCut) ); } -static inline int If_CutDsdIsCompl( If_Man_t * p, If_Cut_t * pCut ) { return Abc_LitIsCompl( If_CutDsdLit(p, pCut) ); } -static inline If_Obj_t * If_CutLeaf( If_Man_t * p, If_Cut_t * pCut, int i ) { assert(i >= 0 && i < (int)pCut->nLeaves); return If_ManObj(p, pCut->pLeaves[i]); } +static inline int If_CutDsdIsCompl( If_Man_t * p, If_Cut_t * pCut ) { return Abc_LitIsCompl( If_CutDsdLit(p, pCut) ); } +static inline char * If_CutDsdPerm( If_Man_t * p, If_Cut_t * pCut ) { return Vec_StrEntryP( p->vTtPerms[pCut->nLeaves], Abc_Lit2Var(pCut->iCutFunc) * Abc_MaxInt(6, pCut->nLeaves) ); } static inline float If_CutLutArea( If_Man_t * p, If_Cut_t * pCut ) { return pCut->fUser? (float)pCut->Cost : (p->pPars->pLutLib? p->pPars->pLutLib->pLutAreas[pCut->nLeaves] : (float)1.0); } static inline float If_CutLutDelay( If_LibLut_t * p, int Size, int iPin ) { return p ? (p->fVarPinDelays ? p->pLutDelays[Size][iPin] : p->pLutDelays[Size][0]) : 1.0; } diff --git a/src/map/if/ifMan.c b/src/map/if/ifMan.c index 6628a70a..c13fc57a 100644 --- a/src/map/if/ifMan.c +++ b/src/map/if/ifMan.c @@ -484,11 +484,8 @@ void If_ManSetupCutTriv( If_Man_t * p, If_Cut_t * pCut, int ObjId ) pCut->pLeaves[0] = p->pPars->fLiftLeaves? (ObjId << 8) : ObjId; pCut->uSign = If_ObjCutSign( pCut->pLeaves[0] ); pCut->iCutFunc = p->pPars->fUseTtPerm ? 3 : (p->pPars->fTruth ? 2: -1); -// pCut->iCutDsd = p->pPars->fUseTtPerm ? 0 : (p->pPars->fUseDsd ? 2: -1); pCut->uMaskFunc = 0; assert( pCut->pLeaves[0] < p->vObjs->nSize ); - if ( p->pPars->fUseDsd ) - pCut->pPerm[0] = 0; } /**Function************************************************************* diff --git a/src/map/if/ifMap.c b/src/map/if/ifMap.c index e1d69501..a15cd4ce 100644 --- a/src/map/if/ifMap.c +++ b/src/map/if/ifMap.c @@ -98,7 +98,7 @@ void If_ObjPerformMappingAnd( If_Man_t * p, If_Obj_t * pObj, int Mode, int fPrep If_Cut_t * pCut0, * pCut1, * pCut; If_Cut_t * pCut0R, * pCut1R; int fFunc0R, fFunc1R; - int i, k, v, fChange; + int i, k, v, iCutDsd, fChange; int fSave0 = p->pPars->fDelayOpt || p->pPars->fDelayOptLut || p->pPars->fDsdBalance || p->pPars->fUserRecLib; assert( !If_ObjIsAnd(pObj->pFanin0) || pObj->pFanin0->pCutSet->nCuts > 0 ); assert( !If_ObjIsAnd(pObj->pFanin1) || pObj->pFanin1->pCutSet->nCuts > 0 ); @@ -191,7 +191,6 @@ void If_ObjPerformMappingAnd( If_Man_t * p, If_Obj_t * pObj, int Mode, int fPrep continue; // compute the truth table pCut->iCutFunc = -1; -// pCut->iCutDsd = -1; pCut->fCompl = 0; if ( p->pPars->fTruth ) { @@ -211,26 +210,19 @@ void If_ObjPerformMappingAnd( If_Man_t * p, If_Obj_t * pObj, int Mode, int fPrep { extern void If_ManCacheRecord( If_Man_t * p, int iDsd0, int iDsd1, int nShared, int iDsd ); int truthId = Abc_Lit2Var(pCut->iCutFunc); - if ( Vec_IntSize(p->vTtDsds[pCut->nLeaves]) <= truthId || Vec_IntEntry(p->vTtDsds[pCut->nLeaves], truthId) == -1 ) + if ( truthId >= Vec_IntSize(p->vTtDsds[pCut->nLeaves]) || Vec_IntEntry(p->vTtDsds[pCut->nLeaves], truthId) == -1 ) { - int iCutDsd = If_DsdManCompute( p->pIfDsdMan, If_CutTruthWR(p, pCut), pCut->nLeaves, (unsigned char *)pCut->pPerm, p->pPars->pLutStruct ); - while ( Vec_IntSize(p->vTtDsds[pCut->nLeaves]) <= truthId ) + while ( truthId >= Vec_IntSize(p->vTtDsds[pCut->nLeaves]) ) { Vec_IntPush( p->vTtDsds[pCut->nLeaves], -1 ); for ( v = 0; v < Abc_MaxInt(6, pCut->nLeaves); v++ ) Vec_StrPush( p->vTtPerms[pCut->nLeaves], IF_BIG_CHAR ); } + iCutDsd = If_DsdManCompute( p->pIfDsdMan, If_CutTruthWR(p, pCut), pCut->nLeaves, (unsigned char *)If_CutDsdPerm(p, pCut), p->pPars->pLutStruct ); Vec_IntWriteEntry( p->vTtDsds[pCut->nLeaves], truthId, iCutDsd ); - for ( v = 0; v < (int)pCut->nLeaves; v++ ) - Vec_StrWriteEntry( p->vTtPerms[pCut->nLeaves], truthId * Abc_MaxInt(6, pCut->nLeaves) + v, (char)pCut->pPerm[v] ); } - else - { - assert( If_DsdManSuppSize(p->pIfDsdMan, If_CutDsdLit(p, pCut)) == (int)pCut->nLeaves ); - for ( v = 0; v < (int)pCut->nLeaves; v++ ) - pCut->pPerm[v] = (unsigned char)Vec_StrEntry( p->vTtPerms[pCut->nLeaves], truthId * Abc_MaxInt(6, pCut->nLeaves) + v ); - } -// If_ManCacheRecord( p, If_CutDsdLit(p, pCut0), If_CutDsdLit(p, pCut1), nShared, If_CutDsdLit(p, pCut) ); + assert( If_DsdManSuppSize(p->pIfDsdMan, If_CutDsdLit(p, pCut)) == (int)pCut->nLeaves ); + //If_ManCacheRecord( p, If_CutDsdLit(p, pCut0), If_CutDsdLit(p, pCut1), nShared, If_CutDsdLit(p, pCut) ); } // run user functions pCut->fUseless = 0; -- cgit v1.2.3