ABC: A System for Sequential Synthesis and Verification
 
Loading...
Searching...
No Matches
mfsGia.c File Reference
#include "mfsInt.h"
#include "aig/gia/giaAig.h"
Include dependency graph for mfsGia.c:

Go to the source code of this file.

Functions

Gia_Man_tGia_ManCreateResubMiter (Aig_Man_t *p)
 FUNCTION DEFINITIONS ///.
 
void Abc_NtkMfsConstructGia (Mfs_Man_t *p)
 
void Abc_NtkMfsDeconstructGia (Mfs_Man_t *p)
 
void Abc_NtkMfsResimulate (Gia_Man_t *p, Vec_Int_t *vCex)
 
int Abc_NtkMfsTryResubOnceGia (Mfs_Man_t *p, int *pCands, int nCands)
 

Function Documentation

◆ Abc_NtkMfsConstructGia()

void Abc_NtkMfsConstructGia ( Mfs_Man_t * p)

Function*************************************************************

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 120 of file mfsGia.c.

121{
122 int nBTLimit = 500;
123 // prepare AIG
124 assert( p->pGia == NULL );
125 p->pGia = Gia_ManCreateResubMiter( p->pAigWin );
126 // prepare AIG
127 Gia_ManCreateRefs( p->pGia );
128 Gia_ManCleanMark0( p->pGia );
129 Gia_ManCleanMark1( p->pGia );
130 Gia_ManFillValue ( p->pGia ); // maps nodes into trail ids
131 Gia_ManCleanPhase( p->pGia );
132 // prepare solver
133 p->pTas = Tas_ManAlloc( p->pGia, nBTLimit );
134 p->vCex = Tas_ReadModel( p->pTas );
135 p->vGiaLits = Vec_PtrAlloc( 100 );
136}
Cube * p
Definition exorList.c:222
Tas_Man_t * Tas_ManAlloc(Gia_Man_t *pAig, int nBTLimit)
Definition giaCTas.c:187
Vec_Int_t * Tas_ReadModel(Tas_Man_t *p)
Definition giaCTas.c:250
void Gia_ManFillValue(Gia_Man_t *p)
Definition giaUtil.c:369
void Gia_ManCleanPhase(Gia_Man_t *p)
Definition giaUtil.c:472
void Gia_ManCleanMark0(Gia_Man_t *p)
Definition giaUtil.c:256
void Gia_ManCreateRefs(Gia_Man_t *p)
Definition giaUtil.c:779
void Gia_ManCleanMark1(Gia_Man_t *p)
Definition giaUtil.c:313
Gia_Man_t * Gia_ManCreateResubMiter(Aig_Man_t *p)
FUNCTION DEFINITIONS ///.
Definition mfsGia.c:53
#define assert(ex)
Definition util_old.h:213
Here is the call graph for this function:

◆ Abc_NtkMfsDeconstructGia()

void Abc_NtkMfsDeconstructGia ( Mfs_Man_t * p)

Function*************************************************************

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 150 of file mfsGia.c.

151{
152 assert( p->pGia != NULL );
153 Gia_ManStop( p->pGia ); p->pGia = NULL;
154 Tas_ManStop( p->pTas ); p->pTas = NULL;
155 Vec_PtrFree( p->vGiaLits );
156}
void Gia_ManStop(Gia_Man_t *p)
Definition giaMan.c:82
void Tas_ManStop(Tas_Man_t *p)
Definition giaCTas.c:223
Here is the call graph for this function:

◆ Abc_NtkMfsResimulate()

void Abc_NtkMfsResimulate ( Gia_Man_t * p,
Vec_Int_t * vCex )

Function*************************************************************

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 169 of file mfsGia.c.

170{
171 Gia_Obj_t * pObj;
172 int i, Entry;
173// Gia_ManCleanMark1( p );
174 Gia_ManConst0(p)->fMark1 = 0;
175 Gia_ManForEachCi( p, pObj, i )
176 pObj->fMark1 = 0;
177// pObj->fMark1 = Gia_ManRandom(0);
178 Vec_IntForEachEntry( vCex, Entry, i )
179 {
180 pObj = Gia_ManCi( p, Gia_Lit2Var(Entry) );
181 pObj->fMark1 = !Gia_LitIsCompl(Entry);
182 }
183 Gia_ManForEachAnd( p, pObj, i )
184 pObj->fMark1 = (Gia_ObjFanin0(pObj)->fMark1 ^ Gia_ObjFaninC0(pObj)) &
185 (Gia_ObjFanin1(pObj)->fMark1 ^ Gia_ObjFaninC1(pObj));
186 Gia_ManForEachCo( p, pObj, i )
187 pObj->fMark1 = Gia_ObjFanin0(pObj)->fMark1 ^ Gia_ObjFaninC0(pObj);
188}
#define Gia_ManForEachAnd(p, pObj, i)
Definition gia.h:1214
struct Gia_Obj_t_ Gia_Obj_t
Definition gia.h:76
#define Gia_ManForEachCo(p, pObj, i)
Definition gia.h:1236
#define Gia_ManForEachCi(p, pObj, i)
Definition gia.h:1228
unsigned fMark1
Definition gia.h:86
#define Vec_IntForEachEntry(vVec, Entry, i)
MACRO DEFINITIONS ///.
Definition vecInt.h:54
Here is the caller graph for this function:

◆ Abc_NtkMfsTryResubOnceGia()

int Abc_NtkMfsTryResubOnceGia ( Mfs_Man_t * p,
int * pCands,
int nCands )

Function*************************************************************

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 204 of file mfsGia.c.

205{
206 int fVeryVerbose = 0;
207 int fUseGia = 1;
208 unsigned * pData;
209 int i, iVar, status, iOut;
210 clock_t clk = clock();
211 p->nSatCalls++;
212// return -1;
213 assert( p->pGia != NULL );
214 assert( p->pTas != NULL );
215 // convert to literals
216 Vec_PtrClear( p->vGiaLits );
217 // create the first four literals
218 Vec_PtrPush( p->vGiaLits, Gia_ObjChild0(Gia_ManPo(p->pGia, 0)) );
219 Vec_PtrPush( p->vGiaLits, Gia_ObjChild0(Gia_ManPo(p->pGia, 1)) );
220 Vec_PtrPush( p->vGiaLits, Gia_ObjChild0(Gia_ManPo(p->pGia, 2)) );
221 Vec_PtrPush( p->vGiaLits, Gia_ObjChild0(Gia_ManPo(p->pGia, 3)) );
222 for ( i = 0; i < nCands; i++ )
223 {
224 // get the output number
225 iOut = Gia_Lit2Var(pCands[i]) - 2 * p->pCnf->nVars;
226 // write the literal
227 Vec_PtrPush( p->vGiaLits, Gia_ObjChild0(Gia_ManPo(p->pGia, 4 + iOut)) );
228 }
229 // perform SAT solving
230 status = Tas_ManSolveArray( p->pTas, p->vGiaLits );
231 if ( status == -1 )
232 {
233 p->nTimeOuts++;
234 if ( fVeryVerbose )
235 printf( "t" );
236// p->nSatUndec++;
237// p->nConfUndec += p->Pars.nBTThis;
238// Cec_ManSatAddToStore( vCexStore, NULL, i ); // timeout
239// p->timeSatUndec += clock() - clk;
240 }
241 else if ( status == 1 )
242 {
243 if ( fVeryVerbose )
244 printf( "u" );
245// p->nSatUnsat++;
246// p->nConfUnsat += p->Pars.nBTThis;
247// p->timeSatUnsat += clock() - clk;
248 }
249 else
250 {
251 p->nSatCexes++;
252 if ( fVeryVerbose )
253 printf( "s" );
254// p->nSatSat++;
255// p->nConfSat += p->Pars.nBTThis;
256// Gia_SatVerifyPattern( pAig, pRoot, vCex, vVisit );
257// Cec_ManSatAddToStore( vCexStore, vCex, i );
258// p->timeSatSat += clock() - clk;
259
260 // resimulate the counter-example
261 Abc_NtkMfsResimulate( p->pGia, Tas_ReadModel(p->pTas) );
262
263 if ( fUseGia )
264 {
265/*
266 int Val0 = Gia_ManPo(p->pGia, 0)->fMark1;
267 int Val1 = Gia_ManPo(p->pGia, 1)->fMark1;
268 int Val2 = Gia_ManPo(p->pGia, 2)->fMark1;
269 int Val3 = Gia_ManPo(p->pGia, 3)->fMark1;
270 assert( Val0 == 1 );
271 assert( Val1 == 1 );
272 assert( Val2 == 1 );
273 assert( Val3 == 1 );
274*/
275 // store the counter-example
276 Vec_IntForEachEntry( p->vProjVarsSat, iVar, i )
277 {
278 pData = (unsigned *)Vec_PtrEntry( p->vDivCexes, i );
279 iOut = iVar - 2 * p->pCnf->nVars;
280// if ( !Gia_ManPo( p->pGia, 4 + iOut )->fMark1 ) // remove 0s!!!
281 if ( Gia_ManPo( p->pGia, 4 + iOut )->fMark1 ) // remove 0s!!! - rememeber complemented attribute
282 {
283 assert( Aig_InfoHasBit(pData, p->nCexes) );
284 Aig_InfoXorBit( pData, p->nCexes );
285 }
286 }
287 p->nCexes++;
288 }
289
290 }
291 return status;
292}
int Tas_ManSolveArray(Tas_Man_t *p, Vec_Ptr_t *vObjs)
Definition giaCTas.c:1423
void Abc_NtkMfsResimulate(Gia_Man_t *p, Vec_Int_t *vCex)
Definition mfsGia.c:169
Here is the call graph for this function:

◆ Gia_ManCreateResubMiter()

Gia_Man_t * Gia_ManCreateResubMiter ( Aig_Man_t * p)

FUNCTION DEFINITIONS ///.

Function*************************************************************

Synopsis [Derives the resubstitution miter as an GIA.]

Description []

SideEffects []

SeeAlso []

Definition at line 53 of file mfsGia.c.

54{
55 Gia_Man_t * pNew;//, * pTemp;
56 Aig_Obj_t * pObj;
57 int i, * pOuts0, * pOuts1;
58 Aig_ManSetPioNumbers( p );
59 // create the new manager
60 pNew = Gia_ManStart( Aig_ManObjNum(p) );
61 pNew->pName = Gia_UtilStrsav( p->pName );
62 pNew->pSpec = Gia_UtilStrsav( p->pSpec );
63 Gia_ManHashAlloc( pNew );
64 // create the objects
65 pOuts0 = ABC_ALLOC( int, Aig_ManPoNum(p) );
66 Aig_ManForEachObj( p, pObj, i )
67 {
68 if ( Aig_ObjIsAnd(pObj) )
69 pObj->iData = Gia_ManHashAnd( pNew, Gia_ObjChild0Copy(pObj), Gia_ObjChild1Copy(pObj) );
70 else if ( Aig_ObjIsPi(pObj) )
71 pObj->iData = Gia_ManAppendCi( pNew );
72 else if ( Aig_ObjIsPo(pObj) )
73 pOuts0[ Aig_ObjPioNum(pObj) ] = Gia_ObjChild0Copy(pObj);
74 else if ( Aig_ObjIsConst1(pObj) )
75 pObj->iData = 1;
76 else
77 assert( 0 );
78 }
79 // create the objects
80 pOuts1 = ABC_ALLOC( int, Aig_ManPoNum(p) );
81 Aig_ManForEachObj( p, pObj, i )
82 {
83 if ( Aig_ObjIsAnd(pObj) )
84 pObj->iData = Gia_ManHashAnd( pNew, Gia_ObjChild0Copy(pObj), Gia_ObjChild1Copy(pObj) );
85 else if ( Aig_ObjIsPi(pObj) )
86 pObj->iData = Gia_ManAppendCi( pNew );
87 else if ( Aig_ObjIsPo(pObj) )
88 pOuts1[ Aig_ObjPioNum(pObj) ] = Gia_ObjChild0Copy(pObj);
89 else if ( Aig_ObjIsConst1(pObj) )
90 pObj->iData = 1;
91 else
92 assert( 0 );
93 }
94 // add the outputs
95 Gia_ManAppendCo( pNew, pOuts0[0] );
96 Gia_ManAppendCo( pNew, pOuts1[0] );
97 Gia_ManAppendCo( pNew, pOuts0[1] );
98 Gia_ManAppendCo( pNew, Gia_LitNot(pOuts1[1]) );
99 for ( i = 2; i < Aig_ManPoNum(p); i++ )
100 Gia_ManAppendCo( pNew, Gia_LitNot( Gia_ManHashXor(pNew, pOuts0[i], pOuts1[i]) ) );
101 Gia_ManHashStop( pNew );
102 ABC_FREE( pOuts0 );
103 ABC_FREE( pOuts1 );
104// pNew = Gia_ManCleanup( pTemp = pNew );
105// Gia_ManStop( pTemp );
106 return pNew;
107}
#define ABC_ALLOC(type, num)
Definition abc_global.h:264
#define ABC_FREE(obj)
Definition abc_global.h:267
#define Aig_ManForEachObj(p, pObj, i)
Definition aig.h:403
struct Aig_Obj_t_ Aig_Obj_t
Definition aig.h:51
void Gia_ManHashAlloc(Gia_Man_t *p)
Definition giaHash.c:105
Gia_Man_t * Gia_ManStart(int nObjsMax)
FUNCTION DEFINITIONS ///.
Definition giaMan.c:57
int Gia_ManHashXor(Gia_Man_t *p, int iLit0, int iLit1)
Definition giaHash.c:668
struct Gia_Man_t_ Gia_Man_t
Definition gia.h:96
int Gia_ManHashAnd(Gia_Man_t *p, int iLit0, int iLit1)
Definition giaHash.c:576
void Gia_ManHashStop(Gia_Man_t *p)
Definition giaHash.c:149
int iData
Definition aig.h:88
char * pSpec
Definition gia.h:100
char * pName
Definition gia.h:99
Here is the call graph for this function:
Here is the caller graph for this function: