mirror of https://github.com/YosysHQ/abc.git
Experiments with variable permutation.
This commit is contained in:
parent
5c3264643e
commit
cb5be5118b
|
|
@ -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 ///
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
|
|
|
|||
Loading…
Reference in New Issue