summaryrefslogtreecommitdiffstats
path: root/src/base/exor
diff options
context:
space:
mode:
Diffstat (limited to 'src/base/exor')
-rw-r--r--src/base/exor/exor.c48
-rw-r--r--src/base/exor/exor.h1
2 files changed, 44 insertions, 5 deletions
diff --git a/src/base/exor/exor.c b/src/base/exor/exor.c
index 2b8f0903..052362e5 100644
--- a/src/base/exor/exor.c
+++ b/src/base/exor/exor.c
@@ -148,6 +148,43 @@ int ComputeQCostBits( Cube * p )
nLits += nLitsN;
return GetQCost( nLits, nLitsN );
}
+int ToffoliGateCount( int controls, int lines )
+{
+ switch ( controls )
+ {
+ case 0u:
+ case 1u:
+ return 0;
+ break;
+ case 2u:
+ return 1;
+ break;
+ case 3u:
+ return 4;
+ break;
+ case 4u:
+ return ( ( ( lines + 1 ) / 2 ) >= controls ) ? 8 : 10;
+ break;
+ default:
+ return ( ( ( lines + 1 ) / 2 ) >= controls ) ? 4 * ( controls - 2 ) : 8 * ( controls - 3 );
+ }
+}
+int ComputeQCostTcount( Vec_Int_t * vCube )
+{
+ return 7 * ToffoliGateCount( Vec_IntSize( vCube ), g_CoverInfo.nVarsIn + 1 );
+}
+int ComputeQCostTcountBits( Cube * p )
+{
+ extern varvalue GetVar( Cube* pC, int Var );
+ int v, nLits = 0;
+ for ( v = 0; v < g_CoverInfo.nVarsIn; v++ )
+ if ( GetVar( p, v ) != VAR_ABS )
+ nLits++;
+ return 7 * ToffoliGateCount( nLits, g_CoverInfo.nVarsIn + 1 );
+
+ /* maybe just: 7 * ToffoliGateCount( p->a, g_CoverInfo.nVarsIn + 1 ); */
+}
+
/**Function*************************************************************
@@ -774,9 +811,9 @@ int Exorcism( Vec_Wec_t * vEsop, int nIns, int nOuts, char * pFileNameOut )
printf( "The number of cubes in the starting cover is %d\n", g_CoverInfo.nCubesBefore );
}
- if ( g_CoverInfo.nCubesBefore > 20000 )
+ if ( g_CoverInfo.nCubesBefore > g_CoverInfo.nCubesMax )
{
- printf( "\nThe size of the starting cover is more than 20000 cubes. Quitting...\n" );
+ printf( "\nThe size of the starting cover is more than %d cubes. Quitting...\n", g_CoverInfo.nCubesMax );
return 0;
}
@@ -857,8 +894,8 @@ int Exorcism( Vec_Wec_t * vEsop, int nIns, int nOuts, char * pFileNameOut )
char Buffer[1000];
sprintf( Buffer, "%s", pFileNameOut ? pFileNameOut : "temp.esop" );
WriteResultIntoFile( Buffer );
- //if ( g_CoverInfo.Verbosity )
- printf( "Minimized cover has been written into file <%s>\n", Buffer );
+ if ( g_CoverInfo.Verbosity )
+ printf( "Minimized cover has been written into file <%s>\n", Buffer );
}
///////////////////////////////////////////////////////////////////////
@@ -884,11 +921,12 @@ int Exorcism( Vec_Wec_t * vEsop, int nIns, int nOuts, char * pFileNameOut )
SeeAlso []
***********************************************************************/
-int Abc_ExorcismMain( Vec_Wec_t * vEsop, int nIns, int nOuts, char * pFileNameOut, int Quality, int Verbosity, int fUseQCost )
+int Abc_ExorcismMain( Vec_Wec_t * vEsop, int nIns, int nOuts, char * pFileNameOut, int Quality, int Verbosity, int nCubesMax, int fUseQCost )
{
memset( &g_CoverInfo, 0, sizeof(cinfo) );
g_CoverInfo.Quality = Quality;
g_CoverInfo.Verbosity = Verbosity;
+ g_CoverInfo.nCubesMax = nCubesMax;
g_CoverInfo.fUseQCost = fUseQCost;
if ( fUseQCost )
s_fDecreaseLiterals = 1;
diff --git a/src/base/exor/exor.h b/src/base/exor/exor.h
index 019b66c5..5a727557 100644
--- a/src/base/exor/exor.h
+++ b/src/base/exor/exor.h
@@ -112,6 +112,7 @@ typedef struct cinfo_tag
int Verbosity; // verbosity level
int Quality; // quality
+ int nCubesMax; // maximum number of cubes in starting cover
int fUseQCost; // use q-cost instead of literal count
abctime TimeRead; // reading time