ABC: A System for Sequential Synthesis and Verification
 
Loading...
Searching...
No Matches
dchSweep.c
Go to the documentation of this file.
1
20
21#include "dchInt.h"
22#include "misc/bar/bar.h"
23
25
26
30
31static inline Aig_Obj_t * Dch_ObjChild0Fra( Aig_Obj_t * pObj ) { assert( !Aig_IsComplement(pObj) ); return Aig_ObjFanin0(pObj)? Aig_NotCond(Dch_ObjFraig(Aig_ObjFanin0(pObj)), Aig_ObjFaninC0(pObj)) : NULL; }
32static inline Aig_Obj_t * Dch_ObjChild1Fra( Aig_Obj_t * pObj ) { assert( !Aig_IsComplement(pObj) ); return Aig_ObjFanin1(pObj)? Aig_NotCond(Dch_ObjFraig(Aig_ObjFanin1(pObj)), Aig_ObjFaninC1(pObj)) : NULL; }
33
37
50{
51 Aig_Obj_t * pObjRepr, * pObjFraig, * pObjFraig2, * pObjReprFraig;
52 int RetValue;
53 // get representative of this class
54 pObjRepr = Aig_ObjRepr( p->pAigTotal, pObj );
55 if ( pObjRepr == NULL )
56 return;
57 // get the fraiged node
58 pObjFraig = Dch_ObjFraig( pObj );
59 if ( pObjFraig == NULL )
60 return;
61 // get the fraiged representative
62 pObjReprFraig = Dch_ObjFraig( pObjRepr );
63 if ( pObjReprFraig == NULL )
64 return;
65 // if the fraiged nodes are the same, return
66 if ( Aig_Regular(pObjFraig) == Aig_Regular(pObjReprFraig) )
67 {
68 // remember the proved equivalence
69 p->pReprsProved[ pObj->Id ] = pObjRepr;
70 return;
71 }
72 assert( Aig_Regular(pObjFraig) != Aig_ManConst1(p->pAigFraig) );
73 RetValue = Dch_NodesAreEquiv( p, Aig_Regular(pObjReprFraig), Aig_Regular(pObjFraig) );
74 if ( RetValue == -1 ) // timed out
75 {
76 Dch_ObjSetFraig( pObj, NULL );
77 return;
78 }
79 if ( RetValue == 1 ) // proved equivalent
80 {
81 pObjFraig2 = Aig_NotCond( pObjReprFraig, pObj->fPhase ^ pObjRepr->fPhase );
82 Dch_ObjSetFraig( pObj, pObjFraig2 );
83 // remember the proved equivalence
84 p->pReprsProved[ pObj->Id ] = pObjRepr;
85 return;
86 }
87 // disproved the equivalence
88 if ( p->pPars->fSimulateTfo )
89 Dch_ManResimulateCex( p, pObj, pObjRepr );
90 else
91 Dch_ManResimulateCex2( p, pObj, pObjRepr );
92 assert( Aig_ObjRepr( p->pAigTotal, pObj ) != pObjRepr );
93}
94
107{
108 Bar_Progress_t * pProgress = NULL;
109 Aig_Obj_t * pObj, * pObjNew;
110 int i;
111 // map constants and PIs
112 p->pAigFraig = Aig_ManStart( Aig_ManObjNumMax(p->pAigTotal) );
113 Aig_ManCleanData( p->pAigTotal );
114 Aig_ManConst1(p->pAigTotal)->pData = Aig_ManConst1(p->pAigFraig);
115 Aig_ManForEachCi( p->pAigTotal, pObj, i )
116 pObj->pData = Aig_ObjCreateCi( p->pAigFraig );
117 // sweep internal nodes
118 pProgress = Bar_ProgressStart( stdout, Aig_ManObjNumMax(p->pAigTotal) );
119 Aig_ManForEachNode( p->pAigTotal, pObj, i )
120 {
121 Bar_ProgressUpdate( pProgress, i, NULL );
122 if ( Dch_ObjFraig(Aig_ObjFanin0(pObj)) == NULL ||
123 Dch_ObjFraig(Aig_ObjFanin1(pObj)) == NULL )
124 continue;
125 pObjNew = Aig_And( p->pAigFraig, Dch_ObjChild0Fra(pObj), Dch_ObjChild1Fra(pObj) );
126 if ( pObjNew == NULL )
127 continue;
128 Dch_ObjSetFraig( pObj, pObjNew );
129 Dch_ManSweepNode( p, pObj );
130 }
131 Bar_ProgressStop( pProgress );
132 // update the representatives of the nodes (makes classes invalid)
133 ABC_FREE( p->pAigTotal->pReprs );
134 p->pAigTotal->pReprs = p->pReprsProved;
135 p->pReprsProved = NULL;
136 // clean the mark
137 Aig_ManCleanMarkB( p->pAigTotal );
138}
139
143
144
146
#define ABC_FREE(obj)
Definition abc_global.h:267
#define ABC_NAMESPACE_IMPL_START
#define ABC_NAMESPACE_IMPL_END
void Aig_ManCleanMarkB(Aig_Man_t *p)
Definition aigUtil.c:167
#define Aig_ManForEachCi(p, pObj, i)
ITERATORS ///.
Definition aig.h:393
Aig_Obj_t * Aig_And(Aig_Man_t *p, Aig_Obj_t *p0, Aig_Obj_t *p1)
Definition aigOper.c:104
struct Aig_Obj_t_ Aig_Obj_t
Definition aig.h:51
Aig_Man_t * Aig_ManStart(int nNodesMax)
DECLARATIONS ///.
Definition aigMan.c:47
#define Aig_ManForEachNode(p, pObj, i)
Definition aig.h:413
Aig_Obj_t * Aig_ObjCreateCi(Aig_Man_t *p)
DECLARATIONS ///.
Definition aigObj.c:45
void Aig_ManCleanData(Aig_Man_t *p)
Definition aigUtil.c:205
void Bar_ProgressStop(Bar_Progress_t *p)
Definition bar.c:126
Bar_Progress_t * Bar_ProgressStart(FILE *pFile, int nItemsTotal)
FUNCTION DEFINITIONS ///.
Definition bar.c:66
struct Bar_Progress_t_ Bar_Progress_t
BASIC TYPES ///.
Definition bar.h:48
struct Dch_Man_t_ Dch_Man_t
Definition dchInt.h:50
void Dch_ManResimulateCex(Dch_Man_t *p, Aig_Obj_t *pObj, Aig_Obj_t *pRepr)
Definition dchSimSat.c:177
void Dch_ManResimulateCex2(Dch_Man_t *p, Aig_Obj_t *pObj, Aig_Obj_t *pRepr)
Definition dchSimSat.c:225
int Dch_NodesAreEquiv(Dch_Man_t *p, Aig_Obj_t *pObj1, Aig_Obj_t *pObj2)
DECLARATIONS ///.
Definition dchSat.c:45
void Dch_ManSweep(Dch_Man_t *p)
Definition dchSweep.c:106
void Dch_ManSweepNode(Dch_Man_t *p, Aig_Obj_t *pObj)
FUNCTION DEFINITIONS ///.
Definition dchSweep.c:49
Cube * p
Definition exorList.c:222
int Id
Definition aig.h:85
void * pData
Definition aig.h:87
unsigned int fPhase
Definition aig.h:78
#define assert(ex)
Definition util_old.h:213