diff options
author | Alan Mishchenko <alanmi@berkeley.edu> | 2022-05-22 19:47:13 -0700 |
---|---|---|
committer | Alan Mishchenko <alanmi@berkeley.edu> | 2022-05-22 19:47:13 -0700 |
commit | 5a3e0a1f15cf4299470c81fdf314f22ea2f37fa7 (patch) | |
tree | fc326c1dea63760f3b998352eb0de6c2a49cc5c2 /src/aig | |
parent | 4f7bf9100399a3a25d51d4fd8d6b0bf7cd9ed3ed (diff) | |
download | abc-5a3e0a1f15cf4299470c81fdf314f22ea2f37fa7.tar.gz abc-5a3e0a1f15cf4299470c81fdf314f22ea2f37fa7.tar.bz2 abc-5a3e0a1f15cf4299470c81fdf314f22ea2f37fa7.zip |
Improvements to MiniAIG.
Diffstat (limited to 'src/aig')
-rw-r--r-- | src/aig/miniaig/miniaig.h | 25 |
1 files changed, 22 insertions, 3 deletions
diff --git a/src/aig/miniaig/miniaig.h b/src/aig/miniaig/miniaig.h index 2573d35b..c501d326 100644 --- a/src/aig/miniaig/miniaig.h +++ b/src/aig/miniaig/miniaig.h @@ -280,18 +280,37 @@ static int Mini_AigAndMulti( Mini_Aig_t * p, int * pLits, int nLits ) } return pLits[0]; } -static int Mini_AigMuxMulti( Mini_Aig_t * p, int * pCtrl, int * pData, int nData ) +static int Mini_AigMuxMulti( Mini_Aig_t * p, int * pCtrl, int nCtrl, int * pData, int nData ) +{ + int i, c; + assert( nData > 0 ); + if ( nCtrl == 0 ) + return pData[0]; + assert( nData <= (1 << nCtrl) ); + for ( c = 0; c < nCtrl; c++ ) + { + for ( i = 0; i < nData/2; i++ ) + pData[i] = Mini_AigMux( p, pCtrl[c], pData[2*i+1], pData[2*i] ); + if ( nData & 1 ) + pData[i++] = Mini_AigMux( p, pCtrl[c], 0, pData[nData-1] ); + nData = i; + } + assert( nData == 1 ); + return pData[0]; +} +static int Mini_AigMuxMulti_rec( Mini_Aig_t * p, int * pCtrl, int * pData, int nData ) { int Res0, Res1; assert( nData > 0 ); if ( nData == 1 ) return pData[0]; assert( nData % 2 == 0 ); - Res0 = Mini_AigMuxMulti( p, pCtrl+1, pData, nData/2 ); - Res1 = Mini_AigMuxMulti( p, pCtrl+1, pData+nData/2, nData/2 ); + Res0 = Mini_AigMuxMulti_rec( p, pCtrl+1, pData, nData/2 ); + Res1 = Mini_AigMuxMulti_rec( p, pCtrl+1, pData+nData/2, nData/2 ); return Mini_AigMux( p, pCtrl[0], Res1, Res0 ); } + static unsigned s_MiniTruths5[5] = { 0xAAAAAAAA, 0xCCCCCCCC, |