diff options
author | Alan Mishchenko <alanmi@berkeley.edu> | 2011-11-06 08:22:05 -0800 |
---|---|---|
committer | Alan Mishchenko <alanmi@berkeley.edu> | 2011-11-06 08:22:05 -0800 |
commit | cb5be5118b1b06e3ffe418eb3dc53f840fdf8743 (patch) | |
tree | da752e92d9d02d6090d478beeb2b1d5f2adcc0a7 /src | |
parent | 5c3264643e402649ade395f91ac40fc2121091d3 (diff) | |
download | abc-cb5be5118b1b06e3ffe418eb3dc53f840fdf8743.tar.gz abc-cb5be5118b1b06e3ffe418eb3dc53f840fdf8743.tar.bz2 abc-cb5be5118b1b06e3ffe418eb3dc53f840fdf8743.zip |
Experiments with variable permutation.
Diffstat (limited to 'src')
-rw-r--r-- | src/aig/kit/kitPerm.c | 56 |
1 files changed, 55 insertions, 1 deletions
diff --git a/src/aig/kit/kitPerm.c b/src/aig/kit/kitPerm.c index d981b6a9..e02cb9be 100644 --- a/src/aig/kit/kitPerm.c +++ b/src/aig/kit/kitPerm.c @@ -235,6 +235,31 @@ void Kit_PermComputeNaive( word * F, int nVars ) If_CluReverseOrder( F, nVars, V2P, P2V, 0 ); } + +word M ( word f1, word f2, int n) +{ + word temp = 0; + word a = 1; + int i; + for( i = 0; i < n; i++) + temp = temp + (((f1>>i)&a) << (2*i) ) + (((f2>>i)&a) << (2*i+1)); + return temp; +} + +word Tf ( word f, int n) +{ + if(n==1) + return f; + else + { + int x = (int)pow(2,n-1); +// int x; + x = (1 << (n-1)); + return ( M (Tf( (f << x) >> x, n-1), Tf( (f >> x), n-1), x) ); //def. of M just below the function + } +} + + #define ABC_PRT(a,t) (printf("%s = ", (a)), printf("%7.2f sec\n", (float)(t)/(float)(CLOCKS_PER_SEC))) #define NFUNCS (1<<20) @@ -271,7 +296,8 @@ void Kit_PermComputeTest() for ( k = 0; k < NFUNCS; k++ ) { i = T[k]; - Kit_PermComputeNaive( &i, 6 ); +// Kit_PermComputeNaive( &i, 6 ); + Tf( i, 6 ); } ABC_PRT( "Perm1 ", clock() - clk ); @@ -292,6 +318,34 @@ void Kit_PermComputeTest() free( T ); } +/**Function************************************************************* + + Synopsis [] + + Description [] + + SideEffects [] + + SeeAlso [] +` +***********************************************************************/ +void Kit_PermComputeTest_() +{ + word t, s; + t = 0xacaccacaaccaacca; +// Kit_DsdPrintFromTruth( &t, 6 ); printf( "\n" ); + s = Tf( t, 6 ); +// Kit_PermComputeNaive( &t, 6 ); +// Kit_DsdPrintFromTruth( &s, 6 ); printf( "\n" ); +} + +/* + { + extern void Kit_PermComputeTest(); + Kit_PermComputeTest(); + } +*/ + //////////////////////////////////////////////////////////////////////// /// END OF FILE /// //////////////////////////////////////////////////////////////////////// |