abc-master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
saigIso.c
Go to the documentation of this file.
1 /**CFile****************************************************************
2 
3  FileName [saigIso.c]
4 
5  SystemName [ABC: Logic synthesis and verification system.]
6 
7  PackageName [Sequential AIG package.]
8 
9  Synopsis [Sequential cleanup.]
10 
11  Author [Alan Mishchenko]
12 
13  Affiliation [UC Berkeley]
14 
15  Date [Ver. 1.0. Started - June 20, 2005.]
16 
17  Revision [$Id: saigIso.c,v 1.00 2005/06/20 00:00:00 alanmi Exp $]
18 
19 ***********************************************************************/
20 
21 #include "aig/ioa/ioa.h"
22 #include "saig.h"
23 
25 
26 
27 ////////////////////////////////////////////////////////////////////////
28 /// DECLARATIONS ///
29 ////////////////////////////////////////////////////////////////////////
30 
31 ////////////////////////////////////////////////////////////////////////
32 /// FUNCTION DEFINITIONS ///
33 ////////////////////////////////////////////////////////////////////////
34 
35 /**Function*************************************************************
36 
37  Synopsis [Find the canonical permutation of the COs.]
38 
39  Description []
40 
41  SideEffects []
42 
43  SeeAlso []
44 
45 ***********************************************************************/
47 {
48  extern int Iso_ObjCompareByData( Aig_Obj_t ** pp1, Aig_Obj_t ** pp2 );
49  Vec_Int_t * vPermCos;
50  Aig_Obj_t * pObj, * pFanin;
51  int i, Entry, Diff;
52  assert( Vec_IntSize(vPermCis) == Aig_ManCiNum(pAig) );
53  vPermCos = Vec_IntAlloc( Aig_ManCoNum(pAig) );
54  if ( Saig_ManPoNum(pAig) == 1 )
55  Vec_IntPush( vPermCos, 0 );
56  else
57  {
58  Vec_Ptr_t * vRoots = Vec_PtrAlloc( Saig_ManPoNum(pAig) );
59  Saig_ManForEachPo( pAig, pObj, i )
60  {
61  pFanin = Aig_ObjFanin0(pObj);
62  assert( Aig_ObjIsConst1(pFanin) || pFanin->iData > 0 );
63  pObj->iData = Abc_Var2Lit( pFanin->iData, Aig_ObjFaninC0(pObj) );
64  Vec_PtrPush( vRoots, pObj );
65  }
66  Vec_PtrSort( vRoots, (int (*)(void))Iso_ObjCompareByData );
67  Vec_PtrForEachEntry( Aig_Obj_t *, vRoots, pObj, i )
68  Vec_IntPush( vPermCos, Aig_ObjCioId(pObj) );
69  Vec_PtrFree( vRoots );
70  }
71  // add flop outputs
72  Diff = Saig_ManPoNum(pAig) - Saig_ManPiNum(pAig);
73  Vec_IntForEachEntryStart( vPermCis, Entry, i, Saig_ManPiNum(pAig) )
74  Vec_IntPush( vPermCos, Entry + Diff );
75  return vPermCos;
76 }
77 
78 /**Function*************************************************************
79 
80  Synopsis [Performs canonical duplication of the AIG.]
81 
82  Description []
83 
84  SideEffects []
85 
86  SeeAlso []
87 
88 ***********************************************************************/
90 {
91  if ( Aig_ObjIsTravIdCurrent(pAig, pObj) )
92  return;
93  Aig_ObjSetTravIdCurrent(pAig, pObj);
94  assert( Aig_ObjIsNode(pObj) );
95  if ( !Aig_ObjIsNode(Aig_ObjFanin0(pObj)) || !Aig_ObjIsNode(Aig_ObjFanin1(pObj)) )
96  {
97  Saig_ManDupIsoCanonical_rec( pNew, pAig, Aig_ObjFanin0(pObj) );
98  Saig_ManDupIsoCanonical_rec( pNew, pAig, Aig_ObjFanin1(pObj) );
99  }
100  else
101  {
102  assert( Aig_ObjFanin0(pObj)->iData != Aig_ObjFanin1(pObj)->iData );
103  if ( Aig_ObjFanin0(pObj)->iData < Aig_ObjFanin1(pObj)->iData )
104  {
105  Saig_ManDupIsoCanonical_rec( pNew, pAig, Aig_ObjFanin0(pObj) );
106  Saig_ManDupIsoCanonical_rec( pNew, pAig, Aig_ObjFanin1(pObj) );
107  }
108  else
109  {
110  Saig_ManDupIsoCanonical_rec( pNew, pAig, Aig_ObjFanin1(pObj) );
111  Saig_ManDupIsoCanonical_rec( pNew, pAig, Aig_ObjFanin0(pObj) );
112  }
113  }
114  pObj->pData = Aig_And( pNew, Aig_ObjChild0Copy(pObj), Aig_ObjChild1Copy(pObj) );
115 }
116 
117 /**Function*************************************************************
118 
119  Synopsis [Performs canonical duplication of the AIG.]
120 
121  Description []
122 
123  SideEffects []
124 
125  SeeAlso []
126 
127 ***********************************************************************/
128 Aig_Man_t * Saig_ManDupIsoCanonical( Aig_Man_t * pAig, int fVerbose )
129 {
130  Aig_Man_t * pNew;
131  Aig_Obj_t * pObj;
132  Vec_Int_t * vPerm, * vPermCo;
133  int i, Entry;
134  // derive permutations
135  vPerm = Saig_ManFindIsoPerm( pAig, fVerbose );
136  vPermCo = Saig_ManFindIsoPermCos( pAig, vPerm );
137  // create the new manager
138  pNew = Aig_ManStart( Aig_ManNodeNum(pAig) );
139  pNew->pName = Abc_UtilStrsav( pAig->pName );
140  Aig_ManIncrementTravId( pAig );
141  // create constant
142  pObj = Aig_ManConst1(pAig);
143  pObj->pData = Aig_ManConst1(pNew);
144  Aig_ObjSetTravIdCurrent( pAig, pObj );
145  // create PIs
146  Vec_IntForEachEntry( vPerm, Entry, i )
147  {
148  pObj = Aig_ManCi(pAig, Entry);
149  pObj->pData = Aig_ObjCreateCi(pNew);
150  Aig_ObjSetTravIdCurrent( pAig, pObj );
151  }
152  // traverse from the POs
153  Vec_IntForEachEntry( vPermCo, Entry, i )
154  {
155  pObj = Aig_ManCo(pAig, Entry);
156  Saig_ManDupIsoCanonical_rec( pNew, pAig, Aig_ObjFanin0(pObj) );
157  }
158  // create POs
159  Vec_IntForEachEntry( vPermCo, Entry, i )
160  {
161  pObj = Aig_ManCo(pAig, Entry);
162  Aig_ObjCreateCo( pNew, Aig_ObjChild0Copy(pObj) );
163  }
164  Aig_ManSetRegNum( pNew, Aig_ManRegNum(pAig) );
165  Vec_IntFreeP( &vPerm );
166  Vec_IntFreeP( &vPermCo );
167  return pNew;
168 }
169 
170 
171 
172 
173 
174 /**Function*************************************************************
175 
176  Synopsis [Checks structural equivalence of AIG1 and AIG2.]
177 
178  Description [Returns 1 if AIG1 and AIG2 are structurally equivalent
179  under this mapping.]
180 
181  SideEffects []
182 
183  SeeAlso []
184 
185 ***********************************************************************/
186 int Iso_ManCheckMapping( Aig_Man_t * pAig1, Aig_Man_t * pAig2, Vec_Int_t * vMap2to1, int fVerbose )
187 {
188  Aig_Obj_t * pObj, * pFanin0, * pFanin1;
189  int i;
190  assert( Aig_ManCiNum(pAig1) == Aig_ManCiNum(pAig2) );
191  assert( Aig_ManCoNum(pAig1) == Aig_ManCoNum(pAig2) );
192  assert( Aig_ManRegNum(pAig1) == Aig_ManRegNum(pAig2) );
193  assert( Aig_ManNodeNum(pAig1) == Aig_ManNodeNum(pAig2) );
194  Aig_ManCleanData( pAig1 );
195  // map const and PI nodes
196  Aig_ManConst1(pAig2)->pData = Aig_ManConst1(pAig1);
197  Aig_ManForEachCi( pAig2, pObj, i )
198  pObj->pData = Aig_ManCi( pAig1, Vec_IntEntry(vMap2to1, i) );
199  // try internal nodes
200  Aig_ManForEachNode( pAig2, pObj, i )
201  {
202  pFanin0 = Aig_ObjChild0Copy( pObj );
203  pFanin1 = Aig_ObjChild1Copy( pObj );
204  pObj->pData = Aig_TableLookupTwo( pAig1, pFanin0, pFanin1 );
205  if ( pObj->pData == NULL )
206  {
207  if ( fVerbose )
208  printf( "Structural equivalence failed at node %d.\n", i );
209  return 0;
210  }
211  }
212  // make sure the first PO points to the same node
213  if ( Aig_ManCoNum(pAig1)-Aig_ManRegNum(pAig1) == 1 && Aig_ObjChild0Copy(Aig_ManCo(pAig2, 0)) != Aig_ObjChild0(Aig_ManCo(pAig1, 0)) )
214  {
215  if ( fVerbose )
216  printf( "Structural equivalence failed at primary output 0.\n" );
217  return 0;
218  }
219  return 1;
220 }
221 
222 //static int s_Counter;
223 
224 /**Function*************************************************************
225 
226  Synopsis []
227 
228  Description []
229 
230  SideEffects []
231 
232  SeeAlso []
233 
234 ***********************************************************************/
236 {
237  Aig_Obj_t * pObj;
238  int i, Counter = 0;
239  if ( pAig->nComplEdges > 0 )
240  return pAig->nComplEdges;
241  Aig_ManForEachObj( pAig, pObj, i )
242  if ( Aig_ObjIsNode(pObj) )
243  {
244  Counter += Aig_ObjFaninC0(pObj);
245  Counter += Aig_ObjFaninC1(pObj);
246  }
247  else if ( Aig_ObjIsCo(pObj) )
248  Counter += Aig_ObjFaninC0(pObj);
249  return (pAig->nComplEdges = Counter);
250 }
251 
252 /**Function*************************************************************
253 
254  Synopsis [Finds mapping of CIs of AIG2 into those of AIG1.]
255 
256  Description [Returns the mapping of CIs of the two AIGs, or NULL
257  if there is no mapping.]
258 
259  SideEffects []
260 
261  SeeAlso []
262 
263 ***********************************************************************/
264 Vec_Int_t * Iso_ManFindMapping( Aig_Man_t * pAig1, Aig_Man_t * pAig2, Vec_Int_t * vPerm1_, Vec_Int_t * vPerm2_, int fVerbose )
265 {
266  Vec_Int_t * vPerm1, * vPerm2, * vInvPerm2;
267  int i, Entry;
268  if ( Aig_ManCiNum(pAig1) != Aig_ManCiNum(pAig2) )
269  return NULL;
270  if ( Aig_ManCoNum(pAig1) != Aig_ManCoNum(pAig2) )
271  return NULL;
272  if ( Aig_ManRegNum(pAig1) != Aig_ManRegNum(pAig2) )
273  return NULL;
274  if ( Aig_ManNodeNum(pAig1) != Aig_ManNodeNum(pAig2) )
275  return NULL;
276  if ( Aig_ManLevelNum(pAig1) != Aig_ManLevelNum(pAig2) )
277  return NULL;
278 // if ( Iso_ManNegEdgeNum(pAig1) != Iso_ManNegEdgeNum(pAig2) )
279 // return NULL;
280 // s_Counter++;
281 
282  if ( fVerbose )
283  printf( "AIG1:\n" );
284  vPerm1 = vPerm1_ ? vPerm1_ : Saig_ManFindIsoPerm( pAig1, fVerbose );
285  if ( fVerbose )
286  printf( "AIG1:\n" );
287  vPerm2 = vPerm2_ ? vPerm2_ : Saig_ManFindIsoPerm( pAig2, fVerbose );
288  if ( vPerm1_ )
289  assert( Vec_IntSize(vPerm1_) == Aig_ManCiNum(pAig1) );
290  if ( vPerm2_ )
291  assert( Vec_IntSize(vPerm2_) == Aig_ManCiNum(pAig2) );
292  // find canonical permutation
293  // vPerm1/vPerm2 give canonical order of CIs of AIG1/AIG2
294  vInvPerm2 = Vec_IntInvert( vPerm2, -1 );
295  Vec_IntForEachEntry( vInvPerm2, Entry, i )
296  {
297  assert( Entry >= 0 && Entry < Aig_ManCiNum(pAig1) );
298  Vec_IntWriteEntry( vInvPerm2, i, Vec_IntEntry(vPerm1, Entry) );
299  }
300  if ( vPerm1_ == NULL )
301  Vec_IntFree( vPerm1 );
302  if ( vPerm2_ == NULL )
303  Vec_IntFree( vPerm2 );
304  // check if they are indeed equivalent
305  if ( !Iso_ManCheckMapping( pAig1, pAig2, vInvPerm2, fVerbose ) )
306  Vec_IntFreeP( &vInvPerm2 );
307  return vInvPerm2;
308 }
309 
310 
311 /**Function*************************************************************
312 
313  Synopsis []
314 
315  Description []
316 
317  SideEffects []
318 
319  SeeAlso []
320 
321 ***********************************************************************/
322 Aig_Man_t * Iso_ManFilterPos_old( Aig_Man_t * pAig, int fVerbose )
323 {
324  int fVeryVerbose = 0;
325  Vec_Ptr_t * vParts, * vPerms, * vAigs;
326  Vec_Int_t * vPos, * vMap;
327  Aig_Man_t * pPart, * pTemp;
328  int i, k, nPos;
329 
330  // derive AIG for each PO
331  nPos = Aig_ManCoNum(pAig) - Aig_ManRegNum(pAig);
332  vParts = Vec_PtrAlloc( nPos );
333  vPerms = Vec_PtrAlloc( nPos );
334  for ( i = 0; i < nPos; i++ )
335  {
336  pPart = Saig_ManDupCones( pAig, &i, 1 );
337  vMap = Saig_ManFindIsoPerm( pPart, fVeryVerbose );
338  Vec_PtrPush( vParts, pPart );
339  Vec_PtrPush( vPerms, vMap );
340  }
341 // s_Counter = 0;
342 
343  // check AIGs for each PO
344  vAigs = Vec_PtrAlloc( 1000 );
345  vPos = Vec_IntAlloc( 1000 );
346  Vec_PtrForEachEntry( Aig_Man_t *, vParts, pPart, i )
347  {
348  if ( fVeryVerbose )
349  {
350  printf( "AIG %4d : ", i );
351  Aig_ManPrintStats( pPart );
352  }
353  Vec_PtrForEachEntry( Aig_Man_t *, vAigs, pTemp, k )
354  {
355  if ( fVeryVerbose )
356  printf( "Comparing AIG %4d and AIG %4d. ", Vec_IntEntry(vPos,k), i );
357  vMap = Iso_ManFindMapping( pTemp, pPart,
358  (Vec_Int_t *)Vec_PtrEntry(vPerms, Vec_IntEntry(vPos,k)),
359  (Vec_Int_t *)Vec_PtrEntry(vPerms, i),
360  fVeryVerbose );
361  if ( vMap != NULL )
362  {
363  if ( fVeryVerbose )
364  printf( "Found match\n" );
365 // if ( fVerbose )
366 // printf( "Found match for AIG %4d and AIG %4d.\n", Vec_IntEntry(vPos,k), i );
367  Vec_IntFree( vMap );
368  break;
369  }
370  if ( fVeryVerbose )
371  printf( "No match.\n" );
372  }
373  if ( k == Vec_PtrSize(vAigs) )
374  {
375  Vec_PtrPush( vAigs, pPart );
376  Vec_IntPush( vPos, i );
377  }
378  }
379  // delete AIGs
380  Vec_PtrForEachEntry( Aig_Man_t *, vParts, pPart, i )
381  Aig_ManStop( pPart );
382  Vec_PtrFree( vParts );
383  Vec_PtrForEachEntry( Vec_Int_t *, vPerms, vMap, i )
384  Vec_IntFree( vMap );
385  Vec_PtrFree( vPerms );
386  // derive the resulting AIG
387  pPart = Saig_ManDupCones( pAig, Vec_IntArray(vPos), Vec_IntSize(vPos) );
388  Vec_PtrFree( vAigs );
389  Vec_IntFree( vPos );
390 
391 // printf( "The number of all checks %d. Complex checks %d.\n", nPos*(nPos-1)/2, s_Counter );
392  return pPart;
393 }
394 
395 /**Function*************************************************************
396 
397  Synopsis [Takes multi-output sequential AIG.]
398 
399  Description [Returns candidate equivalence classes of POs.]
400 
401  SideEffects []
402 
403  SeeAlso []
404 
405 ***********************************************************************/
407 {
408  return Vec_StrCompareVec( *p1, *p2 );
409 }
410 
411 /**Function*************************************************************
412 
413  Synopsis []
414 
415  Description []
416 
417  SideEffects []
418 
419  SeeAlso []
420 
421 ***********************************************************************/
422 Aig_Man_t * Iso_ManFilterPos( Aig_Man_t * pAig, Vec_Ptr_t ** pvPosEquivs, int fVerbose )
423 {
424 // int fVeryVerbose = 0;
425  Aig_Man_t * pPart, * pTemp;
426  Vec_Ptr_t * vBuffers, * vClasses;
427  Vec_Int_t * vLevel, * vRemain;
428  Vec_Str_t * vStr, * vPrev;
429  int i, nPos;
430  abctime clk = Abc_Clock();
431  abctime clkDup = 0, clkAig = 0, clkIso = 0, clk2;
432  *pvPosEquivs = NULL;
433 
434  // derive AIG for each PO
435  nPos = Aig_ManCoNum(pAig) - Aig_ManRegNum(pAig);
436  vBuffers = Vec_PtrAlloc( nPos );
437  for ( i = 0; i < nPos; i++ )
438  {
439  if ( i % 100 == 0 )
440  printf( "%6d finished...\r", i );
441 
442  clk2 = Abc_Clock();
443  pPart = Saig_ManDupCones( pAig, &i, 1 );
444  clkDup += Abc_Clock() - clk2;
445 
446  clk2 = Abc_Clock();
447  pTemp = Saig_ManDupIsoCanonical( pPart, 0 );
448  clkIso += Abc_Clock() - clk2;
449 
450  clk2 = Abc_Clock();
451  vStr = Ioa_WriteAigerIntoMemoryStr( pTemp );
452  clkAig += Abc_Clock() - clk2;
453 
454  Vec_PtrPush( vBuffers, vStr );
455  Aig_ManStop( pTemp );
456  Aig_ManStop( pPart );
457  // remember the output number in nCap (attention: hack!)
458  vStr->nCap = i;
459  }
460 // s_Counter = 0;
461  if ( fVerbose )
462  {
463  Abc_PrintTime( 1, "Duplicate time", clkDup );
464  Abc_PrintTime( 1, "Isomorph time", clkIso );
465  Abc_PrintTime( 1, "AIGER time", clkAig );
466  }
467 
468  // sort the infos
469  clk = Abc_Clock();
470  Vec_PtrSort( vBuffers, (int (*)(void))Iso_StoCompareVecStr );
471 
472  // create classes
473  clk = Abc_Clock();
474  vClasses = Vec_PtrAlloc( Saig_ManPoNum(pAig) );
475  // start the first class
476  Vec_PtrPush( vClasses, (vLevel = Vec_IntAlloc(4)) );
477  vPrev = (Vec_Str_t *)Vec_PtrEntry( vBuffers, 0 );
478  Vec_IntPush( vLevel, vPrev->nCap );
479  // consider other classes
480  Vec_PtrForEachEntryStart( Vec_Str_t *, vBuffers, vStr, i, 1 )
481  {
482  if ( Vec_StrCompareVec(vPrev, vStr) )
483  Vec_PtrPush( vClasses, Vec_IntAlloc(4) );
484  vLevel = (Vec_Int_t *)Vec_PtrEntryLast( vClasses );
485  Vec_IntPush( vLevel, vStr->nCap );
486  vPrev = vStr;
487  }
488  Vec_VecFree( (Vec_Vec_t *)vBuffers );
489 
490  if ( fVerbose )
491  Abc_PrintTime( 1, "Sorting time", Abc_Clock() - clk );
492 // Abc_PrintTime( 1, "Traversal time", time_Trav );
493 
494  // report the results
495 // Vec_VecPrintInt( (Vec_Vec_t *)vClasses );
496 // printf( "Devided %d outputs into %d cand equiv classes.\n", Saig_ManPoNum(pAig), Vec_PtrSize(vClasses) );
497 /*
498  if ( fVerbose )
499  {
500  Vec_PtrForEachEntry( Vec_Int_t *, vClasses, vLevel, i )
501  if ( Vec_IntSize(vLevel) > 1 )
502  printf( "%d ", Vec_IntSize(vLevel) );
503  else
504  nUnique++;
505  printf( " Unique = %d\n", nUnique );
506  }
507 */
508 
509  // canonicize order
510  Vec_PtrForEachEntry( Vec_Int_t *, vClasses, vLevel, i )
511  Vec_IntSort( vLevel, 0 );
512  Vec_VecSortByFirstInt( (Vec_Vec_t *)vClasses, 0 );
513 
514  // collect the first ones
515  vRemain = Vec_IntAlloc( 100 );
516  Vec_PtrForEachEntry( Vec_Int_t *, vClasses, vLevel, i )
517  Vec_IntPush( vRemain, Vec_IntEntry(vLevel, 0) );
518 
519  // derive the resulting AIG
520  pPart = Saig_ManDupCones( pAig, Vec_IntArray(vRemain), Vec_IntSize(vRemain) );
521  Vec_IntFree( vRemain );
522 
523 // return (Vec_Vec_t *)vClasses;
524 // Vec_VecFree( (Vec_Vec_t *)vClasses );
525  *pvPosEquivs = vClasses;
526  return pPart;
527 }
528 
529 /**Function*************************************************************
530 
531  Synopsis []
532 
533  Description []
534 
535  SideEffects []
536 
537  SeeAlso []
538 
539 ***********************************************************************/
540 Aig_Man_t * Iso_ManTest( Aig_Man_t * pAig, int fVerbose )
541 {
542  Vec_Int_t * vPerm;
543  abctime clk = Abc_Clock();
544  vPerm = Saig_ManFindIsoPerm( pAig, fVerbose );
545  Vec_IntFree( vPerm );
546  Abc_PrintTime( 1, "Time", Abc_Clock() - clk );
547  return NULL;
548 }
549 
550 /**Function*************************************************************
551 
552  Synopsis []
553 
554  Description []
555 
556  SideEffects []
557 
558  SeeAlso []
559 
560 ***********************************************************************/
561 Aig_Man_t * Saig_ManIsoReduce( Aig_Man_t * pAig, Vec_Ptr_t ** pvPosEquivs, int fVerbose )
562 {
563  Aig_Man_t * pPart;
564  abctime clk = Abc_Clock();
565  pPart = Iso_ManFilterPos( pAig, pvPosEquivs, fVerbose );
566  printf( "Reduced %d outputs to %d outputs. ", Saig_ManPoNum(pAig), Saig_ManPoNum(pPart) );
567  Abc_PrintTime( 1, "Time", Abc_Clock() - clk );
568  if ( fVerbose && *pvPosEquivs && Saig_ManPoNum(pAig) != Vec_PtrSize(*pvPosEquivs) )
569  {
570  printf( "Nontrivial classes:\n" );
571  Vec_VecPrintInt( (Vec_Vec_t *)*pvPosEquivs, 1 );
572  }
573 // Aig_ManStopP( &pPart );
574  return pPart;
575 }
576 
578 
579 #include "base/abc/abc.h"
580 
582 
583 /**Function*************************************************************
584 
585  Synopsis []
586 
587  Description []
588 
589  SideEffects []
590 
591  SeeAlso []
592 
593 ***********************************************************************/
594 Aig_Man_t * Iso_ManTest888( Aig_Man_t * pAig1, int fVerbose )
595 {
596  extern Aig_Man_t * Abc_NtkToDar( Abc_Ntk_t * pNtk, int fExors, int fRegisters );
597  extern Abc_Ntk_t * Abc_NtkFromAigPhase( Aig_Man_t * pMan );
598  Abc_Ntk_t * pNtk;
599  Aig_Man_t * pAig2;
600  Vec_Int_t * vMap;
601 
602  pNtk = Abc_NtkFromAigPhase( pAig1 );
603  Abc_NtkPermute( pNtk, 1, 0, 1, NULL );
604  pAig2 = Abc_NtkToDar( pNtk, 0, 1 );
605  Abc_NtkDelete( pNtk );
606 
607  vMap = Iso_ManFindMapping( pAig1, pAig2, NULL, NULL, fVerbose );
608  Aig_ManStop( pAig2 );
609 
610  if ( vMap != NULL )
611  {
612  printf( "Mapping of AIGs is found.\n" );
613  if ( fVerbose )
614  Vec_IntPrint( vMap );
615  }
616  else
617  printf( "Mapping of AIGs is NOT found.\n" );
618  Vec_IntFreeP( &vMap );
619  return NULL;
620 }
621 
622 ////////////////////////////////////////////////////////////////////////
623 /// END OF FILE ///
624 ////////////////////////////////////////////////////////////////////////
625 
626 
628 
Aig_Obj_t * Aig_ObjCreateCo(Aig_Man_t *p, Aig_Obj_t *pDriver)
Definition: aigObj.c:66
static int * Vec_IntArray(Vec_Int_t *p)
Definition: vecInt.h:328
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition: vecPtr.h:42
Vec_Str_t * Ioa_WriteAigerIntoMemoryStr(Aig_Man_t *pMan)
Definition: ioaWriteAig.c:286
int Iso_ManNegEdgeNum(Aig_Man_t *pAig)
Definition: saigIso.c:235
#define Vec_PtrForEachEntryStart(Type, vVec, pEntry, i, Start)
Definition: vecPtr.h:57
typedefABC_NAMESPACE_HEADER_START struct Vec_Vec_t_ Vec_Vec_t
INCLUDES ///.
Definition: vecVec.h:42
static int Saig_ManPoNum(Aig_Man_t *p)
Definition: saig.h:74
typedefABC_NAMESPACE_HEADER_START struct Aig_Man_t_ Aig_Man_t
INCLUDES ///.
Definition: aig.h:50
static Aig_Obj_t * Aig_ObjChild0(Aig_Obj_t *pObj)
Definition: aig.h:310
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition: bblif.c:37
void Aig_ManStop(Aig_Man_t *p)
Definition: aigMan.c:187
static int Aig_ObjIsTravIdCurrent(Aig_Man_t *p, Aig_Obj_t *pObj)
Definition: aig.h:295
void * pData
Definition: aig.h:87
static Aig_Obj_t * Aig_ObjFanin0(Aig_Obj_t *pObj)
Definition: aig.h:308
static int Abc_Var2Lit(int Var, int fCompl)
Definition: abc_global.h:263
Aig_Man_t * Aig_ManStart(int nNodesMax)
DECLARATIONS ///.
Definition: aigMan.c:47
void Aig_ManPrintStats(Aig_Man_t *p)
Definition: aigMan.c:379
static Vec_Int_t * Vec_IntInvert(Vec_Int_t *p, int Fill)
Definition: vecInt.h:1092
#define Aig_ManForEachCi(p, pObj, i)
ITERATORS ///.
Definition: aig.h:393
static void Vec_PtrSort(Vec_Ptr_t *p, int(*Vec_PtrSortCompare)()) ___unused
Definition: vecPtr.h:851
Aig_Obj_t * Aig_ObjCreateCi(Aig_Man_t *p)
DECLARATIONS ///.
Definition: aigObj.c:45
static void Vec_PtrPush(Vec_Ptr_t *p, void *Entry)
Definition: vecPtr.h:606
static abctime Abc_Clock()
Definition: abc_global.h:279
static Aig_Obj_t * Aig_ObjFanin1(Aig_Obj_t *pObj)
Definition: aig.h:309
static int Vec_PtrSize(Vec_Ptr_t *p)
Definition: vecPtr.h:295
static void Vec_VecFree(Vec_Vec_t *p)
Definition: vecVec.h:347
static void Vec_IntSort(Vec_Int_t *p, int fReverse)
Definition: vecInt.h:1293
int Iso_StoCompareVecStr(Vec_Str_t **p1, Vec_Str_t **p2)
Definition: saigIso.c:406
static void Aig_ObjSetTravIdCurrent(Aig_Man_t *p, Aig_Obj_t *pObj)
Definition: aig.h:293
int Iso_ObjCompareByData(Aig_Obj_t **pp1, Aig_Obj_t **pp2)
Definition: saigIsoSlow.c:489
static int Aig_ManNodeNum(Aig_Man_t *p)
Definition: aig.h:256
ABC_DLL void Abc_NtkDelete(Abc_Ntk_t *pNtk)
Definition: abcNtk.c:1233
Aig_Man_t * Saig_ManDupCones(Aig_Man_t *pAig, int *pPos, int nPos)
Definition: saigDup.c:543
Aig_Obj_t * Aig_And(Aig_Man_t *p, Aig_Obj_t *p0, Aig_Obj_t *p1)
Definition: aigOper.c:104
ABC_NAMESPACE_IMPL_START Vec_Int_t * Saig_ManFindIsoPermCos(Aig_Man_t *pAig, Vec_Int_t *vPermCis)
DECLARATIONS ///.
Definition: saigIso.c:46
Aig_Man_t * Saig_ManIsoReduce(Aig_Man_t *pAig, Vec_Ptr_t **pvPosEquivs, int fVerbose)
Definition: saigIso.c:561
void Aig_ManIncrementTravId(Aig_Man_t *p)
DECLARATIONS ///.
Definition: aigUtil.c:44
static void Abc_PrintTime(int level, const char *pStr, abctime time)
Definition: abc_global.h:367
static int Aig_ObjIsNode(Aig_Obj_t *pObj)
Definition: aig.h:280
static void Vec_IntWriteEntry(Vec_Int_t *p, int i, int Entry)
Definition: bblif.c:285
static int Aig_ManCoNum(Aig_Man_t *p)
Definition: aig.h:252
#define Aig_ManForEachNode(p, pObj, i)
Definition: aig.h:413
static Vec_Int_t * Vec_IntAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: bblif.c:149
static void * Vec_PtrEntryLast(Vec_Ptr_t *p)
Definition: vecPtr.h:413
Vec_Int_t * Saig_ManFindIsoPerm(Aig_Man_t *pAig, int fVerbose)
Definition: saigIsoSlow.c:1170
Aig_Man_t * Abc_NtkToDar(Abc_Ntk_t *pNtk, int fExors, int fRegisters)
Definition: abcDar.c:233
void Aig_ManSetRegNum(Aig_Man_t *p, int nRegs)
Definition: aigMan.c:438
static Aig_Obj_t * Aig_ManCi(Aig_Man_t *p, int i)
Definition: aig.h:266
Aig_Man_t * Iso_ManFilterPos_old(Aig_Man_t *pAig, int fVerbose)
Definition: saigIso.c:322
static int Vec_IntEntry(Vec_Int_t *p, int i)
Definition: bblif.c:268
static int Aig_ManCiNum(Aig_Man_t *p)
Definition: aig.h:251
#define ABC_NAMESPACE_IMPL_END
Definition: abc_global.h:108
static void Vec_VecPrintInt(Vec_Vec_t *p, int fSkipSingles)
Definition: vecVec.h:616
Aig_Man_t * Saig_ManDupIsoCanonical(Aig_Man_t *pAig, int fVerbose)
Definition: saigIso.c:128
static int Aig_ObjIsConst1(Aig_Obj_t *pObj)
Definition: aig.h:274
static void Vec_VecSortByFirstInt(Vec_Vec_t *p, int fReverse)
Definition: vecVec.h:595
static Aig_Obj_t * Aig_ObjChild1Copy(Aig_Obj_t *pObj)
Definition: aig.h:313
Definition: aig.h:69
static void Vec_IntPush(Vec_Int_t *p, int Entry)
Definition: bblif.c:468
static int Counter
static Aig_Obj_t * Aig_ObjChild0Copy(Aig_Obj_t *pObj)
Definition: aig.h:312
#define Vec_IntForEachEntryStart(vVec, Entry, i, Start)
Definition: vecInt.h:56
static void Vec_IntFreeP(Vec_Int_t **p)
Definition: vecInt.h:289
Aig_Obj_t * Aig_TableLookupTwo(Aig_Man_t *p, Aig_Obj_t *pFanin0, Aig_Obj_t *pFanin1)
Definition: aigTable.c:146
Vec_Int_t * Iso_ManFindMapping(Aig_Man_t *pAig1, Aig_Man_t *pAig2, Vec_Int_t *vPerm1_, Vec_Int_t *vPerm2_, int fVerbose)
Definition: saigIso.c:264
static int Aig_ObjFaninC0(Aig_Obj_t *pObj)
Definition: aig.h:306
static Aig_Obj_t * Aig_ManConst1(Aig_Man_t *p)
Definition: aig.h:264
Abc_Ntk_t * Abc_NtkFromAigPhase(Aig_Man_t *pMan)
Definition: abcDar.c:590
void Saig_ManDupIsoCanonical_rec(Aig_Man_t *pNew, Aig_Man_t *pAig, Aig_Obj_t *pObj)
Definition: saigIso.c:89
#define ABC_NAMESPACE_IMPL_START
Definition: abc_global.h:107
static void * Vec_PtrEntry(Vec_Ptr_t *p, int i)
Definition: vecPtr.h:362
static Aig_Obj_t * Aig_ManCo(Aig_Man_t *p, int i)
Definition: aig.h:267
int Aig_ManLevelNum(Aig_Man_t *p)
Definition: aigDfs.c:486
int iData
Definition: aig.h:88
static int Aig_ManRegNum(Aig_Man_t *p)
Definition: aig.h:260
static int Vec_IntSize(Vec_Int_t *p)
Definition: bblif.c:252
static int Vec_StrCompareVec(Vec_Str_t *p1, Vec_Str_t *p2)
Definition: vecStr.h:793
#define Aig_ManForEachObj(p, pObj, i)
Definition: aig.h:403
static Vec_Ptr_t * Vec_PtrAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: vecPtr.h:83
static int Saig_ManPiNum(Aig_Man_t *p)
MACRO DEFINITIONS ///.
Definition: saig.h:73
static int Aig_ObjFaninC1(Aig_Obj_t *pObj)
Definition: aig.h:307
#define Saig_ManForEachPo(p, pObj, i)
Definition: saig.h:93
ABC_NAMESPACE_IMPL_END ABC_NAMESPACE_IMPL_START Aig_Man_t * Iso_ManTest888(Aig_Man_t *pAig1, int fVerbose)
Definition: saigIso.c:594
#define assert(ex)
Definition: util_old.h:213
Aig_Man_t * Iso_ManTest(Aig_Man_t *pAig, int fVerbose)
Definition: saigIso.c:540
static void Vec_IntPrint(Vec_Int_t *vVec)
Definition: vecInt.h:1803
ABC_DLL void Abc_NtkPermute(Abc_Ntk_t *pNtk, int fInputs, int fOutputs, int fFlops, char *pFlopPermFile)
Definition: abcNtk.c:1906
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
int nCap
Definition: bblif.c:49
ABC_INT64_T abctime
Definition: abc_global.h:278
char * Abc_UtilStrsav(char *s)
Definition: starter.c:47
#define Vec_IntForEachEntry(vVec, Entry, i)
MACRO DEFINITIONS ///.
Definition: vecInt.h:54
void Aig_ManCleanData(Aig_Man_t *p)
Definition: aigUtil.c:205
static int Aig_ObjIsCo(Aig_Obj_t *pObj)
Definition: aig.h:276
int Iso_ManCheckMapping(Aig_Man_t *pAig1, Aig_Man_t *pAig2, Vec_Int_t *vMap2to1, int fVerbose)
Definition: saigIso.c:186
static int Aig_ObjCioId(Aig_Obj_t *pObj)
Definition: aig.h:285
static void Vec_PtrFree(Vec_Ptr_t *p)
Definition: vecPtr.h:223
Aig_Man_t * Iso_ManFilterPos(Aig_Man_t *pAig, Vec_Ptr_t **pvPosEquivs, int fVerbose)
Definition: saigIso.c:422