ABC: A System for Sequential Synthesis and Verification
 
Loading...
Searching...
No Matches
luckyInt.h
Go to the documentation of this file.
1
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
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
41typedef 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
49typedef struct
50{
51 int varN;
52 int* swapArray;
53 int swapCtr;
54 int totalSwaps;
55 int* flipArray;
56 int flipCtr;
57 int totalFlips;
59
60#endif
61
62
64
65typedef struct
66{
67 int nVars;
68 int nWords;
69 int nFuncs;
72
73typedef struct
74{
77} varInfo;
78
79
88
89
90static 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
99static 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
108static inline int luckyMin( int x, int y ) { return (x < y) ? x : y; }
109static inline int luckyMax( int x, int y ) { return (x < y) ? y : x; }
110
111
112extern int memCompare(word* x, word* y, int nVars);
113extern int Kit_TruthWordNum_64bit( int nVars );
114extern Abc_TtStore_t * setTtStore(char * pFileInput);
115extern void Abc_TruthStoreFree( Abc_TtStore_t * p );
116extern void Kit_TruthChangePhase_64bit( word * pInOut, int nVars, int iVar );
117extern void Kit_TruthNot_64bit(word * pIn, int nVars );
118extern void Kit_TruthCopy_64bit( word * pOut, word * pIn, int nVars );
119extern void Kit_TruthSwapAdjacentVars_64bit( word * pInOut, int nVars, int iVar );
120extern int Kit_TruthCountOnes_64bit( word* pIn, int nVars );
121extern void simpleMinimal(word* x, word* pAux,word* minimal, permInfo* pi, int nVars);
122extern permInfo * setPermInfoPtr(int var);
123extern void freePermInfoPtr(permInfo* x);
124extern void Kit_TruthSemiCanonicize_Yasha_simple( word* pInOut, int nVars, int * pStore );
125extern unsigned Kit_TruthSemiCanonicize_Yasha( word* pInOut, int nVars, char * pCanonPerm);
126extern unsigned Kit_TruthSemiCanonicize_Yasha1( word* pInOut, int nVars, char * pCanonPerm, int * pStore);
127extern word luckyCanonicizer_final_fast_6Vars(word InOut, int* pStore, char* pCanonPerm, unsigned* pCanonPhase);
128extern word luckyCanonicizer_final_fast_6Vars1(word InOut, int* pStore, char* pCanonPerm, unsigned* pCanonPhase);
129extern unsigned adjustInfoAfterSwap(char* pCanonPerm, unsigned uCanonPhase, int iVar, unsigned info);
130extern void resetPCanonPermArray_6Vars(char* x);
131extern void swap_ij( word* f,int totalVars, int varI, int varJ);
132
133
135
136#endif /* LUCKY_H_ */
#define ABC_NAMESPACE_HEADER_END
#define ABC_NAMESPACE_HEADER_START
NAMESPACES ///.
Cube * p
Definition exorList.c:222
unsigned __int64 word
DECLARATIONS ///.
Definition kitPerm.c:36
void freePermInfoPtr(permInfo *x)
void Kit_TruthChangePhase_64bit(word *pInOut, int nVars, int iVar)
Definition luckySwap.c:100
void simpleMinimal(word *x, word *pAux, word *minimal, permInfo *pi, int nVars)
void Kit_TruthSwapAdjacentVars_64bit(word *pInOut, int nVars, int iVar)
Definition luckySwap.c:141
void Abc_TruthStoreFree(Abc_TtStore_t *p)
Definition luckyRead.c:115
unsigned adjustInfoAfterSwap(char *pCanonPerm, unsigned uCanonPhase, int iVar, unsigned info)
Definition luckyFast6.c:51
int Kit_TruthCountOnes_64bit(word *pIn, int nVars)
Definition luckySwap.c:49
int Kit_TruthWordNum_64bit(int nVars)
Definition luckySwap.c:36
void Kit_TruthSemiCanonicize_Yasha_simple(word *pInOut, int nVars, int *pStore)
Definition luckySwap.c:358
permInfo * setPermInfoPtr(int var)
void resetPCanonPermArray_6Vars(char *x)
Definition luckyFast6.c:21
void Kit_TruthNot_64bit(word *pIn, int nVars)
Definition luckySwap.c:130
void swap_ij(word *f, int totalVars, int varI, int varJ)
Definition luckySwapIJ.c:88
unsigned Kit_TruthSemiCanonicize_Yasha1(word *pInOut, int nVars, char *pCanonPerm, int *pStore)
Definition luckySwap.c:245
void Kit_TruthCopy_64bit(word *pOut, word *pIn, int nVars)
Definition luckySwap.c:136
word luckyCanonicizer_final_fast_6Vars1(word InOut, int *pStore, char *pCanonPerm, unsigned *pCanonPhase)
Definition luckyFast6.c:270
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
Abc_TtStore_t * setTtStore(char *pFileInput)
Definition luckyRead.c:319
int memCompare(word *x, word *y, int nVars)
Definition lucky.c:22
word ** pFuncs
Definition luckyInt.h:70
int positionToSwap2
Definition luckyInt.h:86
int * realArray
Definition luckyInt.h:83
varInfo * posArray
Definition luckyInt.h:82
int positionToSwap1
Definition luckyInt.h:85
int varN
Definition luckyInt.h:84
int position
Definition luckyInt.h:76
int direction
Definition luckyInt.h:75