summaryrefslogtreecommitdiffstats
path: root/src/bool/lucky/luckyInt.h
diff options
context:
space:
mode:
authorAlan Mishchenko <alanmi@berkeley.edu>2012-09-06 15:32:07 -0700
committerAlan Mishchenko <alanmi@berkeley.edu>2012-09-06 15:32:07 -0700
commit9c8be56ccd76eecf43f59fe26fef3d8978213ed8 (patch)
tree63b8805a84199cd28eee7da1a0a9d47edfff35bc /src/bool/lucky/luckyInt.h
parent4393a5fade106b91ed9e3c32016a5773b5063c6b (diff)
downloadabc-9c8be56ccd76eecf43f59fe26fef3d8978213ed8.tar.gz
abc-9c8be56ccd76eecf43f59fe26fef3d8978213ed8.tar.bz2
abc-9c8be56ccd76eecf43f59fe26fef3d8978213ed8.zip
Integrated new fast semi-canonical form for Boolean functions up to 16 inputs.
Diffstat (limited to 'src/bool/lucky/luckyInt.h')
-rw-r--r--src/bool/lucky/luckyInt.h34
1 files changed, 32 insertions, 2 deletions
diff --git a/src/bool/lucky/luckyInt.h b/src/bool/lucky/luckyInt.h
index 295d3c30..02dc690d 100644
--- a/src/bool/lucky/luckyInt.h
+++ b/src/bool/lucky/luckyInt.h
@@ -24,6 +24,7 @@
#include <math.h>
#include <time.h>
+
// comment out this line to run Lucky Code outside of ABC
#define _RUNNING_ABC_
@@ -80,6 +81,8 @@ typedef struct
int totalFlips;
}permInfo;
+
+
static inline void TimePrint( char* Message )
{
static int timeBegin;
@@ -89,6 +92,25 @@ static inline void TimePrint( char* Message )
timeBegin = clock();
}
+static word SFmask[5][4] = {
+ {0x8888888888888888,0x4444444444444444,0x2222222222222222,0x1111111111111111},
+ {0xC0C0C0C0C0C0C0C0,0x3030303030303030,0x0C0C0C0C0C0C0C0C,0x0303030303030303},
+ {0xF000F000F000F000,0x0F000F000F000F00,0x00F000F000F000F0,0x000F000F000F000F},
+ {0xFF000000FF000000,0x00FF000000FF0000,0x0000FF000000FF00,0x000000FF000000FF},
+ {0xFFFF000000000000,0x0000FFFF00000000,0x00000000FFFF0000,0x000000000000FFFF}
+};
+
+static inline int CompareWords(word x, word y)
+{
+ if(x>y)
+ return 1;
+ else if(x<y)
+ return -1;
+ else
+ return 0;
+
+}
+
extern inline int memCompare(word* x, word* y, int nVars);
extern inline int Kit_TruthWordNum_64bit( int nVars );
extern Abc_TtStore_t * setTtStore(char * pFileInput);
@@ -101,8 +123,16 @@ extern inline int Kit_TruthCountOnes_64bit( word* pIn, int nVars );
extern void simpleMinimal(word* x, word* pAux,word* minimal, permInfo* pi, int nVars);
extern permInfo* setPermInfoPtr(int var);
extern void freePermInfoPtr(permInfo* x);
-extern inline unsigned Kit_TruthSemiCanonicize_Yasha_simple( word* pInOut, int nVars, char * pCanonPerm );
-extern inline unsigned Kit_TruthSemiCanonicize_Yasha( word* pInOut, int nVars, char * pCanonPerm );
+extern inline void Kit_TruthSemiCanonicize_Yasha_simple( word* pInOut, int nVars, int * pStore );
+extern inline unsigned Kit_TruthSemiCanonicize_Yasha( word* pInOut, int nVars, char * pCanonPerm);
+extern inline unsigned Kit_TruthSemiCanonicize_Yasha1( word* pInOut, int nVars, char * pCanonPerm, int * pStore );
+extern inline word luckyCanonicizer_final_fast_6Vars(word InOut, int* pStore, char* pCanonPerm, unsigned* pCanonPhase );
+extern inline void luckyCanonicizer_final_fast_16Vars(word* pInOut, int nVars, int nWords, int * pStore, char * pCanonPerm, unsigned* pCanonPhase);
+extern inline void resetPCanonPermArray_6Vars(char* x);
+extern void swap_ij( word* f,int totalVars, int varI, int varJ);
+extern inline unsigned adjustInfoAfterSwap(char* pCanonPerm, unsigned uCanonPhase, int iVar, unsigned info);
+extern inline void resetPCanonPermArray(char* x, int nVars);
+
ABC_NAMESPACE_HEADER_END