abc-master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
abcNpnSave.c
Go to the documentation of this file.
1 /**CFile****************************************************************
2 
3  FileName [abcNpnSave.c]
4 
5  SystemName [ABC: Logic synthesis and verification system.]
6 
7  PackageName [Network and node package.]
8 
9  Synopsis [Interface with the FPGA mapping package.]
10 
11  Author [Alan Mishchenko]
12 
13  Affiliation [UC Berkeley]
14 
15  Date [Ver. 1.0. Started - November 21, 2006.]
16 
17  Revision [$Id: abcNpnSave.c,v 1.00 2006/11/21 00:00:00 alanmi Exp $]
18 
19 ***********************************************************************/
20 
21 #include "base/abc/abc.h"
22 #include "aig/aig/aig.h"
23 
25 
26 
27 ////////////////////////////////////////////////////////////////////////
28 /// DECLARATIONS ///
29 ////////////////////////////////////////////////////////////////////////
30 
31 typedef struct Npn_Obj_t_ Npn_Obj_t;
32 typedef struct Npn_Man_t_ Npn_Man_t;
33 
34 struct Npn_Obj_t_
35 {
36  word uTruth; // truth table
37  int Count; // occurrences
38  int iNext; // next entry
39 };
40 struct Npn_Man_t_
41 {
42  Npn_Obj_t * pBuffer; // all NPN entries
43  int * pBins; // hash table
44  int nBins; // hash table size
45  int nBufferSize; // buffer size
46  int nEntries; // entry count
47 };
48 
49 static inline Npn_Obj_t * Npn_ManObj( Npn_Man_t * p, int i ) { assert( i < p->nBufferSize ); return i ? p->pBuffer + i : NULL; }
50 static inline int Npn_ManObjNum( Npn_Man_t * p, Npn_Obj_t * pObj ) { assert( p->pBuffer < pObj ); return pObj - p->pBuffer; }
51 
52 static word Truth[8] = {
53  ABC_CONST(0xAAAAAAAAAAAAAAAA),
54  ABC_CONST(0xCCCCCCCCCCCCCCCC),
55  ABC_CONST(0xF0F0F0F0F0F0F0F0),
56  ABC_CONST(0xFF00FF00FF00FF00),
57  ABC_CONST(0xFFFF0000FFFF0000),
58  ABC_CONST(0xFFFFFFFF00000000),
59  ABC_CONST(0x0000000000000000),
60  ABC_CONST(0xFFFFFFFFFFFFFFFF)
61 };
62 
63 static Npn_Man_t * pNpnMan = NULL;
64 
65 ////////////////////////////////////////////////////////////////////////
66 /// FUNCTION DEFINITIONS ///
67 ////////////////////////////////////////////////////////////////////////
68 
69 /**Function*************************************************************
70 
71  Synopsis []
72 
73  Description []
74 
75  SideEffects []
76 
77  SeeAlso []
78 
79 ***********************************************************************/
80 void Npn_TruthPermute_rec( char * pStr, int mid, int end )
81 {
82  static int count = 0;
83  char * pTemp = Abc_UtilStrsav(pStr);
84  char e;
85  int i;
86  if ( mid == end )
87  {
88  printf( "%03d: %s\n", count++, pTemp );
89  return ;
90  }
91  for ( i = mid; i <= end; i++ )
92  {
93  e = pTemp[mid];
94  pTemp[mid] = pTemp[i];
95  pTemp[i] = e;
96 
97  Npn_TruthPermute_rec( pTemp, mid + 1, end );
98 
99  e = pTemp[mid];
100  pTemp[mid] = pTemp[i];
101  pTemp[i] = e;
102  }
103  ABC_FREE( pTemp );
104 }
105 
106 /**Function*************************************************************
107 
108  Synopsis []
109 
110  Description []
111 
112  SideEffects []
113 
114  SeeAlso []
115 
116 ***********************************************************************/
117 static inline int Npn_TruthHasVar( word t, int v )
118 {
119  return ((t & Truth[v]) >> (1<<v)) != (t & ~Truth[v]);
120 }
121 
122 /**Function*************************************************************
123 
124  Synopsis []
125 
126  Description []
127 
128  SideEffects []
129 
130  SeeAlso []
131 
132 ***********************************************************************/
133 static inline int Npn_TruthSupport( word t )
134 {
135  int v, Supp = 0;
136  for ( v = 0; v < 6; v++ )
137  if ( Npn_TruthHasVar( t, v ) )
138  Supp |= (1 << v);
139  return Supp;
140 }
141 
142 /**Function*************************************************************
143 
144  Synopsis []
145 
146  Description []
147 
148  SideEffects []
149 
150  SeeAlso []
151 
152 ***********************************************************************/
153 static inline int Npn_TruthSuppSize( word t, int nVars )
154 {
155  int v, nSupp = 0;
156  assert( nVars <= 6 );
157  for ( v = 0; v < nVars; v++ )
158  if ( Npn_TruthHasVar( t, v ) )
159  nSupp++;
160  return nSupp;
161 }
162 
163 /**Function*************************************************************
164 
165  Synopsis []
166 
167  Description []
168 
169  SideEffects []
170 
171  SeeAlso []
172 
173 ***********************************************************************/
174 static inline int Npn_TruthIsMinBase( word t )
175 {
176  int Supp = Npn_TruthSupport(t);
177  return (Supp & (Supp+1)) == 0;
178 }
179 
180 /**Function*************************************************************
181 
182  Synopsis []
183 
184  Description []
185 
186  SideEffects []
187 
188  SeeAlso []
189 
190 ***********************************************************************/
191 word Npn_TruthPadWord( word uTruth, int nVars )
192 {
193  if ( nVars == 6 )
194  return uTruth;
195  if ( nVars <= 5 )
196  uTruth = ((uTruth & ABC_CONST(0x00000000FFFFFFFF)) << 32) | (uTruth & ABC_CONST(0x00000000FFFFFFFF));
197  if ( nVars <= 4 )
198  uTruth = ((uTruth & ABC_CONST(0x0000FFFF0000FFFF)) << 16) | (uTruth & ABC_CONST(0x0000FFFF0000FFFF));
199  if ( nVars <= 3 )
200  uTruth = ((uTruth & ABC_CONST(0x00FF00FF00FF00FF)) << 8) | (uTruth & ABC_CONST(0x00FF00FF00FF00FF));
201  if ( nVars <= 2 )
202  uTruth = ((uTruth & ABC_CONST(0x0F0F0F0F0F0F0F0F)) << 4) | (uTruth & ABC_CONST(0x0F0F0F0F0F0F0F0F));
203  if ( nVars <= 1 )
204  uTruth = ((uTruth & ABC_CONST(0x3333333333333333)) << 2) | (uTruth & ABC_CONST(0x3333333333333333));
205  if ( nVars == 0 )
206  uTruth = ((uTruth & ABC_CONST(0x5555555555555555)) << 1) | (uTruth & ABC_CONST(0x5555555555555555));
207  return uTruth;
208 }
209 
210 /**Function*************************************************************
211 
212  Synopsis []
213 
214  Description []
215 
216  SideEffects []
217 
218  SeeAlso []
219 
220 ***********************************************************************/
221 static inline int Npn_TruthCountOnes( word t )
222 {
223  t = (t & ABC_CONST(0x5555555555555555)) + ((t>> 1) & ABC_CONST(0x5555555555555555));
224  t = (t & ABC_CONST(0x3333333333333333)) + ((t>> 2) & ABC_CONST(0x3333333333333333));
225  t = (t & ABC_CONST(0x0F0F0F0F0F0F0F0F)) + ((t>> 4) & ABC_CONST(0x0F0F0F0F0F0F0F0F));
226  t = (t & ABC_CONST(0x00FF00FF00FF00FF)) + ((t>> 8) & ABC_CONST(0x00FF00FF00FF00FF));
227  t = (t & ABC_CONST(0x0000FFFF0000FFFF)) + ((t>>16) & ABC_CONST(0x0000FFFF0000FFFF));
228  return (t & ABC_CONST(0x00000000FFFFFFFF)) + (t>>32);
229 }
230 
231 /**Function*************************************************************
232 
233  Synopsis []
234 
235  Description []
236 
237  SideEffects []
238 
239  SeeAlso []
240 
241 ***********************************************************************/
242 static inline word Npn_TruthChangePhase( word t, int v )
243 {
244  return ((t & Truth[v]) >> (1<<v)) | ((t & ~Truth[v]) << (1<<v));
245 }
246 
247 /**Function*************************************************************
248 
249  Synopsis []
250 
251  Description []
252 
253  SideEffects []
254 
255  SeeAlso []
256 
257 ***********************************************************************/
258 static inline word Npn_TruthSwapAdjacentVars( word t, int v )
259 {
260  static word PMasks[5][3] = {
261  { ABC_CONST(0x9999999999999999), ABC_CONST(0x2222222222222222), ABC_CONST(0x4444444444444444) },
262  { ABC_CONST(0xC3C3C3C3C3C3C3C3), ABC_CONST(0x0C0C0C0C0C0C0C0C), ABC_CONST(0x3030303030303030) },
263  { ABC_CONST(0xF00FF00FF00FF00F), ABC_CONST(0x00F000F000F000F0), ABC_CONST(0x0F000F000F000F00) },
264  { ABC_CONST(0xFF0000FFFF0000FF), ABC_CONST(0x0000FF000000FF00), ABC_CONST(0x00FF000000FF0000) },
265  { ABC_CONST(0xFFFF00000000FFFF), ABC_CONST(0x00000000FFFF0000), ABC_CONST(0x0000FFFF00000000) }
266  };
267  assert( v < 6 );
268  return (t & PMasks[v][0]) | ((t & PMasks[v][1]) << (1 << v)) | ((t & PMasks[v][2]) >> (1 << v));
269 }
270 
271 /**Function*************************************************************
272 
273  Synopsis []
274 
275  Description []
276 
277  SideEffects []
278 
279  SeeAlso []
280 
281 ***********************************************************************/
282 static inline word Npn_TruthCanon( word t, int nVars, int * pPhase )
283 {
284  int fUsePolarity = 0;
285  int fUsePermutation = 0;
286  char Temp, pSigs[13], pCanonPerm[6];
287  int v, fChange, CanonPhase = 0;
288  assert( nVars < 7 );
289  pSigs[12] = Npn_TruthCountOnes( t );
290  if ( pSigs[12] > 32 )
291  {
292  t = ~t;
293  pSigs[12] = 64 - pSigs[12];
294  CanonPhase |= (1 << 6);
295  }
296  if ( fUsePolarity || fUsePermutation )
297  {
298  for ( v = 0; v < nVars; v++ )
299  {
300  pCanonPerm[v] = v;
301  pSigs[2*v+1] = Npn_TruthCountOnes( t & Truth[v] );
302  pSigs[2*v] = pSigs[12] - pSigs[2*v+1];
303  }
304  }
305  if ( fUsePolarity )
306  {
307  for ( v = 0; v < nVars; v++ )
308  {
309  if ( pSigs[2*v] >= pSigs[2*v+1] )
310  continue;
311  CanonPhase |= (1 << v);
312  Temp = pSigs[2*v];
313  pSigs[2*v] = pSigs[2*v+1];
314  pSigs[2*v+1] = Temp;
315  t = Npn_TruthChangePhase( t, v );
316  }
317  }
318  if ( fUsePermutation )
319  {
320  do {
321  fChange = 0;
322  for ( v = 0; v < nVars-1; v++ )
323  {
324  if ( fUsePolarity )
325  {
326  if ( pSigs[2*v] >= pSigs[2*(v+1)] )
327  continue;
328  }
329  else
330  {
331  if ( Abc_MinInt(pSigs[2*v],pSigs[2*v+1]) >= Abc_MinInt(pSigs[2*(v+1)],pSigs[2*(v+1)+1]) )
332  continue;
333  }
334  fChange = 1;
335 
336  Temp = pCanonPerm[v];
337  pCanonPerm[v] = pCanonPerm[v+1];
338  pCanonPerm[v+1] = Temp;
339 
340  Temp = pSigs[2*v];
341  pSigs[2*v] = pSigs[2*(v+1)];
342  pSigs[2*(v+1)] = Temp;
343 
344  Temp = pSigs[2*v+1];
345  pSigs[2*v+1] = pSigs[2*(v+1)+1];
346  pSigs[2*(v+1)+1] = Temp;
347 
348  t = Npn_TruthSwapAdjacentVars( t, v );
349  }
350  } while ( fChange );
351  }
352  if ( pPhase )
353  {
354  *pPhase = 0;
355  for ( v = 0; v < nVars; v++ )
356  *pPhase |= (pCanonPerm[v] << (4 * v));
357  *pPhase |= (CanonPhase << 24);
358  }
359  return t;
360 }
361 
362 
363 /**Function*************************************************************
364 
365  Synopsis [Computes the hash key.]
366 
367  Description []
368 
369  SideEffects []
370 
371  SeeAlso []
372 
373 ***********************************************************************/
374 static inline int Npn_ManHash( Npn_Man_t * p, word uTruth )
375 {
376  word Key = (uTruth * (word)101) ^ (uTruth * (word)733) ^ (uTruth * (word)1777);
377  return (int)(Key % (word)p->nBins);
378 }
379 
380 /**Function*************************************************************
381 
382  Synopsis [Resizes the table.]
383 
384  Description []
385 
386  SideEffects []
387 
388  SeeAlso []
389 
390 ***********************************************************************/
392 {
393  Npn_Obj_t * pEntry, * pNext;
394  int * pBinsOld, * ppPlace;
395  int nBinsOld, Counter, i;
396  abctime clk;
397  assert( p->pBins != NULL );
398 clk = Abc_Clock();
399  // save the old Bins
400  pBinsOld = p->pBins;
401  nBinsOld = p->nBins;
402  // get the new Bins
403  p->nBins = Abc_PrimeCudd( 3 * nBinsOld );
404  p->pBins = ABC_CALLOC( int, p->nBins );
405  // rehash the entries from the old table
406  Counter = 1;
407  for ( i = 0; i < nBinsOld; i++ )
408  for ( pEntry = Npn_ManObj(p, pBinsOld[i]),
409  pNext = pEntry ? Npn_ManObj(p, pEntry->iNext) : NULL;
410  pEntry;
411  pEntry = pNext,
412  pNext = pEntry ? Npn_ManObj(p, pEntry->iNext) : NULL )
413  {
414  // get the place where this entry goes
415  ppPlace = p->pBins + Npn_ManHash( p, pEntry->uTruth );
416  // add the entry to the list
417  pEntry->iNext = *ppPlace;
418  *ppPlace = Npn_ManObjNum( p, pEntry );
419  Counter++;
420  }
421  assert( Counter == p->nEntries );
422  ABC_FREE( pBinsOld );
423 //ABC_PRT( "Hash table resizing time", Abc_Clock() - clk );
424 }
425 
426 /**Function*************************************************************
427 
428  Synopsis [Adds one entry to the table.]
429 
430  Description [Increments ref counter by 1.]
431 
432  SideEffects []
433 
434  SeeAlso []
435 
436 ***********************************************************************/
438 {
439  Npn_Obj_t * pEntry;
440  int * pPlace, Key = Npn_ManHash( p, uTruth );
441  // resize the link storage if needed
442  if ( p->nEntries == p->nBufferSize )
443  {
444  p->nBufferSize *= 2;
446  }
447  // find the entry
448  for ( pEntry = Npn_ManObj(p, p->pBins[Key]),
449  pPlace = p->pBins + Key;
450  pEntry;
451  pPlace = &pEntry->iNext,
452  pEntry = Npn_ManObj(p, pEntry->iNext) )
453  if ( pEntry->uTruth == uTruth )
454  {
455  pEntry->Count++;
456  return pEntry;
457  }
458  // create new entry
459  *pPlace = p->nEntries;
460  assert( p->nEntries < p->nBufferSize );
461  pEntry = Npn_ManObj( p, p->nEntries++ );
462  pEntry->uTruth = uTruth;
463  pEntry->Count = 1;
464  pEntry->iNext = 0;
465  // resize the table if needed
466  if ( p->nEntries > 3 * p->nBins )
467  Npn_ManResize( p );
468  return pEntry;
469 }
470 
471 /**Function*************************************************************
472 
473  Synopsis [Fills table from file.]
474 
475  Description []
476 
477  SideEffects []
478 
479  SeeAlso []
480 
481 ***********************************************************************/
482 void Npn_ManRead( Npn_Man_t * p, char * pFileName )
483 {
484  char pBuffer[1000];
485  char * pToken;
486  Npn_Obj_t * pEntry;
487  unsigned Truth[2];
488  word uTruth;
489  FILE * pFile = fopen( pFileName, "r" );
490  if ( pFile == NULL )
491  {
492  Abc_Print( -1, "Cannot open NPN function file \"%s\".\n", pFileName );
493  return;
494  }
495  // read lines from the file
496  while ( fgets( pBuffer, 1000, pFile ) != NULL )
497  {
498  pToken = strtok( pBuffer, " \t\n" );
499  if ( pToken == NULL )
500  continue;
501  if ( pToken[0] == '#' )
502  continue;
503  if ( strlen(pToken) != 16 )
504  {
505  Abc_Print( 0, "Skipping token %s that does not look like a 16-digit hex number.\n" );
506  continue;
507  }
508  // extract truth table
509  Extra_ReadHexadecimal( Truth, pToken, 6 );
510  uTruth = (((word)Truth[1]) << 32) | (word)Truth[0];
511  // add truth table
512  pEntry = Npn_ManAdd( p, uTruth );
513  assert( pEntry->Count == 1 );
514  // read area
515  pToken = strtok( NULL, " \t\n" );
516  pEntry->Count = atoi(pToken);
517  }
518  fclose( pFile );
519 }
520 
521 /**Function*************************************************************
522 
523  Synopsis [Comparison procedure for two entries.]
524 
525  Description []
526 
527  SideEffects []
528 
529  SeeAlso []
530 
531 ***********************************************************************/
532 static int Npn_ManCompareEntries( Npn_Obj_t ** pp1, Npn_Obj_t ** pp2 )
533 {
534  if ( (*pp1)->Count > (*pp2)->Count )
535  return -1;
536  if ( (*pp1)->Count < (*pp2)->Count )
537  return 1;
538  return 0;
539 }
540 
541 /**Function*************************************************************
542 
543  Synopsis [Adds one entry to the table.]
544 
545  Description []
546 
547  SideEffects []
548 
549  SeeAlso []
550 
551 ***********************************************************************/
552 void Npn_ManWrite( Npn_Man_t * p, char * pFileName )
553 {
554  Vec_Ptr_t * vEntries;
555  Npn_Obj_t * pEntry;
556  FILE * pFile = fopen( pFileName, "w" );
557  int i;
558  if ( pFile == NULL )
559  {
560  Abc_Print( -1, "Cannot open NPN function file \"%s\".\n", pFileName );
561  return;
562  }
563  vEntries = Vec_PtrAlloc( p->nEntries );
564  for ( i = 0; i < p->nBins; i++ )
565  for ( pEntry = Npn_ManObj(p, p->pBins[i]); pEntry; pEntry = Npn_ManObj(p, pEntry->iNext) )
566  Vec_PtrPush( vEntries, pEntry );
567  Vec_PtrSort( vEntries, (int (*)())Npn_ManCompareEntries );
568  Vec_PtrForEachEntry( Npn_Obj_t *, vEntries, pEntry, i )
569  {
570  Extra_PrintHexadecimal( pFile, (unsigned *)&pEntry->uTruth, 6 );
571  fprintf( pFile, " %d %d\n", pEntry->Count, Npn_TruthSuppSize(pEntry->uTruth, 6) );
572  }
573  fclose( pFile );
574  Vec_PtrFree( vEntries );
575 }
576 
577 /**Function*************************************************************
578 
579  Synopsis [Creates the manager.]
580 
581  Description []
582 
583  SideEffects []
584 
585  SeeAlso []
586 
587 ***********************************************************************/
588 Npn_Man_t * Npn_ManStart( char * pFileName )
589 {
590  Npn_Man_t * p;
591  p = ABC_CALLOC( Npn_Man_t, 1 );
592  if ( pFileName == NULL )
593  {
594  p->nBufferSize = 1000000;
595  p->nBufferSize = 100;
597  p->nBins = Abc_PrimeCudd( p->nBufferSize / 2 );
598  p->pBins = ABC_CALLOC( int, p->nBins );
599  p->nEntries = 1;
600  }
601  else
602  {
603  FILE * pFile = fopen( pFileName, "r" );
604  if ( pFile == NULL )
605  {
606  Abc_Print( -1, "Cannot open NPN function file \"%s\".\n", pFileName );
607  return NULL;
608  }
609  fclose( pFile );
610  p->nBufferSize = 4 * ( Extra_FileSize(pFileName) / 20 );
612  p->nBins = Abc_PrimeCudd( p->nBufferSize / 2 );
613  p->pBins = ABC_CALLOC( int, p->nBins );
614  p->nEntries = 1;
615  Npn_ManRead( p, pFileName );
616  }
617  return p;
618 }
619 
620 /**Function*************************************************************
621 
622  Synopsis [Deletes the manager.]
623 
624  Description []
625 
626  SideEffects []
627 
628  SeeAlso []
629 
630 ***********************************************************************/
632 {
633  ABC_FREE( p->pBuffer );
634  ABC_FREE( p->pBins );
635  ABC_FREE( p );
636 }
637 
638 /**Function*************************************************************
639 
640  Synopsis [Cleans the manager.]
641 
642  Description []
643 
644  SideEffects []
645 
646  SeeAlso []
647 
648 ***********************************************************************/
650 {
651  if ( pNpnMan != NULL )
652  {
653  Npn_ManStop( pNpnMan );
654  pNpnMan = NULL;
655  }
656 }
657 
658 /**Function*************************************************************
659 
660  Synopsis [Loads functions from a file.]
661 
662  Description []
663 
664  SideEffects []
665 
666  SeeAlso []
667 
668 ***********************************************************************/
669 void Npn_ManLoad( char * pFileName )
670 {
671 // Npn_TruthPermute_rec( "012345", 0, 5 );
672  if ( pNpnMan != NULL )
673  {
674  Abc_Print( 1, "Removing old table with %d entries.\n", pNpnMan->nEntries );
675  Npn_ManStop( pNpnMan );
676  }
677  pNpnMan = Npn_ManStart( pFileName );
678  Abc_Print( 1, "Created new table with %d entries from file \"%s\".\n", pNpnMan->nEntries, pFileName );
679 }
680 
681 /**Function*************************************************************
682 
683  Synopsis [Saves functions into a file.]
684 
685  Description []
686 
687  SideEffects []
688 
689  SeeAlso []
690 
691 ***********************************************************************/
692 void Npn_ManSave( char * pFileName )
693 {
694  if ( pNpnMan == NULL )
695  {
696  Abc_Print( 1, "There is no table with entries.\n" );
697  return;
698  }
699  Npn_ManWrite( pNpnMan, pFileName );
700  Abc_Print( 1, "Dumped table with %d entries from file \"%s\".\n", pNpnMan->nEntries, pFileName );
701 }
702 
703 /**Function*************************************************************
704 
705  Synopsis [Saves one function into storage.]
706 
707  Description []
708 
709  SideEffects []
710 
711  SeeAlso []
712 
713 ***********************************************************************/
714 void Npn_ManSaveOne( unsigned * puTruth, int nVars )
715 {
716  word uTruth = (((word)puTruth[1]) << 32) | (word)puTruth[0];
717  assert( nVars >= 0 && nVars <= 6 );
718  if ( pNpnMan == NULL )
719  {
720  Abc_Print( 1, "Creating new table with 0 entries.\n" );
721  pNpnMan = Npn_ManStart( NULL );
722  }
723  // skip truth tables that do not depend on some vars
724  if ( !Npn_TruthIsMinBase( uTruth ) )
725  return;
726  // extend truth table to look like 6-input
727  uTruth = Npn_TruthPadWord( uTruth, nVars );
728  // semi(!)-NPN-canonize the truth table
729  uTruth = Npn_TruthCanon( uTruth, 6, NULL );
730  // add to storage
731  Npn_ManAdd( pNpnMan, uTruth );
732 }
733 
734 ////////////////////////////////////////////////////////////////////////
735 /// END OF FILE ///
736 ////////////////////////////////////////////////////////////////////////
737 
738 
740 
static int Npn_TruthSuppSize(word t, int nVars)
Definition: abcNpnSave.c:153
static int Npn_TruthCountOnes(word t)
Definition: abcNpnSave.c:221
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition: vecPtr.h:42
static int Abc_PrimeCudd(unsigned int p)
Definition: abc_global.h:383
static int Npn_TruthSupport(word t)
Definition: abcNpnSave.c:133
static int Npn_ManCompareEntries(Npn_Obj_t **pp1, Npn_Obj_t **pp2)
Definition: abcNpnSave.c:532
static Llb_Mgr_t * p
Definition: llb3Image.c:950
#define ABC_REALLOC(type, obj, num)
Definition: abc_global.h:233
void Npn_ManResize(Npn_Man_t *p)
Definition: abcNpnSave.c:391
void Npn_ManSaveOne(unsigned *puTruth, int nVars)
Definition: abcNpnSave.c:714
char * strtok()
static void Vec_PtrSort(Vec_Ptr_t *p, int(*Vec_PtrSortCompare)()) ___unused
Definition: vecPtr.h:851
static void Vec_PtrPush(Vec_Ptr_t *p, void *Entry)
Definition: vecPtr.h:606
#define ABC_ALLOC(type, num)
Definition: abc_global.h:229
static abctime Abc_Clock()
Definition: abc_global.h:279
int * pBins
Definition: abcNpnSave.c:43
static int Npn_TruthIsMinBase(word t)
Definition: abcNpnSave.c:174
void Npn_ManStop(Npn_Man_t *p)
Definition: abcNpnSave.c:631
static word Truth[8]
Definition: abcNpnSave.c:52
static int Npn_TruthHasVar(word t, int v)
Definition: abcNpnSave.c:117
static int Abc_MinInt(int a, int b)
Definition: abc_global.h:239
void Npn_ManSave(char *pFileName)
Definition: abcNpnSave.c:692
int Extra_FileSize(char *pFileName)
unsigned __int64 word
DECLARATIONS ///.
Definition: kitPerm.c:36
#define ABC_NAMESPACE_IMPL_END
Definition: abc_global.h:108
Npn_Obj_t * pBuffer
Definition: abcNpnSave.c:42
void Npn_ManWrite(Npn_Man_t *p, char *pFileName)
Definition: abcNpnSave.c:552
static word Npn_TruthCanon(word t, int nVars, int *pPhase)
Definition: abcNpnSave.c:282
word uTruth
Definition: abcNpnSave.c:36
static int Counter
static int Npn_ManHash(Npn_Man_t *p, word uTruth)
Definition: abcNpnSave.c:374
int Extra_ReadHexadecimal(unsigned Sign[], char *pString, int nVars)
static void Abc_Print(int level, const char *format,...)
Definition: abc_global.h:313
static word PMasks[5][3]
Definition: ifDec07.c:44
#define ABC_NAMESPACE_IMPL_START
Definition: abc_global.h:107
static int Npn_ManObjNum(Npn_Man_t *p, Npn_Obj_t *pObj)
Definition: abcNpnSave.c:50
static Npn_Obj_t * Npn_ManObj(Npn_Man_t *p, int i)
Definition: abcNpnSave.c:49
static Vec_Ptr_t * Vec_PtrAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: vecPtr.h:83
Npn_Man_t * Npn_ManStart(char *pFileName)
Definition: abcNpnSave.c:588
#define ABC_CONST(number)
PARAMETERS ///.
Definition: abc_global.h:206
#define ABC_FREE(obj)
Definition: abc_global.h:232
int nEntries
Definition: abcNpnSave.c:46
static word Npn_TruthSwapAdjacentVars(word t, int v)
Definition: abcNpnSave.c:258
typedefABC_NAMESPACE_IMPL_START struct Npn_Obj_t_ Npn_Obj_t
DECLARATIONS ///.
Definition: abcNpnSave.c:31
static word Npn_TruthChangePhase(word t, int v)
Definition: abcNpnSave.c:242
Npn_Obj_t * Npn_ManAdd(Npn_Man_t *p, word uTruth)
Definition: abcNpnSave.c:437
void Npn_ManClean()
Definition: abcNpnSave.c:649
#define ABC_CALLOC(type, num)
Definition: abc_global.h:230
void Npn_TruthPermute_rec(char *pStr, int mid, int end)
FUNCTION DEFINITIONS ///.
Definition: abcNpnSave.c:80
static Npn_Man_t * pNpnMan
Definition: abcNpnSave.c:63
#define assert(ex)
Definition: util_old.h:213
int strlen()
void Extra_PrintHexadecimal(FILE *pFile, unsigned Sign[], int nVars)
void Npn_ManLoad(char *pFileName)
Definition: abcNpnSave.c:669
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.
Definition: vecPtr.h:55
void Npn_ManRead(Npn_Man_t *p, char *pFileName)
Definition: abcNpnSave.c:482
ABC_INT64_T abctime
Definition: abc_global.h:278
char * Abc_UtilStrsav(char *s)
Definition: starter.c:47
int nBufferSize
Definition: abcNpnSave.c:45
word Npn_TruthPadWord(word uTruth, int nVars)
Definition: abcNpnSave.c:191
static void Vec_PtrFree(Vec_Ptr_t *p)
Definition: vecPtr.h:223