ABC: A System for Sequential Synthesis and Verification
 
Loading...
Searching...
No Matches
abcIvy.c
Go to the documentation of this file.
1
20
21#include "base/abc/abc.h"
22#include "bool/dec/dec.h"
23#include "proof/fra/fra.h"
24#include "aig/ivy/ivy.h"
25#include "proof/fraig/fraig.h"
26#include "map/mio/mio.h"
27#include "aig/aig/aig.h"
28#include "aig/gia/gia.h"
29
30#ifdef ABC_USE_CUDD
31#include "bdd/extrab/extraBdd.h"
32#endif
33
35
36extern Aig_Man_t * Abc_NtkToDar( Abc_Ntk_t * pNtk, int fExors, int fRegisters );
37extern void Aig_ManStop( Aig_Man_t * pMan );
38//extern int Fra_FraigSat( Aig_Man_t * pMan, ABC_INT64_T nConfLimit, ABC_INT64_T nInsLimit, int fFlipBits, int fAndOuts, int fNewSolver, int fVerbose );
39extern Ivy_Obj_t * Dec_GraphToNetworkIvy( Ivy_Man_t * pMan, Dec_Graph_t * pGraph );
40extern void Ivy_CutComputeAll( Ivy_Man_t * p, int nInputs );
41
45
46static Abc_Ntk_t * Abc_NtkFromIvy( Abc_Ntk_t * pNtkOld, Ivy_Man_t * pMan );
47static Abc_Ntk_t * Abc_NtkFromIvySeq( Abc_Ntk_t * pNtkOld, Ivy_Man_t * pMan, int fHaig );
48static Ivy_Man_t * Abc_NtkToIvy( Abc_Ntk_t * pNtkOld );
49
50static void Abc_NtkStrashPerformAig( Abc_Ntk_t * pNtk, Ivy_Man_t * pMan );
51static Ivy_Obj_t * Abc_NodeStrashAig( Ivy_Man_t * pMan, Abc_Obj_t * pNode );
52static Ivy_Obj_t * Abc_NodeStrashAigSopAig( Ivy_Man_t * pMan, Abc_Obj_t * pNode, char * pSop );
53static Ivy_Obj_t * Abc_NodeStrashAigExorAig( Ivy_Man_t * pMan, Abc_Obj_t * pNode, char * pSop );
54static Ivy_Obj_t * Abc_NodeStrashAigFactorAig( Ivy_Man_t * pMan, Abc_Obj_t * pNode, char * pSop );
55
56typedef int Abc_Edge_t;
57static inline Abc_Edge_t Abc_EdgeCreate( int Id, int fCompl ) { return (Id << 1) | fCompl; }
58static inline int Abc_EdgeId( Abc_Edge_t Edge ) { return Edge >> 1; }
59static inline int Abc_EdgeIsComplement( Abc_Edge_t Edge ) { return Edge & 1; }
60static inline Abc_Edge_t Abc_EdgeRegular( Abc_Edge_t Edge ) { return (Edge >> 1) << 1; }
61static inline Abc_Edge_t Abc_EdgeNot( Abc_Edge_t Edge ) { return Edge ^ 1; }
62static inline Abc_Edge_t Abc_EdgeNotCond( Abc_Edge_t Edge, int fCond ) { return Edge ^ fCond; }
63static inline Abc_Edge_t Abc_EdgeFromNode( Abc_Obj_t * pNode ) { return Abc_EdgeCreate( Abc_ObjRegular(pNode)->Id, Abc_ObjIsComplement(pNode) ); }
64static inline Abc_Obj_t * Abc_EdgeToNode( Abc_Ntk_t * p, Abc_Edge_t Edge ) { return Abc_ObjNotCond( Abc_NtkObj(p, Abc_EdgeId(Edge)), Abc_EdgeIsComplement(Edge) ); }
65
66static inline Abc_Obj_t * Abc_ObjFanin0Ivy( Abc_Ntk_t * p, Ivy_Obj_t * pObj ) { return Abc_ObjNotCond( Abc_EdgeToNode(p, Ivy_ObjFanin0(pObj)->TravId), Ivy_ObjFaninC0(pObj) ); }
67static inline Abc_Obj_t * Abc_ObjFanin1Ivy( Abc_Ntk_t * p, Ivy_Obj_t * pObj ) { return Abc_ObjNotCond( Abc_EdgeToNode(p, Ivy_ObjFanin1(pObj)->TravId), Ivy_ObjFaninC1(pObj) ); }
68
69static Vec_Int_t * Abc_NtkCollectLatchValuesIvy( Abc_Ntk_t * pNtk, int fUseDcs );
70
71extern int timeRetime;
72
76
88Ivy_Man_t * Abc_NtkIvyBefore( Abc_Ntk_t * pNtk, int fSeq, int fUseDc )
89{
90 Ivy_Man_t * pMan;
91//timeRetime = Abc_Clock();
92 assert( !Abc_NtkIsNetlist(pNtk) );
93 if ( Abc_NtkIsBddLogic(pNtk) )
94 {
95 if ( !Abc_NtkBddToSop(pNtk, -1, ABC_INFINITY, 1) )
96 {
97 printf( "Abc_NtkIvyBefore(): Converting to SOPs has failed.\n" );
98 return NULL;
99 }
100 }
101 if ( fSeq && Abc_NtkCountSelfFeedLatches(pNtk) )
102 {
103 printf( "Warning: The network has %d self-feeding latches.\n", Abc_NtkCountSelfFeedLatches(pNtk) );
104// return NULL;
105 }
106 // print warning about choice nodes
107 if ( Abc_NtkGetChoiceNum( pNtk ) )
108 printf( "Warning: The choice nodes in the initial AIG are removed by strashing.\n" );
109 // convert to the AIG manager
110 pMan = Abc_NtkToIvy( pNtk );
111 if ( !Ivy_ManCheck( pMan ) )
112 {
113 printf( "AIG check has failed.\n" );
114 Ivy_ManStop( pMan );
115 return NULL;
116 }
117// Ivy_ManPrintStats( pMan );
118 if ( fSeq )
119 {
120 int nLatches = Abc_NtkLatchNum(pNtk);
121 Vec_Int_t * vInit = Abc_NtkCollectLatchValuesIvy( pNtk, fUseDc );
122 Ivy_ManMakeSeq( pMan, nLatches, vInit->pArray );
123 Vec_IntFree( vInit );
124// Ivy_ManPrintStats( pMan );
125 }
126//timeRetime = Abc_Clock() - timeRetime;
127 return pMan;
128}
129
141Abc_Ntk_t * Abc_NtkIvyAfter( Abc_Ntk_t * pNtk, Ivy_Man_t * pMan, int fSeq, int fHaig )
142{
143 Abc_Ntk_t * pNtkAig;
144 int nNodes, fCleanup = 1;
145 // convert from the AIG manager
146 if ( fSeq )
147 pNtkAig = Abc_NtkFromIvySeq( pNtk, pMan, fHaig );
148 else
149 pNtkAig = Abc_NtkFromIvy( pNtk, pMan );
150 // report the cleanup results
151 if ( !fHaig && fCleanup && (nNodes = Abc_AigCleanup((Abc_Aig_t *)pNtkAig->pManFunc)) )
152 printf( "Warning: AIG cleanup removed %d nodes (this is not a bug).\n", nNodes );
153 // duplicate EXDC
154 if ( pNtk->pExdc )
155 pNtkAig->pExdc = Abc_NtkDup( pNtk->pExdc );
156 // make sure everything is okay
157 if ( !Abc_NtkCheck( pNtkAig ) )
158 {
159 printf( "Abc_NtkStrash: The network check has failed.\n" );
160 Abc_NtkDelete( pNtkAig );
161 return NULL;
162 }
163 return pNtkAig;
164}
165
178{
179 Abc_Ntk_t * pNtkAig;
180 Ivy_Man_t * pMan;
181 pMan = Abc_NtkIvyBefore( pNtk, 1, 0 );
182 if ( pMan == NULL )
183 return NULL;
184 pNtkAig = Abc_NtkIvyAfter( pNtk, pMan, 1, 0 );
185 Ivy_ManStop( pMan );
186 return pNtkAig;
187}
188
200Abc_Ntk_t * Abc_NtkIvyHaig( Abc_Ntk_t * pNtk, int nIters, int fUseZeroCost, int fVerbose )
201{
202 Abc_Ntk_t * pNtkAig;
203 Ivy_Man_t * pMan;
204 abctime clk;
205// int i;
206/*
207extern int nMoves;
208extern int nMovesS;
209extern int nClauses;
210extern int timeInv;
211
212nMoves = 0;
213nMovesS = 0;
214nClauses = 0;
215timeInv = 0;
216*/
217 pMan = Abc_NtkIvyBefore( pNtk, 1, 1 );
218 if ( pMan == NULL )
219 return NULL;
220//timeRetime = Abc_Clock();
221
222clk = Abc_Clock();
223 Ivy_ManHaigStart( pMan, fVerbose );
224// Ivy_ManRewriteSeq( pMan, 0, 0 );
225// for ( i = 0; i < nIters; i++ )
226// Ivy_ManRewriteSeq( pMan, fUseZeroCost, 0 );
227
228//printf( "%d ", Ivy_ManNodeNum(pMan) );
229 Ivy_ManRewriteSeq( pMan, 0, 0 );
230 Ivy_ManRewriteSeq( pMan, 0, 0 );
231 Ivy_ManRewriteSeq( pMan, 1, 0 );
232//printf( "%d ", Ivy_ManNodeNum(pMan) );
233//printf( "%d ", Ivy_ManNodeNum(pMan->pHaig) );
234//ABC_PRT( " ", Abc_Clock() - clk );
235//printf( "\n" );
236/*
237 printf( "Moves = %d. ", nMoves );
238 printf( "MovesS = %d. ", nMovesS );
239 printf( "Clauses = %d. ", nClauses );
240 ABC_PRT( "Time", timeInv );
241*/
242// Ivy_ManRewriteSeq( pMan, 1, 0 );
243//printf( "Haig size = %d.\n", Ivy_ManNodeNum(pMan->pHaig) );
244// Ivy_ManHaigPostprocess( pMan, fVerbose );
245//timeRetime = Abc_Clock() - timeRetime;
246
247 // write working AIG into the current network
248// pNtkAig = Abc_NtkIvyAfter( pNtk, pMan, 1, 0 );
249 // write HAIG into the current network
250 pNtkAig = Abc_NtkIvyAfter( pNtk, pMan->pHaig, 1, 1 );
251
252 Ivy_ManHaigStop( pMan );
253 Ivy_ManStop( pMan );
254 return pNtkAig;
255}
256
268void Abc_NtkIvyCuts( Abc_Ntk_t * pNtk, int nInputs )
269{
270 Ivy_Man_t * pMan;
271 pMan = Abc_NtkIvyBefore( pNtk, 1, 0 );
272 if ( pMan == NULL )
273 return;
274 Ivy_CutComputeAll( pMan, nInputs );
275 Ivy_ManStop( pMan );
276}
277
289Abc_Ntk_t * Abc_NtkIvyRewrite( Abc_Ntk_t * pNtk, int fUpdateLevel, int fUseZeroCost, int fVerbose )
290{
291 Abc_Ntk_t * pNtkAig;
292 Ivy_Man_t * pMan;
293 pMan = Abc_NtkIvyBefore( pNtk, 0, 0 );
294 if ( pMan == NULL )
295 return NULL;
296//timeRetime = Abc_Clock();
297 Ivy_ManRewritePre( pMan, fUpdateLevel, fUseZeroCost, fVerbose );
298//timeRetime = Abc_Clock() - timeRetime;
299 pNtkAig = Abc_NtkIvyAfter( pNtk, pMan, 0, 0 );
300 Ivy_ManStop( pMan );
301 return pNtkAig;
302}
303
315Abc_Ntk_t * Abc_NtkIvyRewriteSeq( Abc_Ntk_t * pNtk, int fUseZeroCost, int fVerbose )
316{
317 Abc_Ntk_t * pNtkAig;
318 Ivy_Man_t * pMan;
319 pMan = Abc_NtkIvyBefore( pNtk, 1, 1 );
320 if ( pMan == NULL )
321 return NULL;
322//timeRetime = Abc_Clock();
323 Ivy_ManRewriteSeq( pMan, fUseZeroCost, fVerbose );
324//timeRetime = Abc_Clock() - timeRetime;
325// Ivy_ManRewriteSeq( pMan, 1, 0 );
326// Ivy_ManRewriteSeq( pMan, 1, 0 );
327 pNtkAig = Abc_NtkIvyAfter( pNtk, pMan, 1, 0 );
328 Ivy_ManStop( pMan );
329 return pNtkAig;
330}
331
343Abc_Ntk_t * Abc_NtkIvyResyn0( Abc_Ntk_t * pNtk, int fUpdateLevel, int fVerbose )
344{
345 Abc_Ntk_t * pNtkAig;
346 Ivy_Man_t * pMan, * pTemp;
347 pMan = Abc_NtkIvyBefore( pNtk, 0, 0 );
348 if ( pMan == NULL )
349 return NULL;
350 pMan = Ivy_ManResyn0( pTemp = pMan, fUpdateLevel, fVerbose );
351 Ivy_ManStop( pTemp );
352 pNtkAig = Abc_NtkIvyAfter( pNtk, pMan, 0, 0 );
353 Ivy_ManStop( pMan );
354 return pNtkAig;
355}
356
368Abc_Ntk_t * Abc_NtkIvyResyn( Abc_Ntk_t * pNtk, int fUpdateLevel, int fVerbose )
369{
370 Abc_Ntk_t * pNtkAig;
371 Ivy_Man_t * pMan, * pTemp;
372 pMan = Abc_NtkIvyBefore( pNtk, 0, 0 );
373 if ( pMan == NULL )
374 return NULL;
375 pMan = Ivy_ManResyn( pTemp = pMan, fUpdateLevel, fVerbose );
376 Ivy_ManStop( pTemp );
377 pNtkAig = Abc_NtkIvyAfter( pNtk, pMan, 0, 0 );
378 Ivy_ManStop( pMan );
379 return pNtkAig;
380}
381
393Abc_Ntk_t * Abc_NtkIvySat( Abc_Ntk_t * pNtk, int nConfLimit, int fVerbose )
394{
395 Ivy_FraigParams_t Params, * pParams = &Params;
396 Abc_Ntk_t * pNtkAig;
397 Ivy_Man_t * pMan, * pTemp;
398 pMan = Abc_NtkIvyBefore( pNtk, 0, 0 );
399 if ( pMan == NULL )
400 return NULL;
401 Ivy_FraigParamsDefault( pParams );
402 pParams->nBTLimitMiter = nConfLimit;
403 pParams->fVerbose = fVerbose;
404// pMan = Ivy_FraigPerform( pTemp = pMan, pParams );
405 pMan = Ivy_FraigMiter( pTemp = pMan, pParams );
406 Ivy_ManStop( pTemp );
407 pNtkAig = Abc_NtkIvyAfter( pNtk, pMan, 0, 0 );
408 Ivy_ManStop( pMan );
409 return pNtkAig;
410}
411
424{
425 Abc_Obj_t * pObj;
426 Ivy_Obj_t * pObjIvy, * pObjFraig;
427 int i;
428 pObj = Abc_AigConst1(pNtk);
429 pObj->pCopy = Abc_AigConst1(pNtkAig);
430 Abc_NtkForEachCi( pNtk, pObj, i )
431 pObj->pCopy = Abc_NtkCi(pNtkAig, i);
432 Abc_NtkForEachCo( pNtk, pObj, i )
433 pObj->pCopy = Abc_NtkCo(pNtkAig, i);
434 Abc_NtkForEachLatch( pNtk, pObj, i )
435 pObj->pCopy = Abc_NtkBox(pNtkAig, i);
436 Abc_NtkForEachNode( pNtk, pObj, i )
437 {
438 pObjIvy = (Ivy_Obj_t *)pObj->pCopy;
439 if ( pObjIvy == NULL )
440 continue;
441 pObjFraig = Ivy_ObjEquiv( pObjIvy );
442 if ( pObjFraig == NULL )
443 continue;
444 pObj->pCopy = Abc_EdgeToNode( pNtkAig, Ivy_Regular(pObjFraig)->TravId );
445 pObj->pCopy = Abc_ObjNotCond( pObj->pCopy, Ivy_IsComplement(pObjFraig) );
446 }
447}
448
460Abc_Ntk_t * Abc_NtkIvyFraig( Abc_Ntk_t * pNtk, int nConfLimit, int fDoSparse, int fProve, int fTransfer, int fVerbose )
461{
462 Ivy_FraigParams_t Params, * pParams = &Params;
463 Abc_Ntk_t * pNtkAig;
464 Ivy_Man_t * pMan, * pTemp;
465 pMan = Abc_NtkIvyBefore( pNtk, 0, 0 );
466 if ( pMan == NULL )
467 return NULL;
468 Ivy_FraigParamsDefault( pParams );
469 pParams->nBTLimitNode = nConfLimit;
470 pParams->fVerbose = fVerbose;
471 pParams->fProve = fProve;
472 pParams->fDoSparse = fDoSparse;
473 pMan = Ivy_FraigPerform( pTemp = pMan, pParams );
474 // transfer the pointers
475 if ( fTransfer == 1 )
476 {
477 Vec_Ptr_t * vCopies;
478 vCopies = Abc_NtkSaveCopy( pNtk );
479 pNtkAig = Abc_NtkIvyAfter( pNtk, pMan, 0, 0 );
480 Abc_NtkLoadCopy( pNtk, vCopies );
481 Vec_PtrFree( vCopies );
482 Abc_NtkTransferPointers( pNtk, pNtkAig );
483 }
484 else
485 pNtkAig = Abc_NtkIvyAfter( pNtk, pMan, 0, 0 );
486 pNtkAig->pModel = (int *)pMan->pData; pMan->pData = NULL;
487 Ivy_ManStop( pTemp );
488 Ivy_ManStop( pMan );
489 return pNtkAig;
490}
491
503int Abc_NtkIvyProve( Abc_Ntk_t ** ppNtk, void * pPars )
504{
505 Prove_Params_t * pParams = (Prove_Params_t *)pPars;
506 Abc_Ntk_t * pNtk = *ppNtk, * pNtkTemp;
507 Abc_Obj_t * pObj, * pFanin;
508 Ivy_Man_t * pMan;
509 Aig_Man_t * pMan2;
510 int RetValue;
511 assert( Abc_NtkIsStrash(pNtk) || Abc_NtkIsLogic(pNtk) );
512 // experiment with various parameters settings
513// pParams->fUseBdds = 1;
514// pParams->fBddReorder = 1;
515// pParams->nTotalBacktrackLimit = 10000;
516
517 // strash the network if it is not strashed already
518 if ( !Abc_NtkIsStrash(pNtk) )
519 {
520 pNtk = Abc_NtkStrash( pNtkTemp = pNtk, 0, 1, 0 );
521 Abc_NtkDelete( pNtkTemp );
522 }
523
524 // check the case when the 0000 simulation pattern detect the bug
525 pObj = Abc_NtkPo(pNtk,0);
526 pFanin = Abc_ObjFanin0(pObj);
527 if ( Abc_ObjFanin0(pObj)->fPhase != (unsigned)Abc_ObjFaninC0(pObj) )
528 {
529 pNtk->pModel = ABC_CALLOC( int, Abc_NtkCiNum(pNtk) );
530 return 0;
531 }
532
533 // changed in "src\sat\fraig\fraigMan.c"
534 // pParams->nMiteringLimitStart = 300; // starting mitering limit
535 // to be
536 // pParams->nMiteringLimitStart = 5000; // starting mitering limit
537
538 // if SAT only, solve without iteration
539// RetValue = Abc_NtkMiterSat( pNtk, 2*(ABC_INT64_T)pParams->nMiteringLimitStart, (ABC_INT64_T)0, 0, NULL, NULL );
540 pMan2 = Abc_NtkToDar( pNtk, 0, 0 );
541 RetValue = Fra_FraigSat( pMan2, (ABC_INT64_T)pParams->nMiteringLimitStart, (ABC_INT64_T)0, 0, 0, 0, 1, 0, 0, 0 );
542 pNtk->pModel = (int *)pMan2->pData, pMan2->pData = NULL;
543 Aig_ManStop( pMan2 );
544// pNtk->pModel = Aig_ManReleaseData( pMan2 );
545 if ( RetValue >= 0 )
546 return RetValue;
547
548 // apply AIG rewriting
549 if ( pParams->fUseRewriting && Abc_NtkNodeNum(pNtk) > 500 )
550 {
551// abctime clk = Abc_Clock();
552//printf( "Before rwsat = %d. ", Abc_NtkNodeNum(pNtk) );
553 pParams->fUseRewriting = 0;
554 pNtk = Abc_NtkBalance( pNtkTemp = pNtk, 0, 0, 0 );
555 Abc_NtkDelete( pNtkTemp );
556 Abc_NtkRewrite( pNtk, 0, 0, 0, 0, 0 );
557 pNtk = Abc_NtkBalance( pNtkTemp = pNtk, 0, 0, 0 );
558 Abc_NtkDelete( pNtkTemp );
559 Abc_NtkRewrite( pNtk, 0, 0, 0, 0, 0 );
560 Abc_NtkRefactor( pNtk, 10, 1, 16, 0, 0, 0, 0 );
561//printf( "After rwsat = %d. ", Abc_NtkNodeNum(pNtk) );
562//ABC_PRT( "Time", Abc_Clock() - clk );
563 }
564
565 // convert ABC network into IVY network
566 pMan = Abc_NtkIvyBefore( pNtk, 0, 0 );
567
568 // solve the CEC problem
569 RetValue = Ivy_FraigProve( &pMan, pParams );
570// RetValue = -1;
571
572 // convert IVY network into ABC network
573 pNtk = Abc_NtkIvyAfter( pNtkTemp = pNtk, pMan, 0, 0 );
574 Abc_NtkDelete( pNtkTemp );
575 // transfer model if given
576 pNtk->pModel = (int *)pMan->pData; pMan->pData = NULL;
577 Ivy_ManStop( pMan );
578
579 // try to prove it using brute force SAT with good CNF encoding
580 if ( RetValue < 0 )
581 {
582 pMan2 = Abc_NtkToDar( pNtk, 0, 0 );
583 // dump the miter before entering high-effort solving
584 if ( pParams->fVerbose )
585 {
586 char pFileName[100];
587 sprintf( pFileName, "cecmiter.aig" );
588 Ioa_WriteAiger( pMan2, pFileName, 0, 0 );
589 printf( "Intermediate reduced miter is written into file \"%s\".\n", pFileName );
590 }
591 RetValue = Fra_FraigSat( pMan2, pParams->nMiteringLimitLast, 0, 0, 0, 0, 0, 0, 0, pParams->fVerbose );
592 pNtk->pModel = (int *)pMan2->pData, pMan2->pData = NULL;
593 Aig_ManStop( pMan2 );
594 }
595
596 // try to prove it using brute force BDDs
597#ifdef ABC_USE_CUDD
598 if ( RetValue < 0 && pParams->fUseBdds )
599 {
600 if ( pParams->fVerbose )
601 {
602 printf( "Attempting BDDs with node limit %d ...\n", pParams->nBddSizeLimit );
603 fflush( stdout );
604 }
605 pNtk = Abc_NtkCollapse( pNtkTemp = pNtk, pParams->nBddSizeLimit, 0, pParams->fBddReorder, 0, 0, 0 );
606 if ( pNtk )
607 {
608 Abc_NtkDelete( pNtkTemp );
609 RetValue = ( (Abc_NtkNodeNum(pNtk) == 1) && (Abc_ObjFanin0(Abc_NtkPo(pNtk,0))->pData == Cudd_ReadLogicZero((DdManager *)pNtk->pManFunc)) );
610 }
611 else
612 pNtk = pNtkTemp;
613 }
614#endif
615
616 // return the result
617 *ppNtk = pNtk;
618 return RetValue;
619}
620
633{
634// Abc_Ntk_t * pNtkAig;
635 Ivy_Man_t * pMan;//, * pTemp;
636// int fCleanup = 1;
637// int nNodes;
638// int nLatches = Abc_NtkLatchNum(pNtk);
639 Vec_Int_t * vInit = Abc_NtkCollectLatchValuesIvy( pNtk, 0 );
640
641 assert( !Abc_NtkIsNetlist(pNtk) );
642 if ( Abc_NtkIsBddLogic(pNtk) )
643 {
644 if ( !Abc_NtkBddToSop(pNtk, -1, ABC_INFINITY, 1) )
645 {
646 Vec_IntFree( vInit );
647 printf( "Abc_NtkIvy(): Converting to SOPs has failed.\n" );
648 return NULL;
649 }
650 }
651 if ( Abc_NtkCountSelfFeedLatches(pNtk) )
652 {
653 printf( "Warning: The network has %d self-feeding latches. Quitting.\n", Abc_NtkCountSelfFeedLatches(pNtk) );
654 return NULL;
655 }
656
657 // print warning about choice nodes
658 if ( Abc_NtkGetChoiceNum( pNtk ) )
659 printf( "Warning: The choice nodes in the initial AIG are removed by strashing.\n" );
660
661 // convert to the AIG manager
662 pMan = Abc_NtkToIvy( pNtk );
663 if ( !Ivy_ManCheck( pMan ) )
664 {
665 Vec_IntFree( vInit );
666 printf( "AIG check has failed.\n" );
667 Ivy_ManStop( pMan );
668 return NULL;
669 }
670
671// Ivy_MffcTest( pMan );
672// Ivy_ManPrintStats( pMan );
673
674// pMan = Ivy_ManBalance( pTemp = pMan, 1 );
675// Ivy_ManStop( pTemp );
676
677// Ivy_ManSeqRewrite( pMan, 0, 0 );
678// Ivy_ManTestCutsAlg( pMan );
679// Ivy_ManTestCutsBool( pMan );
680// Ivy_ManRewriteAlg( pMan, 1, 1 );
681
682// pMan = Ivy_ManResyn( pTemp = pMan, 1, 0 );
683// Ivy_ManStop( pTemp );
684
685// Ivy_ManTestCutsAll( pMan );
686// Ivy_ManTestCutsTravAll( pMan );
687
688// Ivy_ManPrintStats( pMan );
689
690// Ivy_ManPrintStats( pMan );
691// Ivy_ManRewritePre( pMan, 1, 0, 0 );
692// Ivy_ManPrintStats( pMan );
693// printf( "\n" );
694
695// Ivy_ManPrintStats( pMan );
696// Ivy_ManMakeSeq( pMan, nLatches, pInit );
697// Ivy_ManPrintStats( pMan );
698
699// Ivy_ManRequiredLevels( pMan );
700
701// Ivy_FastMapPerform( pMan, 8 );
702 Ivy_ManStop( pMan );
703 return NULL;
704
705
706/*
707 // convert from the AIG manager
708 pNtkAig = Abc_NtkFromIvy( pNtk, pMan );
709// pNtkAig = Abc_NtkFromIvySeq( pNtk, pMan );
710 Ivy_ManStop( pMan );
711
712 // report the cleanup results
713 if ( fCleanup && (nNodes = Abc_AigCleanup(pNtkAig->pManFunc)) )
714 printf( "Warning: AIG cleanup removed %d nodes (this is not a bug).\n", nNodes );
715 // duplicate EXDC
716 if ( pNtk->pExdc )
717 pNtkAig->pExdc = Abc_NtkDup( pNtk->pExdc );
718 // make sure everything is okay
719 if ( !Abc_NtkCheck( pNtkAig ) )
720 {
721 ABC_FREE( pInit );
722 printf( "Abc_NtkStrash: The network check has failed.\n" );
723 Abc_NtkDelete( pNtkAig );
724 return NULL;
725 }
726
727 ABC_FREE( pInit );
728 return pNtkAig;
729*/
730}
731
732
733
745Abc_Ntk_t * Abc_NtkFromIvy( Abc_Ntk_t * pNtkOld, Ivy_Man_t * pMan )
746{
747 Vec_Int_t * vNodes;
748 Abc_Ntk_t * pNtk;
749 Abc_Obj_t * pObj, * pObjNew, * pFaninNew, * pFaninNew0, * pFaninNew1;
750 Ivy_Obj_t * pNode;
751 int i;
752 // perform strashing
753 pNtk = Abc_NtkStartFrom( pNtkOld, ABC_NTK_STRASH, ABC_FUNC_AIG );
754 // transfer the pointers to the basic nodes
755 Ivy_ManConst1(pMan)->TravId = Abc_EdgeFromNode( Abc_AigConst1(pNtk) );
756 Abc_NtkForEachCi( pNtkOld, pObj, i )
757 Ivy_ManPi(pMan, i)->TravId = Abc_EdgeFromNode( pObj->pCopy );
758 // rebuild the AIG
759 vNodes = Ivy_ManDfs( pMan );
760 Ivy_ManForEachNodeVec( pMan, vNodes, pNode, i )
761 {
762 // add the first fanin
763 pFaninNew0 = Abc_ObjFanin0Ivy( pNtk, pNode );
764 if ( Ivy_ObjIsBuf(pNode) )
765 {
766 pNode->TravId = Abc_EdgeFromNode( pFaninNew0 );
767 continue;
768 }
769 // add the second fanin
770 pFaninNew1 = Abc_ObjFanin1Ivy( pNtk, pNode );
771 // create the new node
772 if ( Ivy_ObjIsExor(pNode) )
773 pObjNew = Abc_AigXor( (Abc_Aig_t *)pNtk->pManFunc, pFaninNew0, pFaninNew1 );
774 else
775 pObjNew = Abc_AigAnd( (Abc_Aig_t *)pNtk->pManFunc, pFaninNew0, pFaninNew1 );
776 pNode->TravId = Abc_EdgeFromNode( pObjNew );
777 }
778 // connect the PO nodes
779 Abc_NtkForEachCo( pNtkOld, pObj, i )
780 {
781 pFaninNew = Abc_ObjFanin0Ivy( pNtk, Ivy_ManPo(pMan, i) );
782 Abc_ObjAddFanin( pObj->pCopy, pFaninNew );
783 }
784 Vec_IntFree( vNodes );
785 if ( !Abc_NtkCheck( pNtk ) )
786 fprintf( stdout, "Abc_NtkFromIvy(): Network check has failed.\n" );
787 return pNtk;
788}
789
801Abc_Ntk_t * Abc_NtkFromIvySeq( Abc_Ntk_t * pNtkOld, Ivy_Man_t * pMan, int fHaig )
802{
803 Vec_Int_t * vNodes, * vLatches;
804 Abc_Ntk_t * pNtk;
805 Abc_Obj_t * pObj, * pObjNew, * pFaninNew, * pFaninNew0, * pFaninNew1;
806 Ivy_Obj_t * pNode, * pTemp;
807 int i;
808// assert( Ivy_ManLatchNum(pMan) > 0 );
809 // perform strashing
811 // transfer the pointers to the basic nodes
812 Ivy_ManConst1(pMan)->TravId = Abc_EdgeFromNode( Abc_AigConst1(pNtk) );
813 Abc_NtkForEachPi( pNtkOld, pObj, i )
814 Ivy_ManPi(pMan, i)->TravId = Abc_EdgeFromNode( pObj->pCopy );
815 // create latches of the new network
816 vNodes = Ivy_ManDfsSeq( pMan, &vLatches );
817 Ivy_ManForEachNodeVec( pMan, vLatches, pNode, i )
818 {
819 pObjNew = Abc_NtkCreateLatch( pNtk );
820 pFaninNew0 = Abc_NtkCreateBi( pNtk );
821 pFaninNew1 = Abc_NtkCreateBo( pNtk );
822 Abc_ObjAddFanin( pObjNew, pFaninNew0 );
823 Abc_ObjAddFanin( pFaninNew1, pObjNew );
824 if ( fHaig || Ivy_ObjInit(pNode) == IVY_INIT_DC )
825 Abc_LatchSetInitDc( pObjNew );
826 else if ( Ivy_ObjInit(pNode) == IVY_INIT_1 )
827 Abc_LatchSetInit1( pObjNew );
828 else if ( Ivy_ObjInit(pNode) == IVY_INIT_0 )
829 Abc_LatchSetInit0( pObjNew );
830 else assert( 0 );
831 pNode->TravId = Abc_EdgeFromNode( pFaninNew1 );
832 }
834 // rebuild the AIG
835 Ivy_ManForEachNodeVec( pMan, vNodes, pNode, i )
836 {
837 // add the first fanin
838 pFaninNew0 = Abc_ObjFanin0Ivy( pNtk, pNode );
839 if ( Ivy_ObjIsBuf(pNode) )
840 {
841 pNode->TravId = Abc_EdgeFromNode( pFaninNew0 );
842 continue;
843 }
844 // add the second fanin
845 pFaninNew1 = Abc_ObjFanin1Ivy( pNtk, pNode );
846 // create the new node
847 if ( Ivy_ObjIsExor(pNode) )
848 pObjNew = Abc_AigXor( (Abc_Aig_t *)pNtk->pManFunc, pFaninNew0, pFaninNew1 );
849 else
850 pObjNew = Abc_AigAnd( (Abc_Aig_t *)pNtk->pManFunc, pFaninNew0, pFaninNew1 );
851 pNode->TravId = Abc_EdgeFromNode( pObjNew );
852 // process the choice nodes
853 if ( fHaig && pNode->pEquiv && Ivy_ObjRefs(pNode) > 0 )
854 {
855 pFaninNew = Abc_EdgeToNode( pNtk, pNode->TravId );
856// pFaninNew->fPhase = 0;
857 assert( !Ivy_IsComplement(pNode->pEquiv) );
858 for ( pTemp = pNode->pEquiv; pTemp != pNode; pTemp = Ivy_Regular(pTemp->pEquiv) )
859 {
860 pFaninNew1 = Abc_EdgeToNode( pNtk, pTemp->TravId );
861// pFaninNew1->fPhase = Ivy_IsComplement( pTemp->pEquiv );
862 pFaninNew->pData = pFaninNew1;
863 pFaninNew = pFaninNew1;
864 }
865 pFaninNew->pData = NULL;
866// printf( "Writing choice node %d.\n", pNode->Id );
867 }
868 }
869 // connect the PO nodes
870 Abc_NtkForEachPo( pNtkOld, pObj, i )
871 {
872 pFaninNew = Abc_ObjFanin0Ivy( pNtk, Ivy_ManPo(pMan, i) );
873 Abc_ObjAddFanin( pObj->pCopy, pFaninNew );
874 }
875 // connect the latches
876 Ivy_ManForEachNodeVec( pMan, vLatches, pNode, i )
877 {
878 pFaninNew = Abc_ObjFanin0Ivy( pNtk, pNode );
879 Abc_ObjAddFanin( Abc_ObjFanin0(Abc_NtkBox(pNtk, i)), pFaninNew );
880 }
881 Vec_IntFree( vLatches );
882 Vec_IntFree( vNodes );
883 if ( !Abc_NtkCheck( pNtk ) )
884 fprintf( stdout, "Abc_NtkFromIvySeq(): Network check has failed.\n" );
885 return pNtk;
886}
887
899Ivy_Man_t * Abc_NtkToIvy( Abc_Ntk_t * pNtkOld )
900{
901 Ivy_Man_t * pMan;
902 Abc_Obj_t * pObj;
903 Ivy_Obj_t * pFanin;
904 int i;
905 // create the manager
906 assert( Abc_NtkHasSop(pNtkOld) || Abc_NtkIsStrash(pNtkOld) );
907 pMan = Ivy_ManStart();
908 // create the PIs
909 if ( Abc_NtkIsStrash(pNtkOld) )
910 Abc_AigConst1(pNtkOld)->pCopy = (Abc_Obj_t *)Ivy_ManConst1(pMan);
911 Abc_NtkForEachCi( pNtkOld, pObj, i )
912 pObj->pCopy = (Abc_Obj_t *)Ivy_ObjCreatePi(pMan);
913 // perform the conversion of the internal nodes
914 Abc_NtkStrashPerformAig( pNtkOld, pMan );
915 // create the POs
916 Abc_NtkForEachCo( pNtkOld, pObj, i )
917 {
918 pFanin = (Ivy_Obj_t *)Abc_ObjFanin0(pObj)->pCopy;
919 pFanin = Ivy_NotCond( pFanin, Abc_ObjFaninC0(pObj) );
920 Ivy_ObjCreatePo( pMan, pFanin );
921 }
922 Ivy_ManCleanup( pMan );
923 return pMan;
924}
925
937void Abc_NtkStrashPerformAig( Abc_Ntk_t * pNtk, Ivy_Man_t * pMan )
938{
939// ProgressBar * pProgress;
940 Vec_Ptr_t * vNodes;
941 Abc_Obj_t * pNode;
942 int i;
943 vNodes = Abc_NtkDfs( pNtk, 0 );
944// pProgress = Extra_ProgressBarStart( stdout, vNodes->nSize );
945 Vec_PtrForEachEntry( Abc_Obj_t *, vNodes, pNode, i )
946 {
947// Extra_ProgressBarUpdate( pProgress, i, NULL );
948 pNode->pCopy = (Abc_Obj_t *)Abc_NodeStrashAig( pMan, pNode );
949 }
950// Extra_ProgressBarStop( pProgress );
951 Vec_PtrFree( vNodes );
952}
953
965Ivy_Obj_t * Abc_NodeStrashAig( Ivy_Man_t * pMan, Abc_Obj_t * pNode )
966{
967 int fUseFactor = 1;
968 char * pSop;
969 Ivy_Obj_t * pFanin0, * pFanin1;
970
971 assert( Abc_ObjIsNode(pNode) );
972
973 // consider the case when the graph is an AIG
974 if ( Abc_NtkIsStrash(pNode->pNtk) )
975 {
976 if ( Abc_AigNodeIsConst(pNode) )
977 return Ivy_ManConst1(pMan);
978 pFanin0 = (Ivy_Obj_t *)Abc_ObjFanin0(pNode)->pCopy;
979 pFanin0 = Ivy_NotCond( pFanin0, Abc_ObjFaninC0(pNode) );
980 pFanin1 = (Ivy_Obj_t *)Abc_ObjFanin1(pNode)->pCopy;
981 pFanin1 = Ivy_NotCond( pFanin1, Abc_ObjFaninC1(pNode) );
982 return Ivy_And( pMan, pFanin0, pFanin1 );
983 }
984
985 // get the SOP of the node
986 if ( Abc_NtkHasMapping(pNode->pNtk) )
987 pSop = Mio_GateReadSop((Mio_Gate_t *)pNode->pData);
988 else
989 pSop = (char *)pNode->pData;
990
991 // consider the constant node
992 if ( Abc_NodeIsConst(pNode) )
993 return Ivy_NotCond( Ivy_ManConst1(pMan), Abc_SopIsConst0(pSop) );
994
995 // decide when to use factoring
996 if ( fUseFactor && Abc_ObjFaninNum(pNode) > 2 && Abc_SopGetCubeNum(pSop) > 1 && !Abc_SopIsExorType(pSop) )
997 return Abc_NodeStrashAigFactorAig( pMan, pNode, pSop );
998 return Abc_NodeStrashAigSopAig( pMan, pNode, pSop );
999}
1000
1012Ivy_Obj_t * Abc_NodeStrashAigSopAig( Ivy_Man_t * pMan, Abc_Obj_t * pNode, char * pSop )
1013{
1014 Abc_Obj_t * pFanin;
1015 Ivy_Obj_t * pAnd, * pSum;
1016 char * pCube;
1017 int i, nFanins;
1018 int fExor = Abc_SopIsExorType(pSop);
1019
1020 // get the number of node's fanins
1021 nFanins = Abc_ObjFaninNum( pNode );
1022 assert( nFanins == Abc_SopGetVarNum(pSop) );
1023 // go through the cubes of the node's SOP
1024 pSum = Ivy_Not( Ivy_ManConst1(pMan) );
1025 Abc_SopForEachCube( pSop, nFanins, pCube )
1026 {
1027 // create the AND of literals
1028 pAnd = Ivy_ManConst1(pMan);
1029 Abc_ObjForEachFanin( pNode, pFanin, i ) // pFanin can be a net
1030 {
1031 if ( pCube[i] == '1' )
1032 pAnd = Ivy_And( pMan, pAnd, (Ivy_Obj_t *)pFanin->pCopy );
1033 else if ( pCube[i] == '0' )
1034 pAnd = Ivy_And( pMan, pAnd, Ivy_Not((Ivy_Obj_t *)pFanin->pCopy) );
1035 }
1036 // add to the sum of cubes
1037 if ( fExor )
1038 pSum = Ivy_Exor( pMan, pSum, pAnd );
1039 else
1040 pSum = Ivy_Or( pMan, pSum, pAnd );
1041 }
1042 // decide whether to complement the result
1043 if ( Abc_SopIsComplement(pSop) )
1044 pSum = Ivy_Not(pSum);
1045 return pSum;
1046}
1047
1059Ivy_Obj_t * Abc_NodeStrashAigExorAig( Ivy_Man_t * pMan, Abc_Obj_t * pNode, char * pSop )
1060{
1061 Abc_Obj_t * pFanin;
1062 Ivy_Obj_t * pSum;
1063 int i, nFanins;
1064 // get the number of node's fanins
1065 nFanins = Abc_ObjFaninNum( pNode );
1066 assert( nFanins == Abc_SopGetVarNum(pSop) );
1067 // go through the cubes of the node's SOP
1068 pSum = Ivy_Not( Ivy_ManConst1(pMan) );
1069 for ( i = 0; i < nFanins; i++ )
1070 {
1071 pFanin = Abc_ObjFanin( pNode, i );
1072 pSum = Ivy_Exor( pMan, pSum, (Ivy_Obj_t *)pFanin->pCopy );
1073 }
1074 if ( Abc_SopIsComplement(pSop) )
1075 pSum = Ivy_Not(pSum);
1076 return pSum;
1077}
1078
1090Ivy_Obj_t * Abc_NodeStrashAigFactorAig( Ivy_Man_t * pMan, Abc_Obj_t * pRoot, char * pSop )
1091{
1092 Dec_Graph_t * pFForm;
1093 Dec_Node_t * pNode;
1094 Ivy_Obj_t * pAnd;
1095 int i;
1096
1097// extern Ivy_Obj_t * Dec_GraphToNetworkAig( Ivy_Man_t * pMan, Dec_Graph_t * pGraph );
1098
1099// assert( 0 );
1100
1101 // perform factoring
1102 pFForm = Dec_Factor( pSop );
1103 // collect the fanins
1104 Dec_GraphForEachLeaf( pFForm, pNode, i )
1105 pNode->pFunc = Abc_ObjFanin(pRoot,i)->pCopy;
1106 // perform strashing
1107// pAnd = Dec_GraphToNetworkAig( pMan, pFForm );
1108 pAnd = Dec_GraphToNetworkIvy( pMan, pFForm );
1109// pAnd = NULL;
1110
1111 Dec_GraphFree( pFForm );
1112 return pAnd;
1113}
1114
1126Vec_Int_t * Abc_NtkCollectLatchValuesIvy( Abc_Ntk_t * pNtk, int fUseDcs )
1127{
1128 Abc_Obj_t * pLatch;
1129 Vec_Int_t * vArray;
1130 int i;
1131 vArray = Vec_IntAlloc( Abc_NtkLatchNum(pNtk) );
1132 Abc_NtkForEachLatch( pNtk, pLatch, i )
1133 {
1134 if ( fUseDcs || Abc_LatchIsInitDc(pLatch) )
1135 Vec_IntPush( vArray, IVY_INIT_DC );
1136 else if ( Abc_LatchIsInit1(pLatch) )
1137 Vec_IntPush( vArray, IVY_INIT_1 );
1138 else if ( Abc_LatchIsInit0(pLatch) )
1139 Vec_IntPush( vArray, IVY_INIT_0 );
1140 else assert( 0 );
1141 }
1142 return vArray;
1143}
1144
1156static inline Ivy_Obj_t * Gia_ObjChild0Copy3( Ivy_Obj_t ** ppNodes, Gia_Obj_t * pObj, int Id ) { return Ivy_NotCond( ppNodes[Gia_ObjFaninId0(pObj, Id)], Gia_ObjFaninC0(pObj) ); }
1157static inline Ivy_Obj_t * Gia_ObjChild1Copy3( Ivy_Obj_t ** ppNodes, Gia_Obj_t * pObj, int Id ) { return Ivy_NotCond( ppNodes[Gia_ObjFaninId1(pObj, Id)], Gia_ObjFaninC1(pObj) ); }
1158
1160{
1161 Ivy_Man_t * pNew;
1162 Gia_Obj_t * pObj; int i;
1163 Ivy_Obj_t ** ppNodes = ABC_FALLOC( Ivy_Obj_t *, Gia_ManObjNum(p) );
1164 // create the new manager
1165 pNew = Ivy_ManStart();
1166 // create the PIs
1167 Gia_ManForEachObj( p, pObj, i )
1168 {
1169 if ( Gia_ObjIsAnd(pObj) )
1170 ppNodes[i] = Ivy_And( pNew, Gia_ObjChild0Copy3(ppNodes, pObj, i), Gia_ObjChild1Copy3(ppNodes, pObj, i) );
1171 else if ( Gia_ObjIsCi(pObj) )
1172 ppNodes[i] = Ivy_ObjCreatePi( pNew );
1173 else if ( Gia_ObjIsCo(pObj) )
1174 ppNodes[i] = Ivy_ObjCreatePo( pNew, Gia_ObjChild0Copy3(ppNodes, pObj, Gia_ObjId(p, pObj)) );
1175 else if ( Gia_ObjIsConst0(pObj) )
1176 ppNodes[i] = Ivy_Not(Ivy_ManConst1(pNew));
1177 else
1178 assert( 0 );
1179 assert( i == 0 || Ivy_ObjId(ppNodes[i]) == i );
1180 }
1181 ABC_FREE( ppNodes );
1182 return pNew;
1183}
1184static inline int Gia_ObjChild0Copy4( int * pNodes, Ivy_Obj_t * pObj ) { return Abc_LitNotCond( pNodes[Ivy_Regular(pObj->pFanin0)->Id], Ivy_IsComplement(pObj->pFanin0) ); }
1185static inline int Gia_ObjChild1Copy4( int * pNodes, Ivy_Obj_t * pObj ) { return Abc_LitNotCond( pNodes[Ivy_Regular(pObj->pFanin1)->Id], Ivy_IsComplement(pObj->pFanin1) ); }
1186
1188{
1189 Gia_Man_t * pNew;
1190 Ivy_Obj_t * pObj;
1191 int i, * pNodes = ABC_FALLOC( int, Ivy_ManObjIdMax(p) + 1 );
1192 pNew = Gia_ManStart( Ivy_ManObjIdMax(p) );
1193 pNew->pName = Abc_UtilStrsav( "from_ivy" );
1194 Ivy_ManForEachObj( p, pObj, i )
1195 {
1196 if ( Ivy_ObjIsAnd(pObj) )
1197 pNodes[pObj->Id] = Gia_ManAppendAnd( pNew, Gia_ObjChild0Copy4(pNodes, pObj), Gia_ObjChild1Copy4(pNodes, pObj) );
1198 else if ( Ivy_ObjIsCi(pObj) )
1199 pNodes[pObj->Id] = Gia_ManAppendCi( pNew );
1200 else if ( Ivy_ObjIsCo(pObj) )
1201 pNodes[pObj->Id] = Gia_ManAppendCo( pNew, Gia_ObjChild0Copy4(pNodes, pObj) );
1202 else if ( Ivy_ObjIsConst1(pObj) )
1203 pNodes[pObj->Id] = 1;
1204 else
1205 assert( 0 );
1206 }
1207 ABC_FREE( pNodes );
1208 return pNew;
1209}
1210Gia_Man_t * Gia_ManIvyFraig( Gia_Man_t * p, int nConfLimit, int fUseProve, int fVerbose )
1211{
1212 Ivy_FraigParams_t Params, * pParams = &Params;
1213 Gia_Man_t * pNew;
1214 Ivy_Man_t * pMan, * pTemp;
1215 pMan = Gia_ManToIvySimple( p );
1216 if ( pMan == NULL )
1217 return NULL;
1218 Ivy_FraigParamsDefault( pParams );
1219 pParams->nBTLimitNode = nConfLimit;
1220 pParams->fVerbose = fVerbose;
1221 pParams->fProve = fUseProve;
1222 pParams->fDoSparse = 1;
1223 pMan = Ivy_FraigPerform( pTemp = pMan, pParams );
1224 pNew = Gia_ManFromIvySimple( pMan );
1225 if ( pMan->pData )
1226 {
1227 p->pCexSeq = Abc_CexDeriveFromCombModel( (int *)pMan->pData, Ivy_ManPiNum(pMan), 0, -1 );
1228 p->pCexSeq->iPo = Gia_ManFindFailedPoCex( p, p->pCexSeq, 0 );
1229 ABC_FREE( pMan->pData );
1230 }
1231 Ivy_ManStop( pTemp );
1232 Ivy_ManStop( pMan );
1233 return pNew;
1234}
1235Gia_Man_t * Gia_ManIvyFraigTest( Gia_Man_t * p, int nConfLimit, int fVerbose )
1236{
1237 Ivy_Man_t * pMan = Gia_ManToIvySimple( p );
1238 Gia_Man_t * pNew = Gia_ManFromIvySimple( pMan );
1239 Ivy_ManStop( pMan );
1240 return pNew;
1241}
1242
1243
1247
1248
1250
Abc_Ntk_t * Abc_NtkIvyResyn0(Abc_Ntk_t *pNtk, int fUpdateLevel, int fVerbose)
Definition abcIvy.c:343
void Ivy_CutComputeAll(Ivy_Man_t *p, int nInputs)
Definition ivySeq.c:1108
Gia_Man_t * Gia_ManIvyFraig(Gia_Man_t *p, int nConfLimit, int fUseProve, int fVerbose)
Definition abcIvy.c:1210
void Aig_ManStop(Aig_Man_t *pMan)
Definition aigMan.c:187
void Abc_NtkIvyCuts(Abc_Ntk_t *pNtk, int nInputs)
Definition abcIvy.c:268
Ivy_Obj_t * Dec_GraphToNetworkIvy(Ivy_Man_t *pMan, Dec_Graph_t *pGraph)
Definition decAbc.c:330
Abc_Ntk_t * Abc_NtkIvyRewriteSeq(Abc_Ntk_t *pNtk, int fUseZeroCost, int fVerbose)
Definition abcIvy.c:315
Abc_Ntk_t * Abc_NtkIvyHaig(Abc_Ntk_t *pNtk, int nIters, int fUseZeroCost, int fVerbose)
Definition abcIvy.c:200
Abc_Ntk_t * Abc_NtkIvyStrash(Abc_Ntk_t *pNtk)
Definition abcIvy.c:177
void Abc_NtkTransferPointers(Abc_Ntk_t *pNtk, Abc_Ntk_t *pNtkAig)
Definition abcIvy.c:423
int Abc_NtkIvyProve(Abc_Ntk_t **ppNtk, void *pPars)
Definition abcIvy.c:503
ABC_NAMESPACE_IMPL_START Aig_Man_t * Abc_NtkToDar(Abc_Ntk_t *pNtk, int fExors, int fRegisters)
DECLARATIONS ///.
Definition abcDar.c:237
Gia_Man_t * Gia_ManIvyFraigTest(Gia_Man_t *p, int nConfLimit, int fVerbose)
Definition abcIvy.c:1235
Ivy_Man_t * Abc_NtkIvyBefore(Abc_Ntk_t *pNtk, int fSeq, int fUseDc)
FUNCTION DEFINITIONS ///.
Definition abcIvy.c:88
int timeRetime
DECLARATIONS ///.
Definition retCore.c:30
int Abc_Edge_t
Definition abcIvy.c:56
Abc_Ntk_t * Abc_NtkIvyAfter(Abc_Ntk_t *pNtk, Ivy_Man_t *pMan, int fSeq, int fHaig)
Definition abcIvy.c:141
Ivy_Man_t * Gia_ManToIvySimple(Gia_Man_t *p)
Definition abcIvy.c:1159
Gia_Man_t * Gia_ManFromIvySimple(Ivy_Man_t *p)
Definition abcIvy.c:1187
Abc_Ntk_t * Abc_NtkIvyFraig(Abc_Ntk_t *pNtk, int nConfLimit, int fDoSparse, int fProve, int fTransfer, int fVerbose)
Definition abcIvy.c:460
Abc_Ntk_t * Abc_NtkIvyResyn(Abc_Ntk_t *pNtk, int fUpdateLevel, int fVerbose)
Definition abcIvy.c:368
Abc_Ntk_t * Abc_NtkIvySat(Abc_Ntk_t *pNtk, int nConfLimit, int fVerbose)
Definition abcIvy.c:393
Abc_Ntk_t * Abc_NtkIvyRewrite(Abc_Ntk_t *pNtk, int fUpdateLevel, int fUseZeroCost, int fVerbose)
Definition abcIvy.c:289
Abc_Ntk_t * Abc_NtkIvy(Abc_Ntk_t *pNtk)
Definition abcIvy.c:632
struct Abc_Obj_t_ Abc_Obj_t
Definition abc.h:116
#define Abc_NtkForEachCo(pNtk, pCo, i)
Definition abc.h:522
ABC_DLL int Abc_NtkCountSelfFeedLatches(Abc_Ntk_t *pNtk)
Definition abcLatch.c:92
ABC_DLL void Abc_ObjAddFanin(Abc_Obj_t *pObj, Abc_Obj_t *pFanin)
Definition abcFanio.c:84
ABC_DLL Abc_Obj_t * Abc_AigXor(Abc_Aig_t *pMan, Abc_Obj_t *p0, Abc_Obj_t *p1)
Definition abcAig.c:735
ABC_DLL int Abc_SopIsConst0(char *pSop)
Definition abcSop.c:724
#define Abc_NtkForEachPo(pNtk, pPo, i)
Definition abc.h:520
ABC_DLL void Abc_NtkAddDummyBoxNames(Abc_Ntk_t *pNtk)
Definition abcNames.c:547
#define Abc_NtkForEachLatch(pNtk, pObj, i)
Definition abc.h:500
ABC_DLL int Abc_NtkGetChoiceNum(Abc_Ntk_t *pNtk)
Definition abcUtil.c:463
ABC_DLL Vec_Ptr_t * Abc_NtkDfs(Abc_Ntk_t *pNtk, int fCollectAll)
Definition abcDfs.c:82
ABC_DLL int Abc_NtkCheck(Abc_Ntk_t *pNtk)
FUNCTION DEFINITIONS ///.
Definition abcCheck.c:64
#define Abc_ObjForEachFanin(pObj, pFanin, i)
Definition abc.h:527
ABC_DLL Abc_Ntk_t * Abc_NtkStartFromNoLatches(Abc_Ntk_t *pNtk, Abc_NtkType_t Type, Abc_NtkFunc_t Func)
Definition abcNtk.c:301
ABC_DLL Abc_Ntk_t * Abc_NtkCollapse(Abc_Ntk_t *pNtk, int fBddSizeMax, int fDualRail, int fReorder, int fReverse, int fDumpOrder, int fVerbose)
DECLARATIONS ///.
struct Abc_Aig_t_ Abc_Aig_t
Definition abc.h:117
struct Abc_Ntk_t_ Abc_Ntk_t
Definition abc.h:115
ABC_DLL void Abc_NtkLoadCopy(Abc_Ntk_t *pNtk, Vec_Ptr_t *vCopies)
Definition abcUtil.c:650
@ ABC_NTK_STRASH
Definition abc.h:58
ABC_DLL int Abc_NtkRewrite(Abc_Ntk_t *pNtk, int fUpdateLevel, int fUseZeros, int fVerbose, int fVeryVerbose, int fPlaceEnable)
FUNCTION DEFINITIONS ///.
Definition abcRewrite.c:61
ABC_DLL int Abc_NodeIsConst(Abc_Obj_t *pNode)
Definition abcObj.c:867
ABC_DLL int Abc_AigCleanup(Abc_Aig_t *pMan)
Definition abcAig.c:194
ABC_DLL Abc_Obj_t * Abc_AigAnd(Abc_Aig_t *pMan, Abc_Obj_t *p0, Abc_Obj_t *p1)
Definition abcAig.c:700
#define Abc_SopForEachCube(pSop, nFanins, pCube)
Definition abc.h:538
#define Abc_NtkForEachPi(pNtk, pPi, i)
Definition abc.h:516
ABC_DLL Abc_Ntk_t * Abc_NtkStrash(Abc_Ntk_t *pNtk, int fAllNodes, int fCleanup, int fRecord)
Definition abcStrash.c:265
ABC_DLL int Abc_SopGetVarNum(char *pSop)
Definition abcSop.c:584
ABC_DLL int Abc_SopIsExorType(char *pSop)
Definition abcSop.c:850
#define Abc_NtkForEachCi(pNtk, pCi, i)
Definition abc.h:518
ABC_DLL void Abc_NtkDelete(Abc_Ntk_t *pNtk)
Definition abcNtk.c:1421
ABC_DLL Vec_Ptr_t * Abc_NtkSaveCopy(Abc_Ntk_t *pNtk)
Definition abcUtil.c:628
ABC_DLL int Abc_SopIsComplement(char *pSop)
Definition abcSop.c:703
ABC_DLL Abc_Ntk_t * Abc_NtkBalance(Abc_Ntk_t *pNtk, int fDuplicate, int fSelective, int fUpdateLevel)
FUNCTION DEFINITIONS ///.
Definition abcBalance.c:53
@ ABC_FUNC_AIG
Definition abc.h:67
ABC_DLL int Abc_SopGetCubeNum(char *pSop)
Definition abcSop.c:537
ABC_DLL int Abc_NtkRefactor(Abc_Ntk_t *pNtk, int nNodeSizeMax, int nMinSaved, int nConeSizeMax, int fUpdateLevel, int fUseZeros, int fUseDcs, int fVerbose)
ABC_DLL int Abc_NtkBddToSop(Abc_Ntk_t *pNtk, int fMode, int nCubeLimit, int fCubeSort)
Definition abcFunc.c:866
ABC_DLL Abc_Ntk_t * Abc_NtkStartFrom(Abc_Ntk_t *pNtk, Abc_NtkType_t Type, Abc_NtkFunc_t Func)
Definition abcNtk.c:157
ABC_DLL Abc_Ntk_t * Abc_NtkDup(Abc_Ntk_t *pNtk)
Definition abcNtk.c:472
ABC_DLL Abc_Obj_t * Abc_AigConst1(Abc_Ntk_t *pNtk)
Definition abcAig.c:683
#define Abc_NtkForEachNode(pNtk, pNode, i)
Definition abc.h:464
ABC_INT64_T abctime
Definition abc_global.h:332
#define ABC_FALLOC(type, num)
Definition abc_global.h:266
#define ABC_INFINITY
MACRO DEFINITIONS ///.
Definition abc_global.h:250
#define ABC_CALLOC(type, num)
Definition abc_global.h:265
#define ABC_FREE(obj)
Definition abc_global.h:267
#define ABC_NAMESPACE_IMPL_START
#define ABC_NAMESPACE_IMPL_END
typedefABC_NAMESPACE_HEADER_START struct Aig_Man_t_ Aig_Man_t
INCLUDES ///.
Definition aig.h:50
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition bblif.c:37
struct Dec_Node_t_ Dec_Node_t
Definition dec.h:49
#define Dec_GraphForEachLeaf(pGraph, pLeaf, i)
ITERATORS ///.
Definition dec.h:98
Dec_Graph_t * Dec_Factor(char *pSop)
FUNCTION DECLARATIONS ///.
Definition decFactor.c:58
struct Dec_Graph_t_ Dec_Graph_t
Definition dec.h:68
Cube * p
Definition exorList.c:222
int Fra_FraigSat(Aig_Man_t *pMan, ABC_INT64_T nConfLimit, ABC_INT64_T nInsLimit, int nLearnedStart, int nLearnedDelta, int nLearnedPerce, int fFlipBits, int fAndOuts, int fNewSolver, int fVerbose)
ITERATORS ///.
Definition fraCec.c:47
int Gia_ManFindFailedPoCex(Gia_Man_t *pAig, Abc_Cex_t *p, int nOutputs)
Definition giaCex.c:91
Gia_Man_t * Gia_ManStart(int nObjsMax)
FUNCTION DEFINITIONS ///.
Definition giaMan.c:57
struct Gia_Obj_t_ Gia_Obj_t
Definition gia.h:76
struct Gia_Man_t_ Gia_Man_t
Definition gia.h:96
#define Gia_ManForEachObj(p, pObj, i)
MACRO DEFINITIONS ///.
Definition gia.h:1190
void Ioa_WriteAiger(Aig_Man_t *pMan, char *pFileName, int fWriteSymbols, int fCompact)
struct Prove_ParamsStruct_t_ Prove_Params_t
Definition ivyFraig.c:108
Ivy_Man_t * Ivy_ManResyn0(Ivy_Man_t *p, int fUpdateLevel, int fVerbose)
DECLARATIONS ///.
Definition ivyResyn.c:45
Ivy_Man_t * Ivy_FraigPerform(Ivy_Man_t *pManAig, Ivy_FraigParams_t *pParams)
Definition ivyFraig.c:451
int Ivy_ManCheck(Ivy_Man_t *p)
DECLARATIONS ///.
Definition ivyCheck.c:45
typedefABC_NAMESPACE_HEADER_START struct Ivy_Man_t_ Ivy_Man_t
INCLUDES ///.
Definition ivy.h:46
@ IVY_INIT_0
Definition ivy.h:67
@ IVY_INIT_1
Definition ivy.h:68
@ IVY_INIT_DC
Definition ivy.h:69
int Ivy_ManRewriteSeq(Ivy_Man_t *p, int fUseZeroCost, int fVerbose)
FUNCTION DEFINITIONS ///.
Definition ivySeq.c:63
void Ivy_ManMakeSeq(Ivy_Man_t *p, int nLatches, int *pInits)
Definition ivyMan.c:482
Ivy_Man_t * Ivy_ManResyn(Ivy_Man_t *p, int fUpdateLevel, int fVerbose)
Definition ivyResyn.c:86
Ivy_Obj_t * Ivy_Exor(Ivy_Man_t *p, Ivy_Obj_t *p0, Ivy_Obj_t *p1)
Definition ivyOper.c:113
int Ivy_ManCleanup(Ivy_Man_t *p)
Definition ivyMan.c:265
Vec_Int_t * Ivy_ManDfsSeq(Ivy_Man_t *p, Vec_Int_t **pvLatches)
Definition ivyDfs.c:121
Ivy_Man_t * Ivy_ManStart()
DECLARATIONS ///.
Definition ivyMan.c:45
#define Ivy_ManForEachObj(p, pObj, i)
Definition ivy.h:393
void Ivy_FraigParamsDefault(Ivy_FraigParams_t *pParams)
FUNCTION DEFINITIONS ///.
Definition ivyFraig.c:225
Ivy_Obj_t * Ivy_ObjCreatePo(Ivy_Man_t *p, Ivy_Obj_t *pDriver)
Definition ivyObj.c:61
struct Ivy_FraigParams_t_ Ivy_FraigParams_t
Definition ivy.h:49
Vec_Int_t * Ivy_ManDfs(Ivy_Man_t *p)
Definition ivyDfs.c:87
void Ivy_ManStop(Ivy_Man_t *p)
Definition ivyMan.c:238
struct Ivy_Obj_t_ Ivy_Obj_t
Definition ivy.h:47
Ivy_Obj_t * Ivy_Or(Ivy_Man_t *p, Ivy_Obj_t *p0, Ivy_Obj_t *p1)
Definition ivyOper.c:142
void Ivy_ManHaigStop(Ivy_Man_t *p)
Definition ivyHaig.c:159
void Ivy_ManHaigStart(Ivy_Man_t *p, int fVerbose)
FUNCTION DEFINITIONS ///.
Definition ivyHaig.c:94
#define Ivy_ManForEachNodeVec(p, vIds, pObj, i)
Definition ivy.h:408
Ivy_Obj_t * Ivy_ObjCreatePi(Ivy_Man_t *p)
DECLARATIONS ///.
Definition ivyObj.c:45
int Ivy_ManRewritePre(Ivy_Man_t *p, int fUpdateLevel, int fUseZeroCost, int fVerbose)
FUNCTION DEFINITIONS ///.
Definition ivyRwr.c:55
Ivy_Man_t * Ivy_FraigMiter(Ivy_Man_t *pManAig, Ivy_FraigParams_t *pParams)
Definition ivyFraig.c:480
Ivy_Obj_t * Ivy_And(Ivy_Man_t *p, Ivy_Obj_t *p0, Ivy_Obj_t *p1)
Definition ivyOper.c:84
int Ivy_FraigProve(Ivy_Man_t **ppManAig, void *pPars)
Definition ivyFraig.c:255
char * Mio_GateReadSop(Mio_Gate_t *pGate)
Definition mioApi.c:179
struct Mio_GateStruct_t_ Mio_Gate_t
Definition mio.h:43
Abc_Ntk_t * pExdc
Definition abc.h:201
void * pManFunc
Definition abc.h:191
int * pModel
Definition abc.h:198
void * pData
Definition abc.h:145
Abc_Ntk_t * pNtk
Definition abc.h:130
Abc_Obj_t * pCopy
Definition abc.h:148
void * pFunc
Definition dec.h:56
char * pName
Definition gia.h:99
int nBTLimitMiter
Definition ivy.h:144
Ivy_Obj_t * pEquiv
Definition ivy.h:93
Ivy_Obj_t * pFanin0
Definition ivy.h:86
int TravId
Definition ivy.h:76
int Id
Definition ivy.h:75
Ivy_Obj_t * pFanin1
Definition ivy.h:87
Abc_Cex_t * Abc_CexDeriveFromCombModel(int *pModel, int nPis, int nRegs, int iPo)
Definition utilCex.c:173
#define assert(ex)
Definition util_old.h:213
char * sprintf()
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition vecPtr.h:42
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.
Definition vecPtr.h:55