abc-master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
saigGlaCba.c File Reference
#include "saig.h"
#include "sat/bsat/satSolver.h"
#include "sat/cnf/cnf.h"

Go to the source code of this file.

Data Structures

struct  Aig_Gla1Man_t_
 

Typedefs

typedef
typedefABC_NAMESPACE_IMPL_START
struct Aig_Gla1Man_t_ 
Aig_Gla1Man_t
 DECLARATIONS ///. More...
 

Functions

static int Aig_Gla1AddConst (sat_solver *pSat, int iVar, int fCompl)
 FUNCTION DEFINITIONS ///. More...
 
static int Aig_Gla1AddBuffer (sat_solver *pSat, int iVar0, int iVar1, int fCompl)
 
static int Aig_Gla1AddNode (sat_solver *pSat, int iVar, int iVar0, int iVar1, int fCompl0, int fCompl1)
 
void Aig_Gla1CollectAbstr (Aig_Gla1Man_t *p)
 
void Aig_Gla1DeriveAbs_rec (Aig_Man_t *pNew, Aig_Obj_t *pObj)
 
Aig_Man_tAig_Gla1DeriveAbs (Aig_Gla1Man_t *p)
 
static int Aig_Gla1FetchVecId (Aig_Gla1Man_t *p, Aig_Obj_t *pObj)
 
static int Aig_Gla1FetchVar (Aig_Gla1Man_t *p, Aig_Obj_t *pObj, int k)
 
int Aig_Gla1ObjAddToSolver (Aig_Gla1Man_t *p, Aig_Obj_t *pObj, int k)
 
void Aig_Gla1CollectAssigned (Aig_Gla1Man_t *p, Vec_Int_t *vGateClasses)
 
Aig_Gla1Man_tAig_Gla1ManStart (Aig_Man_t *pAig, Vec_Int_t *vGateClassesOld, int fNaiveCnf)
 
void Aig_Gla1ManStop (Aig_Gla1Man_t *p)
 
Abc_Cex_tAig_Gla1DeriveCex (Aig_Gla1Man_t *p, int iFrame)
 
void Aig_Gla1PrintAbstr (Aig_Gla1Man_t *p, int f, int r, int v, int c)
 
void Aig_Gla1ExtendIncluded (Aig_Gla1Man_t *p)
 
Vec_Int_tAig_Gla1ManPerform (Aig_Man_t *pAig, Vec_Int_t *vGateClassesOld, int nStart, int nFramesMax, int nConfLimit, int TimeLimit, int fNaiveCnf, int fVerbose, int *piFrame)
 

Typedef Documentation

typedef typedefABC_NAMESPACE_IMPL_START struct Aig_Gla1Man_t_ Aig_Gla1Man_t

DECLARATIONS ///.

CFile****************************************************************

FileName [saigGlaCba.c]

SystemName [ABC: Logic synthesis and verification system.]

PackageName [Sequential AIG package.]

Synopsis [Gate level abstraction.]

Author [Alan Mishchenko]

Affiliation [UC Berkeley]

Date [Ver. 1.0. Started - June 20, 2005.]

Revision [

Id:
saigGlaCba.c,v 1.00 2005/06/20 00:00:00 alanmi Exp

]

Definition at line 32 of file saigGlaCba.c.

Function Documentation

static int Aig_Gla1AddBuffer ( sat_solver pSat,
int  iVar0,
int  iVar1,
int  fCompl 
)
inlinestatic

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

Synopsis [Adds buffer to the solver.]

Description []

SideEffects []

SeeAlso []

Definition at line 101 of file saigGlaCba.c.

102 {
103  lit Lits[2];
104 
105  Lits[0] = toLitCond( iVar0, 0 );
106  Lits[1] = toLitCond( iVar1, !fCompl );
107  if ( !sat_solver_addclause( pSat, Lits, Lits + 2 ) )
108  return 0;
109 
110  Lits[0] = toLitCond( iVar0, 1 );
111  Lits[1] = toLitCond( iVar1, fCompl );
112  if ( !sat_solver_addclause( pSat, Lits, Lits + 2 ) )
113  return 0;
114 
115  return 1;
116 }
int sat_solver_addclause(sat_solver *s, lit *begin, lit *end)
Definition: satSolver.c:1492
int lit
Definition: satVec.h:130
static lit toLitCond(int v, int c)
Definition: satVec.h:143
static int Aig_Gla1AddConst ( sat_solver pSat,
int  iVar,
int  fCompl 
)
inlinestatic

FUNCTION DEFINITIONS ///.

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

Synopsis [Adds constant to the solver.]

Description []

SideEffects []

SeeAlso []

Definition at line 82 of file saigGlaCba.c.

83 {
84  lit Lit = toLitCond( iVar, fCompl );
85  if ( !sat_solver_addclause( pSat, &Lit, &Lit + 1 ) )
86  return 0;
87  return 1;
88 }
int sat_solver_addclause(sat_solver *s, lit *begin, lit *end)
Definition: satSolver.c:1492
int lit
Definition: satVec.h:130
static lit toLitCond(int v, int c)
Definition: satVec.h:143
static int Aig_Gla1AddNode ( sat_solver pSat,
int  iVar,
int  iVar0,
int  iVar1,
int  fCompl0,
int  fCompl1 
)
inlinestatic

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

Synopsis [Adds buffer to the solver.]

Description []

SideEffects []

SeeAlso []

Definition at line 129 of file saigGlaCba.c.

130 {
131  lit Lits[3];
132 
133  Lits[0] = toLitCond( iVar, 1 );
134  Lits[1] = toLitCond( iVar0, fCompl0 );
135  if ( !sat_solver_addclause( pSat, Lits, Lits + 2 ) )
136  return 0;
137 
138  Lits[0] = toLitCond( iVar, 1 );
139  Lits[1] = toLitCond( iVar1, fCompl1 );
140  if ( !sat_solver_addclause( pSat, Lits, Lits + 2 ) )
141  return 0;
142 
143  Lits[0] = toLitCond( iVar, 0 );
144  Lits[1] = toLitCond( iVar0, !fCompl0 );
145  Lits[2] = toLitCond( iVar1, !fCompl1 );
146  if ( !sat_solver_addclause( pSat, Lits, Lits + 3 ) )
147  return 0;
148 
149  return 1;
150 }
int sat_solver_addclause(sat_solver *s, lit *begin, lit *end)
Definition: satSolver.c:1492
int lit
Definition: satVec.h:130
static lit toLitCond(int v, int c)
Definition: satVec.h:143
void Aig_Gla1CollectAbstr ( Aig_Gla1Man_t p)

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

Synopsis [Derives abstraction components (PIs, PPIs, flops, nodes).]

Description []

SideEffects []

SeeAlso []

Definition at line 163 of file saigGlaCba.c.

164 {
165  Aig_Obj_t * pObj;
166  int i, Entry;
167 /*
168  // make sure every neighbor of included objects is assigned a variable
169  Vec_IntForEachEntry( p->vIncluded, Entry, i )
170  {
171  if ( Entry == 0 )
172  continue;
173  assert( Entry == 1 );
174  pObj = Aig_ManObj( p->pAig, i );
175  if ( Vec_IntFind( p->vAssigned, Aig_ObjId(pObj) ) == -1 )
176  printf( "Aig_Gla1CollectAbstr(): Object not found\n" );
177  if ( Aig_ObjIsNode(pObj) )
178  {
179  if ( Vec_IntFind( p->vAssigned, Aig_ObjFaninId0(pObj) ) == -1 )
180  printf( "Aig_Gla1CollectAbstr(): Node's fanin is not found\n" );
181  if ( Vec_IntFind( p->vAssigned, Aig_ObjFaninId1(pObj) ) == -1 )
182  printf( "Aig_Gla1CollectAbstr(): Node's fanin is not found\n" );
183  }
184  else if ( Saig_ObjIsLo(p->pAig, pObj) )
185  {
186  Aig_Obj_t * pObjLi;
187  pObjLi = Saig_ObjLoToLi(p->pAig, pObj);
188  if ( Vec_IntFind( p->vAssigned, Aig_ObjFaninId0(pObjLi) ) == -1 )
189  printf( "Aig_Gla1CollectAbstr(): Flop's fanin is not found\n" );
190  }
191  else assert( Aig_ObjIsConst1(pObj) );
192  }
193 */
194  Vec_IntClear( p->vPis );
195  Vec_IntClear( p->vPPis );
196  Vec_IntClear( p->vFlops );
197  Vec_IntClear( p->vNodes );
198  Vec_IntForEachEntryReverse( p->vAssigned, Entry, i )
199  {
200  pObj = Aig_ManObj( p->pAig, Entry );
201  if ( Saig_ObjIsPi(p->pAig, pObj) )
202  Vec_IntPush( p->vPis, Aig_ObjId(pObj) );
203  else if ( !Vec_IntEntry(p->vIncluded, Aig_ObjId(pObj)) )
204  Vec_IntPush( p->vPPis, Aig_ObjId(pObj) );
205  else if ( Aig_ObjIsNode(pObj) )
206  Vec_IntPush( p->vNodes, Aig_ObjId(pObj) );
207  else if ( Saig_ObjIsLo(p->pAig, pObj) )
208  Vec_IntPush( p->vFlops, Aig_ObjId(pObj) );
209  else assert( Aig_ObjIsConst1(pObj) );
210  }
211 }
Aig_Man_t * pAig
Definition: llb3Image.c:49
static int Saig_ObjIsLo(Aig_Man_t *p, Aig_Obj_t *pObj)
Definition: saig.h:84
static Llb_Mgr_t * p
Definition: llb3Image.c:950
#define Vec_IntForEachEntryReverse(vVec, pEntry, i)
Definition: vecInt.h:62
static Aig_Obj_t * Aig_ManObj(Aig_Man_t *p, int i)
Definition: aig.h:270
static int Aig_ObjIsNode(Aig_Obj_t *pObj)
Definition: aig.h:280
static int Vec_IntEntry(Vec_Int_t *p, int i)
Definition: bblif.c:268
static int Aig_ObjIsConst1(Aig_Obj_t *pObj)
Definition: aig.h:274
Definition: aig.h:69
static void Vec_IntPush(Vec_Int_t *p, int Entry)
Definition: bblif.c:468
static int Aig_ObjId(Aig_Obj_t *pObj)
Definition: aig.h:286
#define assert(ex)
Definition: util_old.h:213
static void Vec_IntClear(Vec_Int_t *p)
Definition: bblif.c:452
static int Saig_ObjIsPi(Aig_Man_t *p, Aig_Obj_t *pObj)
Definition: saig.h:82
void Aig_Gla1CollectAssigned ( Aig_Gla1Man_t p,
Vec_Int_t vGateClasses 
)

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

Synopsis [Returns the array of neighbors.]

Description []

SideEffects []

SeeAlso []

Definition at line 441 of file saigGlaCba.c.

442 {
443  Aig_Obj_t * pObj;
444  int i, Entry;
445  Vec_IntForEachEntryReverse( vGateClasses, Entry, i )
446  {
447  if ( Entry == 0 )
448  continue;
449  assert( Entry == 1 );
450  pObj = Aig_ManObj( p->pAig, i );
451  Aig_Gla1FetchVecId( p, pObj );
452  if ( Aig_ObjIsNode(pObj) )
453  {
456  }
457  else if ( Saig_ObjIsLo(p->pAig, pObj) )
459  else assert( Aig_ObjIsConst1(pObj) );
460  }
461 }
Aig_Man_t * pAig
Definition: llb3Image.c:49
static int Saig_ObjIsLo(Aig_Man_t *p, Aig_Obj_t *pObj)
Definition: saig.h:84
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static Aig_Obj_t * Saig_ObjLoToLi(Aig_Man_t *p, Aig_Obj_t *pObj)
Definition: saig.h:86
static Aig_Obj_t * Aig_ObjFanin0(Aig_Obj_t *pObj)
Definition: aig.h:308
#define Vec_IntForEachEntryReverse(vVec, pEntry, i)
Definition: vecInt.h:62
static Aig_Obj_t * Aig_ManObj(Aig_Man_t *p, int i)
Definition: aig.h:270
static Aig_Obj_t * Aig_ObjFanin1(Aig_Obj_t *pObj)
Definition: aig.h:309
static int Aig_ObjIsNode(Aig_Obj_t *pObj)
Definition: aig.h:280
static int Aig_Gla1FetchVecId(Aig_Gla1Man_t *p, Aig_Obj_t *pObj)
Definition: saigGlaCba.c:300
static int Aig_ObjIsConst1(Aig_Obj_t *pObj)
Definition: aig.h:274
Definition: aig.h:69
#define assert(ex)
Definition: util_old.h:213
Aig_Man_t* Aig_Gla1DeriveAbs ( Aig_Gla1Man_t p)

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

Synopsis [Derives abstraction.]

Description []

SideEffects []

SeeAlso []

Definition at line 245 of file saigGlaCba.c.

246 {
247  Aig_Man_t * pNew;
248  Aig_Obj_t * pObj;
249  int i, RetValue;
250  assert( Saig_ManPoNum(p->pAig) == 1 );
251  // start the new manager
252  pNew = Aig_ManStart( 5000 );
253  pNew->pName = Abc_UtilStrsav( p->pAig->pName );
254  // create constant
255  Aig_ManCleanData( p->pAig );
257  // create PIs
258  Aig_ManForEachObjVec( p->vPis, p->pAig, pObj, i )
259  pObj->pData = Aig_ObjCreateCi(pNew);
260  // create additional PIs
261  Aig_ManForEachObjVec( p->vPPis, p->pAig, pObj, i )
262  pObj->pData = Aig_ObjCreateCi(pNew);
263  // create ROs
264  Aig_ManForEachObjVec( p->vFlops, p->pAig, pObj, i )
265  pObj->pData = Aig_ObjCreateCi(pNew);
266  // create internal nodes
267  Aig_ManForEachObjVec( p->vNodes, p->pAig, pObj, i )
268 // pObj->pData = Aig_And( pNew, Aig_ObjChild0Copy(pObj), Aig_ObjChild1Copy(pObj) );
269  Aig_Gla1DeriveAbs_rec( pNew, pObj );
270  // create PO
271  Saig_ManForEachPo( p->pAig, pObj, i )
272  pObj->pData = Aig_ObjCreateCo( pNew, Aig_ObjChild0Copy(pObj) );
273  // create RIs
274  Aig_ManForEachObjVec( p->vFlops, p->pAig, pObj, i )
275  {
276  assert( Saig_ObjIsLo(p->pAig, pObj) );
277  pObj = Saig_ObjLoToLi( p->pAig, pObj );
278  pObj->pData = Aig_ObjCreateCo( pNew, Aig_ObjChild0Copy(pObj) );
279  }
280  Aig_ManSetRegNum( pNew, Vec_IntSize(p->vFlops) );
281  // clean up
282  RetValue = Aig_ManCleanup( pNew );
283  if ( RetValue > 0 )
284  printf( "Aig_Gla1DeriveAbs(): Internal error! Object count mismatch.\n" );
285  assert( RetValue == 0 );
286  return pNew;
287 }
Aig_Obj_t * Aig_ObjCreateCo(Aig_Man_t *p, Aig_Obj_t *pDriver)
Definition: aigObj.c:66
Aig_Man_t * pAig
Definition: llb3Image.c:49
static int Saig_ManPoNum(Aig_Man_t *p)
Definition: saig.h:74
static int Saig_ObjIsLo(Aig_Man_t *p, Aig_Obj_t *pObj)
Definition: saig.h:84
#define Aig_ManForEachObjVec(vIds, p, pObj, i)
Definition: aig.h:408
typedefABC_NAMESPACE_HEADER_START struct Aig_Man_t_ Aig_Man_t
INCLUDES ///.
Definition: aig.h:50
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static Aig_Obj_t * Saig_ObjLoToLi(Aig_Man_t *p, Aig_Obj_t *pObj)
Definition: saig.h:86
void * pData
Definition: aig.h:87
Aig_Man_t * Aig_ManStart(int nNodesMax)
DECLARATIONS ///.
Definition: aigMan.c:47
Aig_Obj_t * Aig_ObjCreateCi(Aig_Man_t *p)
DECLARATIONS ///.
Definition: aigObj.c:45
void Aig_ManSetRegNum(Aig_Man_t *p, int nRegs)
Definition: aigMan.c:438
Definition: aig.h:69
static Aig_Obj_t * Aig_ObjChild0Copy(Aig_Obj_t *pObj)
Definition: aig.h:312
static Aig_Obj_t * Aig_ManConst1(Aig_Man_t *p)
Definition: aig.h:264
static int Vec_IntSize(Vec_Int_t *p)
Definition: bblif.c:252
#define Saig_ManForEachPo(p, pObj, i)
Definition: saig.h:93
#define assert(ex)
Definition: util_old.h:213
void Aig_Gla1DeriveAbs_rec(Aig_Man_t *pNew, Aig_Obj_t *pObj)
Definition: saigGlaCba.c:224
char * Abc_UtilStrsav(char *s)
Definition: starter.c:47
void Aig_ManCleanData(Aig_Man_t *p)
Definition: aigUtil.c:205
int Aig_ManCleanup(Aig_Man_t *p)
Definition: aigMan.c:265
void Aig_Gla1DeriveAbs_rec ( Aig_Man_t pNew,
Aig_Obj_t pObj 
)

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

Synopsis [Duplicates the AIG manager recursively.]

Description []

SideEffects []

SeeAlso []

Definition at line 224 of file saigGlaCba.c.

225 {
226  if ( pObj->pData )
227  return;
228  assert( Aig_ObjIsNode(pObj) );
229  Aig_Gla1DeriveAbs_rec( pNew, Aig_ObjFanin0(pObj) );
230  Aig_Gla1DeriveAbs_rec( pNew, Aig_ObjFanin1(pObj) );
231  pObj->pData = Aig_And( pNew, Aig_ObjChild0Copy(pObj), Aig_ObjChild1Copy(pObj) );
232 }
void * pData
Definition: aig.h:87
static Aig_Obj_t * Aig_ObjFanin0(Aig_Obj_t *pObj)
Definition: aig.h:308
static Aig_Obj_t * Aig_ObjFanin1(Aig_Obj_t *pObj)
Definition: aig.h:309
Aig_Obj_t * Aig_And(Aig_Man_t *p, Aig_Obj_t *p0, Aig_Obj_t *p1)
Definition: aigOper.c:104
static int Aig_ObjIsNode(Aig_Obj_t *pObj)
Definition: aig.h:280
static Aig_Obj_t * Aig_ObjChild1Copy(Aig_Obj_t *pObj)
Definition: aig.h:313
static Aig_Obj_t * Aig_ObjChild0Copy(Aig_Obj_t *pObj)
Definition: aig.h:312
#define assert(ex)
Definition: util_old.h:213
void Aig_Gla1DeriveAbs_rec(Aig_Man_t *pNew, Aig_Obj_t *pObj)
Definition: saigGlaCba.c:224
Abc_Cex_t* Aig_Gla1DeriveCex ( Aig_Gla1Man_t p,
int  iFrame 
)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 581 of file saigGlaCba.c.

582 {
583  Abc_Cex_t * pCex;
584  Aig_Obj_t * pObj;
585  int i, f, iVecId, iSatId;
586  pCex = Abc_CexAlloc( Vec_IntSize(p->vFlops), Vec_IntSize(p->vPis) + Vec_IntSize(p->vPPis), iFrame+1 );
587  pCex->iFrame = iFrame;
588  Aig_ManForEachObjVec( p->vPis, p->pAig, pObj, i )
589  {
590  iVecId = Vec_IntEntry( p->vObj2Vec, Aig_ObjId(pObj) );
591  assert( iVecId > 0 );
592  for ( f = 0; f <= iFrame; f++ )
593  {
594  iSatId = Vec_IntEntry( p->vVec2Var, iVecId * p->nFrames + f );
595  if ( iSatId == 0 )
596  continue;
597  assert( iSatId > 0 );
598  if ( sat_solver_var_value(p->pSat, iSatId) )
599  Abc_InfoSetBit( pCex->pData, pCex->nRegs + f * pCex->nPis + i );
600  }
601  }
602  Aig_ManForEachObjVec( p->vPPis, p->pAig, pObj, i )
603  {
604  iVecId = Vec_IntEntry( p->vObj2Vec, Aig_ObjId(pObj) );
605  assert( iVecId > 0 );
606  for ( f = 0; f <= iFrame; f++ )
607  {
608  iSatId = Vec_IntEntry( p->vVec2Var, iVecId * p->nFrames + f );
609  if ( iSatId == 0 )
610  continue;
611  assert( iSatId > 0 );
612  if ( sat_solver_var_value(p->pSat, iSatId) )
613  Abc_InfoSetBit( pCex->pData, pCex->nRegs + f * pCex->nPis + Vec_IntSize(p->vPis) + i );
614  }
615  }
616  return pCex;
617 }
Aig_Man_t * pAig
Definition: llb3Image.c:49
#define Aig_ManForEachObjVec(vIds, p, pObj, i)
Definition: aig.h:408
static Llb_Mgr_t * p
Definition: llb3Image.c:950
ABC_NAMESPACE_IMPL_START Abc_Cex_t * Abc_CexAlloc(int nRegs, int nRealPis, int nFrames)
DECLARATIONS ///.
Definition: utilCex.c:51
static int sat_solver_var_value(sat_solver *s, int v)
Definition: satSolver.h:200
static int Vec_IntEntry(Vec_Int_t *p, int i)
Definition: bblif.c:268
Definition: aig.h:69
static void Abc_InfoSetBit(unsigned *p, int i)
Definition: abc_global.h:259
static int Vec_IntSize(Vec_Int_t *p)
Definition: bblif.c:252
static int Aig_ObjId(Aig_Obj_t *pObj)
Definition: aig.h:286
#define assert(ex)
Definition: util_old.h:213
typedefABC_NAMESPACE_HEADER_START struct Abc_Cex_t_ Abc_Cex_t
INCLUDES ///.
Definition: utilCex.h:39
void Aig_Gla1ExtendIncluded ( Aig_Gla1Man_t p)

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

Synopsis [Prints current abstraction statistics.]

Description []

SideEffects []

SeeAlso []

Definition at line 651 of file saigGlaCba.c.

652 {
653  Aig_Obj_t * pObj;
654  int i, k;
655  Aig_ManForEachNode( p->pAig, pObj, i )
656  {
657  if ( !Vec_IntEntry( p->vIncluded, i ) )
658  continue;
659  Cnf_ComputeClauses( p->pAig, pObj, p->vLeaves, p->vVolume, NULL, p->vCover, p->vNodes );
660  Vec_PtrForEachEntry( Aig_Obj_t *, p->vVolume, pObj, k )
661  {
662  assert( Aig_ObjId(pObj) <= i );
663  Vec_IntWriteEntry( p->vIncluded, Aig_ObjId(pObj), 1 );
664  }
665  }
666 }
Aig_Man_t * pAig
Definition: llb3Image.c:49
static Llb_Mgr_t * p
Definition: llb3Image.c:950
void Cnf_ComputeClauses(Aig_Man_t *p, Aig_Obj_t *pRoot, Vec_Ptr_t *vLeaves, Vec_Ptr_t *vNodes, Vec_Int_t *vMap, Vec_Int_t *vCover, Vec_Int_t *vClauses)
Definition: cnfFast.c:198
static void Vec_IntWriteEntry(Vec_Int_t *p, int i, int Entry)
Definition: bblif.c:285
#define Aig_ManForEachNode(p, pObj, i)
Definition: aig.h:413
static int Vec_IntEntry(Vec_Int_t *p, int i)
Definition: bblif.c:268
Definition: aig.h:69
Vec_Ptr_t * vLeaves
Definition: llb3Image.c:50
static int Aig_ObjId(Aig_Obj_t *pObj)
Definition: aig.h:286
#define assert(ex)
Definition: util_old.h:213
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.
Definition: vecPtr.h:55
static int Aig_Gla1FetchVar ( Aig_Gla1Man_t p,
Aig_Obj_t pObj,
int  k 
)
inlinestatic

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

Synopsis [Finds existing SAT variable or creates a new one.]

Description []

SideEffects []

SeeAlso []

Definition at line 326 of file saigGlaCba.c.

327 {
328  int iVecId, iSatVar;
329  assert( k < p->nFrames );
330  iVecId = Aig_Gla1FetchVecId( p, pObj );
331  iSatVar = Vec_IntEntry( p->vVec2Var, iVecId * p->nFrames + k );
332  if ( iSatVar == 0 )
333  {
334  iSatVar = Vec_IntSize( p->vVar2Inf ) / 2;
335  Vec_IntPush( p->vVar2Inf, Aig_ObjId(pObj) );
336  Vec_IntPush( p->vVar2Inf, k );
337  Vec_IntWriteEntry( p->vVec2Var, iVecId * p->nFrames + k, iSatVar );
338  sat_solver_setnvars( p->pSat, iSatVar + 1 );
339  }
340  return iSatVar;
341 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static void Vec_IntWriteEntry(Vec_Int_t *p, int i, int Entry)
Definition: bblif.c:285
static int Aig_Gla1FetchVecId(Aig_Gla1Man_t *p, Aig_Obj_t *pObj)
Definition: saigGlaCba.c:300
void sat_solver_setnvars(sat_solver *s, int n)
Definition: satSolver.c:1072
static int Vec_IntEntry(Vec_Int_t *p, int i)
Definition: bblif.c:268
static void Vec_IntPush(Vec_Int_t *p, int Entry)
Definition: bblif.c:468
static int Vec_IntSize(Vec_Int_t *p)
Definition: bblif.c:252
static int Aig_ObjId(Aig_Obj_t *pObj)
Definition: aig.h:286
#define assert(ex)
Definition: util_old.h:213
static int Aig_Gla1FetchVecId ( Aig_Gla1Man_t p,
Aig_Obj_t pObj 
)
inlinestatic

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

Synopsis [Finds existing SAT variable or creates a new one.]

Description []

SideEffects []

SeeAlso []

Definition at line 300 of file saigGlaCba.c.

301 {
302  int i, iVecId;
303  iVecId = Vec_IntEntry( p->vObj2Vec, Aig_ObjId(pObj) );
304  if ( iVecId == 0 )
305  {
306  iVecId = Vec_IntSize( p->vVec2Var ) / p->nFrames;
307  for ( i = 0; i < p->nFrames; i++ )
308  Vec_IntPush( p->vVec2Var, 0 );
309  Vec_IntWriteEntry( p->vObj2Vec, Aig_ObjId(pObj), iVecId );
310  Vec_IntPushOrderReverse( p->vAssigned, Aig_ObjId(pObj) );
311  }
312  return iVecId;
313 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static void Vec_IntWriteEntry(Vec_Int_t *p, int i, int Entry)
Definition: bblif.c:285
static int Vec_IntEntry(Vec_Int_t *p, int i)
Definition: bblif.c:268
static void Vec_IntPush(Vec_Int_t *p, int Entry)
Definition: bblif.c:468
static int Vec_IntSize(Vec_Int_t *p)
Definition: bblif.c:252
static void Vec_IntPushOrderReverse(Vec_Int_t *p, int Entry)
Definition: vecInt.h:781
static int Aig_ObjId(Aig_Obj_t *pObj)
Definition: aig.h:286
Vec_Int_t* Aig_Gla1ManPerform ( Aig_Man_t pAig,
Vec_Int_t vGateClassesOld,
int  nStart,
int  nFramesMax,
int  nConfLimit,
int  TimeLimit,
int  fNaiveCnf,
int  fVerbose,
int *  piFrame 
)

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

Synopsis [Performs gate-level localization abstraction.]

Description [Returns array of objects included in the abstraction. This array may contain only const1, flop outputs, and internal nodes, that is, objects that should have clauses added to the SAT solver.]

SideEffects []

SeeAlso []

Definition at line 681 of file saigGlaCba.c.

682 {
683  Vec_Int_t * vResult = NULL;
684  Aig_Gla1Man_t * p;
685  Aig_Man_t * pAbs;
686  Aig_Obj_t * pObj;
687  Abc_Cex_t * pCex;
688  Vec_Int_t * vPPiRefine;
689  int f, g, r, i, iSatVar, Lit, Entry, RetValue;
690  int nConfBef, nConfAft;
691  clock_t clk, clkTotal = clock();
692  clock_t nTimeToStop = TimeLimit ? TimeLimit * CLOCKS_PER_SEC + clock(): 0;
693  assert( Saig_ManPoNum(pAig) == 1 );
694 
695  if ( nFramesMax == 0 )
696  nFramesMax = ABC_INFINITY;
697 
698  if ( fVerbose )
699  {
700  if ( TimeLimit )
701  printf( "Abstracting from frame %d to frame %d with timeout %d sec.\n", nStart, nFramesMax, TimeLimit );
702  else
703  printf( "Abstracting from frame %d to frame %d with no timeout.\n", nStart, nFramesMax );
704  }
705 
706  // start the solver
707  p = Aig_Gla1ManStart( pAig, vGateClassesOld, fNaiveCnf );
708  p->nFramesMax = nFramesMax;
709  p->nConfLimit = nConfLimit;
710  p->fVerbose = fVerbose;
711 
712  // include constant node
713  Vec_IntWriteEntry( p->vIncluded, 0, 1 );
714  Aig_Gla1FetchVecId( p, Aig_ManConst1(pAig) );
715 
716  // set runtime limit
717  if ( TimeLimit )
718  sat_solver_set_runtime_limit( p->pSat, nTimeToStop );
719 
720  // iterate over the timeframes
721  for ( f = 0; f < nFramesMax; f++ )
722  {
723  // initialize abstraction in this timeframe
724  Aig_ManForEachObjVec( p->vAssigned, pAig, pObj, i )
725  if ( Vec_IntEntry(p->vIncluded, Aig_ObjId(pObj)) )
726  if ( !Aig_Gla1ObjAddToSolver( p, pObj, f ) )
727  printf( "Error! SAT solver became UNSAT.\n" );
728 
729  // skip checking if we are not supposed to
730  if ( f < nStart )
731  continue;
732 
733  // create output literal to represent property failure
734  pObj = Aig_ManCo( pAig, 0 );
735  iSatVar = Aig_Gla1FetchVar( p, Aig_ObjFanin0(pObj), f );
736  Lit = toLitCond( iSatVar, Aig_ObjFaninC0(pObj) );
737 
738  // try solving the abstraction
740  for ( r = 0; r < ABC_INFINITY; r++ )
741  {
742  // try to find a counter-example
743  clk = clock();
744  nConfBef = p->pSat->stats.conflicts;
745  RetValue = sat_solver_solve( p->pSat, &Lit, &Lit + 1,
746  (ABC_INT64_T)nConfLimit, (ABC_INT64_T)0, (ABC_INT64_T)0, (ABC_INT64_T)0 );
747  nConfAft = p->pSat->stats.conflicts;
748  p->timeSat += clock() - clk;
749  if ( RetValue != l_True )
750  {
751  if ( fVerbose )
752  {
753  if ( r == 0 )
754  printf( "== %3d ==", f );
755  else
756  printf( " " );
757  if ( TimeLimit && clock() > nTimeToStop )
758  printf( " SAT solver timed out after %d seconds.\n", TimeLimit );
759  else if ( RetValue != l_False )
760  printf( " SAT solver returned UNDECIDED after %5d conflicts.\n", nConfAft - nConfBef );
761  else
762  {
763  printf( " SAT solver returned UNSAT after %5d conflicts. ", nConfAft - nConfBef );
764  Abc_PrintTime( 1, "Total time", clock() - clkTotal );
765  }
766  }
767  break;
768  }
769  clk = clock();
770  // derive abstraction
771  pAbs = Aig_Gla1DeriveAbs( p );
772  // derive counter-example
773  pCex = Aig_Gla1DeriveCex( p, f );
774  // verify the counter-example
775  RetValue = Saig_ManVerifyCex( pAbs, pCex );
776  if ( RetValue == 0 )
777  printf( "Error! CEX is invalid.\n" );
778  // perform refinement
779  vPPiRefine = Saig_ManCbaFilterInputs( pAbs, Vec_IntSize(p->vPis), pCex, 0 );
780  Vec_IntForEachEntry( vPPiRefine, Entry, i )
781  {
782  pObj = Aig_ManObj( pAig, Vec_IntEntry(p->vPPis, Entry) );
783  assert( Aig_ObjIsNode(pObj) || Saig_ObjIsLo(p->pAig, pObj) );
784  assert( Vec_IntEntry( p->vIncluded, Aig_ObjId(pObj) ) == 0 );
785  Vec_IntWriteEntry( p->vIncluded, Aig_ObjId(pObj), 1 );
786  for ( g = 0; g <= f; g++ )
787  if ( !Aig_Gla1ObjAddToSolver( p, pObj, g ) )
788  printf( "Error! SAT solver became UNSAT.\n" );
789  }
790  if ( Vec_IntSize(vPPiRefine) == 0 )
791  {
792  Vec_IntFreeP( &p->vIncluded );
793  Vec_IntFree( vPPiRefine );
794  Aig_ManStop( pAbs );
795  Abc_CexFree( pCex );
796  break;
797  }
798  Vec_IntFree( vPPiRefine );
799  Aig_ManStop( pAbs );
800  Abc_CexFree( pCex );
801  p->timeRef += clock() - clk;
802 
803  // prepare abstraction
805  if ( fVerbose )
806  Aig_Gla1PrintAbstr( p, f, r, p->pSat->size, nConfAft - nConfBef );
807  }
808  if ( RetValue != l_False )
809  break;
810  }
811  p->timeTotal = clock() - clkTotal;
812  if ( f == nFramesMax )
813  printf( "Finished %d frames without exceeding conflict limit (%d).\n", f, nConfLimit );
814  else if ( p->vIncluded == NULL )
815  printf( "The problem is SAT in frame %d. The CEX is currently not produced.\n", f );
816  else
817  printf( "Ran out of conflict limit (%d) at frame %d.\n", nConfLimit, f );
818  *piFrame = f;
819  // print stats
820  if ( fVerbose )
821  {
822  ABC_PRTP( "Sat ", p->timeSat, p->timeTotal );
823  ABC_PRTP( "Ref ", p->timeRef, p->timeTotal );
824  ABC_PRTP( "Total ", p->timeTotal, p->timeTotal );
825  }
826  // prepare return value
827  if ( !fNaiveCnf && p->vIncluded )
829  vResult = p->vIncluded; p->vIncluded = NULL;
830  Aig_Gla1ManStop( p );
831  return vResult;
832 }
void Aig_Gla1ManStop(Aig_Gla1Man_t *p)
Definition: saigGlaCba.c:541
static abctime sat_solver_set_runtime_limit(sat_solver *s, abctime Limit)
Definition: satSolver.h:233
static int Saig_ManPoNum(Aig_Man_t *p)
Definition: saig.h:74
static int Saig_ObjIsLo(Aig_Man_t *p, Aig_Obj_t *pObj)
Definition: saig.h:84
#define Aig_ManForEachObjVec(vIds, p, pObj, i)
Definition: aig.h:408
typedefABC_NAMESPACE_HEADER_START struct Aig_Man_t_ Aig_Man_t
INCLUDES ///.
Definition: aig.h:50
static Llb_Mgr_t * p
Definition: llb3Image.c:950
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
int Saig_ManVerifyCex(Aig_Man_t *pAig, Abc_Cex_t *p)
Definition: saigDup.c:279
int sat_solver_solve(sat_solver *s, lit *begin, lit *end, ABC_INT64_T nConfLimit, ABC_INT64_T nInsLimit, ABC_INT64_T nConfLimitGlobal, ABC_INT64_T nInsLimitGlobal)
Definition: satSolver.c:1700
void Aig_Gla1CollectAbstr(Aig_Gla1Man_t *p)
Definition: saigGlaCba.c:163
static Aig_Obj_t * Aig_ObjFanin0(Aig_Obj_t *pObj)
Definition: aig.h:308
#define l_True
Definition: SolverTypes.h:84
static Aig_Obj_t * Aig_ManObj(Aig_Man_t *p, int i)
Definition: aig.h:270
Abc_Cex_t * Aig_Gla1DeriveCex(Aig_Gla1Man_t *p, int iFrame)
Definition: saigGlaCba.c:581
void Aig_Gla1ExtendIncluded(Aig_Gla1Man_t *p)
Definition: saigGlaCba.c:651
for(p=first;p->value< newval;p=p->next)
static int Aig_Gla1FetchVar(Aig_Gla1Man_t *p, Aig_Obj_t *pObj, int k)
Definition: saigGlaCba.c:326
#define ABC_PRTP(a, t, T)
Definition: abc_global.h:223
int Aig_Gla1ObjAddToSolver(Aig_Gla1Man_t *p, Aig_Obj_t *pObj, int k)
Definition: saigGlaCba.c:354
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_Gla1FetchVecId(Aig_Gla1Man_t *p, Aig_Obj_t *pObj)
Definition: saigGlaCba.c:300
typedefABC_NAMESPACE_HEADER_START struct solver_t solver
Definition: solver.h:30
static lit toLitCond(int v, int c)
Definition: satVec.h:143
static int Vec_IntEntry(Vec_Int_t *p, int i)
Definition: bblif.c:268
if(last==0)
Definition: sparse_int.h:34
Definition: aig.h:69
static void Vec_IntFreeP(Vec_Int_t **p)
Definition: vecInt.h:289
Aig_Man_t * Aig_Gla1DeriveAbs(Aig_Gla1Man_t *p)
Definition: saigGlaCba.c:245
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
static Aig_Obj_t * Aig_ManCo(Aig_Man_t *p, int i)
Definition: aig.h:267
static int Vec_IntSize(Vec_Int_t *p)
Definition: bblif.c:252
Aig_Gla1Man_t * Aig_Gla1ManStart(Aig_Man_t *pAig, Vec_Int_t *vGateClassesOld, int fNaiveCnf)
Definition: saigGlaCba.c:474
void Aig_Gla1PrintAbstr(Aig_Gla1Man_t *p, int f, int r, int v, int c)
Definition: saigGlaCba.c:630
Vec_Int_t * Saig_ManCbaFilterInputs(Aig_Man_t *pAig, int iFirstFlopPi, Abc_Cex_t *pCex, int fVerbose)
Definition: absOldCex.c:785
#define l_False
Definition: SolverTypes.h:85
typedefABC_NAMESPACE_IMPL_START struct Aig_Gla1Man_t_ Aig_Gla1Man_t
DECLARATIONS ///.
Definition: saigGlaCba.c:32
#define ABC_INFINITY
MACRO DEFINITIONS ///.
Definition: abc_global.h:216
static int Aig_ObjId(Aig_Obj_t *pObj)
Definition: aig.h:286
#define assert(ex)
Definition: util_old.h:213
typedefABC_NAMESPACE_HEADER_START struct Abc_Cex_t_ Abc_Cex_t
INCLUDES ///.
Definition: utilCex.h:39
static void Vec_IntFree(Vec_Int_t *p)
Definition: bblif.c:235
void Abc_CexFree(Abc_Cex_t *p)
Definition: utilCex.c:371
#define Vec_IntForEachEntry(vVec, Entry, i)
MACRO DEFINITIONS ///.
Definition: vecInt.h:54
Aig_Gla1Man_t* Aig_Gla1ManStart ( Aig_Man_t pAig,
Vec_Int_t vGateClassesOld,
int  fNaiveCnf 
)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 474 of file saigGlaCba.c.

475 {
476  Aig_Gla1Man_t * p;
477  int i;
478 
479  p = ABC_CALLOC( Aig_Gla1Man_t, 1 );
480  p->pAig = pAig;
481  p->nFrames = 32;
482 
483  // unrolling
484  p->vObj2Vec = Vec_IntStart( Aig_ManObjNumMax(pAig) );
485  p->vVec2Var = Vec_IntAlloc( 1 << 20 );
486  p->vVar2Inf = Vec_IntAlloc( 1 << 20 );
487 
488  // skip first vector ID
489  for ( i = 0; i < p->nFrames; i++ )
490  Vec_IntPush( p->vVec2Var, -1 );
491  // skip first SAT variable
492  Vec_IntPush( p->vVar2Inf, -1 );
493  Vec_IntPush( p->vVar2Inf, -1 );
494 
495  // abstraction
496  p->vAssigned = Vec_IntAlloc( 1000 );
497  if ( vGateClassesOld )
498  {
499  p->vIncluded = Vec_IntDup( vGateClassesOld );
500  Aig_Gla1CollectAssigned( p, vGateClassesOld );
501  assert( fNaiveCnf );
502  }
503  else
504  p->vIncluded = Vec_IntStart( Aig_ManObjNumMax(pAig) );
505 
506  // components
507  p->vPis = Vec_IntAlloc( 1000 );
508  p->vPPis = Vec_IntAlloc( 1000 );
509  p->vFlops = Vec_IntAlloc( 1000 );
510  p->vNodes = Vec_IntAlloc( 1000 );
511 
512  // CNF computation
513  if ( !fNaiveCnf )
514  {
515  p->vLeaves = Vec_PtrAlloc( 100 );
516  p->vVolume = Vec_PtrAlloc( 100 );
517  p->vCover = Vec_IntAlloc( 1 << 16 );
518  p->vObj2Cnf = Vec_PtrStart( Aig_ManObjNumMax(pAig) );
519  p->vLits = Vec_IntAlloc( 100 );
520  Cnf_DeriveFastMark( pAig );
521  }
522 
523  // start the SAT solver
524  p->pSat = sat_solver_new();
525  sat_solver_setnvars( p->pSat, 256 );
526  return p;
527 }
static Vec_Ptr_t * Vec_PtrStart(int nSize)
Definition: vecPtr.h:106
void Cnf_DeriveFastMark(Aig_Man_t *p)
Definition: cnfFast.c:297
static Vec_Int_t * Vec_IntDup(Vec_Int_t *pVec)
Definition: vecInt.h:214
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static Vec_Int_t * Vec_IntStart(int nSize)
Definition: bblif.c:172
static Vec_Int_t * Vec_IntAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: bblif.c:149
void sat_solver_setnvars(sat_solver *s, int n)
Definition: satSolver.c:1072
static void Vec_IntPush(Vec_Int_t *p, int Entry)
Definition: bblif.c:468
static int Aig_ManObjNumMax(Aig_Man_t *p)
Definition: aig.h:259
sat_solver * sat_solver_new(void)
Definition: satSolver.c:1001
static Vec_Ptr_t * Vec_PtrAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: vecPtr.h:83
void Aig_Gla1CollectAssigned(Aig_Gla1Man_t *p, Vec_Int_t *vGateClasses)
Definition: saigGlaCba.c:441
#define ABC_CALLOC(type, num)
Definition: abc_global.h:230
typedefABC_NAMESPACE_IMPL_START struct Aig_Gla1Man_t_ Aig_Gla1Man_t
DECLARATIONS ///.
Definition: saigGlaCba.c:32
#define assert(ex)
Definition: util_old.h:213
void Aig_Gla1ManStop ( Aig_Gla1Man_t p)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 541 of file saigGlaCba.c.

542 {
543  Vec_IntFreeP( &p->vObj2Vec );
544  Vec_IntFreeP( &p->vVec2Var );
545  Vec_IntFreeP( &p->vVar2Inf );
546 
547  Vec_IntFreeP( &p->vAssigned );
548  Vec_IntFreeP( &p->vIncluded );
549 
550  Vec_IntFreeP( &p->vPis );
551  Vec_IntFreeP( &p->vPPis );
552  Vec_IntFreeP( &p->vFlops );
553  Vec_IntFreeP( &p->vNodes );
554 
555  if ( p->vObj2Cnf )
556  {
557  Vec_PtrFreeP( &p->vLeaves );
558  Vec_PtrFreeP( &p->vVolume );
559  Vec_IntFreeP( &p->vCover );
560  Vec_VecFreeP( (Vec_Vec_t **)&p->vObj2Cnf );
561  Vec_IntFreeP( &p->vLits );
563  }
564 
565  if ( p->pSat )
566  sat_solver_delete( p->pSat );
567  ABC_FREE( p );
568 }
Aig_Man_t * pAig
Definition: llb3Image.c:49
typedefABC_NAMESPACE_HEADER_START struct Vec_Vec_t_ Vec_Vec_t
INCLUDES ///.
Definition: vecVec.h:42
static Llb_Mgr_t * p
Definition: llb3Image.c:950
void sat_solver_delete(sat_solver *s)
Definition: satSolver.c:1141
static void Vec_IntFreeP(Vec_Int_t **p)
Definition: vecInt.h:289
Vec_Ptr_t * vLeaves
Definition: llb3Image.c:50
#define ABC_FREE(obj)
Definition: abc_global.h:232
void Aig_ManCleanMarkA(Aig_Man_t *p)
Definition: aigUtil.c:148
static void Vec_PtrFreeP(Vec_Ptr_t **p)
Definition: vecPtr.h:240
static void Vec_VecFreeP(Vec_Vec_t **p)
Definition: vecVec.h:367
int Aig_Gla1ObjAddToSolver ( Aig_Gla1Man_t p,
Aig_Obj_t pObj,
int  k 
)

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

Synopsis [Adds CNF for the given object in the given frame.]

Description [Returns 0, if the solver becames UNSAT.]

SideEffects []

SeeAlso []

Definition at line 354 of file saigGlaCba.c.

355 {
356  if ( k == p->nFrames )
357  {
358  int i, j, nVecIds = Vec_IntSize( p->vVec2Var ) / p->nFrames;
359  Vec_Int_t * vVec2VarNew = Vec_IntAlloc( 4 * nVecIds * p->nFrames );
360  for ( i = 0; i < nVecIds; i++ )
361  {
362  for ( j = 0; j < p->nFrames; j++ )
363  Vec_IntPush( vVec2VarNew, Vec_IntEntry( p->vVec2Var, i * p->nFrames + j ) );
364  for ( j = 0; j < p->nFrames; j++ )
365  Vec_IntPush( vVec2VarNew, i ? 0 : -1 );
366  }
367  Vec_IntFree( p->vVec2Var );
368  p->vVec2Var = vVec2VarNew;
369  p->nFrames *= 2;
370  }
371  assert( k < p->nFrames );
372  assert( Vec_IntEntry(p->vIncluded, Aig_ObjId(pObj)) );
373  if ( Aig_ObjIsConst1(pObj) )
374  return Aig_Gla1AddConst( p->pSat, Aig_Gla1FetchVar(p, pObj, k), 0 );
375  if ( Saig_ObjIsLo(p->pAig, pObj) )
376  {
377  Aig_Obj_t * pObjLi = Saig_ObjLoToLi(p->pAig, pObj);
378  if ( k == 0 )
379  {
380  Aig_Gla1FetchVecId( p, Aig_ObjFanin0(pObjLi) );
381  return Aig_Gla1AddConst( p->pSat, Aig_Gla1FetchVar(p, pObj, k), 1 );
382  }
383  return Aig_Gla1AddBuffer( p->pSat, Aig_Gla1FetchVar(p, pObj, k),
384  Aig_Gla1FetchVar(p, Aig_ObjFanin0(pObjLi), k-1),
385  Aig_ObjFaninC0(pObjLi) );
386  }
387  else
388  {
389  Vec_Int_t * vClauses;
390  int i, Entry;
391  assert( Aig_ObjIsNode(pObj) );
392  if ( p->vObj2Cnf == NULL )
393  return Aig_Gla1AddNode( p->pSat, Aig_Gla1FetchVar(p, pObj, k),
394  Aig_Gla1FetchVar(p, Aig_ObjFanin0(pObj), k),
395  Aig_Gla1FetchVar(p, Aig_ObjFanin1(pObj), k),
396  Aig_ObjFaninC0(pObj), Aig_ObjFaninC1(pObj) );
397  // derive clauses
398  assert( pObj->fMarkA );
399  vClauses = (Vec_Int_t *)Vec_PtrEntry( p->vObj2Cnf, Aig_ObjId(pObj) );
400  if ( vClauses == NULL )
401  {
402  Vec_PtrWriteEntry( p->vObj2Cnf, Aig_ObjId(pObj), (vClauses = Vec_IntAlloc(16)) );
403  Cnf_ComputeClauses( p->pAig, pObj, p->vLeaves, p->vVolume, NULL, p->vCover, vClauses );
404  }
405  // derive variables
406  Cnf_CollectLeaves( pObj, p->vLeaves, 0 );
407  Vec_PtrForEachEntry( Aig_Obj_t *, p->vLeaves, pObj, i )
408  Aig_Gla1FetchVar( p, pObj, k );
409  // translate clauses
410  assert( Vec_IntSize(vClauses) >= 2 );
411  assert( Vec_IntEntry(vClauses, 0) == 0 );
412  Vec_IntForEachEntry( vClauses, Entry, i )
413  {
414  if ( Entry == 0 )
415  {
416  Vec_IntClear( p->vLits );
417  continue;
418  }
419  Vec_IntPush( p->vLits, (Entry & 1) ^ (2 * Aig_Gla1FetchVar(p, Aig_ManObj(p->pAig, Entry >> 1), k)) );
420  if ( i == Vec_IntSize(vClauses) - 1 || Vec_IntEntry(vClauses, i+1) == 0 )
421  {
422  if ( !sat_solver_addclause( p->pSat, Vec_IntArray(p->vLits), Vec_IntArray(p->vLits)+Vec_IntSize(p->vLits) ) )
423  return 0;
424  }
425  }
426  return 1;
427  }
428 }
static int * Vec_IntArray(Vec_Int_t *p)
Definition: vecInt.h:328
Aig_Man_t * pAig
Definition: llb3Image.c:49
static int Saig_ObjIsLo(Aig_Man_t *p, Aig_Obj_t *pObj)
Definition: saig.h:84
static Llb_Mgr_t * p
Definition: llb3Image.c:950
int sat_solver_addclause(sat_solver *s, lit *begin, lit *end)
Definition: satSolver.c:1492
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition: bblif.c:37
static Aig_Obj_t * Saig_ObjLoToLi(Aig_Man_t *p, Aig_Obj_t *pObj)
Definition: saig.h:86
static Aig_Obj_t * Aig_ObjFanin0(Aig_Obj_t *pObj)
Definition: aig.h:308
unsigned int fMarkA
Definition: aig.h:79
static Aig_Obj_t * Aig_ManObj(Aig_Man_t *p, int i)
Definition: aig.h:270
void Cnf_ComputeClauses(Aig_Man_t *p, Aig_Obj_t *pRoot, Vec_Ptr_t *vLeaves, Vec_Ptr_t *vNodes, Vec_Int_t *vMap, Vec_Int_t *vCover, Vec_Int_t *vClauses)
Definition: cnfFast.c:198
static int Aig_Gla1AddNode(sat_solver *pSat, int iVar, int iVar0, int iVar1, int fCompl0, int fCompl1)
Definition: saigGlaCba.c:129
static Aig_Obj_t * Aig_ObjFanin1(Aig_Obj_t *pObj)
Definition: aig.h:309
static int Aig_Gla1FetchVar(Aig_Gla1Man_t *p, Aig_Obj_t *pObj, int k)
Definition: saigGlaCba.c:326
static int Aig_ObjIsNode(Aig_Obj_t *pObj)
Definition: aig.h:280
static int Aig_Gla1AddConst(sat_solver *pSat, int iVar, int fCompl)
FUNCTION DEFINITIONS ///.
Definition: saigGlaCba.c:82
static Vec_Int_t * Vec_IntAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: bblif.c:149
static int Aig_Gla1FetchVecId(Aig_Gla1Man_t *p, Aig_Obj_t *pObj)
Definition: saigGlaCba.c:300
static int Vec_IntEntry(Vec_Int_t *p, int i)
Definition: bblif.c:268
static int Aig_ObjIsConst1(Aig_Obj_t *pObj)
Definition: aig.h:274
Definition: aig.h:69
static void Vec_IntPush(Vec_Int_t *p, int Entry)
Definition: bblif.c:468
void Cnf_CollectLeaves(Aig_Obj_t *pRoot, Vec_Ptr_t *vSuper, int fStopCompl)
Definition: cnfFast.c:76
static int Aig_ObjFaninC0(Aig_Obj_t *pObj)
Definition: aig.h:306
static void Vec_PtrWriteEntry(Vec_Ptr_t *p, int i, void *Entry)
Definition: vecPtr.h:396
Vec_Ptr_t * vLeaves
Definition: llb3Image.c:50
static void * Vec_PtrEntry(Vec_Ptr_t *p, int i)
Definition: vecPtr.h:362
static int Vec_IntSize(Vec_Int_t *p)
Definition: bblif.c:252
static int Aig_ObjFaninC1(Aig_Obj_t *pObj)
Definition: aig.h:307
static int Aig_ObjId(Aig_Obj_t *pObj)
Definition: aig.h:286
#define assert(ex)
Definition: util_old.h:213
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
static void Vec_IntClear(Vec_Int_t *p)
Definition: bblif.c:452
#define Vec_IntForEachEntry(vVec, Entry, i)
MACRO DEFINITIONS ///.
Definition: vecInt.h:54
static int Aig_Gla1AddBuffer(sat_solver *pSat, int iVar0, int iVar1, int fCompl)
Definition: saigGlaCba.c:101
void Aig_Gla1PrintAbstr ( Aig_Gla1Man_t p,
int  f,
int  r,
int  v,
int  c 
)

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

Synopsis [Prints current abstraction statistics.]

Description []

SideEffects []

SeeAlso []

Definition at line 630 of file saigGlaCba.c.

631 {
632  if ( r == 0 )
633  printf( "== %3d ==", f );
634  else
635  printf( " " );
636  printf( " %4d PI =%6d PPI =%6d FF =%6d Node =%6d Var =%7d Conf =%6d\n",
637  r, Vec_IntSize(p->vPis), Vec_IntSize(p->vPPis), Vec_IntSize(p->vFlops), Vec_IntSize(p->vNodes), v, c );
638 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static int Vec_IntSize(Vec_Int_t *p)
Definition: bblif.c:252