abc-master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
abcCascade.c
Go to the documentation of this file.
1 /**CFile****************************************************************
2 
3  FileName [abcCascade.c]
4 
5  SystemName [ABC: Logic synthesis and verification system.]
6 
7  PackageName [Network and node package.]
8 
9  Synopsis [Collapsing the network into two-levels.]
10 
11  Author [Alan Mishchenko]
12 
13  Affiliation [UC Berkeley]
14 
15  Date [Ver. 1.0. Started - June 20, 2005.]
16 
17  Revision [$Id: abcCollapse.c,v 1.00 2005/06/20 00:00:00 alanmi Exp $]
18 
19 ***********************************************************************/
20 
21 #include "base/abc/abc.h"
22 #include "bdd/reo/reo.h"
23 #include "misc/extra/extraBdd.h"
24 
26 
27 ////////////////////////////////////////////////////////////////////////
28 /// DECLARATIONS ///
29 ////////////////////////////////////////////////////////////////////////
30 
31 #define BDD_FUNC_MAX 256
32 
33 //extern void Abc_NodeShowBddOne( DdManager * dd, DdNode * bFunc );
34 extern DdNode * Abc_ConvertSopToBdd( DdManager * dd, char * pSop, DdNode ** pbVars );
35 
36 ////////////////////////////////////////////////////////////////////////
37 /// FUNCTION DEFINITIONS ///
38 ////////////////////////////////////////////////////////////////////////
39 
40 /**Function*************************************************************
41 
42  Synopsis [Derive BDD of the characteristic function.]
43 
44  Description []
45 
46  SideEffects []
47 
48  SeeAlso []
49 
50 ***********************************************************************/
52 {
53  Vec_Ptr_t * vNodes, * vBdds, * vLocals;
54  Abc_Obj_t * pObj, * pFanin;
55  DdNode * bFunc, * bPart, * bTemp, * bVar;
56  int i, k;
57  assert( Abc_NtkIsSopLogic(pNtk) );
58  assert( Abc_NtkCoNum(pNtk) <= 3 );
59  vBdds = Vec_PtrStart( Abc_NtkObjNumMax(pNtk) );
60  Abc_NtkForEachCi( pNtk, pObj, i )
61  Vec_PtrWriteEntry( vBdds, Abc_ObjId(pObj), Cudd_bddIthVar(dd, i) );
62  // create internal node BDDs
63  vNodes = Abc_NtkDfs( pNtk, 0 );
64  vLocals = Vec_PtrAlloc( 6 );
65  Vec_PtrForEachEntry( Abc_Obj_t *, vNodes, pObj, i )
66  {
67  if ( Abc_ObjFaninNum(pObj) == 0 )
68  {
69  bFunc = Cudd_NotCond( Cudd_ReadOne(dd), Abc_SopIsConst0((char *)pObj->pData) ); Cudd_Ref( bFunc );
70  Vec_PtrWriteEntry( vBdds, Abc_ObjId(pObj), bFunc );
71  continue;
72  }
73  Vec_PtrClear( vLocals );
74  Abc_ObjForEachFanin( pObj, pFanin, k )
75  Vec_PtrPush( vLocals, Vec_PtrEntry(vBdds, Abc_ObjId(pFanin)) );
76  bFunc = Abc_ConvertSopToBdd( dd, (char *)pObj->pData, (DdNode **)Vec_PtrArray(vLocals) ); Cudd_Ref( bFunc );
77  Vec_PtrWriteEntry( vBdds, Abc_ObjId(pObj), bFunc );
78  }
79  Vec_PtrFree( vLocals );
80  // create char function
81  bFunc = Cudd_ReadOne( dd ); Cudd_Ref( bFunc );
82  Abc_NtkForEachCo( pNtk, pObj, i )
83  {
84  bVar = Cudd_bddIthVar( dd, i + Abc_NtkCiNum(pNtk) );
85  bTemp = (DdNode *)Vec_PtrEntry( vBdds, Abc_ObjFaninId0(pObj) );
86  bPart = Cudd_bddXnor( dd, bTemp, bVar ); Cudd_Ref( bPart );
87  bFunc = Cudd_bddAnd( dd, bTemp = bFunc, bPart ); Cudd_Ref( bFunc );
88  Cudd_RecursiveDeref( dd, bTemp );
89  Cudd_RecursiveDeref( dd, bPart );
90  }
91  // dereference
92  Vec_PtrForEachEntry( Abc_Obj_t *, vNodes, pObj, i )
93  Cudd_RecursiveDeref( dd, (DdNode *)Vec_PtrEntry(vBdds, Abc_ObjId(pObj)) );
94  Vec_PtrFree( vBdds );
95  Vec_PtrFree( vNodes );
96  // reorder
98  Cudd_Deref( bFunc );
99  return bFunc;
100 }
101 
102 /**Function*************************************************************
103 
104  Synopsis [Initializes variable partition.]
105 
106  Description []
107 
108  SideEffects []
109 
110  SeeAlso []
111 
112 ***********************************************************************/
113 void Abc_ResStartPart( int nInputs, unsigned uParts[], int nParts )
114 {
115  int i, Group, Left, Shift = 0, Count = 0;
116  Group = nInputs / nParts;
117  Left = nInputs % nParts;
118  for ( i = 0; i < Left; i++ )
119  {
120  uParts[i] = (~((~0) << (Group+1))) << Shift;
121  Shift += Group+1;
122  }
123  for ( ; i < nParts; i++ )
124  {
125  uParts[i] = (~((~0) << Group)) << Shift;
126  Shift += Group;
127  }
128  for ( i = 0; i < nParts; i++ )
129  Count += Extra_WordCountOnes( uParts[i] );
130  assert( Count == nInputs );
131 }
132 
133 /**Function*************************************************************
134 
135  Synopsis [Initializes variable partition.]
136 
137  Description []
138 
139  SideEffects []
140 
141  SeeAlso []
142 
143 ***********************************************************************/
144 void Abc_ResStartPart2( int nInputs, unsigned uParts[], int nParts )
145 {
146  int i, Count = 0;
147  for ( i = 0; i < nParts; i++ )
148  uParts[i] = 0;
149  for ( i = 0; i < nInputs; i++ )
150  uParts[i % nParts] |= (1 << i);
151  for ( i = 0; i < nParts; i++ )
152  Count += Extra_WordCountOnes( uParts[i] );
153  assert( Count == nInputs );
154 }
155 
156 /**Function*************************************************************
157 
158  Synopsis [Returns one if unique pattern.]
159 
160  Description []
161 
162  SideEffects []
163 
164  SeeAlso []
165 
166 ***********************************************************************/
167 int Abc_ResCheckUnique( char Pats[], int nPats, int pat )
168 {
169  int i;
170  for ( i = 0; i < nPats; i++ )
171  if ( Pats[i] == pat )
172  return 0;
173  return 1;
174 }
175 
176 /**Function*************************************************************
177 
178  Synopsis [Check if pattern is decomposable with non-strict.]
179 
180  Description []
181 
182  SideEffects []
183 
184  SeeAlso []
185 
186 ***********************************************************************/
187 int Abc_ResCheckNonStrict( char Pattern[], int nVars, int nBits )
188 {
189  static char Pat0[256], Pat1[256];
190  int v, m, nPats0, nPats1, nNumber = (1 << (nBits - 1));
191  int Result = 0;
192  for ( v = 0; v < nVars; v++ )
193  {
194  nPats0 = nPats1 = 0;
195  for ( m = 0; m < (1<<nVars); m++ )
196  {
197  if ( (m & (1 << v)) == 0 )
198  {
199  if ( Abc_ResCheckUnique( Pat0, nPats0, Pattern[m] ) )
200  {
201  Pat0[ nPats0++ ] = Pattern[m];
202  if ( nPats0 > nNumber )
203  break;
204  }
205  }
206  else
207  {
208  if ( Abc_ResCheckUnique( Pat1, nPats1, Pattern[m] ) )
209  {
210  Pat1[ nPats1++ ] = Pattern[m];
211  if ( nPats1 > nNumber )
212  break;
213  }
214  }
215  }
216  if ( m == (1<<nVars) )
217  Result++;
218  }
219  return Result;
220 }
221 
222 /**Function*************************************************************
223 
224  Synopsis [Compute the number of distinct cofactors in the BDD.]
225 
226  Description []
227 
228  SideEffects []
229 
230  SeeAlso []
231 
232 ***********************************************************************/
233 int Abc_ResCofCount( DdManager * dd, DdNode * bFunc, unsigned uMask, int * pCheck )
234 {
235  static char Pattern[256];
236  DdNode * pbVars[32];
237  Vec_Ptr_t * vCofs;
238  DdNode * bCof, * bCube, * bTemp;
239  int i, k, Result, nVars = 0;
240  // collect variables
241  for ( i = 0; i < 32; i++ )
242  if ( uMask & (1 << i) )
243  pbVars[nVars++] = dd->vars[i];
244  assert( nVars <= 8 );
245  // compute cofactors
246  vCofs = Vec_PtrAlloc( 100 );
247  for ( i = 0; i < (1 << nVars); i++ )
248  {
249  bCube = Extra_bddBitsToCube( dd, i, nVars, pbVars, 1 ); Cudd_Ref( bCube );
250  bCof = Cudd_Cofactor( dd, bFunc, bCube ); Cudd_Ref( bCof );
251  Cudd_RecursiveDeref( dd, bCube );
252  Vec_PtrForEachEntry( DdNode *, vCofs, bTemp, k )
253  if ( bTemp == bCof )
254  break;
255  if ( k < Vec_PtrSize(vCofs) )
256  Cudd_RecursiveDeref( dd, bCof );
257  else
258  Vec_PtrPush( vCofs, bCof );
259  Pattern[i] = k;
260  }
261  Result = Vec_PtrSize( vCofs );
262  Vec_PtrForEachEntry( DdNode *, vCofs, bCof, i )
263  Cudd_RecursiveDeref( dd, bCof );
264  Vec_PtrFree( vCofs );
265  if ( pCheck )
266  {
267  *pCheck = Abc_ResCheckNonStrict( Pattern, nVars, Abc_Base2Log(Result) );
268 /*
269  if ( *pCheck == 1 && nVars == 4 && Result == 8 )
270  {
271  for ( i = 0; i < (1 << nVars); i++ )
272  printf( "%d ", Pattern[i] );
273  i = 0;
274  }
275 */
276  }
277  return Result;
278 }
279 
280 /**Function*************************************************************
281 
282  Synopsis [Computes cost of the partition.]
283 
284  Description []
285 
286  SideEffects []
287 
288  SeeAlso []
289 
290 ***********************************************************************/
291 int Abc_ResCost( DdManager * dd, DdNode * bFunc, unsigned uMask, int * pnCofs, int * pCheck )
292 {
293  int nCofs = Abc_ResCofCount( dd, bFunc, uMask, pCheck );
294  int n2Log = Abc_Base2Log( nCofs );
295  if ( pnCofs ) *pnCofs = nCofs;
296  return 10000 * n2Log + (nCofs - (1 << (n2Log-1))) * (nCofs - (1 << (n2Log-1)));
297 }
298 
299 /**Function*************************************************************
300 
301  Synopsis [Migrates variables between the two groups.]
302 
303  Description [Returns 1 if there is change.]
304 
305  SideEffects []
306 
307  SeeAlso []
308 
309 ***********************************************************************/
310 int Abc_ResMigrate( DdManager * dd, DdNode * bFunc, int nInputs, unsigned uParts[], int iPart1, int iPart2 )
311 {
312  unsigned uParts2[2] = { uParts[iPart1], uParts[iPart2] };
313  int i, k, CostCur, CostBest, fChange = 0;
314  assert( (uParts[iPart1] & uParts[iPart2]) == 0 );
315  CostBest = Abc_ResCost( dd, bFunc, uParts[iPart1], NULL, NULL )
316  + Abc_ResCost( dd, bFunc, uParts[iPart2], NULL, NULL );
317  for ( i = 0; i < nInputs; i++ )
318  if ( uParts[iPart1] & (1 << i) )
319  {
320  for ( k = 0; k < nInputs; k++ )
321  if ( uParts[iPart2] & (1 << k) )
322  {
323  if ( i == k )
324  continue;
325  uParts[iPart1] ^= (1 << i) | (1 << k);
326  uParts[iPart2] ^= (1 << i) | (1 << k);
327  CostCur = Abc_ResCost( dd, bFunc, uParts[iPart1], NULL, NULL ) + Abc_ResCost( dd, bFunc, uParts[iPart2], NULL, NULL );
328  if ( CostCur < CostBest )
329  {
330  CostCur = CostBest;
331  uParts2[0] = uParts[iPart1];
332  uParts2[1] = uParts[iPart2];
333  fChange = 1;
334  }
335  uParts[iPart1] ^= (1 << i) | (1 << k);
336  uParts[iPart2] ^= (1 << i) | (1 << k);
337  }
338  }
339  uParts[iPart1] = uParts2[0];
340  uParts[iPart2] = uParts2[1];
341  return fChange;
342 }
343 
344 /**Function*************************************************************
345 
346  Synopsis [Migrates variables between the two groups.]
347 
348  Description [Returns 1 if there is change.]
349 
350  SideEffects []
351 
352  SeeAlso []
353 
354 ***********************************************************************/
355 void Abc_ResPrint( DdManager * dd, DdNode * bFunc, int nInputs, unsigned uParts[], int nParts )
356 {
357  int i, k, nCofs, Cost, CostAll = 0, fCheck;
358  for ( i = 0; i < nParts; i++ )
359  {
360  Cost = Abc_ResCost( dd, bFunc, uParts[i], &nCofs, &fCheck );
361  CostAll += Cost;
362  for ( k = 0; k < nInputs; k++ )
363  printf( "%c", (uParts[i] & (1 << k))? 'a' + k : '-' );
364  printf( " %2d %d-%d %6d ", nCofs, Abc_Base2Log(nCofs), fCheck, Cost );
365  }
366  printf( "%4d\n", CostAll );
367 }
368 
369 /**Function*************************************************************
370 
371  Synopsis [PrintCompute the number of distinct cofactors in the BDD.]
372 
373  Description []
374 
375  SideEffects []
376 
377  SeeAlso []
378 
379 ***********************************************************************/
380 void Abc_ResPrintAllCofs( DdManager * dd, DdNode * bFunc, int nInputs, int nCofMax )
381 {
382  int i, k, nBits, nCofs, Cost, fCheck;
383  for ( i = 0; i < (1<<nInputs); i++ )
384  {
385  nBits = Extra_WordCountOnes( i );
386  if ( nBits < 3 || nBits > 6 )
387  continue;
388  Cost = Abc_ResCost( dd, bFunc, i, &nCofs, &fCheck );
389  if ( nCofs > nCofMax )
390  continue;
391  for ( k = 0; k < nInputs; k++ )
392  printf( "%c", (i & (1 << k))? 'a' + k : '-' );
393  printf( " n=%2d c=%2d l=%d-%d %6d\n",
394  Extra_WordCountOnes(i), nCofs, Abc_Base2Log(nCofs), fCheck, Cost );
395  }
396 }
397 
398 /**Function*************************************************************
399 
400  Synopsis [Compute the number of distinct cofactors in the BDD.]
401 
402  Description []
403 
404  SideEffects []
405 
406  SeeAlso []
407 
408 ***********************************************************************/
409 void Abc_ResSwapRandom( DdManager * dd, DdNode * bFunc, int nInputs, unsigned uParts[], int nParts, int nTimes )
410 {
411  int i, k, n, iPart1, iPart2;
412  for ( n = 0; n < nTimes; )
413  {
414  // get the vars
415  i = k = 0;
416  while ( i == k )
417  {
418  i = rand() % nInputs;
419  k = rand() % nInputs;
420  }
421  // find the groups
422  for ( iPart1 = 0; iPart1 < nParts; iPart1++ )
423  if ( uParts[iPart1] & (1 << i) )
424  break;
425  for ( iPart2 = 0; iPart2 < nParts; iPart2++ )
426  if ( uParts[iPart2] & (1 << k) )
427  break;
428  if ( iPart1 == iPart2 )
429  continue;
430  // swap the vars
431  uParts[iPart1] ^= (1 << i) | (1 << k);
432  uParts[iPart2] ^= (1 << i) | (1 << k);
433  n++;
434 //printf( " " );
435 //Abc_ResPrint( dd, bFunc, nInputs, uParts, nParts );
436  }
437 }
438 
439 /**Function*************************************************************
440 
441  Synopsis [Compute the number of distinct cofactors in the BDD.]
442 
443  Description []
444 
445  SideEffects []
446 
447  SeeAlso []
448 
449 ***********************************************************************/
450 void Abc_ResPartition( DdManager * dd, DdNode * bFunc, int nInputs )
451 {
452  int nIters = 5;
453  unsigned uParts[10];
454  int i, fChange = 1;
455  int nSuppSize = Cudd_SupportSize( dd, bFunc );
456  printf( "Ins =%3d. Outs =%2d. Nodes =%3d. Supp =%2d.\n",
457  nInputs, dd->size-nInputs, Cudd_DagSize(bFunc), nSuppSize );
458 //Abc_ResPrintAllCofs( dd, bFunc, nInputs, 4 );
459 
460  if ( nSuppSize <= 6 )
461  {
462  printf( "Support is less or equal than 6\n" );
463  return;
464  }
465  if ( nInputs <= 12 )
466  {
467  Abc_ResStartPart( nInputs, uParts, 2 );
468  Abc_ResPrint( dd, bFunc, nInputs, uParts, 2 );
469  for ( i = 0; i < nIters; i++ )
470  {
471  if ( i )
472  {
473  printf( "Randomizing... \n" );
474  Abc_ResSwapRandom( dd, bFunc, nInputs, uParts, 2, 20 );
475  Abc_ResPrint( dd, bFunc, nInputs, uParts, 2 );
476  }
477  fChange = 1;
478  while ( fChange )
479  {
480  fChange = Abc_ResMigrate( dd, bFunc, nInputs, uParts, 0, 1 );
481  Abc_ResPrint( dd, bFunc, nInputs, uParts, 2 );
482  }
483  }
484  }
485  else if ( nInputs > 12 && nInputs <= 18 )
486  {
487  Abc_ResStartPart( nInputs, uParts, 3 );
488  Abc_ResPrint( dd, bFunc, nInputs, uParts, 3 );
489  for ( i = 0; i < nIters; i++ )
490  {
491  if ( i )
492  {
493  printf( "Randomizing... \n" );
494  Abc_ResSwapRandom( dd, bFunc, nInputs, uParts, 3, 20 );
495  Abc_ResPrint( dd, bFunc, nInputs, uParts, 3 );
496  }
497  fChange = 1;
498  while ( fChange )
499  {
500  fChange = Abc_ResMigrate( dd, bFunc, nInputs, uParts, 0, 1 );
501  Abc_ResPrint( dd, bFunc, nInputs, uParts, 3 );
502  fChange |= Abc_ResMigrate( dd, bFunc, nInputs, uParts, 0, 2 );
503  Abc_ResPrint( dd, bFunc, nInputs, uParts, 3 );
504  fChange |= Abc_ResMigrate( dd, bFunc, nInputs, uParts, 1, 2 );
505  Abc_ResPrint( dd, bFunc, nInputs, uParts, 3 );
506  }
507  }
508  }
509  else if ( nInputs > 18 && nInputs <= 24 )
510  {
511  Abc_ResStartPart( nInputs, uParts, 4 );
512  Abc_ResPrint( dd, bFunc, nInputs, uParts, 4 );
513  for ( i = 0; i < nIters; i++ )
514  {
515  if ( i )
516  {
517  printf( "Randomizing... \n" );
518  Abc_ResSwapRandom( dd, bFunc, nInputs, uParts, 4, 20 );
519  Abc_ResPrint( dd, bFunc, nInputs, uParts, 4 );
520  }
521  fChange = 1;
522  while ( fChange )
523  {
524  fChange = Abc_ResMigrate( dd, bFunc, nInputs, uParts, 0, 1 );
525  Abc_ResPrint( dd, bFunc, nInputs, uParts, 4 );
526  fChange |= Abc_ResMigrate( dd, bFunc, nInputs, uParts, 0, 2 );
527  Abc_ResPrint( dd, bFunc, nInputs, uParts, 4 );
528  fChange |= Abc_ResMigrate( dd, bFunc, nInputs, uParts, 0, 3 );
529  Abc_ResPrint( dd, bFunc, nInputs, uParts, 4 );
530  fChange |= Abc_ResMigrate( dd, bFunc, nInputs, uParts, 1, 2 );
531  Abc_ResPrint( dd, bFunc, nInputs, uParts, 4 );
532  fChange |= Abc_ResMigrate( dd, bFunc, nInputs, uParts, 1, 3 );
533  Abc_ResPrint( dd, bFunc, nInputs, uParts, 4 );
534  fChange |= Abc_ResMigrate( dd, bFunc, nInputs, uParts, 2, 3 );
535  Abc_ResPrint( dd, bFunc, nInputs, uParts, 4 );
536  }
537  }
538  }
539 // else assert( 0 );
540 }
541 
542 /**Function*************************************************************
543 
544  Synopsis [Compute the number of distinct cofactors in the BDD.]
545 
546  Description []
547 
548  SideEffects []
549 
550  SeeAlso []
551 
552 ***********************************************************************/
554 {
555  DdManager * dd;
556  DdNode * bFunc;
558  bFunc = Abc_ResBuildBdd( pNtk, dd ); Cudd_Ref( bFunc );
559  Abc_ResPartition( dd, bFunc, Abc_NtkCiNum(pNtk) );
560  Cudd_RecursiveDeref( dd, bFunc );
561  Extra_StopManager( dd );
562 }
563 
564 
565 
566 
567 
568 
569 
570 /**Function*************************************************************
571 
572  Synopsis [Compute the number of distinct cofactors in the BDD.]
573 
574  Description []
575 
576  SideEffects []
577 
578  SeeAlso []
579 
580 ***********************************************************************/
581 int Abc_NtkBddCofCount( DdManager * dd, DdNode * bFunc, DdNode ** pbVars, int nVars )
582 {
583  Vec_Ptr_t * vCofs;
584  DdNode * bCof, * bCube;
585  int i, Result;
586  vCofs = Vec_PtrAlloc( 100 );
587  for ( i = 0; i < (1 << nVars); i++ )
588  {
589  bCube = Extra_bddBitsToCube( dd, i, nVars, pbVars, 1 ); Cudd_Ref( bCube );
590  bCof = Cudd_Cofactor( dd, bFunc, bCube ); Cudd_Ref( bCof );
591  Cudd_RecursiveDeref( dd, bCube );
592  if ( Vec_PtrPushUnique( vCofs, bCof ) )
593  Cudd_RecursiveDeref( dd, bCof );
594  }
595  Result = Vec_PtrSize( vCofs );
596  Vec_PtrForEachEntry( DdNode *, vCofs, bCof, i )
597  Cudd_RecursiveDeref( dd, bCof );
598  Vec_PtrFree( vCofs );
599  return Result;
600 }
601 
602 /**Function*************************************************************
603 
604  Synopsis [Compute the number of distinct cofactors in the BDD.]
605 
606  Description []
607 
608  SideEffects []
609 
610  SeeAlso []
611 
612 ***********************************************************************/
613 void Abc_NtkExploreCofs2( DdManager * dd, DdNode * bFunc, DdNode ** pbVars, int nIns, int nLutSize )
614 {
615  int i;
616  printf( "Inputs = %2d. Nodes = %2d. LutSize = %2d.\n", nIns, Cudd_DagSize(bFunc), nLutSize );
617  for ( i = 0; i <= nIns - nLutSize; i++ )
618  printf( "[%2d %2d] : %3d\n", i, i+nLutSize-1, Abc_NtkBddCofCount(dd, bFunc, dd->vars+i, nLutSize) );
619 }
620 
621 /**Function*************************************************************
622 
623  Synopsis [Compute the number of distinct cofactors in the BDD.]
624 
625  Description []
626 
627  SideEffects []
628 
629  SeeAlso []
630 
631 ***********************************************************************/
632 void Abc_NtkExploreCofs( DdManager * dd, DdNode * bFunc, DdNode ** pbVars, int nIns, int nLutSize )
633 {
634  DdManager * ddNew;
635  DdNode * bFuncNew;
636  DdNode * pbVarsNew[32];
637  int i, k, c, nCofs, nBits;
638 
639  ddNew = Cudd_Init( dd->size, 0, CUDD_UNIQUE_SLOTS, CUDD_CACHE_SLOTS, 0 );
640  Cudd_ShuffleHeap( ddNew, dd->invperm );
641  bFuncNew = Cudd_bddTransfer( dd, ddNew, bFunc ); Cudd_Ref( bFuncNew );
642 
643  for ( i = 0; i < (1 << nIns); i++ )
644  {
645  nBits = Extra_WordCountOnes(i);
646  if ( nBits != nLutSize && nBits != nLutSize -1 && nBits != nLutSize -2 )
647  continue;
648  for ( c = k = 0; k < nIns; k++ )
649  {
650  if ( (i & (1 << k)) == 0 )
651  continue;
652 // pbVarsNew[c++] = pbVars[k];
653  pbVarsNew[c++] = ddNew->vars[k];
654  }
655  nCofs = Abc_NtkBddCofCount(ddNew, bFuncNew, pbVarsNew, c);
656  if ( nCofs > 8 )
657  continue;
658 
659  for ( c = k = 0; k < nIns; k++ )
660  {
661  if ( (i & (1 << k)) == 0 )
662  {
663  printf( "-" );
664  continue;
665  }
666  printf( "%c", k + 'a' );
667  }
668  printf( " : %2d\n", nCofs );
669  }
670 
671  Cudd_RecursiveDeref( ddNew, bFuncNew );
672  Extra_StopManager( ddNew );
673 }
674 
675 /**Function*************************************************************
676 
677  Synopsis [Find the constant node corresponding to the encoded output value.]
678 
679  Description []
680 
681  SideEffects []
682 
683  SeeAlso []
684 
685 ***********************************************************************/
686 DdNode * Abc_NtkBddFindAddConst( DdManager * dd, DdNode * bFunc, int nOuts )
687 {
688  int i, TermMask = 0;
689  DdNode * bFunc0, * bFunc1, * bConst0, * bConst1;
690  bConst0 = Cudd_ReadLogicZero( dd );
691  bConst1 = Cudd_ReadOne( dd );
692  for ( i = 0; i < nOuts; i++ )
693  {
694  if ( Cudd_IsComplement(bFunc) )
695  {
696  bFunc0 = Cudd_Not(Cudd_E(bFunc));
697  bFunc1 = Cudd_Not(Cudd_T(bFunc));
698  }
699  else
700  {
701  bFunc0 = Cudd_E(bFunc);
702  bFunc1 = Cudd_T(bFunc);
703  }
704  assert( bFunc0 == bConst0 || bFunc1 == bConst0 );
705  if ( bFunc0 == bConst0 )
706  {
707  TermMask ^= (1 << i);
708  bFunc = bFunc1;
709  }
710  else
711  bFunc = bFunc0;
712  }
713  assert( bFunc == bConst1 );
714  return Cudd_addConst( dd, TermMask );
715 }
716 
717 /**Function*************************************************************
718 
719  Synopsis [Recursively construct ADD for BDD.]
720 
721  Description []
722 
723  SideEffects []
724 
725  SeeAlso []
726 
727 ***********************************************************************/
728 DdNode * Abc_NtkBddToAdd_rec( DdManager * dd, DdNode * bFunc, int nOuts, stmm_table * tTable, int fCompl )
729 {
730  DdNode * aFunc0, * aFunc1, * aFunc;
731  DdNode ** ppSlot;
732  assert( !Cudd_IsComplement(bFunc) );
733  if ( stmm_find_or_add( tTable, (char *)bFunc, (char ***)&ppSlot ) )
734  return *ppSlot;
735  if ( (int)bFunc->index >= Cudd_ReadSize(dd) - nOuts )
736  {
737  assert( Cudd_ReadPerm(dd, bFunc->index) >= Cudd_ReadSize(dd) - nOuts );
738  aFunc = Abc_NtkBddFindAddConst( dd, Cudd_NotCond(bFunc, fCompl), nOuts ); Cudd_Ref( aFunc );
739  }
740  else
741  {
742  aFunc0 = Abc_NtkBddToAdd_rec( dd, Cudd_Regular(cuddE(bFunc)), nOuts, tTable, fCompl ^ Cudd_IsComplement(cuddE(bFunc)) );
743  aFunc1 = Abc_NtkBddToAdd_rec( dd, cuddT(bFunc), nOuts, tTable, fCompl );
744  aFunc = Cudd_addIte( dd, Cudd_addIthVar(dd, bFunc->index), aFunc1, aFunc0 ); Cudd_Ref( aFunc );
745  }
746  return (*ppSlot = aFunc);
747 }
748 
749 /**Function*************************************************************
750 
751  Synopsis [R]
752 
753  Description []
754 
755  SideEffects []
756 
757  SeeAlso []
758 
759 ***********************************************************************/
760 DdNode * Abc_NtkBddToAdd( DdManager * dd, DdNode * bFunc, int nOuts )
761 {
762  DdNode * aFunc, * aTemp, * bTemp;
763  stmm_table * tTable;
764  stmm_generator * gen;
766  aFunc = Abc_NtkBddToAdd_rec( dd, Cudd_Regular(bFunc), nOuts, tTable, Cudd_IsComplement(bFunc) );
767  stmm_foreach_item( tTable, gen, (char **)&bTemp, (char **)&aTemp )
768  Cudd_RecursiveDeref( dd, aTemp );
769  stmm_free_table( tTable );
770  Cudd_Deref( aFunc );
771  return aFunc;
772 }
773 
774 /**Function*************************************************************
775 
776  Synopsis [Recursively construct ADD for BDD.]
777 
778  Description []
779 
780  SideEffects []
781 
782  SeeAlso []
783 
784 ***********************************************************************/
785 DdNode * Abc_NtkAddToBdd_rec( DdManager * dd, DdNode * aFunc, int nIns, int nOuts, stmm_table * tTable )
786 {
787  DdNode * bFunc0, * bFunc1, * bFunc;
788  DdNode ** ppSlot;
789  assert( !Cudd_IsComplement(aFunc) );
790  if ( stmm_find_or_add( tTable, (char *)aFunc, (char ***)&ppSlot ) )
791  return *ppSlot;
792  if ( Cudd_IsConstant(aFunc) )
793  {
794  assert( Cudd_ReadSize(dd) >= nIns + nOuts );
795  bFunc = Extra_bddBitsToCube( dd, (int)Cudd_V(aFunc), nOuts, dd->vars + nIns, 1 ); Cudd_Ref( bFunc );
796  }
797  else
798  {
799  assert( aFunc->index < nIns );
800  bFunc0 = Abc_NtkAddToBdd_rec( dd, cuddE(aFunc), nIns, nOuts, tTable );
801  bFunc1 = Abc_NtkAddToBdd_rec( dd, cuddT(aFunc), nIns, nOuts, tTable );
802  bFunc = Cudd_bddIte( dd, Cudd_bddIthVar(dd, aFunc->index), bFunc1, bFunc0 ); Cudd_Ref( bFunc );
803  }
804  return (*ppSlot = bFunc);
805 }
806 
807 /**Function*************************************************************
808 
809  Synopsis [R]
810 
811  Description []
812 
813  SideEffects []
814 
815  SeeAlso []
816 
817 ***********************************************************************/
818 DdNode * Abc_NtkAddToBdd( DdManager * dd, DdNode * aFunc, int nIns, int nOuts )
819 {
820  DdNode * bFunc, * bTemp, * aTemp;
821  stmm_table * tTable;
822  stmm_generator * gen;
824  bFunc = Abc_NtkAddToBdd_rec( dd, aFunc, nIns, nOuts, tTable );
825  stmm_foreach_item( tTable, gen, (char **)&aTemp, (char **)&bTemp )
826  Cudd_RecursiveDeref( dd, bTemp );
827  stmm_free_table( tTable );
828  Cudd_Deref( bFunc );
829  return bFunc;
830 }
831 
832 /**Function*************************************************************
833 
834  Synopsis [Computes the characteristic function.]
835 
836  Description []
837 
838  SideEffects []
839 
840  SeeAlso []
841 
842 ***********************************************************************/
843 DdNode * Abc_NtkBddDecCharFunc( DdManager * dd, DdNode ** pFuncs, int nOuts, int Mask, int nBits )
844 {
845  DdNode * bFunc, * bTemp, * bExor, * bVar;
846  int i, Count = 0;
847  bFunc = Cudd_ReadOne( dd ); Cudd_Ref( bFunc );
848  for ( i = 0; i < nOuts; i++ )
849  {
850  if ( (Mask & (1 << i)) == 0 )
851  continue;
852  Count++;
853  bVar = Cudd_bddIthVar( dd, dd->size - nOuts + i );
854  bExor = Cudd_bddXor( dd, pFuncs[i], bVar ); Cudd_Ref( bExor );
855  bFunc = Cudd_bddAnd( dd, bTemp = bFunc, Cudd_Not(bExor) ); Cudd_Ref( bFunc );
856  Cudd_RecursiveDeref( dd, bTemp );
857  Cudd_RecursiveDeref( dd, bExor );
858  }
859  Cudd_Deref( bFunc );
860  assert( Count == nBits );
861  return bFunc;
862 }
863 
864 /**Function*************************************************************
865 
866  Synopsis [Evaluate Sasao's decomposition.]
867 
868  Description []
869 
870  SideEffects []
871 
872  SeeAlso []
873 
874 ***********************************************************************/
875 DdNode * Abc_NtkBddDecTry( reo_man * pReo, DdManager * dd, DdNode ** pFuncs, int nIns, int nOuts, int Mask, int nBits )
876 {
877 // int fReorder = 0;
878  DdNode * bFunc;//, * aFunc, * aFuncNew;
879  // derive the characteristic function
880  bFunc = Abc_NtkBddDecCharFunc( dd, pFuncs, nOuts, Mask, nBits ); Cudd_Ref( bFunc );
881 /*
882  // transfer to ADD
883  aFunc = Abc_NtkBddToAdd( dd, bFunc, nOuts ); Cudd_Ref( aFunc );
884  Cudd_RecursiveDeref( dd, bFunc );
885 //Abc_NodeShowBddOne( dd, aFunc );
886 
887  // perform reordering for BDD width
888  if ( fReorder )
889  {
890  aFuncNew = Extra_Reorder( pReo, dd, aFunc, NULL ); Cudd_Ref( aFuncNew );
891  printf( "Before = %d. After = %d.\n", Cudd_DagSize(aFunc), Cudd_DagSize(aFuncNew) );
892  Cudd_RecursiveDeref( dd, aFunc );
893  }
894  else
895  aFuncNew = aFunc;
896 
897  // get back to BDD
898  bFunc = Abc_NtkAddToBdd( dd, aFuncNew, nIns, nOuts ); Cudd_Ref( bFunc );
899  Cudd_RecursiveDeref( dd, aFuncNew );
900 //Abc_NodeShowBddOne( dd, bFunc );
901  // print the result
902 // reoProfileWidthPrint( pReo );
903 */
904  Cudd_Deref( bFunc );
905  return bFunc;
906 }
907 
908 /**Function*************************************************************
909 
910  Synopsis [Evaluate Sasao's decomposition.]
911 
912  Description []
913 
914  SideEffects []
915 
916  SeeAlso []
917 
918 ***********************************************************************/
919 DdNode * Abc_NtkBddDecInt( reo_man * pReo, DdManager * dd, DdNode ** pFuncs, int nIns, int nOuts )
920 {
921 /*
922  int i, k;
923  for ( i = 1; i <= nOuts; i++ )
924  {
925  for ( k = 0; k < (1<<nOuts); k++ )
926  if ( Extra_WordCountOnes(k) == i )
927  {
928  Extra_PrintBinary( stdout, (unsigned *)&k, nOuts );
929  Abc_NtkBddDecTry( pReo, dd, pFuncs, nOuts, k, i );
930  printf( "\n" );
931  }
932  }
933 */
934  return Abc_NtkBddDecTry( pReo, dd, pFuncs, nIns, nOuts, ~(1<<(32-nOuts)), nOuts );
935 
936 }
937 
938 /**Function*************************************************************
939 
940  Synopsis [Evaluate Sasao's decomposition.]
941 
942  Description []
943 
944  SideEffects []
945 
946  SeeAlso []
947 
948 ***********************************************************************/
950 {
951  Abc_Ntk_t * pNtkNew;
952  Abc_Obj_t * pNode, * pNodeNew, * pNodePo;
953  int i;
954  // start the network
955  pNtkNew = Abc_NtkAlloc( ABC_NTK_LOGIC, ABC_FUNC_BDD, 1 );
956  pNtkNew->pName = Extra_UtilStrsav(pNtk->pName);
957  // create inputs for CIs
958  pNodeNew = Abc_NtkCreateNode( pNtkNew );
959  Abc_NtkForEachCi( pNtk, pNode, i )
960  {
961  pNode->pCopy = Abc_NtkCreatePi( pNtkNew );
962  Abc_ObjAddFanin( pNodeNew, pNode->pCopy );
963  Abc_ObjAssignName( pNode->pCopy, Abc_ObjName(pNode), NULL );
964  }
965  // create inputs for COs
966  Abc_NtkForEachCo( pNtk, pNode, i )
967  {
968  pNode->pCopy = Abc_NtkCreatePi( pNtkNew );
969  Abc_ObjAddFanin( pNodeNew, pNode->pCopy );
970  Abc_ObjAssignName( pNode->pCopy, Abc_ObjName(pNode), NULL );
971  }
972  // transfer BDD
973  pNodeNew->pData = Extra_TransferLevelByLevel( dd, (DdManager *)pNtkNew->pManFunc, bFunc ); Cudd_Ref( (DdNode *)pNodeNew->pData );
974  // transfer BDD into to be the local function
975  pNodePo = Abc_NtkCreatePo( pNtkNew );
976  Abc_ObjAddFanin( pNodePo, pNodeNew );
977  Abc_ObjAssignName( pNodePo, "out", NULL );
978  if ( !Abc_NtkCheck( pNtkNew ) )
979  fprintf( stdout, "Abc_NtkCreateFromCharFunc(): Network check has failed.\n" );
980  return pNtkNew;
981 }
982 
983 /**Function*************************************************************
984 
985  Synopsis [Evaluate Sasao's decomposition.]
986 
987  Description []
988 
989  SideEffects []
990 
991  SeeAlso []
992 
993 ***********************************************************************/
994 Abc_Ntk_t * Abc_NtkBddDec( Abc_Ntk_t * pNtk, int fVerbose )
995 {
996  int nBddSizeMax = 1000000;
997  int fDropInternal = 0;
998  int fReorder = 1;
999  Abc_Ntk_t * pNtkNew;
1000  reo_man * pReo;
1001  DdManager * dd;
1002  DdNode * pFuncs[BDD_FUNC_MAX];
1003  DdNode * bFunc;
1004  Abc_Obj_t * pNode;
1005  int i;
1006  assert( Abc_NtkIsStrash(pNtk) );
1007  assert( Abc_NtkCoNum(pNtk) <= BDD_FUNC_MAX );
1008  dd = (DdManager *)Abc_NtkBuildGlobalBdds( pNtk, nBddSizeMax, fDropInternal, fReorder, fVerbose );
1009  if ( dd == NULL )
1010  {
1011  Abc_Print( -1, "Construction of global BDDs has failed.\n" );
1012  return NULL;
1013  }
1014  // collect global BDDs
1015  Abc_NtkForEachCo( pNtk, pNode, i )
1016  pFuncs[i] = (DdNode *)Abc_ObjGlobalBdd(pNode);
1017 
1018  // create new variables at the bottom
1019  assert( dd->size == Abc_NtkCiNum(pNtk) );
1020  for ( i = 0; i < Abc_NtkCoNum(pNtk); i++ )
1021  Cudd_addNewVarAtLevel( dd, dd->size );
1022 
1023  // prepare reordering engine
1024  pReo = Extra_ReorderInit( Abc_NtkCiNum(pNtk), 1000 );
1026  Extra_ReorderSetVerification( pReo, 1 );
1027  Extra_ReorderSetVerbosity( pReo, 1 );
1028 
1029  // derive characteristic function
1030  bFunc = Abc_NtkBddDecInt( pReo, dd, pFuncs, Abc_NtkCiNum(pNtk), Abc_NtkCoNum(pNtk) ); Cudd_Ref( bFunc );
1031  Extra_ReorderQuit( pReo );
1032 
1033 Abc_NtkExploreCofs( dd, bFunc, dd->vars, Abc_NtkCiNum(pNtk), 6 );
1034 
1035  // create new network
1036 // pNtkNew = Abc_NtkCreateFromCharFunc( pNtk, dd, bFunc );
1037  pNtkNew = Abc_NtkDup( pNtk );
1038 
1039  // cleanup
1040  Cudd_RecursiveDeref( dd, bFunc );
1041  Abc_NtkFreeGlobalBdds( pNtk, 1 );
1042  return pNtkNew;
1043 }
1044 
1046 
1047 ////////////////////////////////////////////////////////////////////////
1048 /// END OF FILE ///
1049 ////////////////////////////////////////////////////////////////////////
1050 
1051 
static unsigned Abc_ObjId(Abc_Obj_t *pObj)
Definition: abc.h:329
#define BDD_FUNC_MAX
DECLARATIONS ///.
Definition: abcCascade.c:31
static Vec_Ptr_t * Vec_PtrStart(int nSize)
Definition: vecPtr.h:106
#define Cudd_T(node)
Definition: cudd.h:440
static int Abc_NtkIsStrash(Abc_Ntk_t *pNtk)
Definition: abc.h:251
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition: vecPtr.h:42
DdNode * Abc_NtkBddFindAddConst(DdManager *dd, DdNode *bFunc, int nOuts)
Definition: abcCascade.c:686
DdNode * Abc_NtkBddToAdd_rec(DdManager *dd, DdNode *bFunc, int nOuts, stmm_table *tTable, int fCompl)
Definition: abcCascade.c:728
#define CUDD_UNIQUE_SLOTS
Definition: cudd.h:97
#define Cudd_E(node)
Definition: cudd.h:455
void Cudd_RecursiveDeref(DdManager *table, DdNode *n)
Definition: cuddRef.c:154
Definition: cudd.h:278
#define Cudd_Not(node)
Definition: cudd.h:367
static int Abc_NtkObjNumMax(Abc_Ntk_t *pNtk)
Definition: abc.h:284
stmm_table * stmm_init_table(stmm_compare_func_type compare, stmm_hash_func_type hash)
Definition: stmm.c:69
int Abc_ResCheckUnique(char Pats[], int nPats, int pat)
Definition: abcCascade.c:167
static int Vec_PtrPushUnique(Vec_Ptr_t *p, void *Entry)
Definition: vecPtr.h:656
void Extra_ReorderSetVerbosity(reo_man *p, int fVerbose)
Definition: reoApi.c:229
void Cudd_Deref(DdNode *node)
Definition: cuddRef.c:438
DdNode * Cudd_addNewVarAtLevel(DdManager *dd, int level)
Definition: cuddAPI.c:290
Abc_Ntk_t * Abc_NtkBddDec(Abc_Ntk_t *pNtk, int fVerbose)
Definition: abcCascade.c:994
DdNode * Cudd_addConst(DdManager *dd, CUDD_VALUE_TYPE c)
Definition: cuddAPI.c:620
int size
Definition: cuddInt.h:361
#define Cudd_IsConstant(node)
Definition: cudd.h:352
DdNode * Cudd_ReadLogicZero(DdManager *dd)
Definition: cuddAPI.c:1058
void Abc_ResStartPart(int nInputs, unsigned uParts[], int nParts)
Definition: abcCascade.c:113
void Extra_ReorderSetVerification(reo_man *p, int fVerify)
Definition: reoApi.c:212
#define Cudd_Regular(node)
Definition: cudd.h:397
int Abc_ResCost(DdManager *dd, DdNode *bFunc, unsigned uMask, int *pnCofs, int *pCheck)
Definition: abcCascade.c:291
static int Abc_ObjFaninNum(Abc_Obj_t *pObj)
Definition: abc.h:364
int st__ptrcmp(const char *, const char *)
Definition: st.c:480
DdNode * Abc_ConvertSopToBdd(DdManager *dd, char *pSop, DdNode **pbVars)
FUNCTION DEFINITIONS ///.
Definition: abcFunc.c:56
#define CUDD_CACHE_SLOTS
Definition: cudd.h:98
ABC_DLL Abc_Ntk_t * Abc_NtkDup(Abc_Ntk_t *pNtk)
Definition: abcNtk.c:419
static void Vec_PtrPush(Vec_Ptr_t *p, void *Entry)
Definition: vecPtr.h:606
Abc_Ntk_t * Abc_NtkCreateFromCharFunc(Abc_Ntk_t *pNtk, DdManager *dd, DdNode *bFunc)
Definition: abcCascade.c:949
static int Abc_NtkCiNum(Abc_Ntk_t *pNtk)
Definition: abc.h:287
#define Abc_NtkForEachCo(pNtk, pCo, i)
Definition: abc.h:519
ABC_DLL int Abc_NtkCheck(Abc_Ntk_t *pNtk)
FUNCTION DEFINITIONS ///.
Definition: abcCheck.c:61
static int Abc_NtkIsSopLogic(Abc_Ntk_t *pNtk)
Definition: abc.h:264
ABC_DLL char * Abc_ObjAssignName(Abc_Obj_t *pObj, char *pName, char *pSuffix)
Definition: abcNames.c:68
DdNode * Cudd_bddIte(DdManager *dd, DdNode *f, DdNode *g, DdNode *h)
Definition: cuddBddIte.c:143
ABC_DLL Vec_Ptr_t * Abc_NtkDfs(Abc_Ntk_t *pNtk, int fCollectAll)
Definition: abcDfs.c:81
void Extra_StopManager(DdManager *dd)
Definition: extraBddMisc.c:223
int Abc_ResCheckNonStrict(char Pattern[], int nVars, int nBits)
Definition: abcCascade.c:187
static int Vec_PtrSize(Vec_Ptr_t *p)
Definition: vecPtr.h:295
void Extra_ReorderSetMinimizationType(reo_man *p, reo_min_type fMinType)
Definition: reoApi.c:122
static int Abc_ObjFaninId0(Abc_Obj_t *pObj)
Definition: abc.h:367
static int Abc_NtkCoNum(Abc_Ntk_t *pNtk)
Definition: abc.h:288
int Cudd_ReadSize(DdManager *dd)
Definition: cuddAPI.c:1441
DdNode * Abc_NtkAddToBdd_rec(DdManager *dd, DdNode *aFunc, int nIns, int nOuts, stmm_table *tTable)
Definition: abcCascade.c:785
char * Extra_UtilStrsav(const char *s)
DdNode * Cudd_bddTransfer(DdManager *ddSource, DdManager *ddDestination, DdNode *f)
Definition: cuddBridge.c:409
static void * Abc_ObjGlobalBdd(Abc_Obj_t *pObj)
Definition: abc.h:431
ABC_DLL void Abc_ObjAddFanin(Abc_Obj_t *pObj, Abc_Obj_t *pFanin)
Definition: abcFanio.c:84
ABC_DLL Abc_Ntk_t * Abc_NtkAlloc(Abc_NtkType_t Type, Abc_NtkFunc_t Func, int fUseMemMan)
DECLARATIONS ///.
Definition: abcNtk.c:50
void Abc_NtkExploreCofs(DdManager *dd, DdNode *bFunc, DdNode **pbVars, int nIns, int nLutSize)
Definition: abcCascade.c:632
ABC_DLL void * Abc_NtkFreeGlobalBdds(Abc_Ntk_t *pNtk, int fFreeMan)
Definition: abcNtbdd.c:476
void * pManFunc
Definition: abc.h:191
DdNode * Extra_TransferLevelByLevel(DdManager *ddSource, DdManager *ddDestination, DdNode *f)
Definition: extraBddMisc.c:112
#define Cudd_IsComplement(node)
Definition: cudd.h:425
int Abc_NtkBddCofCount(DdManager *dd, DdNode *bFunc, DdNode **pbVars, int nVars)
Definition: abcCascade.c:581
DdNode * Cudd_addIthVar(DdManager *dd, int i)
Definition: cuddAPI.c:384
Abc_Obj_t * pCopy
Definition: abc.h:148
DdNode * Cudd_Cofactor(DdManager *dd, DdNode *f, DdNode *g)
Definition: cuddCof.c:123
int Cudd_ReadPerm(DdManager *dd, int i)
Definition: cuddAPI.c:2301
int Cudd_ShuffleHeap(DdManager *table, int *permutation)
Definition: cuddReorder.c:338
DdNode * Abc_NtkBddDecCharFunc(DdManager *dd, DdNode **pFuncs, int nOuts, int Mask, int nBits)
Definition: abcCascade.c:843
#define ABC_NAMESPACE_IMPL_END
Definition: abc_global.h:108
DdManager * Cudd_Init(unsigned int numVars, unsigned int numVarsZ, unsigned int numSlots, unsigned int cacheSize, unsigned long maxMemory)
Definition: cuddInit.c:125
void Abc_ResSwapRandom(DdManager *dd, DdNode *bFunc, int nInputs, unsigned uParts[], int nParts, int nTimes)
Definition: abcCascade.c:409
ABC_DLL int Abc_SopIsConst0(char *pSop)
Definition: abcSop.c:676
void Abc_ResPartitionTest(Abc_Ntk_t *pNtk)
Definition: abcCascade.c:553
static Abc_Obj_t * Abc_NtkCreatePi(Abc_Ntk_t *pNtk)
Definition: abc.h:303
DdNode * Cudd_bddXnor(DdManager *dd, DdNode *f, DdNode *g)
Definition: cuddBddIte.c:507
#define cuddT(node)
Definition: cuddInt.h:636
void Abc_ResPrintAllCofs(DdManager *dd, DdNode *bFunc, int nInputs, int nCofMax)
Definition: abcCascade.c:380
static void Abc_Print(int level, const char *format,...)
Definition: abc_global.h:313
int Abc_ResCofCount(DdManager *dd, DdNode *bFunc, unsigned uMask, int *pCheck)
Definition: abcCascade.c:233
int stmm_find_or_add(stmm_table *table, char *key, char ***slot)
Definition: stmm.c:266
#define Cudd_V(node)
Definition: cudd.h:470
static void Vec_PtrWriteEntry(Vec_Ptr_t *p, int i, void *Entry)
Definition: vecPtr.h:396
#define ABC_NAMESPACE_IMPL_START
Definition: abc_global.h:107
static void * Vec_PtrEntry(Vec_Ptr_t *p, int i)
Definition: vecPtr.h:362
void Abc_NtkExploreCofs2(DdManager *dd, DdNode *bFunc, DdNode **pbVars, int nIns, int nLutSize)
Definition: abcCascade.c:613
void stmm_free_table(stmm_table *table)
Definition: stmm.c:79
int Abc_ResMigrate(DdManager *dd, DdNode *bFunc, int nInputs, unsigned uParts[], int iPart1, int iPart2)
Definition: abcCascade.c:310
DdNode * Abc_NtkBddDecInt(reo_man *pReo, DdManager *dd, DdNode **pFuncs, int nIns, int nOuts)
Definition: abcCascade.c:919
DdNode * Cudd_ReadOne(DdManager *dd)
Definition: cuddAPI.c:987
DdNode * Cudd_addIte(DdManager *dd, DdNode *f, DdNode *g, DdNode *h)
Definition: cuddAddIte.c:129
#define Abc_NtkForEachCi(pNtk, pCi, i)
Definition: abc.h:515
static Vec_Ptr_t * Vec_PtrAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: vecPtr.h:83
#define Abc_ObjForEachFanin(pObj, pFanin, i)
Definition: abc.h:524
DdHalfWord index
Definition: cudd.h:279
ABC_DLL char * Abc_ObjName(Abc_Obj_t *pNode)
DECLARATIONS ///.
Definition: abcNames.c:48
DdNode ** vars
Definition: cuddInt.h:390
static int Abc_Base2Log(unsigned n)
Definition: abc_global.h:251
DdNode * Cudd_bddIthVar(DdManager *dd, int i)
Definition: cuddAPI.c:416
DdNode * Cudd_bddXor(DdManager *dd, DdNode *f, DdNode *g)
Definition: cuddBddIte.c:476
static Abc_Obj_t * Abc_NtkCreateNode(Abc_Ntk_t *pNtk)
Definition: abc.h:308
void Abc_ResStartPart2(int nInputs, unsigned uParts[], int nParts)
Definition: abcCascade.c:144
#define cuddE(node)
Definition: cuddInt.h:652
#define Cudd_NotCond(node, c)
Definition: cudd.h:383
static int Extra_WordCountOnes(unsigned uWord)
Definition: extra.h:255
DdNode * Cudd_bddAnd(DdManager *dd, DdNode *f, DdNode *g)
Definition: cuddBddIte.c:314
DdNode * Abc_NtkAddToBdd(DdManager *dd, DdNode *aFunc, int nIns, int nOuts)
Definition: abcCascade.c:818
DdNode * Extra_bddBitsToCube(DdManager *dd, int Code, int CodeWidth, DdNode **pbVars, int fMsbFirst)
Definition: extraBddMisc.c:730
#define assert(ex)
Definition: util_old.h:213
static void Vec_PtrClear(Vec_Ptr_t *p)
Definition: vecPtr.h:545
reo_man * Extra_ReorderInit(int nDdVarsMax, int nNodesMax)
FUNCTION DECLARATIONS ///.
Definition: reoApi.c:50
void Extra_ReorderQuit(reo_man *p)
Definition: reoApi.c:79
int * invperm
Definition: cuddInt.h:388
int Cudd_ReduceHeap(DdManager *table, Cudd_ReorderingType heuristic, int minsize)
Definition: cuddReorder.c:176
void * pData
Definition: abc.h:145
ABC_DLL void * Abc_NtkBuildGlobalBdds(Abc_Ntk_t *pNtk, int fBddSizeMax, int fDropInternal, int fReorder, int fVerbose)
Definition: abcNtbdd.c:251
#define stmm_foreach_item(table, gen, key, value)
Definition: stmm.h:121
void Cudd_Ref(DdNode *n)
Definition: cuddRef.c:129
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.
Definition: vecPtr.h:55
void Abc_ResPartition(DdManager *dd, DdNode *bFunc, int nInputs)
Definition: abcCascade.c:450
int Cudd_SupportSize(DdManager *dd, DdNode *f)
Definition: cuddUtil.c:857
static Abc_Obj_t * Abc_NtkCreatePo(Abc_Ntk_t *pNtk)
Definition: abc.h:304
static void ** Vec_PtrArray(Vec_Ptr_t *p)
Definition: vecPtr.h:279
DdNode * Abc_ResBuildBdd(Abc_Ntk_t *pNtk, DdManager *dd)
FUNCTION DEFINITIONS ///.
Definition: abcCascade.c:51
int st__ptrhash(const char *, int)
Definition: st.c:468
char * pName
Definition: abc.h:158
DdNode * Abc_NtkBddDecTry(reo_man *pReo, DdManager *dd, DdNode **pFuncs, int nIns, int nOuts, int Mask, int nBits)
Definition: abcCascade.c:875
DdNode * Abc_NtkBddToAdd(DdManager *dd, DdNode *bFunc, int nOuts)
Definition: abcCascade.c:760
void Abc_ResPrint(DdManager *dd, DdNode *bFunc, int nInputs, unsigned uParts[], int nParts)
Definition: abcCascade.c:355
Definition: reo.h:101
int Cudd_DagSize(DdNode *node)
Definition: cuddUtil.c:442
static void Vec_PtrFree(Vec_Ptr_t *p)
Definition: vecPtr.h:223