MUX decomposition during mapping.

This commit is contained in:
Alan Mishchenko 2014-10-12 10:13:47 -07:00
parent 3ac8aa9c12
commit 2f1988e8f6
1 changed files with 10 additions and 7 deletions

View File

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