abc-master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
luckyInt.h
Go to the documentation of this file.
1 /**CFile****************************************************************
2 
3  FileName [luckyInt.h]
4 
5  SystemName [ABC: Logic synthesis and verification system.]
6 
7  PackageName [Semi-canonical form computation package.]
8 
9  Synopsis [Internal declarations.]
10 
11  Author [Jake]
12 
13  Date [Started - August 2012]
14 
15 ***********************************************************************/
16 
17 #ifndef ABC__bool__lucky__LUCKY_INT_H_
18 #define ABC__bool__lucky__LUCKY_INT_H_
19 
20 #include <stdio.h>
21 #include <stdlib.h>
22 #include <assert.h>
23 #include <string.h>
24 #include <math.h>
25 #include <time.h>
26 
27 // comment out this line to run Lucky Code outside of ABC
28 #define _RUNNING_ABC_
29 
30 #ifdef _RUNNING_ABC_
31 
32 #include "misc/util/abc_global.h"
33 #include "lucky.h"
34 
35 #else
36 
37 #define ABC_NAMESPACE_HEADER_START
38 #define ABC_NAMESPACE_HEADER_END
39 #define ABC_NAMESPACE_IMPL_START
40 #define ABC_NAMESPACE_IMPL_END
41 typedef unsigned __int64 word;
42 #define bool int
43 #define false 0
44 #define true 1
45 #define inline __inline // compatible with MS VS 6.0
46 #define ABC_ALLOC(type, num) ((type *) malloc(sizeof(type) * (num)))
47 // #define LUCKY_VERIFY
48 
49 typedef struct
50 {
51  int varN;
52  int* swapArray;
53  int swapCtr;
54  int totalSwaps;
55  int* flipArray;
56  int flipCtr;
57  int totalFlips;
58 }permInfo;
59 
60 #endif
61 
62 
64 
65 typedef struct
66 {
67  int nVars;
68  int nWords;
69  int nFuncs;
72 
73 typedef struct
74 {
75  int direction;
76  int position;
77 } varInfo;
78 
79 
80 typedef struct
81 {
83  int* realArray;
84  int varN;
87 } swapInfo;
88 
89 
90 static inline void TimePrint( char* Message )
91 {
92  static int timeBegin;
93  double time = 1.0*(Abc_Clock() - timeBegin)/CLOCKS_PER_SEC ;
94  if ( Message != NULL)
95  printf("%s = %f sec.\n", Message, time);
96  timeBegin = Abc_Clock();
97 }
98 
99 static inline int CompareWords( word x, word y)
100 {
101  if( x > y )
102  return 1;
103  if( x < y )
104  return -1;
105  return 0;
106 }
107 
108 static inline int luckyMin( int x, int y ) { return (x < y) ? x : y; }
109 static inline int luckyMax( int x, int y ) { return (x < y) ? y : x; }
110 
111 
112 extern int memCompare(word* x, word* y, int nVars);
113 extern int Kit_TruthWordNum_64bit( int nVars );
114 extern Abc_TtStore_t * setTtStore(char * pFileInput);
115 extern void Abc_TruthStoreFree( Abc_TtStore_t * p );
116 extern void Kit_TruthChangePhase_64bit( word * pInOut, int nVars, int iVar );
117 extern void Kit_TruthNot_64bit(word * pIn, int nVars );
118 extern void Kit_TruthCopy_64bit( word * pOut, word * pIn, int nVars );
119 extern void Kit_TruthSwapAdjacentVars_64bit( word * pInOut, int nVars, int iVar );
120 extern int Kit_TruthCountOnes_64bit( word* pIn, int nVars );
121 extern void simpleMinimal(word* x, word* pAux,word* minimal, permInfo* pi, int nVars);
122 extern permInfo * setPermInfoPtr(int var);
123 extern void freePermInfoPtr(permInfo* x);
124 extern void Kit_TruthSemiCanonicize_Yasha_simple( word* pInOut, int nVars, int * pStore );
125 extern unsigned Kit_TruthSemiCanonicize_Yasha( word* pInOut, int nVars, char * pCanonPerm);
126 extern unsigned Kit_TruthSemiCanonicize_Yasha1( word* pInOut, int nVars, char * pCanonPerm, int * pStore);
127 extern word luckyCanonicizer_final_fast_6Vars(word InOut, int* pStore, char* pCanonPerm, unsigned* pCanonPhase);
128 extern word luckyCanonicizer_final_fast_6Vars1(word InOut, int* pStore, char* pCanonPerm, unsigned* pCanonPhase);
129 extern unsigned adjustInfoAfterSwap(char* pCanonPerm, unsigned uCanonPhase, int iVar, unsigned info);
130 extern void resetPCanonPermArray_6Vars(char* x);
131 extern void swap_ij( word* f,int totalVars, int varI, int varJ);
132 
133 
135 
136 #endif /* LUCKY_H_ */
permInfo * setPermInfoPtr(int var)
Definition: luckySimple.c:110
void Kit_TruthCopy_64bit(word *pOut, word *pIn, int nVars)
Definition: luckySwap.c:136
static Llb_Mgr_t * p
Definition: llb3Image.c:950
void simpleMinimal(word *x, word *pAux, word *minimal, permInfo *pi, int nVars)
Definition: luckySimple.c:151
typedefABC_NAMESPACE_IMPL_START struct Abc_TtStore_t_ Abc_TtStore_t
DECLARATIONS ///.
Definition: abcDec.c:44
void freePermInfoPtr(permInfo *x)
Definition: luckySimple.c:126
word ** pFuncs
Definition: luckyInt.h:70
int var(Lit p)
Definition: SolverTypes.h:62
int Kit_TruthCountOnes_64bit(word *pIn, int nVars)
Definition: luckySwap.c:49
void Kit_TruthSwapAdjacentVars_64bit(word *pInOut, int nVars, int iVar)
Definition: luckySwap.c:141
void resetPCanonPermArray_6Vars(char *x)
Definition: luckyFast6.c:21
int Kit_TruthWordNum_64bit(int nVars)
Definition: luckySwap.c:36
static abctime Abc_Clock()
Definition: abc_global.h:279
int positionToSwap1
Definition: luckyInt.h:85
Abc_TtStore_t * setTtStore(char *pFileInput)
Definition: luckyRead.c:319
void swap_ij(word *f, int totalVars, int varI, int varJ)
Definition: luckySwapIJ.c:88
void Kit_TruthSemiCanonicize_Yasha_simple(word *pInOut, int nVars, int *pStore)
Definition: luckySwap.c:358
int positionToSwap2
Definition: luckyInt.h:86
int memCompare(word *x, word *y, int nVars)
Definition: lucky.c:22
static int luckyMin(int x, int y)
Definition: luckyInt.h:108
unsigned __int64 word
DECLARATIONS ///.
Definition: kitPerm.c:36
static void TimePrint(char *Message)
Definition: luckyInt.h:90
varInfo * posArray
Definition: luckyInt.h:82
unsigned adjustInfoAfterSwap(char *pCanonPerm, unsigned uCanonPhase, int iVar, unsigned info)
Definition: luckyFast6.c:51
#define ABC_NAMESPACE_HEADER_START
NAMESPACES ///.
Definition: abc_global.h:105
word luckyCanonicizer_final_fast_6Vars1(word InOut, int *pStore, char *pCanonPerm, unsigned *pCanonPhase)
Definition: luckyFast6.c:270
void Kit_TruthNot_64bit(word *pIn, int nVars)
Definition: luckySwap.c:130
#define ABC_NAMESPACE_HEADER_END
Definition: abc_global.h:106
int position
Definition: luckyInt.h:76
void Abc_TruthStoreFree(Abc_TtStore_t *p)
Definition: luckyRead.c:115
unsigned Kit_TruthSemiCanonicize_Yasha1(word *pInOut, int nVars, char *pCanonPerm, int *pStore)
Definition: luckySwap.c:245
int * realArray
Definition: luckyInt.h:83
int direction
Definition: luckyInt.h:75
int varN
Definition: luckyInt.h:84
static int luckyMax(int x, int y)
Definition: luckyInt.h:109
Definition: lucky.h:23
void Kit_TruthChangePhase_64bit(word *pInOut, int nVars, int iVar)
Definition: luckySwap.c:100
unsigned Kit_TruthSemiCanonicize_Yasha(word *pInOut, int nVars, char *pCanonPerm)
Definition: luckySwap.c:186
word luckyCanonicizer_final_fast_6Vars(word InOut, int *pStore, char *pCanonPerm, unsigned *pCanonPhase)
Definition: luckyFast6.c:265
static int CompareWords(word x, word y)
Definition: luckyInt.h:99