From 9291ab9f50a38717827a30f90418b3ecfa5110df Mon Sep 17 00:00:00 2001 From: Alan Mishchenko Date: Wed, 2 Apr 2014 20:20:07 -0700 Subject: Improvements to technology mapping. --- src/aig/gia/giaIf.c | 11 ++++++++--- src/aig/gia/giaJf.c | 2 +- src/map/if/ifMan.c | 6 +++--- src/misc/vec/vecMem.h | 7 +++++-- 4 files changed, 17 insertions(+), 9 deletions(-) diff --git a/src/aig/gia/giaIf.c b/src/aig/gia/giaIf.c index d8a354e4..1c9ecca5 100644 --- a/src/aig/gia/giaIf.c +++ b/src/aig/gia/giaIf.c @@ -1308,10 +1308,15 @@ Gia_Man_t * Gia_ManFromIfLogic( If_Man_t * pIfMan ) pIfObj->iCopy = Gia_ManFromIfLogicCreateLut( pNew, If_CutTruthW(pIfMan, pCutBest), vLeaves, vCover, vMapping, vMapping2 ); pIfObj->iCopy = Abc_LitNotCond( pIfObj->iCopy, pCutBest->fCompl ); } - else if ( (pIfMan->pPars->fDeriveLuts && pIfMan->pPars->fTruth) || pIfMan->pPars->fUseDsd ) + else if ( (pIfMan->pPars->fDeriveLuts && pIfMan->pPars->fTruth) || pIfMan->pPars->fUseDsd || pIfMan->pPars->fUseTtPerm ) { + word * pTruth = If_CutTruthW(pIfMan, pCutBest); + if ( pIfMan->pPars->fUseTtPerm ) + for ( k = 0; k < (int)pCutBest->nLeaves; k++ ) + if ( (pCutBest->iCutDsd >> k) & 1 ) + Abc_TtFlip( pTruth, Abc_TtWordNum(pCutBest->nLimit), k ); // perform decomposition of the cut - pIfObj->iCopy = Gia_ManFromIfLogicNode( pIfMan, pNew, i, vLeaves, vLeaves2, If_CutTruthW(pIfMan, pCutBest), pIfMan->pPars->pLutStruct, vCover, vMapping, vMapping2, vPacking, (pIfMan->pPars->fEnableCheck75 || pIfMan->pPars->fEnableCheck75u), pIfMan->pPars->fEnableCheck07 ); + pIfObj->iCopy = Gia_ManFromIfLogicNode( pIfMan, pNew, i, vLeaves, vLeaves2, pTruth, pIfMan->pPars->pLutStruct, vCover, vMapping, vMapping2, vPacking, (pIfMan->pPars->fEnableCheck75 || pIfMan->pPars->fEnableCheck75u), pIfMan->pPars->fEnableCheck07 ); pIfObj->iCopy = Abc_LitNotCond( pIfObj->iCopy, pCutBest->fCompl ); } else @@ -1528,7 +1533,7 @@ Gia_Man_t * Gia_ManPerformMapping( Gia_Man_t * p, void * pp, int fNormalized ) If_Man_t * pIfMan; If_Par_t * pPars = (If_Par_t *)pp; // disable cut minimization when GIA strucure is needed - if ( !pPars->fDelayOpt && !pPars->fUserRecLib && !pPars->fDeriveLuts && !pPars->fUseDsd ) + if ( !pPars->fDelayOpt && !pPars->fUserRecLib && !pPars->fDeriveLuts && !pPars->fUseDsd && !pPars->fUseTtPerm ) pPars->fCutMin = 0; // reconstruct GIA according to the hierarchy manager diff --git a/src/aig/gia/giaJf.c b/src/aig/gia/giaJf.c index 37c91ec5..176a0cd0 100644 --- a/src/aig/gia/giaJf.c +++ b/src/aig/gia/giaJf.c @@ -371,7 +371,7 @@ Jf_Man_t * Jf_ManAlloc( Gia_Man_t * pGia, Jf_Par_t * pPars ) p->pGia = pGia; p->pPars = pPars; if ( pPars->fCutMin && !pPars->fFuncDsd ) - p->vTtMem = Vec_MemAllocForTT( pPars->nLutSize ); + p->vTtMem = Vec_MemAllocForTT( pPars->nLutSize, 0 ); else if ( pPars->fCutMin && pPars->fFuncDsd ) { p->pDsd = Sdm_ManRead(); diff --git a/src/map/if/ifMan.c b/src/map/if/ifMan.c index 68c6344a..6039bfa9 100644 --- a/src/map/if/ifMan.c +++ b/src/map/if/ifMan.c @@ -70,7 +70,7 @@ If_Man_t * If_ManStart( If_Par_t * pPars ) for ( v = 0; v <= p->pPars->nLutSize; v++ ) p->nTruth6Words[v] = Abc_Truth6WordNum( v ); for ( v = 6; v <= p->pPars->nLutSize; v++ ) - p->vTtMem[v] = Vec_MemAllocForTT( v ); + p->vTtMem[v] = Vec_MemAllocForTT( v, pPars->fUseTtPerm ); for ( v = 0; v < 6; v++ ) p->vTtMem[v] = p->vTtMem[6]; } @@ -448,8 +448,8 @@ void If_ManSetupCutTriv( If_Man_t * p, If_Cut_t * pCut, int ObjId ) pCut->nLeaves = 1; pCut->pLeaves[0] = p->pPars->fLiftLeaves? (ObjId << 8) : ObjId; pCut->uSign = If_ObjCutSign( pCut->pLeaves[0] ); - pCut->iCutFunc = (p->pPars->fTruth || p->pPars->fUseTtPerm) ? 2 : -1; - pCut->iCutDsd = p->pPars->fUseDsd ? 2 : (p->pPars->fUseTtPerm ? 0: -1); + pCut->iCutFunc = p->pPars->fUseTtPerm ? 3 : (p->pPars->fTruth ? 2: -1); + pCut->iCutDsd = p->pPars->fUseTtPerm ? 0 : (p->pPars->fUseDsd ? 2: -1); assert( pCut->pLeaves[0] < p->vObjs->nSize ); if ( p->pPars->fUseDsd ) pCut->pPerm[0] = 0; diff --git a/src/misc/vec/vecMem.h b/src/misc/vec/vecMem.h index 206b42d2..716d939f 100644 --- a/src/misc/vec/vecMem.h +++ b/src/misc/vec/vecMem.h @@ -375,7 +375,7 @@ static int Vec_MemHashInsert( Vec_Mem_t * p, word * pEntry ) SeeAlso [] ***********************************************************************/ -static inline Vec_Mem_t * Vec_MemAllocForTT( int nVars ) +static inline Vec_Mem_t * Vec_MemAllocForTT( int nVars, int fCompl ) { int Value, nWords = (nVars <= 6 ? 1 : (1 << (nVars - 6))); word * uTruth = ABC_ALLOC( word, nWords ); @@ -383,7 +383,10 @@ static inline Vec_Mem_t * Vec_MemAllocForTT( int nVars ) Vec_MemHashAlloc( vTtMem, 10000 ); memset( uTruth, 0x00, sizeof(word) * nWords ); Value = Vec_MemHashInsert( vTtMem, uTruth ); assert( Value == 0 ); - memset( uTruth, 0xAA, sizeof(word) * nWords ); + if ( fCompl ) + memset( uTruth, 0x55, sizeof(word) * nWords ); + else + memset( uTruth, 0xAA, sizeof(word) * nWords ); Value = Vec_MemHashInsert( vTtMem, uTruth ); assert( Value == 1 ); ABC_FREE( uTruth ); return vTtMem; -- cgit v1.2.3