abc-master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
abcDec.c
Go to the documentation of this file.
1 /**CFile****************************************************************
2 
3  FileName [abcDec.c]
4 
5  SystemName [ABC: Logic synthesis and verification system.]
6 
7  PackageName [Network and node package.]
8 
9  Synopsis [Procedures for testing and comparing decomposition algorithms.]
10 
11  Author [Alan Mishchenko]
12 
13  Affiliation [UC Berkeley]
14 
15  Date [Ver. 1.0. Started - June 20, 2005.]
16 
17  Revision [$Id: abcDec.c,v 1.00 2005/06/20 00:00:00 alanmi Exp $]
18 
19 ***********************************************************************/
20 
21 #include "misc/extra/extra.h"
22 #include "misc/vec/vec.h"
23 
24 #include "bool/bdc/bdc.h"
25 #include "bool/dec/dec.h"
26 #include "bool/kit/kit.h"
27 #include "opt/dau/dau.h"
28 #include "misc/util/utilTruth.h"
29 
31 
32 
33 ////////////////////////////////////////////////////////////////////////
34 /// DECLARATIONS ///
35 ////////////////////////////////////////////////////////////////////////
36 
37 // decomposition type
38 // 0 - none
39 // 1 - factoring
40 // 2 - bi-decomposition
41 // 3 - DSD
42 
43 // data-structure to store a bunch of truth tables
46 {
47  int nVars;
48  int nWords;
49  int nFuncs;
51 };
52 
53 // read/write/flip i-th bit of a bit string table:
54 static inline int Abc_TruthGetBit( word * p, int i ) { return (int)(p[i>>6] >> (i & 63)) & 1; }
55 static inline void Abc_TruthSetBit( word * p, int i ) { p[i>>6] |= (((word)1)<<(i & 63)); }
56 static inline void Abc_TruthXorBit( word * p, int i ) { p[i>>6] ^= (((word)1)<<(i & 63)); }
57 
58 // read/write k-th digit d of a hexadecimal number:
59 static inline int Abc_TruthGetHex( word * p, int k ) { return (int)(p[k>>4] >> ((k<<2) & 63)) & 15; }
60 static inline void Abc_TruthSetHex( word * p, int k, int d ) { p[k>>4] |= (((word)d)<<((k<<2) & 63)); }
61 static inline void Abc_TruthXorHex( word * p, int k, int d ) { p[k>>4] ^= (((word)d)<<((k<<2) & 63)); }
62 
63 ////////////////////////////////////////////////////////////////////////
64 /// FUNCTION DEFINITIONS ///
65 ////////////////////////////////////////////////////////////////////////
66 
67 // read one hex character
68 static inline int Abc_TruthReadHexDigit( char HexChar )
69 {
70  if ( HexChar >= '0' && HexChar <= '9' )
71  return HexChar - '0';
72  if ( HexChar >= 'A' && HexChar <= 'F' )
73  return HexChar - 'A' + 10;
74  if ( HexChar >= 'a' && HexChar <= 'f' )
75  return HexChar - 'a' + 10;
76  assert( 0 ); // not a hexadecimal symbol
77  return -1; // return value which makes no sense
78 }
79 
80 // write one hex character
81 static inline void Abc_TruthWriteHexDigit( FILE * pFile, int HexDigit )
82 {
83  assert( HexDigit >= 0 && HexDigit < 16 );
84  if ( HexDigit < 10 )
85  fprintf( pFile, "%d", HexDigit );
86  else
87  fprintf( pFile, "%c", 'A' + HexDigit-10 );
88 }
89 
90 // read one truth table in hexadecimal
91 void Abc_TruthReadHex( word * pTruth, char * pString, int nVars )
92 {
93  int nWords = (nVars < 7)? 1 : (1 << (nVars-6));
94  int k, Digit, nDigits = (nWords << 4);
95  char EndSymbol;
96  // skip the first 2 symbols if they are "0x"
97  if ( pString[0] == '0' && pString[1] == 'x' )
98  pString += 2;
99  // get the last symbol
100  EndSymbol = pString[nDigits];
101  // the end symbol of the TT (the one immediately following hex digits)
102  // should be one of the following: space, a new-line, or a zero-terminator
103  // (note that on Windows symbols '\r' can be inserted before each '\n')
104  assert( EndSymbol == ' ' || EndSymbol == '\n' || EndSymbol == '\r' || EndSymbol == '\0' );
105  // read hexadecimal digits in the reverse order
106  // (the last symbol in the string is the least significant digit)
107  for ( k = 0; k < nDigits; k++ )
108  {
109  Digit = Abc_TruthReadHexDigit( pString[nDigits - 1 - k] );
110  assert( Digit >= 0 && Digit < 16 );
111  Abc_TruthSetHex( pTruth, k, Digit );
112  }
113 }
114 
115 // write one truth table in hexadecimal (do not add end-of-line!)
116 void Abc_TruthWriteHex( FILE * pFile, word * pTruth, int nVars )
117 {
118  int nDigits, Digit, k;
119  nDigits = (1 << (nVars-2));
120  for ( k = 0; k < nDigits; k++ )
121  {
122  Digit = Abc_TruthGetHex( pTruth, k );
123  assert( Digit >= 0 && Digit < 16 );
124  Abc_TruthWriteHexDigit( pFile, Digit );
125  }
126 }
127 
128 
129 /**Function*************************************************************
130 
131  Synopsis [Allocate/Deallocate storage for truth tables..]
132 
133  Description []
134 
135  SideEffects []
136 
137  SeeAlso []
138 
139 ***********************************************************************/
140 Abc_TtStore_t * Abc_TruthStoreAlloc( int nVars, int nFuncs )
141 {
142  Abc_TtStore_t * p;
143  int i;
144  p = (Abc_TtStore_t *)malloc( sizeof(Abc_TtStore_t) );
145  p->nVars = nVars;
146  p->nWords = (nVars < 7) ? 1 : (1 << (nVars-6));
147  p->nFuncs = nFuncs;
148  // alloc storage for 'nFuncs' truth tables as one chunk of memory
149  p->pFuncs = (word **)malloc( (sizeof(word *) + sizeof(word) * p->nWords) * p->nFuncs );
150  // assign and clean the truth table storage
151  p->pFuncs[0] = (word *)(p->pFuncs + p->nFuncs);
152  memset( p->pFuncs[0], 0, sizeof(word) * p->nWords * p->nFuncs );
153  // split it up into individual truth tables
154  for ( i = 1; i < p->nFuncs; i++ )
155  p->pFuncs[i] = p->pFuncs[i-1] + p->nWords;
156  return p;
157 }
158 Abc_TtStore_t * Abc_TruthStoreAlloc2( int nVars, int nFuncs, word * pBuffer )
159 {
160  Abc_TtStore_t * p;
161  int i;
162  p = (Abc_TtStore_t *)malloc( sizeof(Abc_TtStore_t) );
163  p->nVars = nVars;
164  p->nWords = (nVars < 7) ? 1 : (1 << (nVars-6));
165  p->nFuncs = nFuncs;
166  // alloc storage for 'nFuncs' truth tables as one chunk of memory
167  p->pFuncs = (word **)malloc( sizeof(word *) * p->nFuncs );
168  // assign and clean the truth table storage
169  p->pFuncs[0] = pBuffer;
170  // split it up into individual truth tables
171  for ( i = 1; i < p->nFuncs; i++ )
172  p->pFuncs[i] = p->pFuncs[i-1] + p->nWords;
173  return p;
174 }
175 void Abc_TtStoreFree( Abc_TtStore_t * p, int nVarNum )
176 {
177  if ( nVarNum >= 0 )
178  ABC_FREE( p->pFuncs[0] );
179  ABC_FREE( p->pFuncs );
180  ABC_FREE( p );
181 }
182 
183 /**Function*************************************************************
184 
185  Synopsis [Read file contents.]
186 
187  Description []
188 
189  SideEffects []
190 
191  SeeAlso []
192 
193 ***********************************************************************/
194 int Abc_FileSize( char * pFileName )
195 {
196  FILE * pFile;
197  int nFileSize;
198  pFile = fopen( pFileName, "rb" );
199  if ( pFile == NULL )
200  {
201  printf( "Cannot open file \"%s\" for reading.\n", pFileName );
202  return -1;
203  }
204  // get the file size, in bytes
205  fseek( pFile, 0, SEEK_END );
206  nFileSize = ftell( pFile );
207  fclose( pFile );
208  return nFileSize;
209 }
210 
211 /**Function*************************************************************
212 
213  Synopsis [Read file contents.]
214 
215  Description []
216 
217  SideEffects []
218 
219  SeeAlso []
220 
221 ***********************************************************************/
222 char * Abc_FileRead( char * pFileName )
223 {
224  FILE * pFile;
225  char * pBuffer;
226  int nFileSize, RetValue;
227  pFile = fopen( pFileName, "rb" );
228  if ( pFile == NULL )
229  {
230  printf( "Cannot open file \"%s\" for reading.\n", pFileName );
231  return NULL;
232  }
233  // get the file size, in bytes
234  fseek( pFile, 0, SEEK_END );
235  nFileSize = ftell( pFile );
236  // move the file current reading position to the beginning
237  rewind( pFile );
238  // load the contents of the file into memory
239  pBuffer = (char *)malloc( nFileSize + 3 );
240  RetValue = fread( pBuffer, nFileSize, 1, pFile );
241  // add several empty lines at the end
242  // (these will be used to signal the end of parsing)
243  pBuffer[ nFileSize + 0] = '\n';
244  pBuffer[ nFileSize + 1] = '\n';
245  // terminate the string with '\0'
246  pBuffer[ nFileSize + 2] = '\0';
247  fclose( pFile );
248  return pBuffer;
249 }
250 
251 /**Function*************************************************************
252 
253  Synopsis [Determine the number of variables by reading the first line.]
254 
255  Description [Determine the number of functions by counting the lines.]
256 
257  SideEffects []
258 
259  SeeAlso []
260 
261 ***********************************************************************/
262 void Abc_TruthGetParams( char * pFileName, int * pnVars, int * pnTruths )
263 {
264  char * pContents;
265  int i, nVars, nLines;
266  // prepare the output
267  if ( pnVars )
268  *pnVars = 0;
269  if ( pnTruths )
270  *pnTruths = 0;
271  // read data from file
272  pContents = Abc_FileRead( pFileName );
273  if ( pContents == NULL )
274  return;
275  // count the number of symbols before the first space or new-line
276  // (note that on Windows symbols '\r' can be inserted before each '\n')
277  for ( i = 0; pContents[i]; i++ )
278  if ( pContents[i] == ' ' || pContents[i] == '\n' || pContents[i] == '\r' )
279  break;
280  if ( pContents[i] == 0 )
281  printf( "Strange, the input file does not have spaces and new-lines...\n" );
282 
283  // acount for the fact that truth tables may have "0x" at the beginning of each line
284  if ( pContents[0] == '0' && pContents[1] == 'x' )
285  i = i - 2;
286 
287  // determine the number of variables
288  for ( nVars = 0; nVars < 32; nVars++ )
289  if ( 4 * i == (1 << nVars) ) // the number of bits equal to the size of truth table
290  break;
291  if ( nVars < 2 || nVars > 16 )
292  {
293  printf( "Does not look like the input file contains truth tables...\n" );
294  return;
295  }
296  if ( pnVars )
297  *pnVars = nVars;
298 
299  // determine the number of functions by counting the lines
300  nLines = 0;
301  for ( i = 0; pContents[i]; i++ )
302  nLines += (pContents[i] == '\n');
303  if ( pnTruths )
304  *pnTruths = nLines;
305  ABC_FREE( pContents );
306 }
307 
308 
309 /**Function*************************************************************
310 
311  Synopsis [Read truth tables from file.]
312 
313  Description []
314 
315  SideEffects []
316 
317  SeeAlso []
318 
319 ***********************************************************************/
320 void Abc_TruthStoreRead( char * pFileName, Abc_TtStore_t * p )
321 {
322  char * pContents;
323  int i, nLines;
324  pContents = Abc_FileRead( pFileName );
325  if ( pContents == NULL )
326  return;
327  // here it is assumed (without checking!) that each line of the file
328  // begins with a string of hexadecimal chars followed by space
329 
330  // the file will be read till the first empty line (pContents[i] == '\n')
331  // (note that Abc_FileRead() added several empty lines at the end of the file contents)
332  for ( nLines = i = 0; pContents[i] != '\n'; )
333  {
334  // read one line
335  Abc_TruthReadHex( p->pFuncs[nLines++], &pContents[i], p->nVars );
336  // skip till after the end-of-line symbol
337  // (note that end-of-line symbol is also skipped)
338  while ( pContents[i++] != '\n' );
339  }
340  // adjust the number of functions read
341  // (we may have allocated more storage because some lines in the file were empty)
342  assert( p->nFuncs >= nLines );
343  p->nFuncs = nLines;
344  ABC_FREE( pContents );
345 }
346 
347 /**Function*************************************************************
348 
349  Synopsis [Write truth tables into file.]
350 
351  Description []
352 
353  SideEffects []
354 
355  SeeAlso []
356 
357 ***********************************************************************/
358 void Abc_TtStoreWrite( char * pFileName, Abc_TtStore_t * p, int fBinary )
359 {
360  FILE * pFile;
361  char pBuffer[1000];
362  int i, nBytes = 8 * Abc_Truth6WordNum( p->nVars );
363  pFile = fopen( pFileName, "wb" );
364  if ( pFile == NULL )
365  {
366  printf( "Cannot open file \"%s\" for writing.\n", pFileName );
367  return;
368  }
369  for ( i = 0; i < p->nFuncs; i++ )
370  {
371  if ( fBinary )
372  fwrite( p->pFuncs[i], nBytes, 1, pFile );
373  else
374  {
375  Abc_TruthWriteHex( pFile, p->pFuncs[i], p->nVars ), fprintf( pFile, " " );
376  Dau_DsdDecompose( p->pFuncs[i], p->nVars, 0, (int)(p->nVars <= 10), pBuffer );
377  fprintf( pFile, "%s\n", pBuffer );
378  }
379  }
380  fclose( pFile );
381 }
382 
383 
384 /**Function*************************************************************
385 
386  Synopsis [Read truth tables from input file and write them into output file.]
387 
388  Description []
389 
390  SideEffects []
391 
392  SeeAlso []
393 
394 ***********************************************************************/
395 Abc_TtStore_t * Abc_TtStoreLoad( char * pFileName, int nVarNum )
396 {
397  Abc_TtStore_t * p;
398  if ( nVarNum < 0 )
399  {
400  int nVars, nTruths;
401  // figure out how many truth table and how many variables
402  Abc_TruthGetParams( pFileName, &nVars, &nTruths );
403  if ( nVars < 2 || nVars > 16 || nTruths == 0 )
404  return NULL;
405  // allocate data-structure
406  p = Abc_TruthStoreAlloc( nVars, nTruths );
407  // read info from file
408  Abc_TruthStoreRead( pFileName, p );
409  }
410  else
411  {
412  char * pBuffer;
413  int nFileSize = Abc_FileSize( pFileName );
414  int nBytes = (1 << (nVarNum-3));
415  int nTruths = nFileSize / nBytes;
416  if ( nFileSize == -1 )
417  return NULL;
418  assert( nVarNum >= 6 );
419  if ( nFileSize % nBytes != 0 )
420  Abc_Print( 0, "The file size (%d) is divided by the truth table size (%d) with remainder (%d).\n",
421  nFileSize, nBytes, nFileSize % nBytes );
422  // read file contents
423  pBuffer = Abc_FileRead( pFileName );
424  // allocate data-structure
425  p = Abc_TruthStoreAlloc2( nVarNum, nTruths, (word *)pBuffer );
426  }
427  return p;
428 }
429 
430 /**Function*************************************************************
431 
432  Synopsis [Read truth tables from input file and write them into output file.]
433 
434  Description []
435 
436  SideEffects []
437 
438  SeeAlso []
439 
440 ***********************************************************************/
441 void Abc_TtStoreTest( char * pFileName )
442 {
443  Abc_TtStore_t * p;
444  char * pFileInput = pFileName;
445  char * pFileOutput = "out.txt";
446 
447  // read info from file
448  p = Abc_TtStoreLoad( pFileInput, -1 );
449  if ( p == NULL )
450  return;
451 
452  // write into another file
453  Abc_TtStoreWrite( pFileOutput, p, 0 );
454 
455  // delete data-structure
456  Abc_TtStoreFree( p, -1 );
457  printf( "Input file \"%s\" was copied into output file \"%s\".\n", pFileInput, pFileOutput );
458 }
459 
460 /**Function*************************************************************
461 
462  Synopsis [Apply decomposition to the truth table.]
463 
464  Description [Returns the number of AIG nodes.]
465 
466  SideEffects []
467 
468  SeeAlso []
469 
470 ***********************************************************************/
471 void Abc_TruthDecPerform( Abc_TtStore_t * p, int DecType, int fVerbose )
472 {
473  abctime clk = Abc_Clock();
474  int i, nNodes = 0;
475 
476  char * pAlgoName = NULL;
477  if ( DecType == 1 )
478  pAlgoName = "factoring";
479  else if ( DecType == 2 )
480  pAlgoName = "bi-decomp";
481  else if ( DecType == 3 )
482  pAlgoName = "DSD";
483  else if ( DecType == 4 )
484  pAlgoName = "fast DSD";
485  else if ( DecType == 5 )
486  pAlgoName = "analysis";
487 
488  if ( pAlgoName )
489  printf( "Applying %-10s to %8d func%s of %2d vars... ",
490  pAlgoName, p->nFuncs, (p->nFuncs == 1 ? "":"s"), p->nVars );
491  if ( fVerbose )
492  printf( "\n" );
493 
494  if ( DecType == 1 )
495  {
496  // perform algebraic factoring and count AIG nodes
497  Dec_Graph_t * pFForm;
498  Vec_Int_t * vCover;
499  Vec_Str_t * vStr;
500  char * pSopStr;
501  vStr = Vec_StrAlloc( 10000 );
502  vCover = Vec_IntAlloc( 1 << 16 );
503  for ( i = 0; i < p->nFuncs; i++ )
504  {
505 // extern int Abc_IsopTest( word * pFunc, int nVars, Vec_Int_t * vCover );
506 // if ( i == 0 ) printf( "\n" );
507 // Abc_IsopTest( p->pFuncs[i], p->nVars, vCover );
508 // continue;
509  if ( fVerbose )
510  printf( "%7d : ", i );
511  pSopStr = Kit_PlaFromTruthNew( (unsigned *)p->pFuncs[i], p->nVars, vCover, vStr );
512  pFForm = Dec_Factor( pSopStr );
513  nNodes += Dec_GraphNodeNum( pFForm );
514  if ( fVerbose )
515  Dec_GraphPrint( stdout, pFForm, NULL, NULL );
516  Dec_GraphFree( pFForm );
517  }
518  Vec_IntFree( vCover );
519  Vec_StrFree( vStr );
520  }
521  else if ( DecType == 2 )
522  {
523  // perform bi-decomposition and count AIG nodes
524  Bdc_Man_t * pManDec;
525  Bdc_Par_t Pars = {0}, * pPars = &Pars;
526  pPars->nVarsMax = p->nVars;
527  pManDec = Bdc_ManAlloc( pPars );
528  for ( i = 0; i < p->nFuncs; i++ )
529  {
530  if ( fVerbose )
531  printf( "%7d : ", i );
532  Bdc_ManDecompose( pManDec, (unsigned *)p->pFuncs[i], NULL, p->nVars, NULL, 1000 );
533  nNodes += Bdc_ManAndNum( pManDec );
534  if ( fVerbose )
535  Bdc_ManDecPrint( pManDec );
536  }
537  Bdc_ManFree( pManDec );
538  }
539  else if ( DecType == 3 )
540  {
541  // perform disjoint-support decomposition and count AIG nodes
542  // (non-DSD blocks are decomposed into 2:1 MUXes, each counting as 3 AIG nodes)
543  Kit_DsdNtk_t * pNtk;
544  for ( i = 0; i < p->nFuncs; i++ )
545  {
546  if ( fVerbose )
547  printf( "%7d : ", i );
548  pNtk = Kit_DsdDecomposeMux( (unsigned *)p->pFuncs[i], p->nVars, 3 );
549  if ( fVerbose )
550  Kit_DsdPrintExpanded( pNtk ), printf( "\n" );
551  nNodes += Kit_DsdCountAigNodes( pNtk );
552  Kit_DsdNtkFree( pNtk );
553  }
554  }
555  else if ( DecType == 4 )
556  {
557  char pDsd[DAU_MAX_STR];
558  for ( i = 0; i < p->nFuncs; i++ )
559  {
560  if ( fVerbose )
561  printf( "%7d : ", i );
562  Dau_DsdDecompose( p->pFuncs[i], p->nVars, 0, 1, pDsd );
563  if ( fVerbose )
564  printf( "%s\n", pDsd );
565  nNodes += Dau_DsdCountAnds( pDsd );
566  }
567  }
568  else if ( DecType == 5 )
569  {
570  for ( i = 0; i < p->nFuncs; i++ )
571  {
572  extern void Dau_DecTrySets( word * pInit, int nVars, int fVerbose );
573  int nSuppSize = Abc_TtSupportSize( p->pFuncs[i], p->nVars );
574  if ( fVerbose )
575  printf( "%7d : ", i );
576  Dau_DecTrySets( p->pFuncs[i], nSuppSize, fVerbose );
577  if ( fVerbose )
578  printf( "\n" );
579  }
580  }
581  else assert( 0 );
582 
583  printf( "AIG nodes =%9d ", nNodes );
584  Abc_PrintTime( 1, "Time", Abc_Clock() - clk );
585 }
586 
587 /**Function*************************************************************
588 
589  Synopsis [Apply decomposition to truth tables.]
590 
591  Description []
592 
593  SideEffects []
594 
595  SeeAlso []
596 
597 ***********************************************************************/
598 void Abc_TruthDecTest( char * pFileName, int DecType, int nVarNum, int fVerbose )
599 {
600  Abc_TtStore_t * p;
601 
602  // allocate data-structure
603  p = Abc_TtStoreLoad( pFileName, nVarNum );
604  if ( p == NULL ) return;
605 
606  // consider functions from the file
607  Abc_TruthDecPerform( p, DecType, fVerbose );
608 
609  // delete data-structure
610  Abc_TtStoreFree( p, nVarNum );
611 // printf( "Finished decomposing truth tables from file \"%s\".\n", pFileName );
612 }
613 
614 
615 /**Function*************************************************************
616 
617  Synopsis [Testbench for decomposition algorithms.]
618 
619  Description []
620 
621  SideEffects []
622 
623  SeeAlso []
624 
625 ***********************************************************************/
626 int Abc_DecTest( char * pFileName, int DecType, int nVarNum, int fVerbose )
627 {
628  if ( fVerbose )
629  printf( "Using truth tables from file \"%s\"...\n", pFileName );
630  if ( DecType == 0 )
631  { if ( nVarNum < 0 ) Abc_TtStoreTest( pFileName ); }
632  else if ( DecType >= 1 && DecType <= 5 )
633  Abc_TruthDecTest( pFileName, DecType, nVarNum, fVerbose );
634  else
635  printf( "Unknown decomposition type value (%d).\n", DecType );
636  fflush( stdout );
637  return 0;
638 }
639 
640 ////////////////////////////////////////////////////////////////////////
641 /// END OF FILE ///
642 ////////////////////////////////////////////////////////////////////////
643 
644 
646 
char * memset()
char * malloc()
void Abc_TtStoreWrite(char *pFileName, Abc_TtStore_t *p, int fBinary)
Definition: abcDec.c:358
static void Abc_TruthXorBit(word *p, int i)
Definition: abcDec.c:56
void Bdc_ManDecPrint(Bdc_Man_t *p)
Definition: bdcCore.c:260
void Abc_TtStoreTest(char *pFileName)
Definition: abcDec.c:441
void Abc_TtStoreFree(Abc_TtStore_t *p, int nVarNum)
Definition: abcDec.c:175
static int Dec_GraphNodeNum(Dec_Graph_t *pGraph)
Definition: dec.h:421
static int Abc_TruthGetBit(word *p, int i)
Definition: abcDec.c:54
static Llb_Mgr_t * p
Definition: llb3Image.c:950
int nVarsMax
Definition: bdc.h:48
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition: bblif.c:37
static int Abc_TruthReadHexDigit(char HexChar)
FUNCTION DEFINITIONS ///.
Definition: abcDec.c:68
char * Kit_PlaFromTruthNew(unsigned *pTruth, int nVars, Vec_Int_t *vCover, Vec_Str_t *vStr)
Definition: kitPla.c:406
word ** pFuncs
Definition: luckyInt.h:70
static int Abc_Truth6WordNum(int nVars)
Definition: abc_global.h:257
#define SEEK_END
Definition: zconf.h:392
Kit_DsdNtk_t * Kit_DsdDecomposeMux(unsigned *pTruth, int nVars, int nDecMux)
Definition: kitDsd.c:2350
Bdc_Man_t * Bdc_ManAlloc(Bdc_Par_t *pPars)
MACRO DEFINITIONS ///.
Definition: bdcCore.c:68
int nFuncs
Definition: abcDec.c:49
int Abc_DecTest(char *pFileName, int DecType, int nVarNum, int fVerbose)
Definition: abcDec.c:626
int Dau_DsdDecompose(word *pTruth, int nVarsInit, int fSplitPrime, int fWriteTruth, char *pRes)
Definition: dauDsd.c:1912
Dec_Graph_t * Dec_Factor(char *pSop)
FUNCTION DECLARATIONS ///.
Definition: decFactor.c:55
static Vec_Str_t * Vec_StrAlloc(int nCap)
Definition: bblif.c:495
int Bdc_ManDecompose(Bdc_Man_t *p, unsigned *puFunc, unsigned *puCare, int nVars, Vec_Ptr_t *vDivs, int nNodesMax)
Definition: bdcCore.c:291
static abctime Abc_Clock()
Definition: abc_global.h:279
int Kit_DsdCountAigNodes(Kit_DsdNtk_t *pNtk)
Definition: kitDsd.c:1895
int nWords
Definition: abcNpn.c:127
void Dau_DecTrySets(word *pInit, int nVars, int fVerbose)
Definition: dauNonDsd.c:831
static void Abc_PrintTime(int level, const char *pStr, abctime time)
Definition: abc_global.h:367
Abc_TtStore_t * Abc_TruthStoreAlloc2(int nVars, int nFuncs, word *pBuffer)
Definition: abcDec.c:158
#define DAU_MAX_STR
Definition: dau.h:43
static void Abc_TruthXorHex(word *p, int k, int d)
Definition: abcDec.c:61
void Dec_GraphPrint(FILE *pFile, Dec_Graph_t *pGraph, char *pNamesIn[], char *pNameOut)
FUNCTION DEFINITIONS ///.
Definition: decPrint.c:49
static Vec_Int_t * Vec_IntAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: bblif.c:149
static void Abc_TruthWriteHexDigit(FILE *pFile, int HexDigit)
Definition: abcDec.c:81
void Abc_TruthGetParams(char *pFileName, int *pnVars, int *pnTruths)
Definition: abcDec.c:262
Abc_TtStore_t * Abc_TruthStoreAlloc(int nVars, int nFuncs)
Definition: abcDec.c:140
static void Vec_StrFree(Vec_Str_t *p)
Definition: bblif.c:616
unsigned __int64 word
DECLARATIONS ///.
Definition: kitPerm.c:36
int nWords
Definition: abcDec.c:48
#define ABC_NAMESPACE_IMPL_END
Definition: abc_global.h:108
static void Abc_Print(int level, const char *format,...)
Definition: abc_global.h:313
int Bdc_ManAndNum(Bdc_Man_t *p)
Definition: bdcCore.c:49
char * Abc_FileRead(char *pFileName)
Definition: abcDec.c:222
#define ABC_NAMESPACE_IMPL_START
Definition: abc_global.h:107
Abc_TtStore_t * Abc_TtStoreLoad(char *pFileName, int nVarNum)
Definition: abcDec.c:395
void Abc_TruthStoreRead(char *pFileName, Abc_TtStore_t *p)
Definition: abcDec.c:320
void Abc_TruthDecTest(char *pFileName, int DecType, int nVarNum, int fVerbose)
Definition: abcDec.c:598
static void Abc_TruthSetHex(word *p, int k, int d)
Definition: abcDec.c:60
Definition: bdc.h:45
#define ABC_FREE(obj)
Definition: abc_global.h:232
int Abc_FileSize(char *pFileName)
Definition: abcDec.c:194
static int Abc_TtSupportSize(word *t, int nVars)
Definition: utilTruth.h:986
static void Dec_GraphFree(Dec_Graph_t *pGraph)
Definition: dec.h:307
void Kit_DsdNtkFree(Kit_DsdNtk_t *pNtk)
Definition: kitDsd.c:163
#define assert(ex)
Definition: util_old.h:213
void Bdc_ManFree(Bdc_Man_t *p)
Definition: bdcCore.c:113
int Dau_DsdCountAnds(char *pDsd)
Definition: dauDsd.c:316
word ** pFuncs
Definition: abcDec.c:50
static void Vec_IntFree(Vec_Int_t *p)
Definition: bblif.c:235
static int Abc_TruthGetHex(word *p, int k)
Definition: abcDec.c:59
void Abc_TruthWriteHex(FILE *pFile, word *pTruth, int nVars)
Definition: abcDec.c:116
static void Abc_TruthSetBit(word *p, int i)
Definition: abcDec.c:55
void Abc_TruthReadHex(word *pTruth, char *pString, int nVars)
Definition: abcDec.c:91
ABC_INT64_T abctime
Definition: abc_global.h:278
VOID_HACK rewind()
void Kit_DsdPrintExpanded(Kit_DsdNtk_t *pNtk)
Definition: kitDsd.c:471
void Abc_TruthDecPerform(Abc_TtStore_t *p, int DecType, int fVerbose)
Definition: abcDec.c:471