abc-master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
nwkUtil.c
Go to the documentation of this file.
1 /**CFile****************************************************************
2 
3  FileName [nwkUtil.c]
4 
5  SystemName [ABC: Logic synthesis and verification system.]
6 
7  PackageName [Logic network representation.]
8 
9  Synopsis [Various utilities.]
10 
11  Author [Alan Mishchenko]
12 
13  Affiliation [UC Berkeley]
14 
15  Date [Ver. 1.0. Started - June 20, 2005.]
16 
17  Revision [$Id: nwkUtil.c,v 1.00 2005/06/20 00:00:00 alanmi Exp $]
18 
19 ***********************************************************************/
20 
21 #include <math.h>
22 #include "nwk.h"
23 #include "bool/kit/kit.h"
24 
26 
27 
28 ////////////////////////////////////////////////////////////////////////
29 /// DECLARATIONS ///
30 ////////////////////////////////////////////////////////////////////////
31 
32 ////////////////////////////////////////////////////////////////////////
33 /// FUNCTION DEFINITIONS ///
34 ////////////////////////////////////////////////////////////////////////
35 
36 /**Function*************************************************************
37 
38  Synopsis [Increments the current traversal ID of the network.]
39 
40  Description []
41 
42  SideEffects []
43 
44  SeeAlso []
45 
46 ***********************************************************************/
48 {
49  Nwk_Obj_t * pObj;
50  int i;
51  if ( pNtk->nTravIds >= (1<<26)-1 )
52  {
53  pNtk->nTravIds = 0;
54  Nwk_ManForEachObj( pNtk, pObj, i )
55  pObj->TravId = 0;
56  }
57  pNtk->nTravIds++;
58 }
59 
60 /**Function*************************************************************
61 
62  Synopsis [Reads the maximum number of fanins of a node.]
63 
64  Description []
65 
66  SideEffects []
67 
68  SeeAlso []
69 
70 ***********************************************************************/
72 {
73  Nwk_Obj_t * pNode;
74  int i, nFaninsMax = 0;
75  Nwk_ManForEachNode( pNtk, pNode, i )
76  {
77  if ( nFaninsMax < Nwk_ObjFaninNum(pNode) )
78  nFaninsMax = Nwk_ObjFaninNum(pNode);
79  }
80  return nFaninsMax;
81 }
82 
83 /**Function*************************************************************
84 
85  Synopsis [Reads the total number of all fanins.]
86 
87  Description []
88 
89  SideEffects []
90 
91  SeeAlso []
92 
93 ***********************************************************************/
95 {
96  Nwk_Obj_t * pNode;
97  int i, nFanins = 0;
98  Nwk_ManForEachNode( pNtk, pNode, i )
99  nFanins += Nwk_ObjFaninNum(pNode);
100  return nFanins;
101 }
102 
103 
104 /**Function*************************************************************
105 
106  Synopsis [Returns the number of true PIs.]
107 
108  Description []
109 
110  SideEffects []
111 
112  SeeAlso []
113 
114 ***********************************************************************/
115 int Nwk_ManPiNum( Nwk_Man_t * pNtk )
116 {
117  Nwk_Obj_t * pNode;
118  int i, Counter = 0;
119  Nwk_ManForEachCi( pNtk, pNode, i )
120  Counter += Nwk_ObjIsPi( pNode );
121  return Counter;
122 }
123 
124 /**Function*************************************************************
125 
126  Synopsis [Returns the number of true POs.]
127 
128  Description []
129 
130  SideEffects []
131 
132  SeeAlso []
133 
134 ***********************************************************************/
135 int Nwk_ManPoNum( Nwk_Man_t * pNtk )
136 {
137  Nwk_Obj_t * pNode;
138  int i, Counter = 0;
139  Nwk_ManForEachCo( pNtk, pNode, i )
140  Counter += Nwk_ObjIsPo( pNode );
141  return Counter;
142 }
143 
144 /**Function*************************************************************
145 
146  Synopsis [Reads the number of AIG nodes.]
147 
148  Description []
149 
150  SideEffects []
151 
152  SeeAlso []
153 
154 ***********************************************************************/
156 {
157  Nwk_Obj_t * pNode;
158  int i, nNodes = 0;
159  Nwk_ManForEachNode( pNtk, pNode, i )
160  {
161  if ( pNode->pFunc == NULL )
162  {
163  printf( "Nwk_ManGetAigNodeNum(): Local AIG of node %d is not assigned.\n", pNode->Id );
164  continue;
165  }
166  if ( Nwk_ObjFaninNum(pNode) < 2 )
167  continue;
168  nNodes += Hop_DagSize( pNode->pFunc );
169  }
170  return nNodes;
171 }
172 
173 /**Function*************************************************************
174 
175  Synopsis [Procedure used for sorting the nodes in increasing order of levels.]
176 
177  Description []
178 
179  SideEffects []
180 
181  SeeAlso []
182 
183 ***********************************************************************/
185 {
186  int Diff = (*pp1)->Level - (*pp2)->Level;
187  if ( Diff < 0 )
188  return -1;
189  if ( Diff > 0 )
190  return 1;
191  return 0;
192 }
193 
194 /**Function*************************************************************
195 
196  Synopsis [Procedure used for sorting the nodes in decreasing order of levels.]
197 
198  Description []
199 
200  SideEffects []
201 
202  SeeAlso []
203 
204 ***********************************************************************/
206 {
207  int Diff = (*pp1)->Level - (*pp2)->Level;
208  if ( Diff > 0 )
209  return -1;
210  if ( Diff < 0 )
211  return 1;
212  return 0;
213 }
214 
215 /**Function*************************************************************
216 
217  Synopsis [Prints the objects.]
218 
219  Description []
220 
221  SideEffects []
222 
223  SeeAlso []
224 
225 ***********************************************************************/
226 void Nwk_ObjPrint( Nwk_Obj_t * pObj )
227 {
228  Nwk_Obj_t * pNext;
229  int i;
230  printf( "ObjId = %5d. ", pObj->Id );
231  if ( Nwk_ObjIsPi(pObj) )
232  printf( "PI" );
233  if ( Nwk_ObjIsPo(pObj) )
234  printf( "PO" );
235  if ( Nwk_ObjIsNode(pObj) )
236  printf( "Node" );
237  printf( " Fanins = " );
238  Nwk_ObjForEachFanin( pObj, pNext, i )
239  printf( "%d ", pNext->Id );
240  printf( " Fanouts = " );
241  Nwk_ObjForEachFanout( pObj, pNext, i )
242  printf( "%d ", pNext->Id );
243  printf( "\n" );
244 }
245 
246 /**Function*************************************************************
247 
248  Synopsis [Dumps the BLIF file for the network.]
249 
250  Description []
251 
252  SideEffects []
253 
254  SeeAlso []
255 
256 ***********************************************************************/
257 void Nwk_ManDumpBlif( Nwk_Man_t * pNtk, char * pFileName, Vec_Ptr_t * vPiNames, Vec_Ptr_t * vPoNames )
258 {
259  FILE * pFile;
260  Vec_Ptr_t * vNodes;
261  Vec_Int_t * vTruth;
262  Vec_Int_t * vCover;
263  Nwk_Obj_t * pObj, * pFanin;
264  Aig_MmFlex_t * pMem;
265  char * pSop = NULL;
266  unsigned * pTruth;
267  int i, k, nDigits;
268  if ( Nwk_ManPoNum(pNtk) == 0 )
269  {
270  printf( "Nwk_ManDumpBlif(): Network does not have POs.\n" );
271  return;
272  }
273  // collect nodes in the DFS order
274  nDigits = Abc_Base10Log( Nwk_ManObjNumMax(pNtk) );
275  // write the file
276  pFile = fopen( pFileName, "w" );
277  fprintf( pFile, "# BLIF file written by procedure Nwk_ManDumpBlif()\n" );
278 // fprintf( pFile, "# http://www.eecs.berkeley.edu/~alanmi/abc/\n" );
279  fprintf( pFile, ".model %s\n", pNtk->pName );
280  // write PIs
281  fprintf( pFile, ".inputs" );
282  Nwk_ManForEachCi( pNtk, pObj, i )
283  if ( vPiNames )
284  fprintf( pFile, " %s", (char*)Vec_PtrEntry(vPiNames, i) );
285  else
286  fprintf( pFile, " n%0*d", nDigits, pObj->Id );
287  fprintf( pFile, "\n" );
288  // write POs
289  fprintf( pFile, ".outputs" );
290  Nwk_ManForEachCo( pNtk, pObj, i )
291  if ( vPoNames )
292  fprintf( pFile, " %s", (char*)Vec_PtrEntry(vPoNames, i) );
293  else
294  fprintf( pFile, " n%0*d", nDigits, pObj->Id );
295  fprintf( pFile, "\n" );
296  // write nodes
297  pMem = Aig_MmFlexStart();
298  vTruth = Vec_IntAlloc( 1 << 16 );
299  vCover = Vec_IntAlloc( 1 << 16 );
300  vNodes = Nwk_ManDfs( pNtk );
301  Vec_PtrForEachEntry( Nwk_Obj_t *, vNodes, pObj, i )
302  {
303  if ( !Nwk_ObjIsNode(pObj) )
304  continue;
305  // derive SOP for the AIG
306  pTruth = Hop_ManConvertAigToTruth( pNtk->pManHop, Hop_Regular(pObj->pFunc), Nwk_ObjFaninNum(pObj), vTruth, 0 );
307  if ( Hop_IsComplement(pObj->pFunc) )
308  Kit_TruthNot( pTruth, pTruth, Nwk_ObjFaninNum(pObj) );
309  pSop = Kit_PlaFromTruth( pMem, pTruth, Nwk_ObjFaninNum(pObj), vCover );
310  // write the node
311  fprintf( pFile, ".names" );
312  if ( !Kit_TruthIsConst0(pTruth, Nwk_ObjFaninNum(pObj)) && !Kit_TruthIsConst1(pTruth, Nwk_ObjFaninNum(pObj)) )
313  {
314  Nwk_ObjForEachFanin( pObj, pFanin, k )
315  if ( vPiNames && Nwk_ObjIsPi(pFanin) )
316  fprintf( pFile, " %s", (char*)Vec_PtrEntry(vPiNames, Nwk_ObjPioNum(pFanin)) );
317  else
318  fprintf( pFile, " n%0*d", nDigits, pFanin->Id );
319  }
320  fprintf( pFile, " n%0*d\n", nDigits, pObj->Id );
321  // write the function
322  fprintf( pFile, "%s", pSop );
323  }
324  Vec_IntFree( vCover );
325  Vec_IntFree( vTruth );
326  Vec_PtrFree( vNodes );
327  Aig_MmFlexStop( pMem, 0 );
328  // write POs
329  Nwk_ManForEachCo( pNtk, pObj, i )
330  {
331  fprintf( pFile, ".names" );
332  if ( vPiNames && Nwk_ObjIsPi(Nwk_ObjFanin0(pObj)) )
333  fprintf( pFile, " %s", (char*)Vec_PtrEntry(vPiNames, Nwk_ObjPioNum(Nwk_ObjFanin0(pObj))) );
334  else
335  fprintf( pFile, " n%0*d", nDigits, Nwk_ObjFanin0(pObj)->Id );
336  if ( vPoNames )
337  fprintf( pFile, " %s\n", (char*)Vec_PtrEntry(vPoNames, Nwk_ObjPioNum(pObj)) );
338  else
339  fprintf( pFile, " n%0*d\n", nDigits, pObj->Id );
340  fprintf( pFile, "%d 1\n", !pObj->fInvert );
341  }
342  fprintf( pFile, ".end\n\n" );
343  fclose( pFile );
344 }
345 
346 /**Function*************************************************************
347 
348  Synopsis [Prints the distribution of fanins/fanouts in the network.]
349 
350  Description []
351 
352  SideEffects []
353 
354  SeeAlso []
355 
356 ***********************************************************************/
358 {
359  char Buffer[100];
360  Nwk_Obj_t * pNode;
361  Vec_Int_t * vFanins, * vFanouts;
362  int nFanins, nFanouts, nFaninsMax, nFanoutsMax, nFaninsAll, nFanoutsAll;
363  int i, k, nSizeMax;
364 
365  // determine the largest fanin and fanout
366  nFaninsMax = nFanoutsMax = 0;
367  nFaninsAll = nFanoutsAll = 0;
368  Nwk_ManForEachNode( pNtk, pNode, i )
369  {
370  nFanins = Nwk_ObjFaninNum(pNode);
371  nFanouts = Nwk_ObjFanoutNum(pNode);
372  nFaninsAll += nFanins;
373  nFanoutsAll += nFanouts;
374  nFaninsMax = Abc_MaxInt( nFaninsMax, nFanins );
375  nFanoutsMax = Abc_MaxInt( nFanoutsMax, nFanouts );
376  }
377 
378  // allocate storage for fanin/fanout numbers
379  nSizeMax = Abc_MaxInt( 10 * (Abc_Base10Log(nFaninsMax) + 1), 10 * (Abc_Base10Log(nFanoutsMax) + 1) );
380  vFanins = Vec_IntStart( nSizeMax );
381  vFanouts = Vec_IntStart( nSizeMax );
382 
383  // count the number of fanins and fanouts
384  Nwk_ManForEachNode( pNtk, pNode, i )
385  {
386  nFanins = Nwk_ObjFaninNum(pNode);
387  nFanouts = Nwk_ObjFanoutNum(pNode);
388 // nFanouts = Nwk_NodeMffcSize(pNode);
389 
390  if ( nFanins < 10 )
391  Vec_IntAddToEntry( vFanins, nFanins, 1 );
392  else if ( nFanins < 100 )
393  Vec_IntAddToEntry( vFanins, 10 + nFanins/10, 1 );
394  else if ( nFanins < 1000 )
395  Vec_IntAddToEntry( vFanins, 20 + nFanins/100, 1 );
396  else if ( nFanins < 10000 )
397  Vec_IntAddToEntry( vFanins, 30 + nFanins/1000, 1 );
398  else if ( nFanins < 100000 )
399  Vec_IntAddToEntry( vFanins, 40 + nFanins/10000, 1 );
400  else if ( nFanins < 1000000 )
401  Vec_IntAddToEntry( vFanins, 50 + nFanins/100000, 1 );
402  else if ( nFanins < 10000000 )
403  Vec_IntAddToEntry( vFanins, 60 + nFanins/1000000, 1 );
404 
405  if ( nFanouts < 10 )
406  Vec_IntAddToEntry( vFanouts, nFanouts, 1 );
407  else if ( nFanouts < 100 )
408  Vec_IntAddToEntry( vFanouts, 10 + nFanouts/10, 1 );
409  else if ( nFanouts < 1000 )
410  Vec_IntAddToEntry( vFanouts, 20 + nFanouts/100, 1 );
411  else if ( nFanouts < 10000 )
412  Vec_IntAddToEntry( vFanouts, 30 + nFanouts/1000, 1 );
413  else if ( nFanouts < 100000 )
414  Vec_IntAddToEntry( vFanouts, 40 + nFanouts/10000, 1 );
415  else if ( nFanouts < 1000000 )
416  Vec_IntAddToEntry( vFanouts, 50 + nFanouts/100000, 1 );
417  else if ( nFanouts < 10000000 )
418  Vec_IntAddToEntry( vFanouts, 60 + nFanouts/1000000, 1 );
419  }
420 
421  printf( "The distribution of fanins and fanouts in the network:\n" );
422  printf( " Number Nodes with fanin Nodes with fanout\n" );
423  for ( k = 0; k < nSizeMax; k++ )
424  {
425  if ( vFanins->pArray[k] == 0 && vFanouts->pArray[k] == 0 )
426  continue;
427  if ( k < 10 )
428  printf( "%15d : ", k );
429  else
430  {
431  sprintf( Buffer, "%d - %d", (int)pow((double)10, k/10) * (k%10), (int)pow((double)10, k/10) * (k%10+1) - 1 );
432  printf( "%15s : ", Buffer );
433  }
434  if ( vFanins->pArray[k] == 0 )
435  printf( " " );
436  else
437  printf( "%12d ", vFanins->pArray[k] );
438  printf( " " );
439  if ( vFanouts->pArray[k] == 0 )
440  printf( " " );
441  else
442  printf( "%12d ", vFanouts->pArray[k] );
443  printf( "\n" );
444  }
445  Vec_IntFree( vFanins );
446  Vec_IntFree( vFanouts );
447 
448  printf( "Fanins: Max = %d. Ave = %.2f. Fanouts: Max = %d. Ave = %.2f.\n",
449  nFaninsMax, 1.0*nFaninsAll/Nwk_ManNodeNum(pNtk),
450  nFanoutsMax, 1.0*nFanoutsAll/Nwk_ManNodeNum(pNtk) );
451 }
452 
453 /**Function*************************************************************
454 
455  Synopsis [Cleans the temporary marks of the nodes.]
456 
457  Description []
458 
459  SideEffects []
460 
461  SeeAlso []
462 
463 ***********************************************************************/
465 {
466  Nwk_Obj_t * pObj;
467  int i;
468  Nwk_ManForEachObj( pMan, pObj, i )
469  pObj->MarkA = pObj->MarkB = 0;
470 }
471 
472 /**Function*************************************************************
473 
474  Synopsis [Minimizes the support of all nodes.]
475 
476  Description []
477 
478  SideEffects []
479 
480  SeeAlso []
481 
482 ***********************************************************************/
483 int Nwk_ManMinimumBaseNode( Nwk_Obj_t * pObj, Vec_Int_t * vTruth, int fVerbose )
484 {
485  unsigned * pTruth;
486  Nwk_Obj_t * pFanin, * pObjNew;
487  Nwk_Man_t * pNtk = pObj->pMan;
488  int uSupp, nSuppSize, k, Counter = 0;
489  pTruth = Hop_ManConvertAigToTruth( pNtk->pManHop, Hop_Regular(pObj->pFunc), Nwk_ObjFaninNum(pObj), vTruth, 0 );
490  nSuppSize = Kit_TruthSupportSize(pTruth, Nwk_ObjFaninNum(pObj));
491  if ( nSuppSize == Nwk_ObjFaninNum(pObj) )
492  return 0;
493  Counter++;
494  uSupp = Kit_TruthSupport( pTruth, Nwk_ObjFaninNum(pObj) );
495  // create new node with the given support
496  pObjNew = Nwk_ManCreateNode( pNtk, nSuppSize, Nwk_ObjFanoutNum(pObj) );
497  Nwk_ObjForEachFanin( pObj, pFanin, k )
498  if ( uSupp & (1 << k) )
499  Nwk_ObjAddFanin( pObjNew, pFanin );
500  pObjNew->pFunc = Hop_Remap( pNtk->pManHop, pObj->pFunc, uSupp, Nwk_ObjFaninNum(pObj) );
501  if ( fVerbose )
502  printf( "Reducing node %d fanins from %d to %d.\n",
503  pObj->Id, Nwk_ObjFaninNum(pObj), Nwk_ObjFaninNum(pObjNew) );
504  Nwk_ObjReplace( pObj, pObjNew );
505  return 1;
506 }
507 
508 /**Function*************************************************************
509 
510  Synopsis [Minimizes the support of all nodes.]
511 
512  Description []
513 
514  SideEffects []
515 
516  SeeAlso []
517 
518 ***********************************************************************/
519 int Nwk_ManMinimumBaseInt( Nwk_Man_t * pNtk, int fVerbose )
520 {
521  Vec_Int_t * vTruth;
522  Nwk_Obj_t * pObj;
523  int i, Counter = 0;
524  vTruth = Vec_IntAlloc( 1 << 16 );
525  Nwk_ManForEachNode( pNtk, pObj, i )
526  Counter += Nwk_ManMinimumBaseNode( pObj, vTruth, fVerbose );
527  if ( fVerbose && Counter )
528  printf( "Support minimization reduced support of %d nodes.\n", Counter );
529  Vec_IntFree( vTruth );
530  return Counter;
531 }
532 
533 /**Function*************************************************************
534 
535  Synopsis [Minimizes the support of all nodes.]
536 
537  Description []
538 
539  SideEffects []
540 
541  SeeAlso []
542 
543 ***********************************************************************/
544 void Nwk_ManMinimumBaseRec( Nwk_Man_t * pNtk, int fVerbose )
545 {
546  int i;
547  abctime clk = Abc_Clock();
548  for ( i = 0; Nwk_ManMinimumBaseInt( pNtk, fVerbose ); i++ );
549  ABC_PRT( "Minbase", Abc_Clock() - clk );
550 }
551 
552 /**Function*************************************************************
553 
554  Synopsis [Minimizes the support of all nodes.]
555 
556  Description []
557 
558  SideEffects []
559 
560  SeeAlso []
561 
562 ***********************************************************************/
563 void Nwk_ManMinimumBase( Nwk_Man_t * pNtk, int fVerbose )
564 {
565  Vec_Int_t * vTruth;
566  Nwk_Obj_t * pObj;
567  int i, Counter = 0;
568  vTruth = Vec_IntAlloc( 1 << 16 );
569  Nwk_ManForEachNode( pNtk, pObj, i )
570  Counter += Nwk_ManMinimumBaseNode( pObj, vTruth, fVerbose );
571  if ( fVerbose && Counter )
572  printf( "Support minimization reduced support of %d nodes.\n", Counter );
573  Vec_IntFree( vTruth );
574 }
575 
576 /**Function*************************************************************
577 
578  Synopsis [Minimizes the support of all nodes.]
579 
580  Description []
581 
582  SideEffects []
583 
584  SeeAlso []
585 
586 ***********************************************************************/
587 void Nwk_ManRemoveDupFaninsNode( Nwk_Obj_t * pObj, int iFan0, int iFan1, Vec_Int_t * vTruth )
588 {
589  Hop_Man_t * pManHop = pObj->pMan->pManHop;
590 // Nwk_Obj_t * pFanin0 = pObj->pFanio[iFan0];
591 // Nwk_Obj_t * pFanin1 = pObj->pFanio[iFan1];
592  assert( pObj->pFanio[iFan0] == pObj->pFanio[iFan1] );
593  pObj->pFunc = Hop_Compose( pManHop, pObj->pFunc, Hop_IthVar(pManHop,iFan0), iFan1 );
594  Nwk_ManMinimumBaseNode( pObj, vTruth, 0 );
595 }
596 
597 /**Function*************************************************************
598 
599  Synopsis [Minimizes the support of all nodes.]
600 
601  Description []
602 
603  SideEffects []
604 
605  SeeAlso []
606 
607 ***********************************************************************/
608 void Nwk_ManRemoveDupFanins( Nwk_Man_t * pNtk, int fVerbose )
609 {
610  Vec_Int_t * vTruth;
611  Nwk_Obj_t * pObj;
612  int i, k, m, fFound;
613  // check if the nodes have duplicated fanins
614  vTruth = Vec_IntAlloc( 1 << 16 );
615  Nwk_ManForEachNode( pNtk, pObj, i )
616  {
617  fFound = 0;
618  for ( k = 0; k < pObj->nFanins; k++ )
619  {
620  for ( m = k + 1; m < pObj->nFanins; m++ )
621  if ( pObj->pFanio[k] == pObj->pFanio[m] )
622  {
623  if ( fVerbose )
624  printf( "Removing duplicated fanins of node %d (fanins %d and %d).\n",
625  pObj->Id, pObj->pFanio[k]->Id, pObj->pFanio[m]->Id );
626  Nwk_ManRemoveDupFaninsNode( pObj, k, m, vTruth );
627  fFound = 1;
628  break;
629  }
630  if ( fFound )
631  break;
632  }
633  }
634  Vec_IntFree( vTruth );
635 // Nwk_ManMinimumBase( pNtk, fVerbose );
636 }
637 
638 ////////////////////////////////////////////////////////////////////////
639 /// END OF FILE ///
640 ////////////////////////////////////////////////////////////////////////
641 
642 
644 
void Nwk_ManRemoveDupFanins(Nwk_Man_t *pNtk, int fVerbose)
Definition: nwkUtil.c:608
void Nwk_ManMinimumBaseRec(Nwk_Man_t *pNtk, int fVerbose)
Definition: nwkUtil.c:544
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition: vecPtr.h:42
static int Nwk_ObjFanoutNum(Nwk_Obj_t *p)
Definition: nwk.h:138
int Nwk_NodeCompareLevelsIncrease(Nwk_Obj_t **pp1, Nwk_Obj_t **pp2)
Definition: nwkUtil.c:184
#define Nwk_ManForEachCo(p, pObj, i)
Definition: nwk.h:181
int Nwk_ManMinimumBaseInt(Nwk_Man_t *pNtk, int fVerbose)
Definition: nwkUtil.c:519
int Nwk_NodeCompareLevelsDecrease(Nwk_Obj_t **pp1, Nwk_Obj_t **pp2)
Definition: nwkUtil.c:205
int Nwk_ManPoNum(Nwk_Man_t *pNtk)
Definition: nwkUtil.c:135
int Hop_DagSize(Hop_Obj_t *pObj)
Definition: hopDfs.c:279
typedefABC_NAMESPACE_HEADER_START struct Nwk_Obj_t_ Nwk_Obj_t
INCLUDES ///.
Definition: nwk.h:49
int Nwk_ManPiNum(Nwk_Man_t *pNtk)
Definition: nwkUtil.c:115
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition: bblif.c:37
char * Kit_PlaFromTruth(void *p, unsigned *pTruth, int nVars, Vec_Int_t *vCover)
Definition: kitPla.c:337
#define Nwk_ManForEachCi(p, pObj, i)
ITERATORS ///.
Definition: nwk.h:179
Hop_Obj_t * Hop_Compose(Hop_Man_t *p, Hop_Obj_t *pRoot, Hop_Obj_t *pFunc, int iVar)
Definition: hopDfs.c:415
static int Nwk_ObjIsPi(Nwk_Obj_t *p)
Definition: nwk.h:150
#define Nwk_ObjForEachFanout(pObj, pFanout, i)
Definition: nwk.h:201
int Nwk_ManMinimumBaseNode(Nwk_Obj_t *pObj, Vec_Int_t *vTruth, int fVerbose)
Definition: nwkUtil.c:483
static int Kit_TruthIsConst0(unsigned *pIn, int nVars)
Definition: kit.h:315
char * pName
Definition: nwk.h:64
ABC_DLL void Nwk_ObjReplace(Nwk_Obj_t *pNodeOld, Nwk_Obj_t *pNodeNew)
Definition: nwkFanio.c:302
static abctime Abc_Clock()
Definition: abc_global.h:279
static int Abc_MaxInt(int a, int b)
Definition: abc_global.h:238
static int Nwk_ObjFaninNum(Nwk_Obj_t *p)
Definition: nwk.h:137
Hop_Obj_t * Hop_Remap(Hop_Man_t *p, Hop_Obj_t *pRoot, unsigned uSupp, int nVars)
Definition: hopDfs.c:518
int Nwk_ManGetAigNodeNum(Nwk_Man_t *pNtk)
Definition: nwkUtil.c:155
static Vec_Int_t * Vec_IntStart(int nSize)
Definition: bblif.c:172
static int Kit_TruthIsConst1(unsigned *pIn, int nVars)
Definition: kit.h:323
void Nwk_ManMinimumBase(Nwk_Man_t *pNtk, int fVerbose)
Definition: nwkUtil.c:563
ABC_DLL Vec_Ptr_t * Nwk_ManDfs(Nwk_Man_t *pNtk)
Definition: nwkDfs.c:321
void Nwk_ManCleanMarks(Nwk_Man_t *pMan)
Definition: nwkUtil.c:464
Hop_Man_t * pManHop
Definition: nwk.h:73
static Vec_Int_t * Vec_IntAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: bblif.c:149
Definition: nwk.h:61
static void Vec_IntAddToEntry(Vec_Int_t *p, int i, int Addition)
Definition: bblif.c:302
static int Abc_Base10Log(unsigned n)
Definition: abc_global.h:252
#define ABC_NAMESPACE_IMPL_END
Definition: abc_global.h:108
static int Nwk_ObjIsPo(Nwk_Obj_t *p)
Definition: nwk.h:151
static int Hop_IsComplement(Hop_Obj_t *p)
Definition: hop.h:129
void Nwk_ManDumpBlif(Nwk_Man_t *pNtk, char *pFileName, Vec_Ptr_t *vPiNames, Vec_Ptr_t *vPoNames)
Definition: nwkUtil.c:257
char * sprintf()
static int Counter
ABC_NAMESPACE_IMPL_START void Nwk_ManIncrementTravId(Nwk_Man_t *pNtk)
DECLARATIONS ///.
Definition: nwkUtil.c:47
static void Kit_TruthNot(unsigned *pOut, unsigned *pIn, int nVars)
Definition: kit.h:373
static int Nwk_ObjIsNode(Nwk_Obj_t *p)
Definition: nwk.h:148
#define ABC_NAMESPACE_IMPL_START
Definition: abc_global.h:107
void Nwk_ManRemoveDupFaninsNode(Nwk_Obj_t *pObj, int iFan0, int iFan1, Vec_Int_t *vTruth)
Definition: nwkUtil.c:587
void Nwk_ObjPrint(Nwk_Obj_t *pObj)
Definition: nwkUtil.c:226
static void * Vec_PtrEntry(Vec_Ptr_t *p, int i)
Definition: vecPtr.h:362
static int Nwk_ObjPioNum(Nwk_Obj_t *p)
Definition: nwk.h:136
#define Nwk_ObjForEachFanin(pObj, pFanin, i)
Definition: nwk.h:199
static int Nwk_ManObjNumMax(Nwk_Man_t *p)
Definition: nwk.h:129
Aig_MmFlex_t * Aig_MmFlexStart()
Definition: aigMem.c:305
#define ABC_PRT(a, t)
Definition: abc_global.h:220
void Aig_MmFlexStop(Aig_MmFlex_t *p, int fVerbose)
Definition: aigMem.c:337
unsigned Kit_TruthSupport(unsigned *pTruth, int nVars)
Definition: kitTruth.c:346
int Nwk_ManGetFaninMax(Nwk_Man_t *pNtk)
Definition: nwkUtil.c:71
#define Nwk_ManForEachObj(p, pObj, i)
Definition: nwk.h:189
static int Nwk_ManNodeNum(Nwk_Man_t *p)
Definition: nwk.h:127
static Nwk_Obj_t * Nwk_ObjFanin0(Nwk_Obj_t *p)
Definition: nwk.h:140
int Nwk_ManGetTotalFanins(Nwk_Man_t *pNtk)
Definition: nwkUtil.c:94
unsigned * Hop_ManConvertAigToTruth(Hop_Man_t *p, Hop_Obj_t *pRoot, int nVars, Vec_Int_t *vTruth, int fMsbFirst)
Definition: hopTruth.c:143
ABC_DLL void Nwk_ObjAddFanin(Nwk_Obj_t *pObj, Nwk_Obj_t *pFanin)
Definition: nwkFanio.c:165
#define assert(ex)
Definition: util_old.h:213
int nTravIds
Definition: nwk.h:78
static void Vec_IntFree(Vec_Int_t *p)
Definition: bblif.c:235
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.
Definition: vecPtr.h:55
static Hop_Obj_t * Hop_Regular(Hop_Obj_t *p)
Definition: hop.h:126
ABC_INT64_T abctime
Definition: abc_global.h:278
void Nwk_ManPrintFanioNew(Nwk_Man_t *pNtk)
Definition: nwkUtil.c:357
typedefABC_NAMESPACE_HEADER_START struct Hop_Man_t_ Hop_Man_t
INCLUDES ///.
Definition: hop.h:49
Hop_Obj_t * Hop_IthVar(Hop_Man_t *p, int i)
FUNCTION DEFINITIONS ///.
Definition: hopOper.c:63
int Kit_TruthSupportSize(unsigned *pTruth, int nVars)
Definition: kitTruth.c:327
static void Vec_PtrFree(Vec_Ptr_t *p)
Definition: vecPtr.h:223
#define Nwk_ManForEachNode(p, pObj, i)
Definition: nwk.h:192
ABC_DLL Nwk_Obj_t * Nwk_ManCreateNode(Nwk_Man_t *pMan, int nFanins, int nFanouts)
Definition: nwkObj.c:134