diff options
author | Alan Mishchenko <alanmi@berkeley.edu> | 2014-10-12 10:13:47 -0700 |
---|---|---|
committer | Alan Mishchenko <alanmi@berkeley.edu> | 2014-10-12 10:13:47 -0700 |
commit | 2f1988e8f6f959339868b5df976b6d30b4fe0201 (patch) | |
tree | f4eed4c9085fe1c9a99bdfec2256cb0a40cc2785 | |
parent | 3ac8aa9c12adb9593f498dc1ea33bbdce18e6713 (diff) | |
download | abc-2f1988e8f6f959339868b5df976b6d30b4fe0201.tar.gz abc-2f1988e8f6f959339868b5df976b6d30b4fe0201.tar.bz2 abc-2f1988e8f6f959339868b5df976b6d30b4fe0201.zip |
MUX decomposition during mapping.
-rw-r--r-- | src/aig/gia/giaIf.c | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/src/aig/gia/giaIf.c b/src/aig/gia/giaIf.c index 3afb07b7..8a69994d 100644 --- a/src/aig/gia/giaIf.c +++ b/src/aig/gia/giaIf.c @@ -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 ) |