summaryrefslogtreecommitdiffstats
path: root/src/base/wlc
diff options
context:
space:
mode:
authorAlan Mishchenko <alanmi@berkeley.edu>2016-06-07 15:20:38 -0700
committerAlan Mishchenko <alanmi@berkeley.edu>2016-06-07 15:20:38 -0700
commitcad3d8d4199b861db1044a485ee4f53712ccb1bc (patch)
tree55487dc151db275d3110b57d02d1be170772925d /src/base/wlc
parent820a48b2cb61131f527af7b6fe3ae1c566c4356f (diff)
downloadabc-cad3d8d4199b861db1044a485ee4f53712ccb1bc.tar.gz
abc-cad3d8d4199b861db1044a485ee4f53712ccb1bc.tar.bz2
abc-cad3d8d4199b861db1044a485ee4f53712ccb1bc.zip
Support bit-blasting of shifts with more than 32 bits.
Diffstat (limited to 'src/base/wlc')
-rw-r--r--src/base/wlc/wlcBlast.c36
1 files changed, 30 insertions, 6 deletions
diff --git a/src/base/wlc/wlcBlast.c b/src/base/wlc/wlcBlast.c
index 59562432..fbace4ab 100644
--- a/src/base/wlc/wlcBlast.c
+++ b/src/base/wlc/wlcBlast.c
@@ -121,13 +121,11 @@ int Wlc_NtkMuxTree_rec( Gia_Man_t * pNew, int * pCtrl, int nCtrl, Vec_Int_t * vD
SeeAlso []
***********************************************************************/
-void Wlc_BlastShiftRight( Gia_Man_t * pNew, int * pNum, int nNum, int * pShift, int nShift, int fSticky, Vec_Int_t * vRes )
+void Wlc_BlastShiftRightInt( Gia_Man_t * pNew, int * pNum, int nNum, int * pShift, int nShift, int fSticky, Vec_Int_t * vRes )
{
int * pRes = Wlc_VecCopy( vRes, pNum, nNum );
int Fill = fSticky ? pNum[nNum-1] : 0;
int i, j, fShort = 0;
- if ( nShift > 32 )
- nShift = 32;
assert( nShift <= 32 );
for( i = 0; i < nShift; i++ )
for( j = 0; j < nNum - fSticky; j++ )
@@ -142,13 +140,25 @@ void Wlc_BlastShiftRight( Gia_Man_t * pNew, int * pNum, int nNum, int * pShift,
pRes[j] = Gia_ManHashMux( pNew, pShift[i], pRes[j+(1<<i)], pRes[j] );
}
}
-void Wlc_BlastShiftLeft( Gia_Man_t * pNew, int * pNum, int nNum, int * pShift, int nShift, int fSticky, Vec_Int_t * vRes )
+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);
+ if ( nShiftMax < nShift )
+ {
+ int i, iRes = pShift[nShiftMax];
+ for ( i = nShiftMax + 1; i < nShift; i++ )
+ iRes = Gia_ManHashOr( pNew, iRes, pShift[i] );
+ pShift[nShiftMax] = iRes;
+ }
+ else
+ nShiftMax = nShift;
+ Wlc_BlastShiftRightInt( pNew, pNum, nNum, pShift, nShiftMax, fSticky, vRes );
+}
+void Wlc_BlastShiftLeftInt( Gia_Man_t * pNew, int * pNum, int nNum, int * pShift, int nShift, int fSticky, Vec_Int_t * vRes )
{
int * pRes = Wlc_VecCopy( vRes, pNum, nNum );
int Fill = fSticky ? pNum[0] : 0;
int i, j, fShort = 0;
- if ( nShift > 32 )
- nShift = 32;
assert( nShift <= 32 );
for( i = 0; i < nShift; i++ )
for( j = nNum-1; j >= fSticky; j-- )
@@ -163,6 +173,20 @@ void Wlc_BlastShiftLeft( Gia_Man_t * pNew, int * pNum, int nNum, int * pShift, i
pRes[j] = Gia_ManHashMux( pNew, pShift[i], pRes[j-(1<<i)], pRes[j] );
}
}
+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 )
+ {
+ int i, iRes = pShift[nShiftMax];
+ for ( i = nShiftMax + 1; i < nShift; i++ )
+ iRes = Gia_ManHashOr( pNew, iRes, pShift[i] );
+ pShift[nShiftMax] = iRes;
+ }
+ else
+ nShiftMax = nShift;
+ Wlc_BlastShiftLeftInt( pNew, pNum, nNum, pShift, nShiftMax, fSticky, vRes );
+}
void Wlc_BlastRotateRight( Gia_Man_t * pNew, int * pNum, int nNum, int * pShift, int nShift, Vec_Int_t * vRes )
{
int * pRes = Wlc_VecCopy( vRes, pNum, nNum );