summaryrefslogtreecommitdiffstats
path: root/src/base
diff options
context:
space:
mode:
authorAlan Mishchenko <alanmi@berkeley.edu>2016-06-29 15:36:31 -0700
committerAlan Mishchenko <alanmi@berkeley.edu>2016-06-29 15:36:31 -0700
commitd02f9dd4df982d3d2b438344e798c09c79be9222 (patch)
treeddeb6ceecff008800feb0e5736c4e1086cd1d4c7 /src/base
parent7dcba3e27be4fade9fbdaa07d0bee3ef5070b565 (diff)
downloadabc-d02f9dd4df982d3d2b438344e798c09c79be9222.tar.gz
abc-d02f9dd4df982d3d2b438344e798c09c79be9222.tar.bz2
abc-d02f9dd4df982d3d2b438344e798c09c79be9222.zip
Bug fix in blasting shifters with large bit-width.
Diffstat (limited to 'src/base')
-rw-r--r--src/base/wlc/wlcBlast.c24
1 files changed, 15 insertions, 9 deletions
diff --git a/src/base/wlc/wlcBlast.c b/src/base/wlc/wlcBlast.c
index 3ec7256a..3327e909 100644
--- a/src/base/wlc/wlcBlast.c
+++ b/src/base/wlc/wlcBlast.c
@@ -143,16 +143,19 @@ void Wlc_BlastShiftRightInt( Gia_Man_t * pNew, int * pNum, int nNum, int * pShif
void Wlc_BlastShiftRight( Gia_Man_t * pNew, int * pNum, int nNum, int * pShift, int nShift, int fSticky, Vec_Int_t * vRes )
{
int nShiftMax = Abc_Base2Log(nNum);
+ int * pShiftNew = ABC_ALLOC( int, nShift );
+ memcpy( pShiftNew, pShift, sizeof(int)*nShift );
if ( nShiftMax < nShift && nShift > 30 )
{
- int i, iRes = pShift[nShiftMax];
+ int i, iRes = pShiftNew[nShiftMax];
for ( i = nShiftMax + 1; i < nShift; i++ )
- iRes = Gia_ManHashOr( pNew, iRes, pShift[i] );
- pShift[nShiftMax++] = iRes;
+ iRes = Gia_ManHashOr( pNew, iRes, pShiftNew[i] );
+ pShiftNew[nShiftMax++] = iRes;
}
else
nShiftMax = nShift;
- Wlc_BlastShiftRightInt( pNew, pNum, nNum, pShift, nShiftMax, fSticky, vRes );
+ Wlc_BlastShiftRightInt( pNew, pNum, nNum, pShiftNew, nShiftMax, fSticky, vRes );
+ ABC_FREE( pShiftNew );
}
void Wlc_BlastShiftLeftInt( Gia_Man_t * pNew, int * pNum, int nNum, int * pShift, int nShift, int fSticky, Vec_Int_t * vRes )
{
@@ -176,16 +179,19 @@ void Wlc_BlastShiftLeftInt( Gia_Man_t * pNew, int * pNum, int nNum, int * pShift
void Wlc_BlastShiftLeft( Gia_Man_t * pNew, int * pNum, int nNum, int * pShift, int nShift, int fSticky, Vec_Int_t * vRes )
{
int nShiftMax = Abc_Base2Log(nNum);
- if ( nShiftMax < nShift && nShift > 30 )
+ int * pShiftNew = ABC_ALLOC( int, nShift );
+ memcpy( pShiftNew, pShift, sizeof(int)*nShift );
+ if ( nShiftMax < nShift )
{
- int i, iRes = pShift[nShiftMax];
+ int i, iRes = pShiftNew[nShiftMax];
for ( i = nShiftMax + 1; i < nShift; i++ )
- iRes = Gia_ManHashOr( pNew, iRes, pShift[i] );
- pShift[nShiftMax++] = iRes;
+ iRes = Gia_ManHashOr( pNew, iRes, pShiftNew[i] );
+ pShiftNew[nShiftMax++] = iRes;
}
else
nShiftMax = nShift;
- Wlc_BlastShiftLeftInt( pNew, pNum, nNum, pShift, nShiftMax, fSticky, vRes );
+ Wlc_BlastShiftLeftInt( pNew, pNum, nNum, pShiftNew, nShiftMax, fSticky, vRes );
+ ABC_FREE( pShiftNew );
}
void Wlc_BlastRotateRight( Gia_Man_t * pNew, int * pNum, int nNum, int * pShift, int nShift, Vec_Int_t * vRes )
{