ABC: A System for Sequential Synthesis and Verification
 
Loading...
Searching...
No Matches
giaExist.c File Reference
#include "gia.h"
#include "misc/util/utilTruth.h"
Include dependency graph for giaExist.c:

Go to the source code of this file.

Functions

int Gia_ManQuantVerify_rec (Gia_Man_t *p, int iObj, int CiId)
 
void Gia_ManQuantVerify (Gia_Man_t *p, int iObj)
 
void Gia_ManQuantSetSuppStart (Gia_Man_t *p)
 
void Gia_ManQuantSetSuppZero (Gia_Man_t *p)
 
void Gia_ManQuantSetSuppCi (Gia_Man_t *p, Gia_Obj_t *pObj)
 
void Gia_ManQuantSetSuppAnd (Gia_Man_t *p, Gia_Obj_t *pObj)
 
int Gia_ManQuantCheckSupp (Gia_Man_t *p, int iObj, int iSupp)
 
void Gia_ManQuantUpdateCiSupp (Gia_Man_t *p, int iObj)
 
int Gia_ManQuantCheckOverlap (Gia_Man_t *p, int iObj)
 
void Gia_ManQuantMarkUsedCis (Gia_Man_t *p, int(*pFuncCiToKeep)(void *, int), void *pData)
 
int Gia_ManQuantCountUsed_rec (Gia_Man_t *p, int iObj)
 
int Gia_ManQuantCountUsed (Gia_Man_t *p, int iObj)
 
void Gia_ManQuantDupConeSupp_rec (Gia_Man_t *pNew, Gia_Man_t *p, Gia_Obj_t *pObj, Vec_Int_t *vCis, Vec_Int_t *vObjs, int(*pFuncCiToKeep)(void *, int), void *pData)
 
Gia_Man_tGia_ManQuantDupConeSupp (Gia_Man_t *p, int iLit, int(*pFuncCiToKeep)(void *, int), void *pData, Vec_Int_t **pvCis, int *pOutLit)
 
void Gia_ManQuantExist_rec (Gia_Man_t *p, int iObj, int pRes[2])
 
int Gia_ManQuantExist2 (Gia_Man_t *p0, int iLit, int(*pFuncCiToKeep)(void *, int), void *pData)
 
void Gia_ManQuantCollect_rec (Gia_Man_t *p, int iObj, Vec_Int_t *vQuantCis, Vec_Int_t *vQuantSide, Vec_Int_t *vQuantAnds)
 
void Gia_ManQuantCollect (Gia_Man_t *p, int iObj, int(*pFuncCiToKeep)(void *, int), void *pData, Vec_Int_t *vQuantCis, Vec_Int_t *vQuantSide, Vec_Int_t *vQuantAnds)
 
Gia_Man_tGia_ManQuantExist2Dup (Gia_Man_t *p, int iLit, Vec_Int_t *vCis, Vec_Int_t *vSide, Vec_Int_t *vAnds, int *pOutLit)
 
int Gia_ManQuantExistInt (Gia_Man_t *p0, int iLit, Vec_Int_t *vCis, Vec_Int_t *vSide, Vec_Int_t *vAnds)
 
int Gia_ManQuantExist (Gia_Man_t *p0, int iLit, int(*pFuncCiToKeep)(void *, int), void *pData)
 

Function Documentation

◆ Gia_ManQuantCheckOverlap()

int Gia_ManQuantCheckOverlap ( Gia_Man_t * p,
int iObj )

Definition at line 163 of file giaExist.c.

164{
165 return Abc_TtIntersect( Gia_ManQuantInfoId(p, iObj), Gia_ManQuantInfoId(p, 0), p->nSuppWords, 0 );
166}
Cube * p
Definition exorList.c:222
Here is the caller graph for this function:

◆ Gia_ManQuantCheckSupp()

int Gia_ManQuantCheckSupp ( Gia_Man_t * p,
int iObj,
int iSupp )

Definition at line 153 of file giaExist.c.

154{
155 return Abc_TtGetBit( Gia_ManQuantInfoId(p, iObj), iSupp );
156}
Here is the caller graph for this function:

◆ Gia_ManQuantCollect()

void Gia_ManQuantCollect ( Gia_Man_t * p,
int iObj,
int(* pFuncCiToKeep )(void *, int),
void * pData,
Vec_Int_t * vQuantCis,
Vec_Int_t * vQuantSide,
Vec_Int_t * vQuantAnds )

Definition at line 403 of file giaExist.c.

404{
405 Gia_ManQuantMarkUsedCis( p, pFuncCiToKeep, pData );
407 Gia_ManQuantCollect_rec( p, iObj, vQuantCis, vQuantSide, vQuantAnds );
408// printf( "\nCreated cone with %d quant-vars, %d side-inputs, and %d internal nodes.\n",
409// Vec_IntSize(p->vQuantCis), Vec_IntSize(p->vQuantSide), Vec_IntSize(p->vQuantAnds) );
410}
void Gia_ManQuantCollect_rec(Gia_Man_t *p, int iObj, Vec_Int_t *vQuantCis, Vec_Int_t *vQuantSide, Vec_Int_t *vQuantAnds)
Definition giaExist.c:382
void Gia_ManQuantMarkUsedCis(Gia_Man_t *p, int(*pFuncCiToKeep)(void *, int), void *pData)
Definition giaExist.c:167
void Gia_ManIncrementTravId(Gia_Man_t *p)
Definition giaUtil.c:190
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_ManQuantCollect_rec()

void Gia_ManQuantCollect_rec ( Gia_Man_t * p,
int iObj,
Vec_Int_t * vQuantCis,
Vec_Int_t * vQuantSide,
Vec_Int_t * vQuantAnds )

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

Synopsis [Existentially quantified several variables.]

Description []

SideEffects []

SeeAlso []

Definition at line 382 of file giaExist.c.

383{
384 Gia_Obj_t * pObj;
385 if ( Gia_ObjIsTravIdCurrentId( p, iObj ) )
386 return;
387 Gia_ObjSetTravIdCurrentId( p, iObj );
388 if ( !Gia_ManQuantCheckOverlap(p, iObj) )
389 {
390 Vec_IntPush( vQuantSide, iObj );
391 return;
392 }
393 pObj = Gia_ManObj( p, iObj );
394 if ( Gia_ObjIsCi(pObj) )
395 {
396 Vec_IntPush( vQuantCis, iObj );
397 return;
398 }
399 Gia_ManQuantCollect_rec( p, Gia_ObjFaninId0(pObj, iObj), vQuantCis, vQuantSide, vQuantAnds );
400 Gia_ManQuantCollect_rec( p, Gia_ObjFaninId1(pObj, iObj), vQuantCis, vQuantSide, vQuantAnds );
401 Vec_IntPush( vQuantAnds, iObj );
402}
int Gia_ManQuantCheckOverlap(Gia_Man_t *p, int iObj)
Definition giaExist.c:163
struct Gia_Obj_t_ Gia_Obj_t
Definition gia.h:76
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_ManQuantCountUsed()

int Gia_ManQuantCountUsed ( Gia_Man_t * p,
int iObj )

Definition at line 193 of file giaExist.c.

194{
196 return Gia_ManQuantCountUsed_rec( p, iObj );
197}
int Gia_ManQuantCountUsed_rec(Gia_Man_t *p, int iObj)
Definition giaExist.c:178
Here is the call graph for this function:

◆ Gia_ManQuantCountUsed_rec()

int Gia_ManQuantCountUsed_rec ( Gia_Man_t * p,
int iObj )

Definition at line 178 of file giaExist.c.

179{
180 Gia_Obj_t * pObj; int Count = 1;
181 if ( Gia_ObjIsTravIdCurrentId( p, iObj ) )
182 return 0;
183 Gia_ObjSetTravIdCurrentId( p, iObj );
184 pObj = Gia_ManObj( p, iObj );
185 if ( Gia_ObjIsCi(pObj) )
186 return 0;
187 if ( Gia_ManQuantCheckSupp(p, Gia_ObjFaninId0(pObj, iObj), p->iSuppPi) )
188 Count += Gia_ManQuantCountUsed_rec( p, Gia_ObjFaninId0(pObj, iObj) );
189 if ( Gia_ManQuantCheckSupp(p, Gia_ObjFaninId1(pObj, iObj), p->iSuppPi) )
190 Count += Gia_ManQuantCountUsed_rec( p, Gia_ObjFaninId1(pObj, iObj) );
191 return Count;
192}
int Gia_ManQuantCheckSupp(Gia_Man_t *p, int iObj, int iSupp)
Definition giaExist.c:153
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_ManQuantDupConeSupp()

Gia_Man_t * Gia_ManQuantDupConeSupp ( Gia_Man_t * p,
int iLit,
int(* pFuncCiToKeep )(void *, int),
void * pData,
Vec_Int_t ** pvCis,
int * pOutLit )

Definition at line 230 of file giaExist.c.

231{
232 Gia_Man_t * pNew; int i, iLit0, iObj;
233 Gia_Obj_t * pObj, * pRoot = Gia_ManObj( p, Abc_Lit2Var(iLit) );
234 Vec_Int_t * vCis = Vec_IntAlloc( 1000 );
235 Vec_Int_t * vObjs = Vec_IntAlloc( 1000 );
236 assert( Gia_ObjIsAnd(pRoot) );
237 if ( Vec_IntSize(&p->vCopies) < Gia_ManObjNum(p) )
238 Vec_IntFillExtra( &p->vCopies, Gia_ManObjNum(p), -1 );
239 pNew = Gia_ManStart( 1000 );
240 Gia_ManHashStart( pNew );
242 Gia_ManQuantDupConeSupp_rec( pNew, p, pRoot, vCis, vObjs, pFuncCiToKeep, pData );
243 iLit0 = Gia_ObjCopyArray( p, Abc_Lit2Var(iLit) );
244 iLit0 = Abc_LitNotCond( iLit0, Abc_LitIsCompl(iLit) );
245 if ( pOutLit ) *pOutLit = iLit0;
246 Gia_ManForEachObjVec( vCis, p, pObj, i )
247 Gia_ObjSetCopyArray( p, Gia_ObjId(p, pObj), -1 );
248 Gia_ManForEachObjVec( vObjs, p, pObj, i )
249 Gia_ObjSetCopyArray( p, Gia_ObjId(p, pObj), -1 );
250 //assert( Vec_IntCountLarger(&p->vCopies, -1) == 0 );
251 Vec_IntFree( vObjs );
252 // remap into CI Ids
253 Vec_IntForEachEntry( vCis, iObj, i )
254 Vec_IntWriteEntry( vCis, i, Gia_ManIdToCioId(p, iObj) );
255 if ( pvCis ) *pvCis = vCis;
256 return pNew;
257}
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition bblif.c:37
void Gia_ManQuantSetSuppStart(Gia_Man_t *p)
Definition giaExist.c:100
void Gia_ManQuantDupConeSupp_rec(Gia_Man_t *pNew, Gia_Man_t *p, Gia_Obj_t *pObj, Vec_Int_t *vCis, Vec_Int_t *vObjs, int(*pFuncCiToKeep)(void *, int), void *pData)
Definition giaExist.c:199
void Gia_ManHashStart(Gia_Man_t *p)
Definition giaHash.c:125
Gia_Man_t * Gia_ManStart(int nObjsMax)
FUNCTION DEFINITIONS ///.
Definition giaMan.c:57
struct Gia_Man_t_ Gia_Man_t
Definition gia.h:96
#define Gia_ManForEachObjVec(vVec, p, pObj, i)
Definition gia.h:1194
#define assert(ex)
Definition util_old.h:213
#define Vec_IntForEachEntry(vVec, Entry, i)
MACRO DEFINITIONS ///.
Definition vecInt.h:54
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_ManQuantDupConeSupp_rec()

void Gia_ManQuantDupConeSupp_rec ( Gia_Man_t * pNew,
Gia_Man_t * p,
Gia_Obj_t * pObj,
Vec_Int_t * vCis,
Vec_Int_t * vObjs,
int(* pFuncCiToKeep )(void *, int),
void * pData )

Definition at line 199 of file giaExist.c.

200{
201 int iLit0, iLit1, iObj = Gia_ObjId( p, pObj );
202 int iLit = Gia_ObjCopyArray( p, iObj );
203 if ( iLit >= 0 )
204 return;
205 if ( Gia_ObjIsCi(pObj) )
206 {
207 int iLit = Gia_ManAppendCi( pNew );
208 Gia_Obj_t * pObjNew = Gia_ManObj( pNew, Abc_Lit2Var(iLit) );
210 if ( !pFuncCiToKeep( pData, Gia_ObjCioId(pObj) ) )
211 {
212 //printf( "Collecting CI %d\n", Gia_ObjCioId(pObj)+1 );
213 Gia_ManQuantSetSuppCi( pNew, pObjNew );
214 }
215 Gia_ObjSetCopyArray( p, iObj, iLit );
216 Vec_IntPush( vCis, iObj );
217 return;
218 }
219 assert( Gia_ObjIsAnd(pObj) );
220 Gia_ManQuantDupConeSupp_rec( pNew, p, Gia_ObjFanin0(pObj), vCis, vObjs, pFuncCiToKeep, pData );
221 Gia_ManQuantDupConeSupp_rec( pNew, p, Gia_ObjFanin1(pObj), vCis, vObjs, pFuncCiToKeep, pData );
222 iLit0 = Gia_ObjCopyArray( p, Gia_ObjFaninId0(pObj, iObj) );
223 iLit1 = Gia_ObjCopyArray( p, Gia_ObjFaninId1(pObj, iObj) );
224 iLit0 = Abc_LitNotCond( iLit0, Gia_ObjFaninC0(pObj) );
225 iLit1 = Abc_LitNotCond( iLit1, Gia_ObjFaninC1(pObj) );
226 iLit = Gia_ManHashAnd( pNew, iLit0, iLit1 );
227 Gia_ObjSetCopyArray( p, iObj, iLit );
228 Vec_IntPush( vObjs, iObj );
229}
void Gia_ManQuantSetSuppCi(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition giaExist.c:117
void Gia_ManQuantSetSuppZero(Gia_Man_t *p)
Definition giaExist.c:110
int Gia_ManHashAnd(Gia_Man_t *p, int iLit0, int iLit1)
Definition giaHash.c:576
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_ManQuantExist()

int Gia_ManQuantExist ( Gia_Man_t * p0,
int iLit,
int(* pFuncCiToKeep )(void *, int),
void * pData )

Definition at line 505 of file giaExist.c.

506{
507 int Res;
508 Vec_Int_t * vQuantCis = Vec_IntAlloc( 100 );
509 Vec_Int_t * vQuantSide = Vec_IntAlloc( 100 );
510 Vec_Int_t * vQuantAnds = Vec_IntAlloc( 100 );
511 Gia_ManQuantCollect( p0, Abc_Lit2Var(iLit), pFuncCiToKeep, pData, vQuantCis, vQuantSide, vQuantAnds );
512 Res = Gia_ManQuantExistInt( p0, iLit, vQuantCis, vQuantSide, vQuantAnds );
513 Vec_IntFree( vQuantCis );
514 Vec_IntFree( vQuantSide );
515 Vec_IntFree( vQuantAnds );
516 return Res;
517}
void Gia_ManQuantCollect(Gia_Man_t *p, int iObj, int(*pFuncCiToKeep)(void *, int), void *pData, Vec_Int_t *vQuantCis, Vec_Int_t *vQuantSide, Vec_Int_t *vQuantAnds)
Definition giaExist.c:403
int Gia_ManQuantExistInt(Gia_Man_t *p0, int iLit, Vec_Int_t *vCis, Vec_Int_t *vSide, Vec_Int_t *vAnds)
Definition giaExist.c:452
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_ManQuantExist2()

int Gia_ManQuantExist2 ( Gia_Man_t * p0,
int iLit,
int(* pFuncCiToKeep )(void *, int),
void * pData )

Definition at line 291 of file giaExist.c.

292{
293// abctime clk = Abc_Clock();
294 Gia_Man_t * pNew;
295 Vec_Int_t * vOuts, * vOuts2, * vCis;
296 Gia_Obj_t * pObj = Gia_ManObj( p0, Abc_Lit2Var(iLit) );
297 int i, n, Entry, Lit, OutLit = -1, pLits[2], nVarsQua, nAndsOld, nAndsNew;
298 if ( iLit < 2 ) return iLit;
299 if ( Gia_ObjIsCi(pObj) ) return pFuncCiToKeep(pData, Gia_ObjCioId(pObj)) ? iLit : 1;
300 assert( Gia_ObjIsAnd(pObj) );
301 pNew = Gia_ManQuantDupConeSupp( p0, iLit, pFuncCiToKeep, pData, &vCis, &OutLit );
302 if ( pNew->iSuppPi == 0 )
303 {
304 Gia_ManStop( pNew );
305 Vec_IntFree( vCis );
306 return iLit;
307 }
308 assert( pNew->iSuppPi > 0 && pNew->iSuppPi <= 64 * pNew->nSuppWords );
309 vOuts = Vec_IntAlloc( 100 );
310 vOuts2 = Vec_IntAlloc( 100 );
311 assert( OutLit > 1 );
312 Vec_IntPush( vOuts, OutLit );
313 nVarsQua = pNew->iSuppPi;
314 nAndsOld = Gia_ManAndNum(pNew);
315 while ( --pNew->iSuppPi >= 0 )
316 {
317 Entry = Abc_Lit2Var( Vec_IntEntry(vOuts, 0) );
318// printf( "Quantifying input %d with %d affected nodes (out of %d):\n",
319// pNew->iSuppPi, Gia_ManQuantCountUsed(pNew,Entry), Gia_ManAndNum(pNew) );
320 if ( Vec_IntSize(&pNew->vCopiesTwo) < 2*Gia_ManObjNum(pNew) )
321 Vec_IntFillExtra( &pNew->vCopiesTwo, 2*Gia_ManObjNum(pNew), -1 );
322 assert( Vec_IntSize(vOuts) > 0 );
323 Vec_IntClear( vOuts2 );
325 Vec_IntForEachEntry( vOuts, Entry, i )
326 {
327 Gia_ManQuantExist_rec( pNew, Abc_Lit2Var(Entry), pLits );
328 for ( n = 0; n < 2; n++ )
329 {
330 Lit = Abc_LitNotCond( pLits[n], Abc_LitIsCompl(Entry) );
331 if ( Lit == 0 )
332 continue;
333 if ( Lit == 1 )
334 {
335 Vec_IntFree( vOuts );
336 Vec_IntFree( vOuts2 );
337 Gia_ManStop( pNew );
338 Vec_IntFree( vCis );
339 return 1;
340 }
341 Vec_IntPushUnique( vOuts2, Lit );
342 }
343 }
344 Vec_IntClear( vOuts );
345 ABC_SWAP( Vec_Int_t *, vOuts, vOuts2 );
346 }
347// printf( "\n" );
348 //printf( "The number of diff cofactors = %d.\n", Vec_IntSize(vOuts) );
349 assert( Vec_IntSize(vOuts) > 0 );
350 Vec_IntForEachEntry( vOuts, Entry, i )
351 Vec_IntWriteEntry( vOuts, i, Abc_LitNot(Entry) );
352 OutLit = Gia_ManHashAndMulti( pNew, vOuts );
353 OutLit = Abc_LitNot( OutLit );
354 Vec_IntFree( vOuts );
355 Vec_IntFree( vOuts2 );
356 // transfer back
357 Gia_ManAppendCo( pNew, OutLit );
358 nAndsNew = Gia_ManAndNum(p0);
359 Lit = Gia_ManDupConeBack( p0, pNew, vCis );
360 nAndsNew = Gia_ManAndNum(p0) - nAndsNew;
361 Gia_ManStop( pNew );
362 // report the result
363// printf( "Performed quantification with %6d nodes, %3d keep-vars, %3d quant-vars, resulting in %5d new nodes. \n",
364// nAndsOld, Vec_IntSize(vCis) - nVarsQua, nVarsQua, nAndsNew );
365// Abc_PrintTime( 1, "Time", Abc_Clock() - clk );
366 Vec_IntFree( vCis );
367 return Lit;
368}
#define ABC_SWAP(Type, a, b)
Definition abc_global.h:253
Gia_Man_t * Gia_ManQuantDupConeSupp(Gia_Man_t *p, int iLit, int(*pFuncCiToKeep)(void *, int), void *pData, Vec_Int_t **pvCis, int *pOutLit)
Definition giaExist.c:230
void Gia_ManQuantExist_rec(Gia_Man_t *p, int iObj, int pRes[2])
Definition giaExist.c:258
void Gia_ManStop(Gia_Man_t *p)
Definition giaMan.c:82
int Gia_ManHashAndMulti(Gia_Man_t *p, Vec_Int_t *vLits)
Definition giaHash.c:783
int Gia_ManDupConeBack(Gia_Man_t *p, Gia_Man_t *pNew, Vec_Int_t *vCiIds)
Definition giaDup.c:2270
int iSuppPi
Definition gia.h:237
int nSuppWords
Definition gia.h:238
Vec_Int_t vCopiesTwo
Definition gia.h:240
Here is the call graph for this function:

◆ Gia_ManQuantExist2Dup()

Gia_Man_t * Gia_ManQuantExist2Dup ( Gia_Man_t * p,
int iLit,
Vec_Int_t * vCis,
Vec_Int_t * vSide,
Vec_Int_t * vAnds,
int * pOutLit )

Definition at line 412 of file giaExist.c.

413{
414 int i, iObj, iLit0, iLit1, iLitR;
415 Gia_Man_t * pNew = Gia_ManStart( Vec_IntSize(vSide) + Vec_IntSize(vCis) + 10*Vec_IntSize(vAnds) );
417 Gia_ManHashStart( pNew );
418 if ( Vec_IntSize(&p->vCopies) < Gia_ManObjNum(p) )
419 Vec_IntFillExtra( &p->vCopies, Gia_ManObjNum(p), -1 );
420 Vec_IntForEachEntry( vSide, iObj, i )
421 {
422 Gia_ObjSetCopyArray( p, iObj, Gia_ManAppendCi(pNew) );
424 }
425 Vec_IntForEachEntry( vCis, iObj, i )
426 {
427 Gia_ObjSetCopyArray( p, iObj, (iLit0 = Gia_ManAppendCi(pNew)) );
429 Gia_ManQuantSetSuppCi( pNew, Gia_ManObj(pNew, Abc_Lit2Var(iLit0)) );
430 }
431 Vec_IntForEachEntry( vAnds, iObj, i )
432 {
433 Gia_Obj_t * pObj = Gia_ManObj( p, iObj );
434 iLit0 = Gia_ObjCopyArray( p, Gia_ObjFaninId0(pObj, iObj) );
435 iLit1 = Gia_ObjCopyArray( p, Gia_ObjFaninId1(pObj, iObj) );
436 iLit0 = Abc_LitNotCond( iLit0, Gia_ObjFaninC0(pObj) );
437 iLit1 = Abc_LitNotCond( iLit1, Gia_ObjFaninC1(pObj) );
438 iLitR = Gia_ManHashAnd( pNew, iLit0, iLit1 );
439 Gia_ObjSetCopyArray( p, iObj, iLitR );
440 }
441 iLit0 = Gia_ObjCopyArray( p, Abc_Lit2Var(iLit) );
442 iLit0 = Abc_LitNotCond( iLit0, Abc_LitIsCompl(iLit) );
443 if ( pOutLit ) *pOutLit = iLit0;
444 Vec_IntForEachEntry( vSide, iObj, i )
445 Gia_ObjSetCopyArray( p, iObj, -1 );
446 Vec_IntForEachEntry( vCis, iObj, i )
447 Gia_ObjSetCopyArray( p, iObj, -1 );
448 Vec_IntForEachEntry( vAnds, iObj, i )
449 Gia_ObjSetCopyArray( p, iObj, -1 );
450 return pNew;
451}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_ManQuantExist_rec()

void Gia_ManQuantExist_rec ( Gia_Man_t * p,
int iObj,
int pRes[2] )

Definition at line 258 of file giaExist.c.

259{
260 Gia_Obj_t * pObj;
261 int Lits0[2], Lits1[2], pFans[2], fCompl[2];
262 if ( Gia_ObjIsTravIdCurrentId( p, iObj ) )
263 {
264 Gia_ObjCopyGetTwoArray( p, iObj, pRes );
265 return;
266 }
267 Gia_ObjSetTravIdCurrentId( p, iObj );
268 pObj = Gia_ManObj( p, iObj );
269 if ( Gia_ObjIsCi(pObj) )
270 {
271 pRes[0] = 0; pRes[1] = 1;
272 Gia_ObjCopySetTwoArray( p, iObj, pRes );
273 return;
274 }
275 pFans[0] = Gia_ObjFaninId0( pObj, iObj );
276 pFans[1] = Gia_ObjFaninId1( pObj, iObj );
277 fCompl[0] = Gia_ObjFaninC0( pObj );
278 fCompl[1] = Gia_ObjFaninC1( pObj );
279 if ( Gia_ManQuantCheckSupp(p, pFans[0], p->iSuppPi) )
280 Gia_ManQuantExist_rec( p, pFans[0], Lits0 );
281 else
282 Lits0[0] = Lits0[1] = Abc_Var2Lit( pFans[0], 0 );
283 if ( Gia_ManQuantCheckSupp(p, pFans[1], p->iSuppPi) )
284 Gia_ManQuantExist_rec( p, pFans[1], Lits1 );
285 else
286 Lits1[0] = Lits1[1] = Abc_Var2Lit( pFans[1], 0 );
287 pRes[0] = Gia_ManHashAnd( p, Abc_LitNotCond(Lits0[0], fCompl[0]), Abc_LitNotCond(Lits1[0], fCompl[1]) );
288 pRes[1] = Gia_ManHashAnd( p, Abc_LitNotCond(Lits0[1], fCompl[0]), Abc_LitNotCond(Lits1[1], fCompl[1]) );
289 Gia_ObjCopySetTwoArray( p, iObj, pRes );
290}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_ManQuantExistInt()

int Gia_ManQuantExistInt ( Gia_Man_t * p0,
int iLit,
Vec_Int_t * vCis,
Vec_Int_t * vSide,
Vec_Int_t * vAnds )

Definition at line 452 of file giaExist.c.

453{
454 int i, Lit, iOutLit, nAndsNew, pLits[2], pRes[2] = {0};
455 Gia_Man_t * pNew;
456 if ( iLit < 2 )
457 return 0;
458 if ( Vec_IntSize(vCis) == 0 )
459 return iLit;
460 if ( Vec_IntSize(vAnds) == 0 )
461 {
462 assert( Gia_ObjIsCi( Gia_ManObj(p0, Abc_Lit2Var(iLit)) ) );
463 return Vec_IntFind(vCis, Abc_Lit2Var(iLit)) == -1 ? iLit : 1;
464 }
465 pNew = Gia_ManQuantExist2Dup( p0, iLit, vCis, vSide, vAnds, &iOutLit );
466 if ( Vec_IntSize(&pNew->vCopiesTwo) < 2*Gia_ManObjNum(pNew) )
467 Vec_IntFillExtra( &pNew->vCopiesTwo, 2*Gia_ManObjNum(pNew), -1 );
468 Gia_ObjCopySetTwoArray( pNew, 0, pRes );
469 for ( i = 0; i < Gia_ManCiNum(pNew); i++ )
470 {
471 pRes[0] = pRes[1] = Abc_Var2Lit( i+1, 0 );
472 Gia_ObjCopySetTwoArray( pNew, i+1, pRes );
473 }
474 assert( pNew->iSuppPi == Gia_ManCiNum(pNew) - Vec_IntSize(vSide) );
475 for ( i = Gia_ManCiNum(pNew) - 1; i >= Vec_IntSize(vSide); i-- )
476 {
477 pRes[0] = 0; pRes[1] = 1;
478 Gia_ObjCopySetTwoArray( pNew, i+1, pRes );
479
480 pNew->iSuppPi--;
481 if ( Vec_IntSize(&pNew->vCopiesTwo) < 2*Gia_ManObjNum(pNew) )
482 Vec_IntFillExtra( &pNew->vCopiesTwo, 2*Gia_ManObjNum(pNew), -1 );
484 Gia_ManQuantExist_rec( pNew, Abc_Lit2Var(iOutLit), pLits );
485 pLits[0] = Abc_LitNotCond( pLits[0], Abc_LitIsCompl(iOutLit) );
486 pLits[1] = Abc_LitNotCond( pLits[1], Abc_LitIsCompl(iOutLit) );
487 iOutLit = Gia_ManHashOr( pNew, pLits[0], pLits[1] );
488
489 pRes[0] = pRes[1] = Abc_Var2Lit( i+1, 0 );
490 Gia_ObjCopySetTwoArray( pNew, i+1, pRes );
491 }
492 assert( pNew->iSuppPi == 0 );
493 Vec_IntAppend( vSide, vCis );
494 // transfer back
495 Gia_ManAppendCo( pNew, iOutLit );
496 nAndsNew = Gia_ManAndNum(p0);
497 Lit = Gia_ManDupConeBackObjs( p0, pNew, vSide );
498 nAndsNew = Gia_ManAndNum(p0) - nAndsNew;
499 Vec_IntShrink( vSide, Vec_IntSize(vSide) - Vec_IntSize(vCis) );
500// printf( "Performed quantification with %6d -> %6d nodes, %3d side-vars, %3d quant-vars, resulting in %5d new nodes. \n",
501// Vec_IntSize(vAnds), Gia_ManAndNum(pNew), Vec_IntSize(vSide), Vec_IntSize(vCis), nAndsNew );
502 Gia_ManStop( pNew );
503 return Lit;
504}
Gia_Man_t * Gia_ManQuantExist2Dup(Gia_Man_t *p, int iLit, Vec_Int_t *vCis, Vec_Int_t *vSide, Vec_Int_t *vAnds, int *pOutLit)
Definition giaExist.c:412
int Gia_ManDupConeBackObjs(Gia_Man_t *p, Gia_Man_t *pNew, Vec_Int_t *vObjs)
Definition giaDup.c:2282
int Gia_ManHashOr(Gia_Man_t *p, int iLit0, int iLit1)
Definition giaHash.c:621
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_ManQuantMarkUsedCis()

void Gia_ManQuantMarkUsedCis ( Gia_Man_t * p,
int(* pFuncCiToKeep )(void *, int),
void * pData )

Definition at line 167 of file giaExist.c.

168{
169 int i, CiId;
170 word * pInfo = Gia_ManQuantInfoId( p, 0 );
171 Abc_TtClear( pInfo, p->nSuppWords );
172 assert( Abc_TtIsConst0(pInfo, p->nSuppWords) );
173 Vec_IntForEachEntry( &p->vSuppVars, CiId, i )
174 if ( !pFuncCiToKeep( pData, CiId ) ) // quant var
175 Abc_TtSetBit( pInfo, i );
176}
unsigned __int64 word
DECLARATIONS ///.
Definition kitPerm.c:36
Here is the caller graph for this function:

◆ Gia_ManQuantSetSuppAnd()

void Gia_ManQuantSetSuppAnd ( Gia_Man_t * p,
Gia_Obj_t * pObj )

Definition at line 144 of file giaExist.c.

145{
146 int iObj = Gia_ObjId(p, pObj);
147 int iFan0 = Gia_ObjFaninId0(pObj, iObj);
148 int iFan1 = Gia_ObjFaninId1(pObj, iObj);
149 assert( Gia_ObjIsAnd(pObj) );
151 Abc_TtOr( Gia_ManQuantInfo(p, pObj), Gia_ManQuantInfoId(p, iFan0), Gia_ManQuantInfoId(p, iFan1), p->nSuppWords );
152}
Here is the call graph for this function:

◆ Gia_ManQuantSetSuppCi()

void Gia_ManQuantSetSuppCi ( Gia_Man_t * p,
Gia_Obj_t * pObj )

Definition at line 117 of file giaExist.c.

118{
119 assert( Gia_ObjIsCi(pObj) );
120 assert( p->vSuppWords != NULL );
121 if ( p->iSuppPi == 64 * p->nSuppWords )
122 {
123 word Data; int w, Count = 0, Size = Vec_WrdSize(p->vSuppWords);
124 Vec_Wrd_t * vTemp = Vec_WrdAlloc( Size ? 2 * Size : 1000 );
125 Vec_WrdForEachEntry( p->vSuppWords, Data, w )
126 {
127 Vec_WrdPush( vTemp, Data );
128 if ( ++Count == p->nSuppWords )
129 {
130 Vec_WrdPush( vTemp, 0 );
131 Count = 0;
132 }
133 }
134 Vec_WrdFree( p->vSuppWords );
135 p->vSuppWords = vTemp;
136 p->nSuppWords++;
137 assert( Vec_WrdSize(p->vSuppWords) == p->nSuppWords * Gia_ManObjNum(p) );
138 //printf( "Resizing to %d words.\n", p->nSuppWords );
139 }
140 assert( p->iSuppPi == Vec_IntSize(&p->vSuppVars) );
141 Vec_IntPush( &p->vSuppVars, Gia_ObjCioId(pObj) );
142 Abc_TtSetBit( Gia_ManQuantInfo(p, pObj), p->iSuppPi++ );
143}
#define Vec_WrdForEachEntry(vVec, Entry, i)
MACRO DEFINITIONS ///.
Definition vecWrd.h:54
typedefABC_NAMESPACE_HEADER_START struct Vec_Wrd_t_ Vec_Wrd_t
INCLUDES ///.
Definition vecWrd.h:42
Here is the caller graph for this function:

◆ Gia_ManQuantSetSuppStart()

void Gia_ManQuantSetSuppStart ( Gia_Man_t * p)

Definition at line 100 of file giaExist.c.

101{
102 assert( Gia_ManObjNum(p) == 1 );
103 assert( p->vSuppWords == NULL );
104 assert( Vec_IntSize(&p->vSuppVars) == 0 );
105 p->iSuppPi = 0;
106 p->nSuppWords = 1;
107 p->vSuppWords = Vec_WrdAlloc( 1000 );
108 Vec_WrdPush( p->vSuppWords, 0 );
109}
Here is the caller graph for this function:

◆ Gia_ManQuantSetSuppZero()

void Gia_ManQuantSetSuppZero ( Gia_Man_t * p)

Definition at line 110 of file giaExist.c.

111{
112 int w;
113 for ( w = 0; w < p->nSuppWords; w++ )
114 Vec_WrdPush( p->vSuppWords, 0 );
115 assert( Vec_WrdSize(p->vSuppWords) == p->nSuppWords * Gia_ManObjNum(p) );
116}
Here is the caller graph for this function:

◆ Gia_ManQuantUpdateCiSupp()

void Gia_ManQuantUpdateCiSupp ( Gia_Man_t * p,
int iObj )

Definition at line 157 of file giaExist.c.

158{
159 if ( Abc_TtIsConst0( Gia_ManQuantInfoId(p, iObj), p->nSuppWords ) )
160 Gia_ManQuantSetSuppCi( p, Gia_ManObj(p, iObj) );
161 assert( !Abc_TtIsConst0( Gia_ManQuantInfoId(p, iObj), p->nSuppWords ) );
162}
Here is the call graph for this function:

◆ Gia_ManQuantVerify()

void Gia_ManQuantVerify ( Gia_Man_t * p,
int iObj )

Definition at line 86 of file giaExist.c.

87{
88 word * pInfo = Gia_ManQuantInfoId( p, iObj ); int i, CiId;
89 assert( Gia_ObjIsAnd(Gia_ManObj(p, iObj)) );
90 Vec_IntForEachEntry( &p->vSuppVars, CiId, i )
91 {
93 if ( Abc_TtGetBit(pInfo, i) != Gia_ManQuantVerify_rec(p, iObj, CiId) )
94 printf( "Mismatch at node %d related to CI %d (%d).\n", iObj, CiId, Abc_TtGetBit(pInfo, i) );
95 }
96}
int Gia_ManQuantVerify_rec(Gia_Man_t *p, int iObj, int CiId)
Definition giaExist.c:74
Here is the call graph for this function:

◆ Gia_ManQuantVerify_rec()

int Gia_ManQuantVerify_rec ( Gia_Man_t * p,
int iObj,
int CiId )

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

Synopsis [Existentially quantified several variables.]

Description []

SideEffects []

SeeAlso []

Definition at line 74 of file giaExist.c.

75{
76 Gia_Obj_t * pObj;
77 if ( Gia_ObjIsTravIdCurrentId( p, iObj ) )
78 return 0;
79 Gia_ObjSetTravIdCurrentId( p, iObj );
80 pObj = Gia_ManObj( p, iObj );
81 if ( Gia_ObjIsCi(pObj) )
82 return Gia_ObjCioId(pObj) == CiId;
83 return Gia_ManQuantVerify_rec( p, Gia_ObjFaninId0(pObj, iObj), CiId ) ||
84 Gia_ManQuantVerify_rec( p, Gia_ObjFaninId1(pObj, iObj), CiId );
85}
Here is the call graph for this function:
Here is the caller graph for this function: