abc-master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
abcSweep.c
Go to the documentation of this file.
1 /**CFile****************************************************************
2 
3  FileName [abcDsd.c]
4 
5  SystemName [ABC: Logic synthesis and verification system.]
6 
7  PackageName [Network and node package.]
8 
9  Synopsis [Technology dependent sweep.]
10 
11  Author [Alan Mishchenko]
12 
13  Affiliation [UC Berkeley]
14 
15  Date [Ver. 1.0. Started - June 20, 2005.]
16 
17  Revision [$Id: abcDsd.c,v 1.00 2005/06/20 00:00:00 alanmi Exp $]
18 
19 ***********************************************************************/
20 
21 #include "base/abc/abc.h"
22 #include "base/main/main.h"
23 #include "proof/fraig/fraig.h"
24 #include "misc/extra/extraBdd.h"
25 
27 
28 ////////////////////////////////////////////////////////////////////////
29 /// DECLARATIONS ///
30 ////////////////////////////////////////////////////////////////////////
31 
32 static void Abc_NtkFraigSweepUsingExdc( Fraig_Man_t * pMan, Abc_Ntk_t * pNtk );
33 static stmm_table * Abc_NtkFraigEquiv( Abc_Ntk_t * pNtk, int fUseInv, int fVerbose, int fVeryVerbose );
34 static void Abc_NtkFraigTransform( Abc_Ntk_t * pNtk, stmm_table * tEquiv, int fUseInv, int fVerbose );
35 static void Abc_NtkFraigMergeClassMapped( Abc_Ntk_t * pNtk, Abc_Obj_t * pChain, int fUseInv, int fVerbose );
36 static void Abc_NtkFraigMergeClass( Abc_Ntk_t * pNtk, Abc_Obj_t * pChain, int fUseInv, int fVerbose );
37 static int Abc_NodeDroppingCost( Abc_Obj_t * pNode );
38 
39 static int Abc_NtkReduceNodes( Abc_Ntk_t * pNtk, Vec_Ptr_t * vNodes );
40 static void Abc_NodeSweep( Abc_Obj_t * pNode, int fVerbose );
41 static void Abc_NodeConstantInput( Abc_Obj_t * pNode, Abc_Obj_t * pFanin, int fConst0 );
42 
43 ////////////////////////////////////////////////////////////////////////
44 /// FUNCTION DEFINITIONS ///
45 ////////////////////////////////////////////////////////////////////////
46 
47 /**Function*************************************************************
48 
49  Synopsis [Sweping functionally equivalence nodes.]
50 
51  Description [Removes gates with equivalent functionality. Works for
52  both technology-independent and mapped networks. If the flag is set,
53  allows adding inverters at the gate outputs.]
54 
55  SideEffects []
56 
57  SeeAlso []
58 
59 ***********************************************************************/
60 int Abc_NtkFraigSweep( Abc_Ntk_t * pNtk, int fUseInv, int fExdc, int fVerbose, int fVeryVerbose )
61 {
62  Fraig_Params_t Params;
63  Abc_Ntk_t * pNtkAig;
64  Fraig_Man_t * pMan;
65  stmm_table * tEquiv;
66  Abc_Obj_t * pObj;
67  int i, fUseTrick;
68 
69  assert( !Abc_NtkIsStrash(pNtk) );
70 
71  // save gate assignments
72  fUseTrick = 0;
73  if ( Abc_NtkIsMappedLogic(pNtk) )
74  {
75  fUseTrick = 1;
76  Abc_NtkForEachNode( pNtk, pObj, i )
77  pObj->pNext = (Abc_Obj_t *)pObj->pData;
78  }
79  // derive the AIG
80  pNtkAig = Abc_NtkStrash( pNtk, 0, 1, 0 );
81  // reconstruct gate assignments
82  if ( fUseTrick )
83  {
84 // extern void * Abc_FrameReadLibGen();
85  Hop_ManStop( (Hop_Man_t *)pNtk->pManFunc );
86  pNtk->pManFunc = Abc_FrameReadLibGen();
87  pNtk->ntkFunc = ABC_FUNC_MAP;
88  Abc_NtkForEachNode( pNtk, pObj, i )
89  pObj->pData = pObj->pNext, pObj->pNext = NULL;
90  }
91 
92  // perform fraiging of the AIG
93  Fraig_ParamsSetDefault( &Params );
94  Params.fInternal = 1;
95  pMan = (Fraig_Man_t *)Abc_NtkToFraig( pNtkAig, &Params, 0, 0 );
96  // cannot use EXDC with FRAIG because it can create classes of equivalent FRAIG nodes
97  // with representative nodes that do not correspond to the nodes with the current network
98 
99  // update FRAIG using EXDC
100  if ( fExdc )
101  {
102  if ( pNtk->pExdc == NULL )
103  printf( "Warning: Networks has no EXDC.\n" );
104  else
105  Abc_NtkFraigSweepUsingExdc( pMan, pNtk );
106  }
107  // assign levels to the nodes of the network
108  Abc_NtkLevel( pNtk );
109 
110  // collect the classes of equivalent nets
111  tEquiv = Abc_NtkFraigEquiv( pNtk, fUseInv, fVerbose, fVeryVerbose );
112 
113  // transform the network into the equivalent one
114  Abc_NtkFraigTransform( pNtk, tEquiv, fUseInv, fVerbose );
115  stmm_free_table( tEquiv );
116 
117  // free the manager
118  Fraig_ManFree( pMan );
119  Abc_NtkDelete( pNtkAig );
120 
121  // cleanup the dangling nodes
122  if ( Abc_NtkHasMapping(pNtk) )
123  Abc_NtkCleanup( pNtk, fVerbose );
124  else
125  Abc_NtkSweep( pNtk, fVerbose );
126 
127  // check
128  if ( !Abc_NtkCheck( pNtk ) )
129  {
130  printf( "Abc_NtkFraigSweep: The network check has failed.\n" );
131  return 0;
132  }
133  return 1;
134 }
135 
136 /**Function*************************************************************
137 
138  Synopsis [Sweep the network using EXDC.]
139 
140  Description []
141 
142  SideEffects []
143 
144  SeeAlso []
145 
146 ***********************************************************************/
148 {
149  Fraig_Node_t * gNodeExdc, * gNode, * gNodeRes;
150  Abc_Obj_t * pNode, * pNodeAig;
151  int i;
152  extern Fraig_Node_t * Abc_NtkToFraigExdc( Fraig_Man_t * pMan, Abc_Ntk_t * pNtk, Abc_Ntk_t * pNtkExdc );
153 
154  assert( pNtk->pExdc );
155  // derive FRAIG node representing don't-cares in the EXDC network
156  gNodeExdc = Abc_NtkToFraigExdc( pMan, pNtk, pNtk->pExdc );
157  // update the node pointers
158  Abc_NtkForEachNode( pNtk, pNode, i )
159  {
160  // skip the constant input nodes
161  if ( Abc_ObjFaninNum(pNode) == 0 )
162  continue;
163  // get the strashed node
164  pNodeAig = pNode->pCopy;
165  // skip the dangling nodes
166  if ( pNodeAig == NULL )
167  continue;
168  // get the FRAIG node
169  gNode = Fraig_NotCond( Abc_ObjRegular(pNodeAig)->pCopy, (int)Abc_ObjIsComplement(pNodeAig) );
170  // perform ANDing with EXDC
171  gNodeRes = Fraig_NodeAnd( pMan, gNode, Fraig_Not(gNodeExdc) );
172  // write the node back
173  Abc_ObjRegular(pNodeAig)->pCopy = (Abc_Obj_t *)Fraig_NotCond( gNodeRes, (int)Abc_ObjIsComplement(pNodeAig) );
174  }
175 }
176 
177 /**Function*************************************************************
178 
179  Synopsis [Collects equivalence classes of node in the network.]
180 
181  Description []
182 
183  SideEffects []
184 
185  SeeAlso []
186 
187 ***********************************************************************/
188 stmm_table * Abc_NtkFraigEquiv( Abc_Ntk_t * pNtk, int fUseInv, int fVerbose, int fVeryVerbose )
189 {
190  Abc_Obj_t * pList, * pNode, * pNodeAig;
191  Fraig_Node_t * gNode;
192  Abc_Obj_t ** ppSlot;
193  stmm_table * tStrash2Net;
194  stmm_table * tResult;
195  stmm_generator * gen;
196  int c, Counter;
197 
198  // create mapping of strashed nodes into the corresponding network nodes
200  Abc_NtkForEachNode( pNtk, pNode, c )
201  {
202  // skip the constant input nodes
203  if ( Abc_ObjFaninNum(pNode) == 0 )
204  continue;
205  // get the strashed node
206  pNodeAig = pNode->pCopy;
207  // skip the dangling nodes
208  if ( pNodeAig == NULL )
209  continue;
210  // skip the nodes that fanout into COs
211  if ( Abc_NodeFindCoFanout(pNode) )
212  continue;
213  // get the FRAIG node
214  gNode = Fraig_NotCond( Abc_ObjRegular(pNodeAig)->pCopy, (int)Abc_ObjIsComplement(pNodeAig) );
215  if ( !stmm_find_or_add( tStrash2Net, (char *)Fraig_Regular(gNode), (char ***)&ppSlot ) )
216  *ppSlot = NULL;
217  // add the node to the list
218  pNode->pNext = *ppSlot;
219  *ppSlot = pNode;
220  // mark the node if it is complemented
221  pNode->fPhase = Fraig_IsComplement(gNode);
222  }
223 
224  // print the classes
225  c = 0;
226  Counter = 0;
228  stmm_foreach_item( tStrash2Net, gen, (char **)&gNode, (char **)&pList )
229  {
230  // skip the trival classes
231  if ( pList == NULL || pList->pNext == NULL )
232  continue;
233  // add the non-trival class
234  stmm_insert( tResult, (char *)pList, NULL );
235  // count nodes in the non-trival classes
236  for ( pNode = pList; pNode; pNode = pNode->pNext )
237  Counter++;
238 
239  if ( fVeryVerbose )
240  {
241  printf( "Class %2d : {", c );
242  for ( pNode = pList; pNode; pNode = pNode->pNext )
243  {
244  pNode->pCopy = NULL;
245  printf( " %s", Abc_ObjName(pNode) );
246  printf( "(%c)", pNode->fPhase? '-' : '+' );
247  printf( "(%d)", pNode->Level );
248  }
249  printf( " }\n" );
250  c++;
251  }
252  }
253  if ( fVerbose || fVeryVerbose )
254  {
255  printf( "Sweeping stats for network \"%s\":\n", pNtk->pName );
256  printf( "Internal nodes = %d. Different functions (up to compl) = %d.\n", Abc_NtkNodeNum(pNtk), stmm_count(tStrash2Net) );
257  printf( "Non-trivial classes = %d. Nodes in non-trivial classes = %d.\n", stmm_count(tResult), Counter );
258  }
259  stmm_free_table( tStrash2Net );
260  return tResult;
261 }
262 
263 
264 /**Function*************************************************************
265 
266  Synopsis [Transforms the network using the equivalence relation on nodes.]
267 
268  Description []
269 
270  SideEffects []
271 
272  SeeAlso []
273 
274 ***********************************************************************/
275 void Abc_NtkFraigTransform( Abc_Ntk_t * pNtk, stmm_table * tEquiv, int fUseInv, int fVerbose )
276 {
277  stmm_generator * gen;
278  Abc_Obj_t * pList;
279  if ( stmm_count(tEquiv) == 0 )
280  return;
281  // merge nodes in the classes
282  if ( Abc_NtkHasMapping( pNtk ) )
283  {
284  Abc_NtkDelayTrace( pNtk, NULL, NULL, 0 );
285  stmm_foreach_item( tEquiv, gen, (char **)&pList, NULL )
286  Abc_NtkFraigMergeClassMapped( pNtk, pList, fUseInv, fVerbose );
287  }
288  else
289  {
290  stmm_foreach_item( tEquiv, gen, (char **)&pList, NULL )
291  Abc_NtkFraigMergeClass( pNtk, pList, fUseInv, fVerbose );
292  }
293 }
294 
295 
296 /**Function*************************************************************
297 
298  Synopsis [Transforms the list of one-phase equivalent nodes.]
299 
300  Description []
301 
302  SideEffects []
303 
304  SeeAlso []
305 
306 ***********************************************************************/
307 void Abc_NtkFraigMergeClassMapped( Abc_Ntk_t * pNtk, Abc_Obj_t * pChain, int fUseInv, int fVerbose )
308 {
309  Abc_Obj_t * pListDir, * pListInv;
310  Abc_Obj_t * pNodeMin, * pNode, * pNext;
311  float Arrival1, Arrival2;
312 
313  assert( pChain );
314  assert( pChain->pNext );
315 
316  // divide the nodes into two parts:
317  // those that need the invertor and those that don't need
318  pListDir = pListInv = NULL;
319  for ( pNode = pChain, pNext = pChain->pNext;
320  pNode;
321  pNode = pNext, pNext = pNode? pNode->pNext : NULL )
322  {
323  // check to which class the node belongs
324  if ( pNode->fPhase == 1 )
325  {
326  pNode->pNext = pListDir;
327  pListDir = pNode;
328  }
329  else
330  {
331  pNode->pNext = pListInv;
332  pListInv = pNode;
333  }
334  }
335 
336  // find the node with the smallest number of logic levels
337  pNodeMin = pListDir;
338  for ( pNode = pListDir; pNode; pNode = pNode->pNext )
339  {
340  Arrival1 = Abc_NodeReadArrivalWorst(pNodeMin);
341  Arrival2 = Abc_NodeReadArrivalWorst(pNode );
342 // assert( Abc_ObjIsCi(pNodeMin) || Arrival1 > 0 );
343 // assert( Abc_ObjIsCi(pNode) || Arrival2 > 0 );
344  if ( Arrival1 > Arrival2 ||
345  (Arrival1 == Arrival2 && pNodeMin->Level > pNode->Level) ||
346  (Arrival1 == Arrival2 && pNodeMin->Level == pNode->Level &&
347  Abc_NodeDroppingCost(pNodeMin) < Abc_NodeDroppingCost(pNode)) )
348  pNodeMin = pNode;
349  }
350 
351  // move the fanouts of the direct nodes
352  for ( pNode = pListDir; pNode; pNode = pNode->pNext )
353  if ( pNode != pNodeMin )
354  Abc_ObjTransferFanout( pNode, pNodeMin );
355 
356  // find the node with the smallest number of logic levels
357  pNodeMin = pListInv;
358  for ( pNode = pListInv; pNode; pNode = pNode->pNext )
359  {
360  Arrival1 = Abc_NodeReadArrivalWorst(pNodeMin);
361  Arrival2 = Abc_NodeReadArrivalWorst(pNode );
362 // assert( Abc_ObjIsCi(pNodeMin) || Arrival1 > 0 );
363 // assert( Abc_ObjIsCi(pNode) || Arrival2 > 0 );
364  if ( Arrival1 > Arrival2 ||
365  (Arrival1 == Arrival2 && pNodeMin->Level > pNode->Level) ||
366  (Arrival1 == Arrival2 && pNodeMin->Level == pNode->Level &&
367  Abc_NodeDroppingCost(pNodeMin) < Abc_NodeDroppingCost(pNode)) )
368  pNodeMin = pNode;
369  }
370 
371  // move the fanouts of the direct nodes
372  for ( pNode = pListInv; pNode; pNode = pNode->pNext )
373  if ( pNode != pNodeMin )
374  Abc_ObjTransferFanout( pNode, pNodeMin );
375 }
376 
377 /**Function*************************************************************
378 
379  Synopsis [Process one equivalence class of nodes.]
380 
381  Description [This function does not remove the nodes. It only switches
382  around the connections.]
383 
384  SideEffects []
385 
386  SeeAlso []
387 
388 ***********************************************************************/
389 void Abc_NtkFraigMergeClass( Abc_Ntk_t * pNtk, Abc_Obj_t * pChain, int fUseInv, int fVerbose )
390 {
391  Abc_Obj_t * pListDir, * pListInv;
392  Abc_Obj_t * pNodeMin, * pNodeMinInv;
393  Abc_Obj_t * pNode, * pNext;
394 
395  assert( pChain );
396  assert( pChain->pNext );
397 
398  // find the node with the smallest number of logic levels
399  pNodeMin = pChain;
400  for ( pNode = pChain->pNext; pNode; pNode = pNode->pNext )
401  if ( pNodeMin->Level > pNode->Level ||
402  ( pNodeMin->Level == pNode->Level &&
403  Abc_NodeDroppingCost(pNodeMin) < Abc_NodeDroppingCost(pNode) ) )
404  pNodeMin = pNode;
405 
406  // divide the nodes into two parts:
407  // those that need the invertor and those that don't need
408  pListDir = pListInv = NULL;
409  for ( pNode = pChain, pNext = pChain->pNext;
410  pNode;
411  pNode = pNext, pNext = pNode? pNode->pNext : NULL )
412  {
413  if ( pNode == pNodeMin )
414  continue;
415  // check to which class the node belongs
416  if ( pNodeMin->fPhase == pNode->fPhase )
417  {
418  pNode->pNext = pListDir;
419  pListDir = pNode;
420  }
421  else
422  {
423  pNode->pNext = pListInv;
424  pListInv = pNode;
425  }
426  }
427 
428  // move the fanouts of the direct nodes
429  for ( pNode = pListDir; pNode; pNode = pNode->pNext )
430  Abc_ObjTransferFanout( pNode, pNodeMin );
431 
432  // skip if there are no inverted nodes
433  if ( pListInv == NULL )
434  return;
435 
436  // add the invertor
437  pNodeMinInv = Abc_NtkCreateNodeInv( pNtk, pNodeMin );
438 
439  // move the fanouts of the inverted nodes
440  for ( pNode = pListInv; pNode; pNode = pNode->pNext )
441  Abc_ObjTransferFanout( pNode, pNodeMinInv );
442 }
443 
444 
445 /**Function*************************************************************
446 
447  Synopsis [Returns the number of literals saved if this node becomes useless.]
448 
449  Description []
450 
451  SideEffects []
452 
453  SeeAlso []
454 
455 ***********************************************************************/
457 {
458  return 1;
459 }
460 
461 
462 
463 
464 
465 /**Function*************************************************************
466 
467  Synopsis [Removes dangling nodes.]
468 
469  Description [Returns the number of nodes removed.]
470 
471  SideEffects []
472 
473  SeeAlso []
474 
475 ***********************************************************************/
476 int Abc_NtkCleanup( Abc_Ntk_t * pNtk, int fVerbose )
477 {
478  Vec_Ptr_t * vNodes;
479  int Counter;
480  assert( Abc_NtkIsLogic(pNtk) );
481  // mark the nodes reachable from the POs
482  vNodes = Abc_NtkDfs( pNtk, 0 );
483  Counter = Abc_NtkReduceNodes( pNtk, vNodes );
484  if ( fVerbose )
485  printf( "Cleanup removed %d dangling nodes.\n", Counter );
486  Vec_PtrFree( vNodes );
487  return Counter;
488 }
489 
490 /**Function*************************************************************
491 
492  Synopsis [Removes dangling nodes.]
493 
494  Description [Returns the number of nodes removed.]
495 
496  SideEffects []
497 
498  SeeAlso []
499 
500 ***********************************************************************/
501 int Abc_NtkCleanupNodes( Abc_Ntk_t * pNtk, Vec_Ptr_t * vRoots, int fVerbose )
502 {
503  Vec_Ptr_t * vNodes, * vStarts;
504  Abc_Obj_t * pObj;
505  int i, Counter;
506  assert( Abc_NtkIsLogic(pNtk) );
507  // collect starting nodes into one array
508  vStarts = Vec_PtrAlloc( 1000 );
509  Abc_NtkForEachCo( pNtk, pObj, i )
510  Vec_PtrPush( vStarts, pObj );
511  Vec_PtrForEachEntry( Abc_Obj_t *, vRoots, pObj, i )
512  if ( pObj )
513  Vec_PtrPush( vStarts, pObj );
514  // mark the nodes reachable from the POs
515  vNodes = Abc_NtkDfsNodes( pNtk, (Abc_Obj_t **)Vec_PtrArray(vStarts), Vec_PtrSize(vStarts) );
516  Vec_PtrFree( vStarts );
517  Counter = Abc_NtkReduceNodes( pNtk, vNodes );
518  if ( fVerbose )
519  printf( "Cleanup removed %d dangling nodes.\n", Counter );
520  Vec_PtrFree( vNodes );
521  return Counter;
522 }
523 
524 /**Function*************************************************************
525 
526  Synopsis [Preserves the nodes collected in the array.]
527 
528  Description [Returns the number of nodes removed.]
529 
530  SideEffects []
531 
532  SeeAlso []
533 
534 ***********************************************************************/
535 int Abc_NtkReduceNodes( Abc_Ntk_t * pNtk, Vec_Ptr_t * vNodes )
536 {
537  Abc_Obj_t * pNode;
538  int i, Counter;
539  assert( Abc_NtkIsLogic(pNtk) );
540  // mark the nodes reachable from the POs
541  Vec_PtrForEachEntry( Abc_Obj_t *, vNodes, pNode, i )
542  pNode->fMarkA = 1;
543  // remove the non-marked nodes
544  Counter = 0;
545  Abc_NtkForEachNode( pNtk, pNode, i )
546  if ( pNode->fMarkA == 0 )
547  {
548  Abc_NtkDeleteObj( pNode );
549  Counter++;
550  }
551  // unmark the remaining nodes
552  Vec_PtrForEachEntry( Abc_Obj_t *, vNodes, pNode, i )
553  pNode->fMarkA = 0;
554  // check
555  if ( !Abc_NtkCheck( pNtk ) )
556  printf( "Abc_NtkCleanup: The network check has failed.\n" );
557  return Counter;
558 }
559 
560 
561 
562 
563 /**Function*************************************************************
564 
565  Synopsis [Tranditional sweep of the network.]
566 
567  Description [Propagates constant and single-input node, removes dangling nodes.]
568 
569  SideEffects []
570 
571  SeeAlso []
572 
573 ***********************************************************************/
574 int Abc_NtkSweep( Abc_Ntk_t * pNtk, int fVerbose )
575 {
576  Vec_Ptr_t * vNodes;
577  Abc_Obj_t * pNode, * pFanout, * pDriver;
578  int i, nNodesOld;
579  assert( Abc_NtkIsLogic(pNtk) );
580  // convert network to BDD representation
581  if ( !Abc_NtkToBdd(pNtk) )
582  {
583  fprintf( stdout, "Converting to BDD has failed.\n" );
584  return 1;
585  }
586  // perform cleanup
587  nNodesOld = Abc_NtkNodeNum(pNtk);
588  Abc_NtkCleanup( pNtk, 0 );
589  // prepare nodes for sweeping
591  Abc_NtkMinimumBase(pNtk);
592  // collect sweepable nodes
593  vNodes = Vec_PtrAlloc( 100 );
594  Abc_NtkForEachNode( pNtk, pNode, i )
595  if ( Abc_ObjFaninNum(pNode) < 2 )
596  Vec_PtrPush( vNodes, pNode );
597  // sweep the nodes
598  while ( Vec_PtrSize(vNodes) > 0 )
599  {
600  // get any sweepable node
601  pNode = (Abc_Obj_t *)Vec_PtrPop(vNodes);
602  if ( !Abc_ObjIsNode(pNode) )
603  continue;
604  // get any non-CO fanout of this node
605  pFanout = Abc_NodeFindNonCoFanout(pNode);
606  if ( pFanout == NULL )
607  continue;
608  assert( Abc_ObjIsNode(pFanout) );
609  // transform the function of the fanout
610  if ( Abc_ObjFaninNum(pNode) == 0 )
611  Abc_NodeConstantInput( pFanout, pNode, Abc_NodeIsConst0(pNode) );
612  else
613  {
614  assert( Abc_ObjFaninNum(pNode) == 1 );
615  pDriver = Abc_ObjFanin0(pNode);
616  if ( Abc_NodeIsInv(pNode) )
617  Abc_NodeComplementInput( pFanout, pNode );
618  Abc_ObjPatchFanin( pFanout, pNode, pDriver );
619  }
620  Abc_NodeRemoveDupFanins( pFanout );
621  Abc_NodeMinimumBase( pFanout );
622  // check if the fanout should be added
623  if ( Abc_ObjFaninNum(pFanout) < 2 )
624  Vec_PtrPush( vNodes, pFanout );
625  // check if the node has other fanouts
626  if ( Abc_ObjFanoutNum(pNode) > 0 )
627  Vec_PtrPush( vNodes, pNode );
628  else
629  Abc_NtkDeleteObj_rec( pNode, 1 );
630  }
631  Vec_PtrFree( vNodes );
632  // sweep a node into its CO fanout if all of this is true:
633  // (a) this node is a single-input node
634  // (b) the driver of the node has only one fanout (this node)
635  // (c) the driver is a node
636  Abc_NtkForEachCo( pNtk, pFanout, i )
637  {
638  pNode = Abc_ObjFanin0(pFanout);
639  if ( Abc_ObjFaninNum(pNode) != 1 )
640  continue;
641  pDriver = Abc_ObjFanin0(pNode);
642  if ( !(Abc_ObjFanoutNum(pDriver) == 1 && Abc_ObjIsNode(pDriver)) )
643  continue;
644  // trasform this CO
645  if ( Abc_NodeIsInv(pNode) )
646  pDriver->pData = Cudd_Not(pDriver->pData);
647  Abc_ObjPatchFanin( pFanout, pNode, pDriver );
648  }
649  // perform cleanup
650  Abc_NtkCleanup( pNtk, 0 );
651  // report
652  if ( fVerbose )
653  printf( "Sweep removed %d nodes.\n", nNodesOld - Abc_NtkNodeNum(pNtk) );
654  return nNodesOld - Abc_NtkNodeNum(pNtk);
655 }
656 
657 
658 /**Function*************************************************************
659 
660  Synopsis [Replaces the local function by its cofactor.]
661 
662  Description []
663 
664  SideEffects []
665 
666  SeeAlso []
667 
668 ***********************************************************************/
669 void Abc_NodeConstantInput( Abc_Obj_t * pNode, Abc_Obj_t * pFanin, int fConst0 )
670 {
671  DdManager * dd = (DdManager *)pNode->pNtk->pManFunc;
672  DdNode * bVar, * bTemp;
673  int iFanin;
674  assert( Abc_NtkIsBddLogic(pNode->pNtk) );
675  if ( (iFanin = Vec_IntFind( &pNode->vFanins, pFanin->Id )) == -1 )
676  {
677  printf( "Node %s should be among", Abc_ObjName(pFanin) );
678  printf( " the fanins of node %s...\n", Abc_ObjName(pNode) );
679  return;
680  }
681  bVar = Cudd_NotCond( Cudd_bddIthVar(dd, iFanin), fConst0 );
682  pNode->pData = Cudd_Cofactor( dd, bTemp = (DdNode *)pNode->pData, bVar ); Cudd_Ref( (DdNode *)pNode->pData );
683  Cudd_RecursiveDeref( dd, bTemp );
684 }
685 
686 
687 /**Function*************************************************************
688 
689  Synopsis [Removes all objects whose trav ID is not current.]
690 
691  Description []
692 
693  SideEffects []
694 
695  SeeAlso []
696 
697 ***********************************************************************/
699 {
700  Abc_Obj_t * pObj;
701  int Counter, i;
702  int fVerbose = 0;
703 
704  // report on the nodes to be deleted
705  if ( fVerbose )
706  {
707  printf( "These nodes will be deleted: \n" );
708  Abc_NtkForEachObj( pNtk, pObj, i )
709  if ( !Abc_NodeIsTravIdCurrent( pObj ) )
710  {
711  printf( " " );
712  Abc_ObjPrint( stdout, pObj );
713  }
714  }
715 
716  // delete the nodes
717  Counter = 0;
718  Abc_NtkForEachObj( pNtk, pObj, i )
719  if ( !Abc_NodeIsTravIdCurrent( pObj ) )
720  {
721  Abc_NtkDeleteObj( pObj );
722  Counter++;
723  }
724  return Counter;
725 }
726 
727 /**Function*************************************************************
728 
729  Synopsis [Check if the fanin of this latch is a constant.]
730 
731  Description [Returns 0/1 if constant; -1 if not a constant.]
732 
733  SideEffects []
734 
735  SeeAlso []
736 
737 ***********************************************************************/
739 {
741  if ( Abc_ObjFaninNum(pObj) == 0 )
742  return;
743  assert( Abc_ObjFaninNum(pObj) == 1 );
745 }
746 
747 /**Function*************************************************************
748 
749  Synopsis [Check if the fanin of this latch is a constant.]
750 
751  Description [Returns 0/1 if constant; -1 if not a constant.]
752 
753  SideEffects []
754 
755  SeeAlso []
756 
757 ***********************************************************************/
759 {
760  if ( Abc_ObjFaninNum(pObj) == 0 )
761  {
762  if ( !Abc_ObjIsNode(pObj) )
763  return -1;
764  if ( Abc_NodeIsConst0(pObj) )
765  return 0;
766  if ( Abc_NodeIsConst1(pObj) )
767  return 1;
768  assert( 0 );
769  return -1;
770  }
771  if ( Abc_ObjIsLatch(pObj) || Abc_ObjFaninNum(pObj) > 1 )
772  return -1;
773  if ( !Abc_ObjIsNode(pObj) || Abc_NodeIsBuf(pObj) )
774  return Abc_NtkCheckConstant_rec( Abc_ObjFanin0(pObj) );
775  if ( Abc_NodeIsInv(pObj) )
776  {
777  int RetValue = Abc_NtkCheckConstant_rec( Abc_ObjFanin0(pObj) );
778  if ( RetValue == 0 )
779  return 1;
780  if ( RetValue == 1 )
781  return 0;
782  return RetValue;
783  }
784  assert( 0 );
785  return -1;
786 }
787 
788 /**Function*************************************************************
789 
790  Synopsis [Removes redundant latches.]
791 
792  Description [The redundant latches are of two types:
793  - Latches fed by a constant which matches the init value of the latch.
794  - Latches fed by a constant which does not match the init value of the latch
795  can be all replaced by one latch.]
796 
797  SideEffects []
798 
799  SeeAlso []
800 
801 ***********************************************************************/
803 {
804  Abc_Obj_t * pFanin, * pLatch, * pLatchPivot = NULL;
805  int Counter, RetValue, i;
806  Counter = 0;
807  // go through the latches
808  Abc_NtkForEachLatch( pNtk, pLatch, i )
809  {
810  // check if the latch has constant input
811  RetValue = Abc_NtkCheckConstant_rec( Abc_ObjFanin0(pLatch) );
812  if ( RetValue == -1 )
813  continue;
814  // found a latch with constant fanin
815  if ( (RetValue == 1 && Abc_LatchIsInit0(pLatch)) ||
816  (RetValue == 0 && Abc_LatchIsInit1(pLatch)) )
817  {
818  // fanin constant differs from the latch init value
819  if ( pLatchPivot == NULL )
820  {
821  pLatchPivot = pLatch;
822  continue;
823  }
824  if ( Abc_LatchInit(pLatch) != Abc_LatchInit(pLatchPivot) ) // add inverter
825  pFanin = Abc_NtkCreateNodeInv( pNtk, Abc_ObjFanout0(pLatchPivot) );
826  else
827  pFanin = Abc_ObjFanout0(pLatchPivot);
828  }
829  else
830  pFanin = Abc_ObjFanin0(Abc_ObjFanin0(pLatch));
831  // replace latch
832  Abc_ObjTransferFanout( Abc_ObjFanout0(pLatch), pFanin );
833  // delete the extra nodes
834  Abc_NtkDeleteObj_rec( Abc_ObjFanout0(pLatch), 0 );
835  Counter++;
836  }
837  return Counter;
838 }
839 
840 /**Function*************************************************************
841 
842  Synopsis [Replaces autonumnous logic by free inputs.]
843 
844  Description [Assumes that non-autonomous logic is marked with
845  the current ID.]
846 
847  SideEffects []
848 
849  SeeAlso []
850 
851 ***********************************************************************/
853 {
854  Abc_Obj_t * pNode, * pFanin;
855  Vec_Ptr_t * vNodes;
856  int i, k, Counter;
857  // collect the nodes that feed into the reachable logic
858  vNodes = Vec_PtrAlloc( 100 );
859  Abc_NtkForEachObj( pNtk, pNode, i )
860  {
861  // skip non-visited fanins
862  if ( !Abc_NodeIsTravIdCurrent(pNode) )
863  continue;
864  // look for non-visited fanins
865  Abc_ObjForEachFanin( pNode, pFanin, k )
866  {
867  // skip visited fanins
868  if ( Abc_NodeIsTravIdCurrent(pFanin) )
869  continue;
870  // skip constants and latches fed by constants
871  if ( Abc_NtkCheckConstant_rec(pFanin) != -1 ||
872  (Abc_ObjIsBo(pFanin) && Abc_NtkCheckConstant_rec(Abc_ObjFanin0(Abc_ObjFanin0(pFanin))) != -1) )
873  {
874  Abc_NtkSetTravId_rec( pFanin );
875  continue;
876  }
877  assert( !Abc_ObjIsLatch(pFanin) );
878  Vec_PtrPush( vNodes, pFanin );
879  }
880  }
881  Vec_PtrUniqify( vNodes, (int (*)(void))Abc_ObjPointerCompare );
882  // replace these nodes by the PIs
883  Vec_PtrForEachEntry( Abc_Obj_t *, vNodes, pNode, i )
884  {
885  pFanin = Abc_NtkCreatePi(pNtk);
886  Abc_ObjAssignName( pFanin, Abc_ObjName(pFanin), NULL );
887  Abc_NodeSetTravIdCurrent( pFanin );
888  Abc_ObjTransferFanout( pNode, pFanin );
889  }
890  Counter = Vec_PtrSize(vNodes);
891  Vec_PtrFree( vNodes );
892  return Counter;
893 }
894 
895 /**Function*************************************************************
896 
897  Synopsis [Sequential cleanup.]
898 
899  Description [Performs three tasks:
900  - Removes logic that does not feed into POs.
901  - Removes latches driven by constant values equal to the initial state.
902  - Replaces the autonomous components by additional PI variables.]
903 
904  SideEffects []
905 
906  SeeAlso []
907 
908 ***********************************************************************/
909 int Abc_NtkCleanupSeq( Abc_Ntk_t * pNtk, int fLatchSweep, int fAutoSweep, int fVerbose )
910 {
911  Vec_Ptr_t * vNodes;
912  int Counter;
913  assert( Abc_NtkIsLogic(pNtk) );
914  // mark the nodes reachable from the POs
915  vNodes = Abc_NtkDfsSeq( pNtk );
916  Vec_PtrFree( vNodes );
917  // remove the non-marked nodes
918  Counter = Abc_NodeRemoveNonCurrentObjects( pNtk );
919  if ( fVerbose )
920  printf( "Cleanup removed %4d dangling objects.\n", Counter );
921  // check if some of the latches can be removed
922  if ( fLatchSweep )
923  {
924  Counter = Abc_NtkLatchSweep( pNtk );
925  if ( fVerbose )
926  printf( "Cleanup removed %4d redundant latches.\n", Counter );
927  }
928  // detect the autonomous components
929  if ( fAutoSweep )
930  {
931  vNodes = Abc_NtkDfsSeqReverse( pNtk );
932  Vec_PtrFree( vNodes );
933  // replace them by PIs
934  Counter = Abc_NtkReplaceAutonomousLogic( pNtk );
935  if ( fVerbose )
936  printf( "Cleanup added %4d additional PIs.\n", Counter );
937  // remove the non-marked nodes
938  Counter = Abc_NodeRemoveNonCurrentObjects( pNtk );
939  if ( fVerbose )
940  printf( "Cleanup removed %4d autonomous objects.\n", Counter );
941  }
942  // check
943  if ( !Abc_NtkCheck( pNtk ) )
944  printf( "Abc_NtkCleanupSeq: The network check has failed.\n" );
945  return 1;
946 }
947 
948 /**Function*************************************************************
949 
950  Synopsis [Sweep to remove buffers and inverters.]
951 
952  Description []
953 
954  SideEffects []
955 
956  SeeAlso []
957 
958 ***********************************************************************/
959 int Abc_NtkSweepBufsInvs( Abc_Ntk_t * pNtk, int fVerbose )
960 {
961  Hop_Man_t * pMan;
962  Abc_Obj_t * pObj, * pFanin;
963  int i, k, fChanges = 1, Counter = 0;
964  assert( Abc_NtkIsLogic(pNtk) );
965  // convert network to BDD representation
966  if ( !Abc_NtkToAig(pNtk) )
967  {
968  fprintf( stdout, "Converting to SOP has failed.\n" );
969  return 1;
970  }
971  // get AIG manager
972  pMan = (Hop_Man_t *)pNtk->pManFunc;
973  // label selected nodes
974  Abc_NtkIncrementTravId( pNtk );
975  // iterate till no improvement
976  while ( fChanges )
977  {
978  fChanges = 0;
979  Abc_NtkForEachObj( pNtk, pObj, i )
980  {
981  Abc_ObjForEachFanin( pObj, pFanin, k )
982  {
983  // do not eliminate marked fanins
984  if ( Abc_NodeIsTravIdCurrent(pFanin) )
985  continue;
986  // do not eliminate constant nodes
987  if ( !Abc_ObjIsNode(pFanin) || Abc_ObjFaninNum(pFanin) != 1 )
988  continue;
989  // do not eliminate inverters into COs
990  if ( Abc_ObjIsCo(pObj) && Abc_NodeIsInv(pFanin) )
991  continue;
992  // do not eliminate buffers connecting PIs and POs
993 // if ( Abc_ObjIsCo(pObj) && Abc_ObjIsCi(Abc_ObjFanin0(pFanin)) )
994 // continue;
995  fChanges = 1;
996  Counter++;
997  // update function of the node
998  if ( Abc_NodeIsInv(pFanin) )
999  pObj->pData = Hop_Compose( pMan, (Hop_Obj_t *)pObj->pData, Hop_Not(Hop_IthVar(pMan, k)), k );
1000  // update the fanin
1001  Abc_ObjPatchFanin( pObj, pFanin, Abc_ObjFanin0(pFanin) );
1002  if ( Abc_ObjFanoutNum(pFanin) == 0 )
1003  Abc_NtkDeleteObj(pFanin);
1004  }
1005  }
1006  }
1007  if ( fVerbose )
1008  printf( "Removed %d single input nodes.\n", Counter );
1009  return Counter;
1010 }
1011 
1012 
1013 
1014 
1015 
1016 ////////////////////////////////////////////////////////////////////////
1017 /// END OF FILE ///
1018 ////////////////////////////////////////////////////////////////////////
1019 
1020 
1022 
ABC_DLL int Abc_ObjPointerCompare(void **pp1, void **pp2)
Definition: abcUtil.c:1899
int Abc_NodeRemoveNonCurrentObjects(Abc_Ntk_t *pNtk)
Definition: abcSweep.c:698
static int Abc_NtkIsStrash(Abc_Ntk_t *pNtk)
Definition: abc.h:251
static stmm_table * Abc_NtkFraigEquiv(Abc_Ntk_t *pNtk, int fUseInv, int fVerbose, int fVeryVerbose)
Definition: abcSweep.c:188
static int Abc_NtkIsLogic(Abc_Ntk_t *pNtk)
Definition: abc.h:250
static int Abc_LatchInit(Abc_Obj_t *pLatch)
Definition: abc.h:425
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition: vecPtr.h:42
ABC_DLL void * Abc_FrameReadLibGen()
Definition: mainFrame.c:56
static ABC_NAMESPACE_IMPL_START void Abc_NtkFraigSweepUsingExdc(Fraig_Man_t *pMan, Abc_Ntk_t *pNtk)
DECLARATIONS ///.
Definition: abcSweep.c:147
unsigned fMarkA
Definition: abc.h:134
typedefABC_NAMESPACE_HEADER_START struct Fraig_ManStruct_t_ Fraig_Man_t
INCLUDES ///.
Definition: fraig.h:40
ABC_DLL float Abc_NtkDelayTrace(Abc_Ntk_t *pNtk, Abc_Obj_t *pOut, Abc_Obj_t *pIn, int fPrint)
Definition: abcTiming.c:919
void Cudd_RecursiveDeref(DdManager *table, DdNode *n)
Definition: cuddRef.c:154
Definition: cudd.h:278
#define Cudd_Not(node)
Definition: cudd.h:367
static void Abc_NtkFraigTransform(Abc_Ntk_t *pNtk, stmm_table *tEquiv, int fUseInv, int fVerbose)
Definition: abcSweep.c:275
stmm_table * stmm_init_table(stmm_compare_func_type compare, stmm_hash_func_type hash)
Definition: stmm.c:69
static int Abc_ObjIsBo(Abc_Obj_t *pObj)
Definition: abc.h:350
ABC_DLL int Abc_NtkMinimumBase(Abc_Ntk_t *pNtk)
FUNCTION DEFINITIONS ///.
Definition: abcMinBase.c:48
Abc_Ntk_t * pExdc
Definition: abc.h:201
static int Abc_ObjIsLatch(Abc_Obj_t *pObj)
Definition: abc.h:356
ABC_DLL int Abc_NodeIsConst0(Abc_Obj_t *pNode)
Definition: abcObj.c:860
static int Abc_ObjFanoutNum(Abc_Obj_t *pObj)
Definition: abc.h:365
void Fraig_ManFree(Fraig_Man_t *pMan)
Definition: fraigMan.c:262
static int Abc_NodeDroppingCost(Abc_Obj_t *pNode)
Definition: abcSweep.c:456
ABC_DLL Abc_Ntk_t * Abc_NtkStrash(Abc_Ntk_t *pNtk, int fAllNodes, int fCleanup, int fRecord)
Definition: abcStrash.c:265
int stmm_insert(stmm_table *table, char *key, char *value)
Definition: stmm.c:200
ABC_DLL void Abc_ObjPrint(FILE *pFile, Abc_Obj_t *pObj)
Definition: abcPrint.c:1287
Hop_Obj_t * Hop_Compose(Hop_Man_t *p, Hop_Obj_t *pRoot, Hop_Obj_t *pFunc, int iVar)
Definition: hopDfs.c:415
static void Abc_NodeSweep(Abc_Obj_t *pNode, int fVerbose)
static int Abc_ObjFaninNum(Abc_Obj_t *pObj)
Definition: abc.h:364
static int Abc_NtkHasMapping(Abc_Ntk_t *pNtk)
Definition: abc.h:256
#define stmm_count(table)
Definition: stmm.h:76
static int Vec_IntFind(Vec_Int_t *p, int Entry)
Definition: vecInt.h:895
ABC_DLL void Abc_NtkDeleteObj_rec(Abc_Obj_t *pObj, int fOnlyNodes)
Definition: abcObj.c:273
Vec_Int_t vFanins
Definition: abc.h:143
static void Vec_PtrPush(Vec_Ptr_t *p, void *Entry)
Definition: vecPtr.h:606
ABC_DLL int Abc_NtkRemoveDupFanins(Abc_Ntk_t *pNtk)
Definition: abcMinBase.c:116
static int Abc_LatchIsInit0(Abc_Obj_t *pLatch)
Definition: abc.h:422
#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
ABC_DLL char * Abc_ObjAssignName(Abc_Obj_t *pObj, char *pName, char *pSuffix)
Definition: abcNames.c:68
ABC_DLL Vec_Ptr_t * Abc_NtkDfs(Abc_Ntk_t *pNtk, int fCollectAll)
Definition: abcDfs.c:81
static int Vec_PtrSize(Vec_Ptr_t *p)
Definition: vecPtr.h:295
static void * Vec_PtrPop(Vec_Ptr_t *p)
Definition: vecPtr.h:677
static Hop_Obj_t * Hop_Not(Hop_Obj_t *p)
Definition: hop.h:127
static Abc_Obj_t * Abc_ObjFanin0(Abc_Obj_t *pObj)
Definition: abc.h:373
ABC_DLL Vec_Ptr_t * Abc_NtkDfsSeq(Abc_Ntk_t *pNtk)
Definition: abcDfs.c:397
Definition: hop.h:65
int Abc_NtkCleanup(Abc_Ntk_t *pNtk, int fVerbose)
Definition: abcSweep.c:476
ABC_DLL void Abc_NtkDelete(Abc_Ntk_t *pNtk)
Definition: abcNtk.c:1233
unsigned Level
Definition: abc.h:142
static int Abc_ObjIsCo(Abc_Obj_t *pObj)
Definition: abc.h:352
void Hop_ManStop(Hop_Man_t *p)
Definition: hopMan.c:84
Fraig_Node_t * Abc_NtkToFraigExdc(Fraig_Man_t *pMan, Abc_Ntk_t *pNtkMain, Abc_Ntk_t *pNtkExdc)
Definition: abcFraig.c:164
ABC_DLL int Abc_NodeIsBuf(Abc_Obj_t *pNode)
Definition: abcObj.c:920
static void Vec_PtrUniqify(Vec_Ptr_t *p, int(*Vec_PtrSortCompare)()) ___unused
Definition: vecPtr.h:875
#define Fraig_Not(p)
Definition: fraig.h:109
ABC_DLL void Abc_ObjPatchFanin(Abc_Obj_t *pObj, Abc_Obj_t *pFaninOld, Abc_Obj_t *pFaninNew)
Definition: abcFanio.c:172
void Abc_NtkSetTravId_rec(Abc_Obj_t *pObj)
Definition: abcSweep.c:738
ABC_DLL Abc_Obj_t * Abc_NodeFindNonCoFanout(Abc_Obj_t *pNode)
Definition: abcUtil.c:800
void * pManFunc
Definition: abc.h:191
static int Abc_ObjIsNode(Abc_Obj_t *pObj)
Definition: abc.h:355
static int Abc_NtkNodeNum(Abc_Ntk_t *pNtk)
Definition: abc.h:293
static void Abc_NtkFraigMergeClassMapped(Abc_Ntk_t *pNtk, Abc_Obj_t *pChain, int fUseInv, int fVerbose)
Definition: abcSweep.c:307
int Abc_NtkCleanupSeq(Abc_Ntk_t *pNtk, int fLatchSweep, int fAutoSweep, int fVerbose)
Definition: abcSweep.c:909
Fraig_Node_t * Fraig_NodeAnd(Fraig_Man_t *p, Fraig_Node_t *p1, Fraig_Node_t *p2)
Definition: fraigApi.c:212
Abc_Obj_t * pCopy
Definition: abc.h:148
ABC_DLL void Abc_NtkDeleteObj(Abc_Obj_t *pObj)
Definition: abcObj.c:167
DdNode * Cudd_Cofactor(DdManager *dd, DdNode *f, DdNode *g)
Definition: cuddCof.c:123
ABC_DLL Abc_Obj_t * Abc_NtkCreateNodeInv(Abc_Ntk_t *pNtk, Abc_Obj_t *pFanin)
Definition: abcObj.c:662
int stmm_ptrhash(const char *x, int size)
Definition: stmm.c:533
int Abc_NtkFraigSweep(Abc_Ntk_t *pNtk, int fUseInv, int fExdc, int fVerbose, int fVeryVerbose)
FUNCTION DEFINITIONS ///.
Definition: abcSweep.c:60
#define ABC_NAMESPACE_IMPL_END
Definition: abc_global.h:108
void Fraig_ParamsSetDefault(Fraig_Params_t *pParams)
Definition: fraigMan.c:122
int Abc_NtkSweep(Abc_Ntk_t *pNtk, int fVerbose)
Definition: abcSweep.c:574
ABC_DLL int Abc_NtkToBdd(Abc_Ntk_t *pNtk)
Definition: abcFunc.c:1160
ABC_DLL Vec_Ptr_t * Abc_NtkDfsSeqReverse(Abc_Ntk_t *pNtk)
Definition: abcDfs.c:454
static int Counter
int Abc_NtkReplaceAutonomousLogic(Abc_Ntk_t *pNtk)
Definition: abcSweep.c:852
int Abc_NtkSweepBufsInvs(Abc_Ntk_t *pNtk, int fVerbose)
Definition: abcSweep.c:959
#define Abc_NtkForEachLatch(pNtk, pObj, i)
Definition: abc.h:497
static int Abc_LatchIsInit1(Abc_Obj_t *pLatch)
Definition: abc.h:423
static Abc_Obj_t * Abc_NtkCreatePi(Abc_Ntk_t *pNtk)
Definition: abc.h:303
int Abc_NtkCleanupNodes(Abc_Ntk_t *pNtk, Vec_Ptr_t *vRoots, int fVerbose)
Definition: abcSweep.c:501
int stmm_find_or_add(stmm_table *table, char *key, char ***slot)
Definition: stmm.c:266
static void Abc_NtkFraigMergeClass(Abc_Ntk_t *pNtk, Abc_Obj_t *pChain, int fUseInv, int fVerbose)
Definition: abcSweep.c:389
int Abc_NtkLatchSweep(Abc_Ntk_t *pNtk)
Definition: abcSweep.c:802
#define Fraig_IsComplement(p)
GLOBAL VARIABLES ///.
Definition: fraig.h:107
int Abc_NtkCheckConstant_rec(Abc_Obj_t *pObj)
Definition: abcSweep.c:758
#define Abc_NtkForEachNode(pNtk, pNode, i)
Definition: abc.h:461
ABC_DLL void Abc_ObjTransferFanout(Abc_Obj_t *pObjOld, Abc_Obj_t *pObjNew)
Definition: abcFanio.c:264
#define ABC_NAMESPACE_IMPL_START
Definition: abc_global.h:107
int stmm_ptrcmp(const char *x, const char *y)
Definition: stmm.c:545
void stmm_free_table(stmm_table *table)
Definition: stmm.c:79
ABC_DLL float Abc_NodeReadArrivalWorst(Abc_Obj_t *pNode)
Definition: abcTiming.c:95
static int Abc_NodeIsTravIdCurrent(Abc_Obj_t *p)
Definition: abc.h:411
static void Abc_NodeConstantInput(Abc_Obj_t *pNode, Abc_Obj_t *pFanin, int fConst0)
Definition: abcSweep.c:669
static Abc_Obj_t * Abc_ObjRegular(Abc_Obj_t *p)
Definition: abc.h:323
Abc_Ntk_t * pNtk
Definition: abc.h:130
static int Abc_NtkIsMappedLogic(Abc_Ntk_t *pNtk)
Definition: abc.h:267
ABC_DLL int Abc_NodeIsInv(Abc_Obj_t *pNode)
Definition: abcObj.c:950
ABC_DLL Abc_Obj_t * Abc_NodeFindCoFanout(Abc_Obj_t *pNode)
Definition: abcUtil.c:779
static Vec_Ptr_t * Vec_PtrAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: vecPtr.h:83
Abc_NtkFunc_t ntkFunc
Definition: abc.h:157
#define Abc_ObjForEachFanin(pObj, pFanin, i)
Definition: abc.h:524
static int Abc_NtkIsBddLogic(Abc_Ntk_t *pNtk)
Definition: abc.h:265
int Id
Definition: abc.h:132
ABC_DLL char * Abc_ObjName(Abc_Obj_t *pNode)
DECLARATIONS ///.
Definition: abcNames.c:48
#define Fraig_Regular(p)
Definition: fraig.h:108
DdNode * Cudd_bddIthVar(DdManager *dd, int i)
Definition: cuddAPI.c:416
static void Abc_NtkIncrementTravId(Abc_Ntk_t *p)
Definition: abc.h:406
#define Fraig_NotCond(p, c)
Definition: fraig.h:110
#define Cudd_NotCond(node, c)
Definition: cudd.h:383
ABC_DLL int Abc_NtkToAig(Abc_Ntk_t *pNtk)
Definition: abcFunc.c:1192
Abc_Obj_t * pNext
Definition: abc.h:131
ABC_DLL int Abc_NodeIsConst1(Abc_Obj_t *pNode)
Definition: abcObj.c:890
#define assert(ex)
Definition: util_old.h:213
void * pData
Definition: abc.h:145
ABC_DLL Vec_Ptr_t * Abc_NtkDfsNodes(Abc_Ntk_t *pNtk, Abc_Obj_t **ppNodes, int nNodes)
Definition: abcDfs.c:120
ABC_DLL int Abc_NodeRemoveDupFanins(Abc_Obj_t *pNode)
Definition: abcMinBase.c:180
#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
static int Abc_ObjIsComplement(Abc_Obj_t *p)
Definition: abc.h:322
#define Abc_NtkForEachObj(pNtk, pObj, i)
ITERATORS ///.
Definition: abc.h:446
ABC_DLL int Abc_NtkLevel(Abc_Ntk_t *pNtk)
Definition: abcDfs.c:1265
static void ** Vec_PtrArray(Vec_Ptr_t *p)
Definition: vecPtr.h:279
unsigned fPhase
Definition: abc.h:137
typedefABC_NAMESPACE_HEADER_START struct Hop_Man_t_ Hop_Man_t
INCLUDES ///.
Definition: hop.h:49
char * pName
Definition: abc.h:158
Hop_Obj_t * Hop_IthVar(Hop_Man_t *p, int i)
FUNCTION DEFINITIONS ///.
Definition: hopOper.c:63
ABC_DLL int Abc_NodeMinimumBase(Abc_Obj_t *pNode)
Definition: abcMinBase.c:70
static Abc_Obj_t * Abc_ObjFanout0(Abc_Obj_t *pObj)
Definition: abc.h:371
ABC_DLL void Abc_NodeComplementInput(Abc_Obj_t *pNode, Abc_Obj_t *pFanin)
Definition: abcObj.c:1005
static int Abc_NtkReduceNodes(Abc_Ntk_t *pNtk, Vec_Ptr_t *vNodes)
Definition: abcSweep.c:535
static void Abc_NodeSetTravIdCurrent(Abc_Obj_t *p)
Definition: abc.h:409
ABC_DLL void * Abc_NtkToFraig(Abc_Ntk_t *pNtk, void *pParams, int fAllNodes, int fExdc)
Definition: abcFraig.c:103
static void Vec_PtrFree(Vec_Ptr_t *p)
Definition: vecPtr.h:223