summaryrefslogtreecommitdiffstats
path: root/src/misc/util/utilCex.c
diff options
context:
space:
mode:
authorAlan Mishchenko <alanmi@berkeley.edu>2012-11-14 18:20:35 -0800
committerAlan Mishchenko <alanmi@berkeley.edu>2012-11-14 18:20:35 -0800
commitbe29f37baaa4eaef52829bc48593d12c8c81e8ba (patch)
tree5b0671988bf8fc8dadd51af1addb6e5d5242e34e /src/misc/util/utilCex.c
parent9d5d8046105e083228fa504238d5e36b4e0d32d2 (diff)
downloadabc-be29f37baaa4eaef52829bc48593d12c8c81e8ba.tar.gz
abc-be29f37baaa4eaef52829bc48593d12c8c81e8ba.tar.bz2
abc-be29f37baaa4eaef52829bc48593d12c8c81e8ba.zip
Added command 'cexcut' and 'cexmerge'.
Diffstat (limited to 'src/misc/util/utilCex.c')
-rw-r--r--src/misc/util/utilCex.c23
1 files changed, 12 insertions, 11 deletions
diff --git a/src/misc/util/utilCex.c b/src/misc/util/utilCex.c
index 16dbb076..edb246b9 100644
--- a/src/misc/util/utilCex.c
+++ b/src/misc/util/utilCex.c
@@ -195,14 +195,14 @@ Abc_Cex_t * Abc_CexMerge( Abc_Cex_t * pCex, Abc_Cex_t * pPart, int iFrBeg, int i
{ printf( "Starting frame is more than the last frame of CEX (%d).\n", pCex->iFrame ); return NULL; }
if ( iFrEnd > pCex->iFrame )
{ printf( "Stopping frame is more than the last frame of CEX (%d).\n", pCex->iFrame ); return NULL; }
- if ( iFrBeg >= iFrEnd )
+ if ( iFrBeg > iFrEnd )
{ printf( "Starting frame (%d) should be less than stopping frame (%d).\n", iFrBeg, iFrEnd ); return NULL; }
assert( iFrBeg >= 0 && iFrBeg <= pCex->iFrame );
assert( iFrEnd >= 0 && iFrEnd <= pCex->iFrame );
- assert( iFrBeg < iFrEnd );
+ assert( iFrBeg <= iFrEnd );
assert( pCex->nPis == pPart->nPis );
- assert( iFrEnd - iFrBeg > pPart->iFrame );
+ assert( iFrEnd - iFrBeg >= pPart->iFrame );
nFramesGain = (iFrEnd - iFrBeg) - pPart->iFrame;
pNew = Abc_CexAlloc( pCex->nRegs, pCex->nPis, pCex->iFrame + 1 - nFramesGain );
@@ -211,20 +211,21 @@ Abc_Cex_t * Abc_CexMerge( Abc_Cex_t * pCex, Abc_Cex_t * pPart, int iFrBeg, int i
for ( iBit = 0; iBit < pCex->nRegs; iBit++ )
if ( Abc_InfoHasBit(pCex->pData, iBit) )
- Abc_InfoSetBit( pNew->pData, iBit++ );
+ Abc_InfoSetBit( pNew->pData, iBit );
for ( f = 0; f < iFrBeg; f++ )
- for ( i = 0; i < pCex->nPis; i++ )
+ for ( i = 0; i < pCex->nPis; i++, iBit++ )
if ( Abc_InfoHasBit(pCex->pData, pCex->nRegs + pCex->nPis * f + i) )
- Abc_InfoSetBit( pNew->pData, iBit++ );
+ Abc_InfoSetBit( pNew->pData, iBit );
for ( f = 0; f < pPart->iFrame; f++ )
- for ( i = 0; i < pCex->nPis; i++ )
+ for ( i = 0; i < pCex->nPis; i++, iBit++ )
if ( Abc_InfoHasBit(pPart->pData, pPart->nRegs + pCex->nPis * f + i) )
- Abc_InfoSetBit( pNew->pData, iBit++ );
+ Abc_InfoSetBit( pNew->pData, iBit );
for ( f = iFrEnd; f <= pCex->iFrame; f++ )
- for ( i = 0; i < pCex->nPis; i++ )
- if ( Abc_InfoHasBit(pPart->pData, pPart->nRegs + pCex->nPis * f + i) )
- Abc_InfoSetBit( pNew->pData, iBit++ );
+ for ( i = 0; i < pCex->nPis; i++, iBit++ )
+ if ( Abc_InfoHasBit(pCex->pData, pCex->nRegs + pCex->nPis * f + i) )
+ Abc_InfoSetBit( pNew->pData, iBit );
assert( iBit == pNew->nBits );
+
return pNew;
}