Commit 2f1988e8 by Alan Mishchenko

MUX decomposition during mapping.

parent 3ac8aa9c
...@@ -1602,7 +1602,7 @@ Gia_Man_t * Gia_ManFromIfLogic( If_Man_t * pIfMan ) ...@@ -1602,7 +1602,7 @@ Gia_Man_t * Gia_ManFromIfLogic( If_Man_t * pIfMan )
int nWords = Abc_Truth6WordNum(LutSize); int nWords = Abc_Truth6WordNum(LutSize);
int truthId = Abc_Lit2Var(pCutBest->iCutFunc); int truthId = Abc_Lit2Var(pCutBest->iCutFunc);
int nLeaves = pCutBest->nLeaves; int nLeaves = pCutBest->nLeaves;
int c, iVar = Vec_StrEntry(pIfMan->vTtVars[nLeaves], truthId), iTemp; int c, iVar = Vec_StrEntry(pIfMan->vTtVars[nLeaves], truthId), iTemp, iTopLit;
assert( iVar >= 0 && iVar < nLeaves && LutSize <= 13 ); assert( iVar >= 0 && iVar < nLeaves && LutSize <= 13 );
for ( c = 0; c < 2; c++ ) for ( c = 0; c < 2; c++ )
{ {
...@@ -1629,7 +1629,7 @@ Gia_Man_t * Gia_ManFromIfLogic( If_Man_t * pIfMan ) ...@@ -1629,7 +1629,7 @@ Gia_Man_t * Gia_ManFromIfLogic( If_Man_t * pIfMan )
} }
iLitCofs[2] = Vec_IntEntry(vLeaves, iVar); iLitCofs[2] = Vec_IntEntry(vLeaves, iVar);
// derive MUX // derive MUX
if ( iLitCofs[0] > 1 || iLitCofs[1] > 1 ) if ( iLitCofs[0] > 1 && iLitCofs[1] > 1 )
{ {
pTruthCof[0] = ABC_CONST(0xCACACACACACACACA); pTruthCof[0] = ABC_CONST(0xCACACACACACACACA);
Vec_IntClear( vLeaves2 ); Vec_IntClear( vLeaves2 );
...@@ -1637,25 +1637,28 @@ Gia_Man_t * Gia_ManFromIfLogic( If_Man_t * pIfMan ) ...@@ -1637,25 +1637,28 @@ Gia_Man_t * Gia_ManFromIfLogic( If_Man_t * pIfMan )
Vec_IntPush( vLeaves2, iLitCofs[1] ); Vec_IntPush( vLeaves2, iLitCofs[1] );
Vec_IntPush( vLeaves2, iLitCofs[2] ); Vec_IntPush( vLeaves2, iLitCofs[2] );
pIfObj->iCopy = Kit_TruthToGia( pNew, (unsigned *)pTruthCof, Vec_IntSize(vLeaves2), vCover, vLeaves2, 0 ); pIfObj->iCopy = Kit_TruthToGia( pNew, (unsigned *)pTruthCof, Vec_IntSize(vLeaves2), vCover, vLeaves2, 0 );
iTopLit = iLitCofs[2];
} }
else else
{ {
iLitCofs[0] = Abc_LitNot( Gia_ManAppendAnd2( pNew, iLitCofs[0], Abc_LitNot(iLitCofs[2]) ) );
iLitCofs[1] = Abc_LitNot( Gia_ManAppendAnd2( pNew, iLitCofs[1], iLitCofs[2] ) );
pIfObj->iCopy = Abc_LitNot( Gia_ManAppendAnd2( pNew, iLitCofs[0], iLitCofs[1] ) );
// collect leaves // collect leaves
Vec_IntClear( vLeaves2 ); Vec_IntClear( vLeaves2 );
for ( k = 0; k < 3; k++ ) for ( k = 0; k < 3; k++ )
if ( iLitCofs[k] > 1 ) if ( iLitCofs[k] > 1 )
Vec_IntPush( vLeaves2, iLitCofs[k] ); Vec_IntPush( vLeaves2, iLitCofs[k] );
assert( Vec_IntSize(vLeaves2) > 1 ); assert( Vec_IntSize(vLeaves2) == 2 );
// create "MUX"
iLitCofs[0] = Abc_LitNot( Gia_ManAppendAnd2( pNew, iLitCofs[0], Abc_LitNot(iLitCofs[2]) ) );
iLitCofs[1] = Abc_LitNot( Gia_ManAppendAnd2( pNew, iLitCofs[1], iLitCofs[2] ) );
pIfObj->iCopy = Abc_LitNot( Gia_ManAppendAnd2( pNew, iLitCofs[0], iLitCofs[1] ) );
iTopLit = pIfObj->iCopy;
} }
// create mapping // create mapping
Vec_IntSetEntry( vMapping, Abc_Lit2Var(pIfObj->iCopy), Vec_IntSize(vMapping2) ); Vec_IntSetEntry( vMapping, Abc_Lit2Var(pIfObj->iCopy), Vec_IntSize(vMapping2) );
Vec_IntPush( vMapping2, Vec_IntSize(vLeaves2) ); Vec_IntPush( vMapping2, Vec_IntSize(vLeaves2) );
Vec_IntForEachEntry( vLeaves2, iTemp, k ) Vec_IntForEachEntry( vLeaves2, iTemp, k )
Vec_IntPush( vMapping2, Abc_Lit2Var(iTemp) ); Vec_IntPush( vMapping2, Abc_Lit2Var(iTemp) );
Vec_IntPush( vMapping2, -Abc_Lit2Var(pIfObj->iCopy) ); Vec_IntPush( vMapping2, -Abc_Lit2Var(iTopLit) );
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 || pIfMan->pPars->fUseTtPerm ) else if ( (pIfMan->pPars->fDeriveLuts && pIfMan->pPars->fTruth) || pIfMan->pPars->fUseDsd || pIfMan->pPars->fUseTtPerm )
......
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