diff options
author | Mathias Soeken <mathias.soeken@gmail.com> | 2017-03-03 10:33:59 +0100 |
---|---|---|
committer | Mathias Soeken <mathias.soeken@gmail.com> | 2017-03-03 10:33:59 +0100 |
commit | f03871ab22b6c8a487e8fce19ab6b8a540b849f8 (patch) | |
tree | b2c4c1fad6f8b5ce111e0545ed34c89d38397fc9 /src/opt | |
parent | 28e8e7f3e79d1391a2f3a31cefe3afe234aa3b8e (diff) | |
parent | b1907e909d92d1147937b26b5e97fb344647f719 (diff) | |
download | abc-f03871ab22b6c8a487e8fce19ab6b8a540b849f8.tar.gz abc-f03871ab22b6c8a487e8fce19ab6b8a540b849f8.tar.bz2 abc-f03871ab22b6c8a487e8fce19ab6b8a540b849f8.zip |
Merged alanmi/abc into default
Diffstat (limited to 'src/opt')
-rw-r--r-- | src/opt/sbd/sbd.c | 63 |
1 files changed, 63 insertions, 0 deletions
diff --git a/src/opt/sbd/sbd.c b/src/opt/sbd/sbd.c index 4d86d2ee..5c5b1f2b 100644 --- a/src/opt/sbd/sbd.c +++ b/src/opt/sbd/sbd.c @@ -19,6 +19,7 @@ ***********************************************************************/ #include "sbdInt.h" +#include "misc/vec/vecHsh.h" ABC_NAMESPACE_IMPL_START @@ -42,6 +43,68 @@ ABC_NAMESPACE_IMPL_START SeeAlso [] ***********************************************************************/ +int Sbd_CountConfigVars( Vec_Int_t * vSet, int nVars ) +{ + int i, k, Entry = 0, Entry2, Count = 0, Below; + int Prev = Vec_IntEntry( vSet, 0 ); + Vec_IntForEachEntryStart( vSet, Entry, i, 1 ) + { + assert( 2*Prev >= Entry ); + if ( 2*Prev == Entry ) + { + Prev = Entry; + continue; + } + Below = nVars; + Vec_IntForEachEntryStart( vSet, Entry2, k, i ) + Below += Entry2; + Count += Below * (2*Prev - 1); + Prev = Entry; + } + Count += nVars * 2*Prev; + return Vec_IntSum(vSet) < nVars - 1 ? 0 : Count; +} +void Sbd_CountTopos() +{ + Hsh_VecMan_t * p = Hsh_VecManStart( 100000 ); // hash table for arrays + Vec_Int_t * vSet = Vec_IntAlloc( 100 ); + int i, k, e, Start, Stop; + Start = Hsh_VecManAdd( p, vSet ); + for ( i = 1; i < 9; i++ ) + { + Stop = Hsh_VecSize( p ); + for ( e = Start; e < Stop; e++ ) + { + Vec_Int_t * vTemp = Hsh_VecReadEntry( p, e ); + Vec_IntClear( vSet ); + Vec_IntAppend( vSet, vTemp ); + for ( k = 0; k < Vec_IntSize(vSet); k++ ) + { + // skip if the number of entries on this level is equal to the number of fanins on the previous level + if ( k ? (Vec_IntEntry(vSet, k) == 2*Vec_IntEntry(vSet, k-1)) : (Vec_IntEntry(vSet, 0) > 0) ) + continue; + Vec_IntAddToEntry( vSet, k, 1 ); + Hsh_VecManAdd( p, vSet ); + Vec_IntAddToEntry( vSet, k, -1 ); + } + Vec_IntPush( vSet, 1 ); + Hsh_VecManAdd( p, vSet ); + } + printf( "%2d : This = %8d All = %8d\n", i, Hsh_VecSize(p) - Stop, Hsh_VecSize(p) ); + if ( 0 ) + { + for ( e = Stop; e < Hsh_VecSize(p); e++ ) + { + Vec_Int_t * vTemp = Hsh_VecReadEntry( p, e ); + printf( "Params = %3d. ", Sbd_CountConfigVars(vTemp, 5) ); + Vec_IntPrint( vTemp ); + } + } + Start = Stop; + } + Vec_IntFree( vSet ); + Hsh_VecManStop( p ); +} //////////////////////////////////////////////////////////////////////// |