Commit 9291ab9f by Alan Mishchenko

Improvements to technology mapping.

parent 280a4853
...@@ -1308,10 +1308,15 @@ Gia_Man_t * Gia_ManFromIfLogic( If_Man_t * pIfMan ) ...@@ -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 = Gia_ManFromIfLogicCreateLut( pNew, If_CutTruthW(pIfMan, pCutBest), vLeaves, vCover, vMapping, vMapping2 );
pIfObj->iCopy = Abc_LitNotCond( pIfObj->iCopy, pCutBest->fCompl ); 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 // 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 ); pIfObj->iCopy = Abc_LitNotCond( pIfObj->iCopy, pCutBest->fCompl );
} }
else else
...@@ -1528,7 +1533,7 @@ Gia_Man_t * Gia_ManPerformMapping( Gia_Man_t * p, void * pp, int fNormalized ) ...@@ -1528,7 +1533,7 @@ Gia_Man_t * Gia_ManPerformMapping( Gia_Man_t * p, void * pp, int fNormalized )
If_Man_t * pIfMan; If_Man_t * pIfMan;
If_Par_t * pPars = (If_Par_t *)pp; If_Par_t * pPars = (If_Par_t *)pp;
// disable cut minimization when GIA strucure is needed // 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; pPars->fCutMin = 0;
// reconstruct GIA according to the hierarchy manager // reconstruct GIA according to the hierarchy manager
......
...@@ -371,7 +371,7 @@ Jf_Man_t * Jf_ManAlloc( Gia_Man_t * pGia, Jf_Par_t * pPars ) ...@@ -371,7 +371,7 @@ Jf_Man_t * Jf_ManAlloc( Gia_Man_t * pGia, Jf_Par_t * pPars )
p->pGia = pGia; p->pGia = pGia;
p->pPars = pPars; p->pPars = pPars;
if ( pPars->fCutMin && !pPars->fFuncDsd ) if ( pPars->fCutMin && !pPars->fFuncDsd )
p->vTtMem = Vec_MemAllocForTT( pPars->nLutSize ); p->vTtMem = Vec_MemAllocForTT( pPars->nLutSize, 0 );
else if ( pPars->fCutMin && pPars->fFuncDsd ) else if ( pPars->fCutMin && pPars->fFuncDsd )
{ {
p->pDsd = Sdm_ManRead(); p->pDsd = Sdm_ManRead();
......
...@@ -70,7 +70,7 @@ If_Man_t * If_ManStart( If_Par_t * pPars ) ...@@ -70,7 +70,7 @@ If_Man_t * If_ManStart( If_Par_t * pPars )
for ( v = 0; v <= p->pPars->nLutSize; v++ ) for ( v = 0; v <= p->pPars->nLutSize; v++ )
p->nTruth6Words[v] = Abc_Truth6WordNum( v ); p->nTruth6Words[v] = Abc_Truth6WordNum( v );
for ( v = 6; v <= p->pPars->nLutSize; 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++ ) for ( v = 0; v < 6; v++ )
p->vTtMem[v] = p->vTtMem[6]; p->vTtMem[v] = p->vTtMem[6];
} }
...@@ -448,8 +448,8 @@ void If_ManSetupCutTriv( If_Man_t * p, If_Cut_t * pCut, int ObjId ) ...@@ -448,8 +448,8 @@ void If_ManSetupCutTriv( If_Man_t * p, If_Cut_t * pCut, int ObjId )
pCut->nLeaves = 1; pCut->nLeaves = 1;
pCut->pLeaves[0] = p->pPars->fLiftLeaves? (ObjId << 8) : ObjId; pCut->pLeaves[0] = p->pPars->fLiftLeaves? (ObjId << 8) : ObjId;
pCut->uSign = If_ObjCutSign( pCut->pLeaves[0] ); pCut->uSign = If_ObjCutSign( pCut->pLeaves[0] );
pCut->iCutFunc = (p->pPars->fTruth || p->pPars->fUseTtPerm) ? 2 : -1; pCut->iCutFunc = p->pPars->fUseTtPerm ? 3 : (p->pPars->fTruth ? 2: -1);
pCut->iCutDsd = p->pPars->fUseDsd ? 2 : (p->pPars->fUseTtPerm ? 0: -1); pCut->iCutDsd = p->pPars->fUseTtPerm ? 0 : (p->pPars->fUseDsd ? 2: -1);
assert( pCut->pLeaves[0] < p->vObjs->nSize ); assert( pCut->pLeaves[0] < p->vObjs->nSize );
if ( p->pPars->fUseDsd ) if ( p->pPars->fUseDsd )
pCut->pPerm[0] = 0; pCut->pPerm[0] = 0;
......
...@@ -375,7 +375,7 @@ static int Vec_MemHashInsert( Vec_Mem_t * p, word * pEntry ) ...@@ -375,7 +375,7 @@ static int Vec_MemHashInsert( Vec_Mem_t * p, word * pEntry )
SeeAlso [] 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))); int Value, nWords = (nVars <= 6 ? 1 : (1 << (nVars - 6)));
word * uTruth = ABC_ALLOC( word, nWords ); word * uTruth = ABC_ALLOC( word, nWords );
...@@ -383,7 +383,10 @@ static inline Vec_Mem_t * Vec_MemAllocForTT( int nVars ) ...@@ -383,7 +383,10 @@ static inline Vec_Mem_t * Vec_MemAllocForTT( int nVars )
Vec_MemHashAlloc( vTtMem, 10000 ); Vec_MemHashAlloc( vTtMem, 10000 );
memset( uTruth, 0x00, sizeof(word) * nWords ); memset( uTruth, 0x00, sizeof(word) * nWords );
Value = Vec_MemHashInsert( vTtMem, uTruth ); assert( Value == 0 ); 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 ); Value = Vec_MemHashInsert( vTtMem, uTruth ); assert( Value == 1 );
ABC_FREE( uTruth ); ABC_FREE( uTruth );
return vTtMem; return vTtMem;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment