abc-master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
luckyInt.h File Reference
#include <stdio.h>
#include <stdlib.h>
#include <assert.h>
#include <string.h>
#include <math.h>
#include <time.h>
#include "misc/util/abc_global.h"
#include "lucky.h"

Go to the source code of this file.

Data Structures

struct  Abc_TtStore_t
 
struct  varInfo
 
struct  swapInfo
 

Macros

#define _RUNNING_ABC_
 

Functions

static void TimePrint (char *Message)
 
static int CompareWords (word x, word y)
 
static int luckyMin (int x, int y)
 
static int luckyMax (int x, int y)
 
int memCompare (word *x, word *y, int nVars)
 
int Kit_TruthWordNum_64bit (int nVars)
 
Abc_TtStore_tsetTtStore (char *pFileInput)
 
void Abc_TruthStoreFree (Abc_TtStore_t *p)
 
void Kit_TruthChangePhase_64bit (word *pInOut, int nVars, int iVar)
 
void Kit_TruthNot_64bit (word *pIn, int nVars)
 
void Kit_TruthCopy_64bit (word *pOut, word *pIn, int nVars)
 
void Kit_TruthSwapAdjacentVars_64bit (word *pInOut, int nVars, int iVar)
 
int Kit_TruthCountOnes_64bit (word *pIn, int nVars)
 
void simpleMinimal (word *x, word *pAux, word *minimal, permInfo *pi, int nVars)
 
permInfosetPermInfoPtr (int var)
 
void freePermInfoPtr (permInfo *x)
 
void Kit_TruthSemiCanonicize_Yasha_simple (word *pInOut, int nVars, int *pStore)
 
unsigned Kit_TruthSemiCanonicize_Yasha (word *pInOut, int nVars, char *pCanonPerm)
 
unsigned Kit_TruthSemiCanonicize_Yasha1 (word *pInOut, int nVars, char *pCanonPerm, int *pStore)
 
word luckyCanonicizer_final_fast_6Vars (word InOut, int *pStore, char *pCanonPerm, unsigned *pCanonPhase)
 
word luckyCanonicizer_final_fast_6Vars1 (word InOut, int *pStore, char *pCanonPerm, unsigned *pCanonPhase)
 
unsigned adjustInfoAfterSwap (char *pCanonPerm, unsigned uCanonPhase, int iVar, unsigned info)
 
void resetPCanonPermArray_6Vars (char *x)
 
void swap_ij (word *f, int totalVars, int varI, int varJ)
 

Macro Definition Documentation

#define _RUNNING_ABC_

CFile****************************************************************

FileName [luckyInt.h]

SystemName [ABC: Logic synthesis and verification system.]

PackageName [Semi-canonical form computation package.]

Synopsis [Internal declarations.]

Author [Jake]

Date [Started - August 2012]

Definition at line 28 of file luckyInt.h.

Function Documentation

void Abc_TruthStoreFree ( Abc_TtStore_t p)

Definition at line 115 of file luckyRead.c.

116 {
117  free( p->pFuncs[0] );
118  free( p->pFuncs );
119  free( p );
120 }
VOID_HACK free()
word ** pFuncs
Definition: luckyInt.h:70
unsigned adjustInfoAfterSwap ( char *  pCanonPerm,
unsigned  uCanonPhase,
int  iVar,
unsigned  info 
)

Definition at line 51 of file luckyFast6.c.

52 {
53  if(info<4)
54  return (uCanonPhase ^= (info << iVar));
55  else
56  {
57  char temp;
58  uCanonPhase ^= ((info-4) << iVar);
59  temp=pCanonPerm[iVar];
60  pCanonPerm[iVar]=pCanonPerm[iVar+1];
61  pCanonPerm[iVar+1]=temp;
62  if ( ((uCanonPhase & (1 << iVar)) > 0) != ((uCanonPhase & (1 << (iVar+1))) > 0) )
63  {
64  uCanonPhase ^= (1 << iVar);
65  uCanonPhase ^= (1 << (iVar+1));
66  }
67  return uCanonPhase;
68  }
69 
70 
71 }
static int CompareWords ( word  x,
word  y 
)
inlinestatic

Definition at line 99 of file luckyInt.h.

100 {
101  if( x > y )
102  return 1;
103  if( x < y )
104  return -1;
105  return 0;
106 }
void freePermInfoPtr ( permInfo x)

Definition at line 126 of file luckySimple.c.

127 {
128  free(x->flipArray);
129  free(x->swapArray);
130  free(x);
131 }
VOID_HACK free()
int * flipArray
Definition: lucky.h:29
int * swapArray
Definition: lucky.h:26
void Kit_TruthChangePhase_64bit ( word pInOut,
int  nVars,
int  iVar 
)

Definition at line 100 of file luckySwap.c.

101 {
102  int nWords = Kit_TruthWordNum_64bit( nVars );
103  int i, Step,SizeOfBlock;
104  word Temp[512];
105 
106  assert( iVar < nVars );
107  if(iVar<=5)
108  {
109  for ( i = 0; i < nWords; i++ )
110  pInOut[i] = ((pInOut[i] & mask0[iVar]) << (1<<(iVar))) | ((pInOut[i] & ~mask0[iVar]) >> (1<<(iVar)));
111  }
112  else
113  {
114  Step = (1 << (iVar - 6));
115  SizeOfBlock = sizeof(word)*Step;
116  for ( i = 0; i < nWords; i += 2*Step )
117  {
118  memcpy(Temp,pInOut,SizeOfBlock);
119  memcpy(pInOut,pInOut+Step,SizeOfBlock);
120  memcpy(pInOut+Step,Temp,SizeOfBlock);
121  // Temp = pInOut[i];
122  // pInOut[i] = pInOut[Step+i];
123  // pInOut[Step+i] = Temp;
124  pInOut += 2*Step;
125  }
126  }
127 
128 }
static ABC_NAMESPACE_IMPL_START word mask0[6]
Definition: luckySwap.c:23
char * memcpy()
int nWords
Definition: abcNpn.c:127
int Kit_TruthWordNum_64bit(int nVars)
Definition: luckySwap.c:36
unsigned __int64 word
DECLARATIONS ///.
Definition: kitPerm.c:36
#define assert(ex)
Definition: util_old.h:213
void Kit_TruthCopy_64bit ( word pOut,
word pIn,
int  nVars 
)

Definition at line 136 of file luckySwap.c.

137 {
138  memcpy(pOut,pIn,Kit_TruthWordNum_64bit(nVars)*sizeof(word));
139 }
char * memcpy()
int Kit_TruthWordNum_64bit(int nVars)
Definition: luckySwap.c:36
unsigned __int64 word
DECLARATIONS ///.
Definition: kitPerm.c:36
int Kit_TruthCountOnes_64bit ( word pIn,
int  nVars 
)

Definition at line 49 of file luckySwap.c.

50 {
51  int w, Counter = 0;
52  for ( w = Kit_TruthWordNum_64bit(nVars)-1; w >= 0; w-- )
53  Counter += Kit_WordCountOnes_64bit(pIn[w]);
54  return Counter;
55 }
int Kit_WordCountOnes_64bit(word x)
Definition: luckySwap.c:38
int Kit_TruthWordNum_64bit(int nVars)
Definition: luckySwap.c:36
static int Counter
void Kit_TruthNot_64bit ( word pIn,
int  nVars 
)

Definition at line 130 of file luckySwap.c.

131 {
132  int w;
133  for ( w = Kit_TruthWordNum_64bit(nVars)-1; w >= 0; w-- )
134  pIn[w] = ~pIn[w];
135 }
int Kit_TruthWordNum_64bit(int nVars)
Definition: luckySwap.c:36
unsigned Kit_TruthSemiCanonicize_Yasha ( word pInOut,
int  nVars,
char *  pCanonPerm 
)

Definition at line 186 of file luckySwap.c.

187 {
188  int pStore[16];
189  int nWords = Kit_TruthWordNum_64bit( nVars );
190  int i, Temp, fChange, nOnes;
191  unsigned uCanonPhase=0;
192  assert( nVars <= 16 );
193 
194  nOnes = Kit_TruthCountOnes_64bit(pInOut, nVars);
195 
196  if ( (nOnes > nWords * 32) )
197  {
198  uCanonPhase |= (1 << nVars);
199  Kit_TruthNot_64bit( pInOut, nVars );
200  nOnes = nWords*64 - nOnes;
201  }
202 
203  // collect the minterm counts
204  Kit_TruthCountOnesInCofs_64bit( pInOut, nVars, pStore );
205 
206  // canonicize phase
207  for ( i = 0; i < nVars; i++ )
208  {
209  if ( pStore[i] >= nOnes-pStore[i])
210  continue;
211  uCanonPhase |= (1 << i);
212  pStore[i] = nOnes-pStore[i];
213  Kit_TruthChangePhase_64bit( pInOut, nVars, i );
214  }
215 
216  do {
217  fChange = 0;
218  for ( i = 0; i < nVars-1; i++ )
219  {
220  if ( pStore[i] <= pStore[i+1] )
221  continue;
222  fChange = 1;
223 
224  Temp = pCanonPerm[i];
225  pCanonPerm[i] = pCanonPerm[i+1];
226  pCanonPerm[i+1] = Temp;
227 
228  Temp = pStore[i];
229  pStore[i] = pStore[i+1];
230  pStore[i+1] = Temp;
231 
232  // if the polarity of variables is different, swap them
233  if ( ((uCanonPhase & (1 << i)) > 0) != ((uCanonPhase & (1 << (i+1))) > 0) )
234  {
235  uCanonPhase ^= (1 << i);
236  uCanonPhase ^= (1 << (i+1));
237  }
238 
239  Kit_TruthSwapAdjacentVars_64bit( pInOut, nVars, i );
240  }
241  } while ( fChange );
242  return uCanonPhase;
243 }
int nWords
Definition: abcNpn.c:127
int Kit_TruthWordNum_64bit(int nVars)
Definition: luckySwap.c:36
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 Kit_TruthNot_64bit(word *pIn, int nVars)
Definition: luckySwap.c:130
#define assert(ex)
Definition: util_old.h:213
void Kit_TruthCountOnesInCofs_64bit(word *pTruth, int nVars, int *pStore)
Definition: luckySwap.c:57
void Kit_TruthChangePhase_64bit(word *pInOut, int nVars, int iVar)
Definition: luckySwap.c:100
unsigned Kit_TruthSemiCanonicize_Yasha1 ( word pInOut,
int  nVars,
char *  pCanonPerm,
int *  pStore 
)

Definition at line 245 of file luckySwap.c.

246 {
247  int nWords = Kit_TruthWordNum_64bit( nVars );
248  int i, fChange, nOnes;
249  int Temp;
250  unsigned uCanonPhase=0;
251  assert( nVars <= 16 );
252 
253  nOnes = Kit_TruthCountOnes_64bit(pInOut, nVars);
254  if ( nOnes == nWords * 32 )
255  uCanonPhase |= (1 << (nVars+2));
256 
257  else if ( (nOnes > nWords * 32) )
258  {
259  uCanonPhase |= (1 << nVars);
260  Kit_TruthNot_64bit( pInOut, nVars );
261  nOnes = nWords*64 - nOnes;
262  }
263 
264  // collect the minterm counts
265  Kit_TruthCountOnesInCofs_64bit( pInOut, nVars, pStore );
266 
267  // canonicize phase
268  for ( i = 0; i < nVars; i++ )
269  {
270  if ( 2*pStore[i] == nOnes)
271  {
272  uCanonPhase |= (1 << (nVars+1));
273  continue;
274  }
275  if ( pStore[i] > nOnes-pStore[i])
276  continue;
277  uCanonPhase |= (1 << i);
278  pStore[i] = nOnes-pStore[i];
279  Kit_TruthChangePhase_64bit( pInOut, nVars, i );
280  }
281 
282  do {
283  fChange = 0;
284  for ( i = 0; i < nVars-1; i++ )
285  {
286  if ( pStore[i] <= pStore[i+1] )
287  continue;
288  fChange = 1;
289 
290  Temp = pCanonPerm[i];
291  pCanonPerm[i] = pCanonPerm[i+1];
292  pCanonPerm[i+1] = Temp;
293 
294  Temp = pStore[i];
295  pStore[i] = pStore[i+1];
296  pStore[i+1] = Temp;
297 
298  // if the polarity of variables is different, swap them
299  if ( ((uCanonPhase & (1 << i)) > 0) != ((uCanonPhase & (1 << (i+1))) > 0) )
300  {
301  uCanonPhase ^= (1 << i);
302  uCanonPhase ^= (1 << (i+1));
303  }
304 
305  Kit_TruthSwapAdjacentVars_64bit( pInOut, nVars, i );
306  }
307  } while ( fChange );
308  return uCanonPhase;
309 }
int nWords
Definition: abcNpn.c:127
int Kit_TruthWordNum_64bit(int nVars)
Definition: luckySwap.c:36
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 Kit_TruthNot_64bit(word *pIn, int nVars)
Definition: luckySwap.c:130
#define assert(ex)
Definition: util_old.h:213
void Kit_TruthCountOnesInCofs_64bit(word *pTruth, int nVars, int *pStore)
Definition: luckySwap.c:57
void Kit_TruthChangePhase_64bit(word *pInOut, int nVars, int iVar)
Definition: luckySwap.c:100
void Kit_TruthSemiCanonicize_Yasha_simple ( word pInOut,
int  nVars,
int *  pStore 
)

Definition at line 358 of file luckySwap.c.

359 {
360  int nWords = Kit_TruthWordNum_64bit( nVars );
361  int i, Temp, fChange, nOnes;
362  assert( nVars <= 16 );
363 
364  nOnes = Kit_TruthCountOnes_64bit(pInOut, nVars);
365 
366  if ( (nOnes > nWords * 32) )
367  {
368  Kit_TruthNot_64bit( pInOut, nVars );
369  nOnes = nWords*64 - nOnes;
370  }
371 
372  // collect the minterm counts
373  Kit_TruthCountOnesInCofs_64bit( pInOut, nVars, pStore );
374 
375  // canonicize phase
376  for ( i = 0; i < nVars; i++ )
377  {
378  if ( pStore[i] >= nOnes-pStore[i])
379  continue;
380  pStore[i] = nOnes-pStore[i];
381  Kit_TruthChangePhase_64bit( pInOut, nVars, i );
382  }
383 
384  do {
385  fChange = 0;
386  for ( i = 0; i < nVars-1; i++ )
387  {
388  if ( pStore[i] <= pStore[i+1] )
389  continue;
390  fChange = 1;
391 
392  Temp = pStore[i];
393  pStore[i] = pStore[i+1];
394  pStore[i+1] = Temp;
395 
396  Kit_TruthSwapAdjacentVars_64bit( pInOut, nVars, i );
397  }
398  } while ( fChange );
399 }
int nWords
Definition: abcNpn.c:127
int Kit_TruthWordNum_64bit(int nVars)
Definition: luckySwap.c:36
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 Kit_TruthNot_64bit(word *pIn, int nVars)
Definition: luckySwap.c:130
#define assert(ex)
Definition: util_old.h:213
void Kit_TruthCountOnesInCofs_64bit(word *pTruth, int nVars, int *pStore)
Definition: luckySwap.c:57
void Kit_TruthChangePhase_64bit(word *pInOut, int nVars, int iVar)
Definition: luckySwap.c:100
void Kit_TruthSwapAdjacentVars_64bit ( word pInOut,
int  nVars,
int  iVar 
)

Definition at line 141 of file luckySwap.c.

142 {
143  int i, Step, Shift, SizeOfBlock; //
144  word temp[256]; // to make only pInOut possible
145  static word PMasks[5][3] = {
146  { ABC_CONST(0x9999999999999999), ABC_CONST(0x2222222222222222), ABC_CONST(0x4444444444444444) },
147  { ABC_CONST(0xC3C3C3C3C3C3C3C3), ABC_CONST(0x0C0C0C0C0C0C0C0C), ABC_CONST(0x3030303030303030) },
148  { ABC_CONST(0xF00FF00FF00FF00F), ABC_CONST(0x00F000F000F000F0), ABC_CONST(0x0F000F000F000F00) },
149  { ABC_CONST(0xFF0000FFFF0000FF), ABC_CONST(0x0000FF000000FF00), ABC_CONST(0x00FF000000FF0000) },
150  { ABC_CONST(0xFFFF00000000FFFF), ABC_CONST(0x00000000FFFF0000), ABC_CONST(0x0000FFFF00000000) }
151  };
152  int nWords = Kit_TruthWordNum_64bit( nVars );
153 
154  assert( iVar < nVars - 1 );
155  if ( iVar < 5 )
156  {
157  Shift = (1 << iVar);
158  for ( i = 0; i < nWords; i++ )
159  pInOut[i] = (pInOut[i] & PMasks[iVar][0]) | ((pInOut[i] & PMasks[iVar][1]) << Shift) | ((pInOut[i] & PMasks[iVar][2]) >> Shift);
160  }
161  else if ( iVar > 5 )
162  {
163  Step = 1 << (iVar - 6);
164  SizeOfBlock = sizeof(word)*Step;
165  pInOut += 2*Step;
166  for(i=2*Step; i<nWords; i+=4*Step)
167  {
168  memcpy(temp,pInOut-Step,SizeOfBlock);
169  memcpy(pInOut-Step,pInOut,SizeOfBlock);
170  memcpy(pInOut,temp,SizeOfBlock);
171  pInOut += 4*Step;
172  }
173  }
174  else // if ( iVar == 5 )
175  {
176  for ( i = 0; i < nWords; i += 2 )
177  {
178  temp[0] = pInOut[i+1] << 32;
179  pInOut[i+1] ^= (temp[0] ^ pInOut[i]) >> 32;
180  pInOut[i] = (pInOut[i] & 0x00000000FFFFFFFF) | temp[0];
181 
182  }
183  }
184 }
char * memcpy()
int nWords
Definition: abcNpn.c:127
int Kit_TruthWordNum_64bit(int nVars)
Definition: luckySwap.c:36
unsigned __int64 word
DECLARATIONS ///.
Definition: kitPerm.c:36
static word PMasks[5][3]
Definition: ifDec07.c:44
#define ABC_CONST(number)
PARAMETERS ///.
Definition: abc_global.h:206
#define assert(ex)
Definition: util_old.h:213
int Kit_TruthWordNum_64bit ( int  nVars)

Definition at line 36 of file luckySwap.c.

36 { return nVars <= 6 ? 1 : (1 << (nVars - 6));}
word luckyCanonicizer_final_fast_6Vars ( word  InOut,
int *  pStore,
char *  pCanonPerm,
unsigned *  pCanonPhase 
)

Definition at line 265 of file luckyFast6.c.

266 {
267  (* pCanonPhase) = Kit_TruthSemiCanonicize_Yasha1( &InOut, 6, pCanonPerm, pStore);
268  return Extra_Truth6MinimumRoundMany1(InOut, pStore, pCanonPerm, pCanonPhase);
269 }
unsigned Kit_TruthSemiCanonicize_Yasha1(word *pInOut, int nVars, char *pCanonPerm, int *pStore)
Definition: luckySwap.c:245
word Extra_Truth6MinimumRoundMany1(word t, int *pStore, char *pCanonPerm, unsigned *pCanonPhase)
Definition: luckyFast6.c:213
word luckyCanonicizer_final_fast_6Vars1 ( word  InOut,
int *  pStore,
char *  pCanonPerm,
unsigned *  pCanonPhase 
)

Definition at line 270 of file luckyFast6.c.

271 {
272  (* pCanonPhase) = Kit_TruthSemiCanonicize_Yasha1( &InOut, 6, pCanonPerm, pStore);
273  InOut = Extra_Truth6MinimumRoundMany1(InOut, pStore, pCanonPerm, pCanonPhase);
274  Kit_TruthChangePhase_64bit( &InOut, 6, 5 );
275  Kit_TruthChangePhase_64bit( &InOut, 6, 4 );
276  Kit_TruthChangePhase_64bit( &InOut, 6, 3 );
277  Kit_TruthChangePhase_64bit( &InOut, 6, 2 );
278  Kit_TruthChangePhase_64bit( &InOut, 6, 1 );
279  Kit_TruthChangePhase_64bit( &InOut, 6, 0 );
280  (*pCanonPhase) ^= 0x3F;
281  return Extra_Truth6MinimumRoundMany1(InOut, pStore, pCanonPerm, pCanonPhase);
282 }
unsigned Kit_TruthSemiCanonicize_Yasha1(word *pInOut, int nVars, char *pCanonPerm, int *pStore)
Definition: luckySwap.c:245
void Kit_TruthChangePhase_64bit(word *pInOut, int nVars, int iVar)
Definition: luckySwap.c:100
word Extra_Truth6MinimumRoundMany1(word t, int *pStore, char *pCanonPerm, unsigned *pCanonPhase)
Definition: luckyFast6.c:213
static int luckyMax ( int  x,
int  y 
)
inlinestatic

Definition at line 109 of file luckyInt.h.

109 { return (x < y) ? y : x; }
static int luckyMin ( int  x,
int  y 
)
inlinestatic

Definition at line 108 of file luckyInt.h.

108 { return (x < y) ? x : y; }
int memCompare ( word x,
word y,
int  nVars 
)

CFile****************************************************************

FileName [lucky.c]

SystemName [ABC: Logic synthesis and verification system.]

PackageName [Semi-canonical form computation package.]

Synopsis [Truth table minimization procedures.]

Author [Jake]

Date [Started - August 2012]

Definition at line 22 of file lucky.c.

23 {
24  int i;
25  for(i=Kit_TruthWordNum_64bit( nVars )-1;i>=0;i--)
26  {
27  if(x[i]==y[i])
28  continue;
29  else if(x[i]>y[i])
30  return 1;
31  else
32  return -1;
33  }
34  return 0;
35 }
int Kit_TruthWordNum_64bit(int nVars)
Definition: luckySwap.c:36
void resetPCanonPermArray_6Vars ( char *  x)

CFile****************************************************************

FileName [luckyFast6.c]

SystemName [ABC: Logic synthesis and verification system.]

PackageName [Semi-canonical form computation package.]

Synopsis [Truth table minimization procedures for 6 vars.]

Author [Jake]

Date [Started - September 2012]

Definition at line 21 of file luckyFast6.c.

22 {
23  x[0]='a';
24  x[1]='b';
25  x[2]='c';
26  x[3]='d';
27  x[4]='e';
28  x[5]='f';
29 }
permInfo* setPermInfoPtr ( int  var)

Definition at line 110 of file luckySimple.c.

111 {
112  permInfo* x;
113  x = (permInfo*) malloc(sizeof(permInfo));
114  x->flipCtr=0;
115  x->varN = var;
116  x->totalFlips=(1<<var)-1;
117  x->swapCtr=0;
118  x->totalSwaps=factorial(var)-1;
119  x->flipArray = (int*) malloc(sizeof(int)*x->totalFlips);
120  x->swapArray = (int*) malloc(sizeof(int)*x->totalSwaps);
121  fillInSwapArray(x);
122  fillInFlipArray(x);
123  return x;
124 }
char * malloc()
int totalSwaps
Definition: lucky.h:28
int var(Lit p)
Definition: SolverTypes.h:62
int totalFlips
Definition: lucky.h:31
int flipCtr
Definition: lucky.h:30
int * flipArray
Definition: lucky.h:29
void fillInFlipArray(permInfo *pi)
Definition: luckySimple.c:94
static int factorial(int n)
Definition: luckySimple.c:106
void fillInSwapArray(permInfo *pi)
Definition: luckySimple.c:72
int swapCtr
Definition: lucky.h:27
int * swapArray
Definition: lucky.h:26
int varN
Definition: lucky.h:25
Definition: lucky.h:23
Abc_TtStore_t* setTtStore ( char *  pFileInput)

Definition at line 319 of file luckyRead.c.

320 {
321  int nVars, nTruths;
322  Abc_TtStore_t * p;
323  // figure out how many truth table and how many variables
324  Abc_TruthGetParams( pFileInput, &nVars, &nTruths );
325  // allocate data-structure
326  p = Abc_TruthStoreAlloc( nVars, nTruths );
327 
328  Abc_TruthStoreRead( pFileInput, p );
329  return p;
330 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static Abc_TtStore_t * Abc_TruthStoreAlloc(int nVars, int nFuncs)
Definition: luckyRead.c:96
static void Abc_TruthGetParams(char *pFileName, int *pnVars, int *pnTruths)
Definition: luckyRead.c:155
static void Abc_TruthStoreRead(char *pFileName, Abc_TtStore_t *p)
Definition: luckyRead.c:210
void simpleMinimal ( word x,
word pAux,
word minimal,
permInfo pi,
int  nVars 
)

Definition at line 151 of file luckySimple.c.

152 {
153  int i,j=0;
154  Kit_TruthCopy_64bit( pAux, x, nVars );
155  Kit_TruthNot_64bit( x, nVars );
156 
157  minWord(x, pAux, minimal, nVars);
158 
159  for(i=pi->totalSwaps-1;i>=0;i--)
160  {
161  Kit_TruthSwapAdjacentVars_64bit(x, nVars, pi->swapArray[i]);
162  Kit_TruthSwapAdjacentVars_64bit(pAux, nVars, pi->swapArray[i]);
163  minWord3(x, pAux, minimal, nVars);
164  }
165  for(j=pi->totalFlips-1;j>=0;j--)
166  {
167  Kit_TruthSwapAdjacentVars_64bit(x, nVars, 0);
168  Kit_TruthSwapAdjacentVars_64bit(pAux, nVars, 0);
169  Kit_TruthChangePhase_64bit(x, nVars, pi->flipArray[j]);
170  Kit_TruthChangePhase_64bit(pAux, nVars, pi->flipArray[j]);
171  minWord3(x, pAux, minimal, nVars);
172  for(i=pi->totalSwaps-1;i>=0;i--)
173  {
174  Kit_TruthSwapAdjacentVars_64bit(x, nVars, pi->swapArray[i]);
175  Kit_TruthSwapAdjacentVars_64bit(pAux, nVars, pi->swapArray[i]);
176  minWord3(x, pAux, minimal, nVars);
177  }
178  }
179  Kit_TruthCopy_64bit( x, minimal, nVars );
180 }
static void minWord3(word *a, word *b, word *minimal, int nVars)
Definition: luckySimple.c:139
void Kit_TruthCopy_64bit(word *pOut, word *pIn, int nVars)
Definition: luckySwap.c:136
int totalSwaps
Definition: lucky.h:28
void Kit_TruthSwapAdjacentVars_64bit(word *pInOut, int nVars, int iVar)
Definition: luckySwap.c:141
int totalFlips
Definition: lucky.h:31
int * flipArray
Definition: lucky.h:29
static void minWord(word *a, word *b, word *minimal, int nVars)
Definition: luckySimple.c:132
int * swapArray
Definition: lucky.h:26
void Kit_TruthNot_64bit(word *pIn, int nVars)
Definition: luckySwap.c:130
void Kit_TruthChangePhase_64bit(word *pInOut, int nVars, int iVar)
Definition: luckySwap.c:100
void swap_ij ( word f,
int  totalVars,
int  varI,
int  varJ 
)

Definition at line 88 of file luckySwapIJ.c.

89 {
90  if (varI == varJ)
91  return;
92  else if(varI>varJ)
93  swap_ij( f,totalVars,varJ,varI);
94  else if((varI <= 4) && (varJ <= 5))
95  swap_ij_case1(f,totalVars, varI, varJ);
96  else if((varI <= 5) && (varJ > 5))
97  swap_ij_case2(f,totalVars, varI, varJ);
98  else if((varI > 5) && (varJ > 5))
99  swap_ij_case3(f,totalVars,varI,varJ);
100 }
void swap_ij_case3(word *f, int totalVars, int i, int j)
Definition: luckySwapIJ.c:68
void swap_ij(word *f, int totalVars, int varI, int varJ)
Definition: luckySwapIJ.c:88
void swap_ij_case2(word *f, int totalVars, int i, int j)
Definition: luckySwapIJ.c:47
ABC_NAMESPACE_IMPL_START void swap_ij_case1(word *f, int totalVars, int i, int j)
Definition: luckySwapIJ.c:23
static void TimePrint ( char *  Message)
inlinestatic

Definition at line 90 of file luckyInt.h.

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 }
static abctime Abc_Clock()
Definition: abc_global.h:279