summaryrefslogtreecommitdiffstats
path: root/src/misc/extra
diff options
context:
space:
mode:
authorAlan Mishchenko <alanmi@berkeley.edu>2014-05-21 22:32:08 +0900
committerAlan Mishchenko <alanmi@berkeley.edu>2014-05-21 22:32:08 +0900
commit79c62d22fca56bcf5f9c51a51da3e6dfac7a4d15 (patch)
tree412420ded5872906a2117f5ce5a02b09a0fe2e1c /src/misc/extra
parent8160721240399c5f89881a8bc5e60f4adb8f2958 (diff)
downloadabc-79c62d22fca56bcf5f9c51a51da3e6dfac7a4d15.tar.gz
abc-79c62d22fca56bcf5f9c51a51da3e6dfac7a4d15.tar.bz2
abc-79c62d22fca56bcf5f9c51a51da3e6dfac7a4d15.zip
Simple version of ECO.
Diffstat (limited to 'src/misc/extra')
-rw-r--r--src/misc/extra/extraUtilSupp.c23
1 files changed, 19 insertions, 4 deletions
diff --git a/src/misc/extra/extraUtilSupp.c b/src/misc/extra/extraUtilSupp.c
index 4699b7ae..13d8828b 100644
--- a/src/misc/extra/extraUtilSupp.c
+++ b/src/misc/extra/extraUtilSupp.c
@@ -92,6 +92,21 @@ Vec_Int_t * Abc_SuppGenPairs( Vec_Int_t * p, int nBits )
ABC_FREE( pMap );
return vRes;
}
+Vec_Int_t * Abc_SuppGenPairs2( int nOnes, int nBits )
+{
+ Vec_Int_t * vRes = Vec_IntAlloc( 1000 );
+ int i, k, Size = (1 << nBits), Value;
+ for ( i = 0; i < Size; i++ )
+ {
+ Value = Abc_SuppCountOnes(i);
+ for ( k = 1; k <= nOnes; k++ )
+ if ( Value == 2*k )
+ break;
+ if ( k <= nOnes )
+ Vec_IntPush( vRes, i );
+ }
+ return vRes;
+}
/**Function*************************************************************
@@ -196,17 +211,17 @@ int Abc_SuppMinimize( Vec_Int_t * p, int nBits, int fVerbose )
SeeAlso []
***********************************************************************/
-void Abc_SuppTest( int nOnes, int nVars, int fVerbose )
+void Abc_SuppTest( int nOnes, int nVars, int fUseSimple, int fVerbose )
{
int nVarsMin;
abctime clk = Abc_Clock();
// create the problem
Vec_Int_t * vRes = Abc_SuppGen( nOnes, nVars );
- Vec_Int_t * vPairs = Abc_SuppGenPairs( vRes, nVars );
+ Vec_Int_t * vPairs = fUseSimple ? Abc_SuppGenPairs2( nOnes, nVars ) : Abc_SuppGenPairs( vRes, nVars );
printf( "M = %2d N = %2d : ", nOnes, nVars );
printf( "K = %6d ", Vec_IntSize(vRes) );
- printf( "Total = %10d ", Vec_IntSize(vRes) * (Vec_IntSize(vRes) - 1) /2 );
- printf( "Distinct = %8d ", Vec_IntSize(vPairs) );
+ printf( "Total = %12u ", (word)Vec_IntSize(vRes) * (word)(Vec_IntSize(vRes) - 1) / 2 );
+ printf( "Distinct = %8d ", Vec_IntSize(vPairs) );
Abc_PrintTime( 1, "Reduction time", Abc_Clock() - clk );
// solve the problem
clk = Abc_Clock();