abc-master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
sswConstr.c File Reference
#include "sswInt.h"
#include "sat/cnf/cnf.h"
#include "misc/bar/bar.h"

Go to the source code of this file.

Functions

ABC_NAMESPACE_IMPL_START
Aig_Man_t
Ssw_FramesWithConstraints (Aig_Man_t *p, int nFrames)
 DECLARATIONS ///. More...
 
int Ssw_ManSetConstrPhases (Aig_Man_t *p, int nFrames, Vec_Int_t **pvInits)
 
int Ssw_ManSetConstrPhases_ (Aig_Man_t *p, int nFrames, Vec_Int_t **pvInits)
 
void Ssw_ManPrintPolarity (Aig_Man_t *p)
 
void Ssw_ManRefineByConstrSim (Ssw_Man_t *p)
 
int Ssw_ManSweepNodeConstr (Ssw_Man_t *p, Aig_Obj_t *pObj, int f, int fBmc)
 
Aig_Obj_tSsw_ManSweepBmcConstr_rec (Ssw_Man_t *p, Aig_Obj_t *pObj, int f)
 
int Ssw_ManSweepBmcConstr_old (Ssw_Man_t *p)
 
int Ssw_ManSweepBmcConstr (Ssw_Man_t *p)
 
Aig_Obj_tSsw_FramesWithClasses_rec (Ssw_Man_t *p, Aig_Obj_t *pObj, int f)
 
int Ssw_ManSweepConstr (Ssw_Man_t *p)
 

Function Documentation

Aig_Obj_t* Ssw_FramesWithClasses_rec ( Ssw_Man_t p,
Aig_Obj_t pObj,
int  f 
)

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

Synopsis [Performs fraiging for the internal nodes.]

Description []

SideEffects []

SeeAlso []

Definition at line 581 of file sswConstr.c.

582 {
583  Aig_Obj_t * pObjNew, * pObjLi;
584  pObjNew = Ssw_ObjFrame( p, pObj, f );
585  if ( pObjNew )
586  return pObjNew;
587  assert( !Saig_ObjIsPi(p->pAig, pObj) );
588  if ( Saig_ObjIsLo(p->pAig, pObj) )
589  {
590  assert( f > 0 );
591  pObjLi = Saig_ObjLoToLi( p->pAig, pObj );
592  pObjNew = Ssw_FramesWithClasses_rec( p, Aig_ObjFanin0(pObjLi), f-1 );
593  pObjNew = Aig_NotCond( pObjNew, Aig_ObjFaninC0(pObjLi) );
594  }
595  else
596  {
597  assert( Aig_ObjIsNode(pObj) );
600  pObjNew = Aig_And( p->pFrames, Ssw_ObjChild0Fra(p, pObj, f), Ssw_ObjChild1Fra(p, pObj, f) );
601  }
602  Ssw_ObjSetFrame( p, pObj, f, pObjNew );
603  assert( pObjNew != NULL );
604  return pObjNew;
605 }
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 Aig_Obj_t * Ssw_ObjChild0Fra(Ssw_Man_t *p, Aig_Obj_t *pObj, int i)
Definition: sswInt.h:185
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
static Aig_Obj_t * Aig_ObjFanin1(Aig_Obj_t *pObj)
Definition: aig.h:309
static Aig_Obj_t * Ssw_ObjChild1Fra(Ssw_Man_t *p, Aig_Obj_t *pObj, int i)
Definition: sswInt.h:186
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
Definition: aig.h:69
static int Aig_ObjFaninC0(Aig_Obj_t *pObj)
Definition: aig.h:306
static void Ssw_ObjSetFrame(Ssw_Man_t *p, Aig_Obj_t *pObj, int i, Aig_Obj_t *pNode)
Definition: sswInt.h:183
#define assert(ex)
Definition: util_old.h:213
static Aig_Obj_t * Aig_NotCond(Aig_Obj_t *p, int c)
Definition: aig.h:248
Aig_Obj_t * Ssw_FramesWithClasses_rec(Ssw_Man_t *p, Aig_Obj_t *pObj, int f)
Definition: sswConstr.c:581
static int Saig_ObjIsPi(Aig_Man_t *p, Aig_Obj_t *pObj)
Definition: saig.h:82
static Aig_Obj_t * Ssw_ObjFrame(Ssw_Man_t *p, Aig_Obj_t *pObj, int i)
Definition: sswInt.h:182
ABC_NAMESPACE_IMPL_START Aig_Man_t* Ssw_FramesWithConstraints ( Aig_Man_t p,
int  nFrames 
)

DECLARATIONS ///.

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

FileName [sswConstr.c]

SystemName [ABC: Logic synthesis and verification system.]

PackageName [Inductive prover with constraints.]

Synopsis [One round of SAT sweeping.]

Author [Alan Mishchenko]

Affiliation [UC Berkeley]

Date [Ver. 1.0. Started - September 1, 2008.]

Revision [

Id:
sswConstr.c,v 1.00 2008/09/01 00:00:00 alanmi Exp

]FUNCTION DEFINITIONS /// Function*************************************************************

Synopsis [Constructs initialized timeframes with constraints as POs.]

Description []

SideEffects []

SeeAlso []

Definition at line 47 of file sswConstr.c.

48 {
49  Aig_Man_t * pFrames;
50  Aig_Obj_t * pObj, * pObjLi, * pObjLo;
51  int i, f;
52 // assert( Saig_ManConstrNum(p) > 0 );
53  assert( Aig_ManRegNum(p) > 0 );
55  // start the fraig package
56  pFrames = Aig_ManStart( Aig_ManObjNumMax(p) * nFrames );
57  // create latches for the first frame
58  Saig_ManForEachLo( p, pObj, i )
59  Aig_ObjSetCopy( pObj, Aig_ManConst0(pFrames) );
60  // add timeframes
61  for ( f = 0; f < nFrames; f++ )
62  {
63  // map constants and PIs
65  Saig_ManForEachPi( p, pObj, i )
66  Aig_ObjSetCopy( pObj, Aig_ObjCreateCi(pFrames) );
67  // add internal nodes of this frame
68  Aig_ManForEachNode( p, pObj, i )
69  Aig_ObjSetCopy( pObj, Aig_And( pFrames, Aig_ObjChild0Copy(pObj), Aig_ObjChild1Copy(pObj) ) );
70  // transfer to the primary output
71  Aig_ManForEachCo( p, pObj, i )
72  Aig_ObjSetCopy( pObj, Aig_ObjChild0Copy(pObj) );
73  // create constraint outputs
74  Saig_ManForEachPo( p, pObj, i )
75  {
76  if ( i < Saig_ManPoNum(p) - Saig_ManConstrNum(p) )
77  continue;
78  Aig_ObjCreateCo( pFrames, Aig_Not( Aig_ObjCopy(pObj) ) );
79  }
80  // transfer latch inputs to the latch outputs
81  Saig_ManForEachLiLo( p, pObjLi, pObjLo, i )
82  Aig_ObjSetCopy( pObjLo, Aig_ObjCopy(pObjLi) );
83  }
84  // remove dangling nodes
85  Aig_ManCleanup( pFrames );
86  return pFrames;
87 }
Aig_Obj_t * Aig_ObjCreateCo(Aig_Man_t *p, Aig_Obj_t *pDriver)
Definition: aigObj.c:66
static int Saig_ManPoNum(Aig_Man_t *p)
Definition: saig.h:74
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
#define Saig_ManForEachLiLo(p, pObjLi, pObjLo, i)
Definition: saig.h:101
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
static Aig_Obj_t * Aig_ManConst0(Aig_Man_t *p)
Definition: aig.h:263
#define Aig_ManForEachCo(p, pObj, i)
Definition: aig.h:398
static Aig_Obj_t * Aig_Not(Aig_Obj_t *p)
Definition: aig.h:247
for(p=first;p->value< newval;p=p->next)
Aig_Obj_t * Aig_And(Aig_Man_t *p, Aig_Obj_t *p0, Aig_Obj_t *p1)
Definition: aigOper.c:104
static int Saig_ManConstrNum(Aig_Man_t *p)
Definition: saig.h:78
#define Aig_ManForEachNode(p, pObj, i)
Definition: aig.h:413
static int Aig_ManCiNum(Aig_Man_t *p)
Definition: aig.h:251
static Aig_Obj_t * Aig_ObjChild1Copy(Aig_Obj_t *pObj)
Definition: aig.h:313
Definition: aig.h:69
#define Saig_ManForEachLo(p, pObj, i)
Definition: saig.h:96
static Aig_Obj_t * Aig_ObjChild0Copy(Aig_Obj_t *pObj)
Definition: aig.h:312
static int Aig_ManObjNumMax(Aig_Man_t *p)
Definition: aig.h:259
static Aig_Obj_t * Aig_ManConst1(Aig_Man_t *p)
Definition: aig.h:264
static void Aig_ObjSetCopy(Aig_Obj_t *pObj, Aig_Obj_t *pCopy)
Definition: aig.h:319
static Aig_Obj_t * Aig_ObjCopy(Aig_Obj_t *pObj)
Definition: aig.h:318
static int Aig_ManRegNum(Aig_Man_t *p)
Definition: aig.h:260
#define Saig_ManForEachPo(p, pObj, i)
Definition: saig.h:93
#define assert(ex)
Definition: util_old.h:213
int Aig_ManCleanup(Aig_Man_t *p)
Definition: aigMan.c:265
#define Saig_ManForEachPi(p, pObj, i)
Definition: saig.h:91
void Ssw_ManPrintPolarity ( Aig_Man_t p)

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

Synopsis [Performs fraiging for one node.]

Description [Returns the fraiged node.]

SideEffects []

SeeAlso []

Definition at line 227 of file sswConstr.c.

228 {
229  Aig_Obj_t * pObj;
230  int i;
231  Aig_ManForEachObj( p, pObj, i )
232  Abc_Print( 1, "%d", pObj->fPhase );
233  Abc_Print( 1, "\n" );
234 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
Definition: aig.h:69
static void Abc_Print(int level, const char *format,...)
Definition: abc_global.h:313
#define Aig_ManForEachObj(p, pObj, i)
Definition: aig.h:403
void Ssw_ManRefineByConstrSim ( Ssw_Man_t p)

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

Synopsis [Performs fraiging for one node.]

Description [Returns the fraiged node.]

SideEffects []

SeeAlso []

Definition at line 247 of file sswConstr.c.

248 {
249  Aig_Obj_t * pObj, * pObjLi;
250  int f, i, iLits, RetValue1, RetValue2;
251  int nFrames = Vec_IntSize(p->vInits) / Saig_ManPiNum(p->pAig);
252  assert( Vec_IntSize(p->vInits) % Saig_ManPiNum(p->pAig) == 0 );
253  // assign register outputs
254  Saig_ManForEachLi( p->pAig, pObj, i )
255  pObj->fMarkB = 0;
256  // simulate the timeframes
257  iLits = 0;
258  for ( f = 0; f < nFrames; f++ )
259  {
260  // set the PI simulation information
261  Aig_ManConst1(p->pAig)->fMarkB = 1;
262  Saig_ManForEachPi( p->pAig, pObj, i )
263  pObj->fMarkB = Vec_IntEntry( p->vInits, iLits++ );
264  Saig_ManForEachLiLo( p->pAig, pObjLi, pObj, i )
265  pObj->fMarkB = pObjLi->fMarkB;
266  // simulate internal nodes
267  Aig_ManForEachNode( p->pAig, pObj, i )
268  pObj->fMarkB = ( Aig_ObjFanin0(pObj)->fMarkB ^ Aig_ObjFaninC0(pObj) )
269  & ( Aig_ObjFanin1(pObj)->fMarkB ^ Aig_ObjFaninC1(pObj) );
270  // assign the COs
271  Aig_ManForEachCo( p->pAig, pObj, i )
272  pObj->fMarkB = ( Aig_ObjFanin0(pObj)->fMarkB ^ Aig_ObjFaninC0(pObj) );
273  // check the outputs
274  Saig_ManForEachPo( p->pAig, pObj, i )
275  {
276  if ( i < Saig_ManPoNum(p->pAig) - Saig_ManConstrNum(p->pAig) )
277  {
278  if ( pObj->fMarkB && Saig_ManConstrNum(p->pAig) )
279  Abc_Print( 1, "output %d failed in frame %d.\n", i, f );
280  }
281  else
282  {
283  if ( pObj->fMarkB && Saig_ManConstrNum(p->pAig) )
284  Abc_Print( 1, "constraint %d failed in frame %d.\n", i, f );
285  }
286  }
287  // transfer
288  if ( f == 0 )
289  { // copy markB into phase
290  Aig_ManForEachObj( p->pAig, pObj, i )
291  pObj->fPhase = pObj->fMarkB;
292  }
293  else
294  { // refine classes
295  RetValue1 = Ssw_ClassesRefineConst1( p->ppClasses, 0 );
296  RetValue2 = Ssw_ClassesRefine( p->ppClasses, 0 );
297  }
298  }
299  assert( iLits == Vec_IntSize(p->vInits) );
300 }
Aig_Man_t * pAig
Definition: llb3Image.c:49
static int Saig_ManPoNum(Aig_Man_t *p)
Definition: saig.h:74
static Llb_Mgr_t * p
Definition: llb3Image.c:950
#define Saig_ManForEachLiLo(p, pObjLi, pObjLo, i)
Definition: saig.h:101
unsigned int fMarkB
Definition: aig.h:80
static Aig_Obj_t * Aig_ObjFanin0(Aig_Obj_t *pObj)
Definition: aig.h:308
#define Aig_ManForEachCo(p, pObj, i)
Definition: aig.h:398
int Ssw_ClassesRefine(Ssw_Cla_t *p, int fRecursive)
Definition: sswClass.c:1034
static Aig_Obj_t * Aig_ObjFanin1(Aig_Obj_t *pObj)
Definition: aig.h:309
for(p=first;p->value< newval;p=p->next)
static int Saig_ManConstrNum(Aig_Man_t *p)
Definition: saig.h:78
#define Aig_ManForEachNode(p, pObj, i)
Definition: aig.h:413
#define Saig_ManForEachLi(p, pObj, i)
Definition: saig.h:98
static int Vec_IntEntry(Vec_Int_t *p, int i)
Definition: bblif.c:268
else
Definition: sparse_int.h:55
Definition: aig.h:69
static void Abc_Print(int level, const char *format,...)
Definition: abc_global.h:313
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 int Vec_IntSize(Vec_Int_t *p)
Definition: bblif.c:252
#define Aig_ManForEachObj(p, pObj, i)
Definition: aig.h:403
static int Saig_ManPiNum(Aig_Man_t *p)
MACRO DEFINITIONS ///.
Definition: saig.h:73
static int Aig_ObjFaninC1(Aig_Obj_t *pObj)
Definition: aig.h:307
#define Saig_ManForEachPo(p, pObj, i)
Definition: saig.h:93
#define assert(ex)
Definition: util_old.h:213
int Ssw_ClassesRefineConst1(Ssw_Cla_t *p, int fRecursive)
Definition: sswClass.c:1119
#define Saig_ManForEachPi(p, pObj, i)
Definition: saig.h:91
int Ssw_ManSetConstrPhases ( Aig_Man_t p,
int  nFrames,
Vec_Int_t **  pvInits 
)

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

Synopsis [Finds one satisfiable assignment of the timeframes.]

Description []

SideEffects []

SeeAlso []

Definition at line 100 of file sswConstr.c.

101 {
102  Aig_Man_t * pFrames;
103  sat_solver * pSat;
104  Cnf_Dat_t * pCnf;
105  Aig_Obj_t * pObj;
106  int i, RetValue;
107  if ( pvInits )
108  *pvInits = NULL;
109 // assert( p->nConstrs > 0 );
110  // derive the timeframes
111  pFrames = Ssw_FramesWithConstraints( p, nFrames );
112  // create CNF
113  pCnf = Cnf_Derive( pFrames, 0 );
114  // create SAT solver
115  pSat = (sat_solver *)Cnf_DataWriteIntoSolver( pCnf, 1, 0 );
116  if ( pSat == NULL )
117  {
118  Cnf_DataFree( pCnf );
119  Aig_ManStop( pFrames );
120  return 1;
121  }
122  // solve
123  RetValue = sat_solver_solve( pSat, NULL, NULL,
124  (ABC_INT64_T)1000000, (ABC_INT64_T)0, (ABC_INT64_T)0, (ABC_INT64_T)0 );
125  if ( RetValue == l_True && pvInits )
126  {
127  *pvInits = Vec_IntAlloc( 1000 );
128  Aig_ManForEachCi( pFrames, pObj, i )
129  Vec_IntPush( *pvInits, sat_solver_var_value(pSat, pCnf->pVarNums[Aig_ObjId(pObj)]) );
130 
131 // Aig_ManForEachCi( pFrames, pObj, i )
132 // Abc_Print( 1, "%d", Vec_IntEntry(*pvInits, i) );
133 // Abc_Print( 1, "\n" );
134  }
135  sat_solver_delete( pSat );
136  Cnf_DataFree( pCnf );
137  Aig_ManStop( pFrames );
138  if ( RetValue == l_False )
139  return 1;
140  if ( RetValue == l_True )
141  return 0;
142  return -1;
143 }
Cnf_Dat_t * Cnf_Derive(Aig_Man_t *pAig, int nOutputs)
Definition: cnfCore.c:165
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
void Aig_ManStop(Aig_Man_t *p)
Definition: aigMan.c:187
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 sat_solver_delete(sat_solver *s)
Definition: satSolver.c:1141
#define Aig_ManForEachCi(p, pObj, i)
ITERATORS ///.
Definition: aig.h:393
#define l_True
Definition: SolverTypes.h:84
Definition: cnf.h:56
static int sat_solver_var_value(sat_solver *s, int v)
Definition: satSolver.h:200
static Vec_Int_t * Vec_IntAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: bblif.c:149
ABC_NAMESPACE_IMPL_START Aig_Man_t * Ssw_FramesWithConstraints(Aig_Man_t *p, int nFrames)
DECLARATIONS ///.
Definition: sswConstr.c:47
if(last==0)
Definition: sparse_int.h:34
Definition: aig.h:69
static void Vec_IntPush(Vec_Int_t *p, int Entry)
Definition: bblif.c:468
void * Cnf_DataWriteIntoSolver(Cnf_Dat_t *p, int nFrames, int fInit)
Definition: cnfMan.c:463
#define l_False
Definition: SolverTypes.h:85
void Cnf_DataFree(Cnf_Dat_t *p)
Definition: cnfMan.c:180
static int Aig_ObjId(Aig_Obj_t *pObj)
Definition: aig.h:286
int Ssw_ManSetConstrPhases_ ( Aig_Man_t p,
int  nFrames,
Vec_Int_t **  pvInits 
)

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

Synopsis [Performs fraiging for one node.]

Description [Returns the fraiged node.]

SideEffects []

SeeAlso []

Definition at line 156 of file sswConstr.c.

157 {
158  Vec_Int_t * vLits;
159  sat_solver * pSat;
160  Cnf_Dat_t * pCnf;
161  Aig_Obj_t * pObj;
162  int i, f, iVar, RetValue, nRegs;
163  if ( pvInits )
164  *pvInits = NULL;
165  assert( p->nConstrs > 0 );
166  // create CNF
167  nRegs = p->nRegs; p->nRegs = 0;
168  pCnf = Cnf_Derive( p, Aig_ManCoNum(p) );
169  p->nRegs = nRegs;
170  // create SAT solver
171  pSat = (sat_solver *)Cnf_DataWriteIntoSolver( pCnf, nFrames, 0 );
172  assert( pSat->size == nFrames * pCnf->nVars );
173  // collect constraint literals
174  vLits = Vec_IntAlloc( 100 );
175  Saig_ManForEachLo( p, pObj, i )
176  {
177  assert( pCnf->pVarNums[Aig_ObjId(pObj)] >= 0 );
178  Vec_IntPush( vLits, toLitCond(pCnf->pVarNums[Aig_ObjId(pObj)], 1) );
179  }
180  for ( f = 0; f < nFrames; f++ )
181  {
182  Saig_ManForEachPo( p, pObj, i )
183  {
184  if ( i < Saig_ManPoNum(p) - Saig_ManConstrNum(p) )
185  continue;
186  assert( pCnf->pVarNums[Aig_ObjId(pObj)] >= 0 );
187  iVar = pCnf->pVarNums[Aig_ObjId(pObj)] + pCnf->nVars*f;
188  Vec_IntPush( vLits, toLitCond(iVar, 1) );
189  }
190  }
191  RetValue = sat_solver_solve( pSat, (int *)Vec_IntArray(vLits),
192  (int *)Vec_IntArray(vLits) + Vec_IntSize(vLits),
193  (ABC_INT64_T)1000000, (ABC_INT64_T)0, (ABC_INT64_T)0, (ABC_INT64_T)0 );
194  if ( RetValue == l_True && pvInits )
195  {
196  *pvInits = Vec_IntAlloc( 1000 );
197  for ( f = 0; f < nFrames; f++ )
198  {
199  Saig_ManForEachPi( p, pObj, i )
200  {
201  iVar = pCnf->pVarNums[Aig_ObjId(pObj)] + pCnf->nVars*f;
202  Vec_IntPush( *pvInits, sat_solver_var_value(pSat, iVar) );
203  }
204  }
205  }
206  sat_solver_delete( pSat );
207  Vec_IntFree( vLits );
208  Cnf_DataFree( pCnf );
209  if ( RetValue == l_False )
210  return 1;
211  if ( RetValue == l_True )
212  return 0;
213  return -1;
214 }
static int * Vec_IntArray(Vec_Int_t *p)
Definition: vecInt.h:328
static int Saig_ManPoNum(Aig_Man_t *p)
Definition: saig.h:74
Cnf_Dat_t * Cnf_Derive(Aig_Man_t *pAig, int nOutputs)
Definition: cnfCore.c:165
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
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
int nVars
Definition: cnf.h:59
void sat_solver_delete(sat_solver *s)
Definition: satSolver.c:1141
int * pVarNums
Definition: cnf.h:63
#define l_True
Definition: SolverTypes.h:84
Definition: cnf.h:56
static int sat_solver_var_value(sat_solver *s, int v)
Definition: satSolver.h:200
static int Aig_ManCoNum(Aig_Man_t *p)
Definition: aig.h:252
static int Saig_ManConstrNum(Aig_Man_t *p)
Definition: saig.h:78
static Vec_Int_t * Vec_IntAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: bblif.c:149
static lit toLitCond(int v, int c)
Definition: satVec.h:143
Definition: aig.h:69
static void Vec_IntPush(Vec_Int_t *p, int Entry)
Definition: bblif.c:468
#define Saig_ManForEachLo(p, pObj, i)
Definition: saig.h:96
static int Vec_IntSize(Vec_Int_t *p)
Definition: bblif.c:252
void * Cnf_DataWriteIntoSolver(Cnf_Dat_t *p, int nFrames, int fInit)
Definition: cnfMan.c:463
#define l_False
Definition: SolverTypes.h:85
void Cnf_DataFree(Cnf_Dat_t *p)
Definition: cnfMan.c:180
#define Saig_ManForEachPo(p, pObj, i)
Definition: saig.h:93
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 Saig_ManForEachPi(p, pObj, i)
Definition: saig.h:91
int Ssw_ManSweepBmcConstr ( Ssw_Man_t p)

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

Synopsis [Performs fraiging for the internal nodes.]

Description []

SideEffects []

SeeAlso []

Definition at line 498 of file sswConstr.c.

499 {
500  Aig_Obj_t * pObj, * pObjNew, * pObjLi, * pObjLo;
501  int i, f, iLits;
502  abctime clk;
503 clk = Abc_Clock();
504 
505  // start initialized timeframes
506  p->pFrames = Aig_ManStart( Aig_ManObjNumMax(p->pAig) * p->pPars->nFramesK );
507  Saig_ManForEachLo( p->pAig, pObj, i )
508  Ssw_ObjSetFrame( p, pObj, 0, Aig_ManConst0(p->pFrames) );
509 
510  // build the constraint outputs
511  iLits = 0;
512  p->fRefined = 0;
513  for ( f = 0; f < p->pPars->nFramesK; f++ )
514  {
515  // map constants and PIs
516  Ssw_ObjSetFrame( p, Aig_ManConst1(p->pAig), f, Aig_ManConst1(p->pFrames) );
517  Saig_ManForEachPi( p->pAig, pObj, i )
518  {
519  pObjNew = Aig_ObjCreateCi(p->pFrames);
520  pObjNew->fPhase = Vec_IntEntry( p->vInits, iLits++ );
521  Ssw_ObjSetFrame( p, pObj, f, pObjNew );
522  }
523  // build the constraint cones
524  Saig_ManForEachPo( p->pAig, pObj, i )
525  {
526  if ( i < Saig_ManPoNum(p->pAig) - Saig_ManConstrNum(p->pAig) )
527  continue;
528  pObjNew = Ssw_ManSweepBmcConstr_rec( p, Aig_ObjFanin0(pObj), f );
529  pObjNew = Aig_NotCond( pObjNew, Aig_ObjFaninC0(pObj) );
530  if ( Aig_Regular(pObjNew) == Aig_ManConst1(p->pFrames) )
531  {
532  assert( Aig_IsComplement(pObjNew) );
533  continue;
534  }
535  Ssw_NodesAreConstrained( p, pObjNew, Aig_ManConst0(p->pFrames) );
536  }
537 
538  // sweep internal nodes
539  Aig_ManForEachNode( p->pAig, pObj, i )
540  {
541  pObjNew = Aig_And( p->pFrames, Ssw_ObjChild0Fra(p, pObj, f), Ssw_ObjChild1Fra(p, pObj, f) );
542  Ssw_ObjSetFrame( p, pObj, f, pObjNew );
543  p->fRefined |= Ssw_ManSweepNodeConstr( p, pObj, f, 1 );
544  }
545  // quit if this is the last timeframe
546  if ( f == p->pPars->nFramesK - 1 )
547  break;
548  // transfer latch input to the latch outputs
549  Aig_ManForEachCo( p->pAig, pObj, i )
550  Ssw_ObjSetFrame( p, pObj, f, Ssw_ObjChild0Fra(p, pObj, f) );
551  // build logic cones for register outputs
552  Saig_ManForEachLiLo( p->pAig, pObjLi, pObjLo, i )
553  {
554  pObjNew = Ssw_ObjFrame( p, pObjLi, f );
555  Ssw_ObjSetFrame( p, pObjLo, f+1, pObjNew );
556  Ssw_CnfNodeAddToSolver( p->pMSat, Aig_Regular(pObjNew) );//
557  }
558  }
559  assert( Vec_IntSize(p->vInits) == iLits + Saig_ManPiNum(p->pAig) );
560 
561  // cleanup
562 // Ssw_ClassesCheck( p->ppClasses );
563 p->timeBmc += Abc_Clock() - clk;
564  return p->fRefined;
565 }
Aig_Man_t * pAig
Definition: llb3Image.c:49
void Ssw_CnfNodeAddToSolver(Ssw_Sat_t *p, Aig_Obj_t *pObj)
Definition: sswCnf.c:351
static int Saig_ManPoNum(Aig_Man_t *p)
Definition: saig.h:74
static Aig_Obj_t * Ssw_ObjChild0Fra(Ssw_Man_t *p, Aig_Obj_t *pObj, int i)
Definition: sswInt.h:185
static Llb_Mgr_t * p
Definition: llb3Image.c:950
#define Saig_ManForEachLiLo(p, pObjLi, pObjLo, i)
Definition: saig.h:101
int Ssw_NodesAreConstrained(Ssw_Man_t *p, Aig_Obj_t *pOld, Aig_Obj_t *pNew)
Definition: sswSat.c:196
int Ssw_ManSweepNodeConstr(Ssw_Man_t *p, Aig_Obj_t *pObj, int f, int fBmc)
Definition: sswConstr.c:314
static Aig_Obj_t * Aig_ObjFanin0(Aig_Obj_t *pObj)
Definition: aig.h:308
Aig_Man_t * Aig_ManStart(int nNodesMax)
DECLARATIONS ///.
Definition: aigMan.c:47
static int Aig_IsComplement(Aig_Obj_t *p)
Definition: aig.h:249
static Aig_Obj_t * Aig_Regular(Aig_Obj_t *p)
Definition: aig.h:246
Aig_Obj_t * Aig_ObjCreateCi(Aig_Man_t *p)
DECLARATIONS ///.
Definition: aigObj.c:45
static Aig_Obj_t * Aig_ManConst0(Aig_Man_t *p)
Definition: aig.h:263
#define Aig_ManForEachCo(p, pObj, i)
Definition: aig.h:398
static abctime Abc_Clock()
Definition: abc_global.h:279
for(p=first;p->value< newval;p=p->next)
static Aig_Obj_t * Ssw_ObjChild1Fra(Ssw_Man_t *p, Aig_Obj_t *pObj, int i)
Definition: sswInt.h:186
Aig_Obj_t * Aig_And(Aig_Man_t *p, Aig_Obj_t *p0, Aig_Obj_t *p1)
Definition: aigOper.c:104
static int Saig_ManConstrNum(Aig_Man_t *p)
Definition: saig.h:78
#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
#define Saig_ManForEachLo(p, pObj, i)
Definition: saig.h:96
static int Aig_ObjFaninC0(Aig_Obj_t *pObj)
Definition: aig.h:306
static int Aig_ManObjNumMax(Aig_Man_t *p)
Definition: aig.h:259
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
unsigned int fPhase
Definition: aig.h:78
static void Ssw_ObjSetFrame(Ssw_Man_t *p, Aig_Obj_t *pObj, int i, Aig_Obj_t *pNode)
Definition: sswInt.h:183
static int Saig_ManPiNum(Aig_Man_t *p)
MACRO DEFINITIONS ///.
Definition: saig.h:73
#define Saig_ManForEachPo(p, pObj, i)
Definition: saig.h:93
#define assert(ex)
Definition: util_old.h:213
Aig_Obj_t * Ssw_ManSweepBmcConstr_rec(Ssw_Man_t *p, Aig_Obj_t *pObj, int f)
Definition: sswConstr.c:370
static Aig_Obj_t * Aig_NotCond(Aig_Obj_t *p, int c)
Definition: aig.h:248
ABC_INT64_T abctime
Definition: abc_global.h:278
#define Saig_ManForEachPi(p, pObj, i)
Definition: saig.h:91
static Aig_Obj_t * Ssw_ObjFrame(Ssw_Man_t *p, Aig_Obj_t *pObj, int i)
Definition: sswInt.h:182
int Ssw_ManSweepBmcConstr_old ( Ssw_Man_t p)

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

Synopsis [Performs fraiging for the internal nodes.]

Description []

SideEffects []

SeeAlso []

Definition at line 407 of file sswConstr.c.

408 {
409  Bar_Progress_t * pProgress = NULL;
410  Aig_Obj_t * pObj, * pObjNew, * pObjLi, * pObjLo;
411  int i, f, iLits;
412  abctime clk;
413 clk = Abc_Clock();
414 
415  // start initialized timeframes
416  p->pFrames = Aig_ManStart( Aig_ManObjNumMax(p->pAig) * p->pPars->nFramesK );
417  Saig_ManForEachLo( p->pAig, pObj, i )
418  Ssw_ObjSetFrame( p, pObj, 0, Aig_ManConst0(p->pFrames) );
419 
420  // build the constraint outputs
421  iLits = 0;
422  for ( f = 0; f < p->pPars->nFramesK; f++ )
423  {
424  // map constants and PIs
425  Ssw_ObjSetFrame( p, Aig_ManConst1(p->pAig), f, Aig_ManConst1(p->pFrames) );
426  Saig_ManForEachPi( p->pAig, pObj, i )
427  {
428  pObjNew = Aig_ObjCreateCi(p->pFrames);
429  pObjNew->fPhase = Vec_IntEntry( p->vInits, iLits++ );
430  Ssw_ObjSetFrame( p, pObj, f, pObjNew );
431  }
432  // build the constraint cones
433  Saig_ManForEachPo( p->pAig, pObj, i )
434  {
435  if ( i < Saig_ManPoNum(p->pAig) - Saig_ManConstrNum(p->pAig) )
436  continue;
437  pObjNew = Ssw_ManSweepBmcConstr_rec( p, Aig_ObjFanin0(pObj), f );
438  pObjNew = Aig_NotCond( pObjNew, Aig_ObjFaninC0(pObj) );
439  if ( Aig_Regular(pObjNew) == Aig_ManConst1(p->pFrames) )
440  {
441  assert( Aig_IsComplement(pObjNew) );
442  continue;
443  }
444  Ssw_NodesAreConstrained( p, pObjNew, Aig_ManConst0(p->pFrames) );
445  }
446  }
447  assert( Vec_IntSize(p->vInits) == iLits + Saig_ManPiNum(p->pAig) );
448 
449  // sweep internal nodes
450  p->fRefined = 0;
451  if ( p->pPars->fVerbose )
452  pProgress = Bar_ProgressStart( stdout, Aig_ManObjNumMax(p->pAig) * p->pPars->nFramesK );
453  for ( f = 0; f < p->pPars->nFramesK; f++ )
454  {
455  // sweep internal nodes
456  Aig_ManForEachNode( p->pAig, pObj, i )
457  {
458  if ( p->pPars->fVerbose )
459  Bar_ProgressUpdate( pProgress, Aig_ManObjNumMax(p->pAig) * f + i, NULL );
460  pObjNew = Aig_And( p->pFrames, Ssw_ObjChild0Fra(p, pObj, f), Ssw_ObjChild1Fra(p, pObj, f) );
461  Ssw_ObjSetFrame( p, pObj, f, pObjNew );
462  p->fRefined |= Ssw_ManSweepNodeConstr( p, pObj, f, 1 );
463  }
464  // quit if this is the last timeframe
465  if ( f == p->pPars->nFramesK - 1 )
466  break;
467  // transfer latch input to the latch outputs
468  Aig_ManForEachCo( p->pAig, pObj, i )
469  Ssw_ObjSetFrame( p, pObj, f, Ssw_ObjChild0Fra(p, pObj, f) );
470  // build logic cones for register outputs
471  Saig_ManForEachLiLo( p->pAig, pObjLi, pObjLo, i )
472  {
473  pObjNew = Ssw_ObjFrame( p, pObjLi, f );
474  Ssw_ObjSetFrame( p, pObjLo, f+1, pObjNew );
475  Ssw_CnfNodeAddToSolver( p->pMSat, Aig_Regular(pObjNew) );//
476  }
477  }
478  if ( p->pPars->fVerbose )
479  Bar_ProgressStop( pProgress );
480 
481  // cleanup
482 // Ssw_ClassesCheck( p->ppClasses );
483 p->timeBmc += Abc_Clock() - clk;
484  return p->fRefined;
485 }
Aig_Man_t * pAig
Definition: llb3Image.c:49
void Ssw_CnfNodeAddToSolver(Ssw_Sat_t *p, Aig_Obj_t *pObj)
Definition: sswCnf.c:351
static int Saig_ManPoNum(Aig_Man_t *p)
Definition: saig.h:74
static Aig_Obj_t * Ssw_ObjChild0Fra(Ssw_Man_t *p, Aig_Obj_t *pObj, int i)
Definition: sswInt.h:185
static Llb_Mgr_t * p
Definition: llb3Image.c:950
#define Saig_ManForEachLiLo(p, pObjLi, pObjLo, i)
Definition: saig.h:101
int Ssw_NodesAreConstrained(Ssw_Man_t *p, Aig_Obj_t *pOld, Aig_Obj_t *pNew)
Definition: sswSat.c:196
int Ssw_ManSweepNodeConstr(Ssw_Man_t *p, Aig_Obj_t *pObj, int f, int fBmc)
Definition: sswConstr.c:314
static Aig_Obj_t * Aig_ObjFanin0(Aig_Obj_t *pObj)
Definition: aig.h:308
Aig_Man_t * Aig_ManStart(int nNodesMax)
DECLARATIONS ///.
Definition: aigMan.c:47
static int Aig_IsComplement(Aig_Obj_t *p)
Definition: aig.h:249
static Aig_Obj_t * Aig_Regular(Aig_Obj_t *p)
Definition: aig.h:246
Aig_Obj_t * Aig_ObjCreateCi(Aig_Man_t *p)
DECLARATIONS ///.
Definition: aigObj.c:45
static Aig_Obj_t * Aig_ManConst0(Aig_Man_t *p)
Definition: aig.h:263
#define Aig_ManForEachCo(p, pObj, i)
Definition: aig.h:398
static abctime Abc_Clock()
Definition: abc_global.h:279
for(p=first;p->value< newval;p=p->next)
static Aig_Obj_t * Ssw_ObjChild1Fra(Ssw_Man_t *p, Aig_Obj_t *pObj, int i)
Definition: sswInt.h:186
Aig_Obj_t * Aig_And(Aig_Man_t *p, Aig_Obj_t *p0, Aig_Obj_t *p1)
Definition: aigOper.c:104
static int Saig_ManConstrNum(Aig_Man_t *p)
Definition: saig.h:78
static void Bar_ProgressUpdate(Bar_Progress_t *p, int nItemsCur, char *pString)
Definition: bar.h:63
#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
#define Saig_ManForEachLo(p, pObj, i)
Definition: saig.h:96
DECLARATIONS ///.
Definition: bar.c:36
static int Aig_ObjFaninC0(Aig_Obj_t *pObj)
Definition: aig.h:306
static int Aig_ManObjNumMax(Aig_Man_t *p)
Definition: aig.h:259
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
unsigned int fPhase
Definition: aig.h:78
static void Ssw_ObjSetFrame(Ssw_Man_t *p, Aig_Obj_t *pObj, int i, Aig_Obj_t *pNode)
Definition: sswInt.h:183
static int Saig_ManPiNum(Aig_Man_t *p)
MACRO DEFINITIONS ///.
Definition: saig.h:73
#define Saig_ManForEachPo(p, pObj, i)
Definition: saig.h:93
#define assert(ex)
Definition: util_old.h:213
Aig_Obj_t * Ssw_ManSweepBmcConstr_rec(Ssw_Man_t *p, Aig_Obj_t *pObj, int f)
Definition: sswConstr.c:370
static Aig_Obj_t * Aig_NotCond(Aig_Obj_t *p, int c)
Definition: aig.h:248
ABC_INT64_T abctime
Definition: abc_global.h:278
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
#define Saig_ManForEachPi(p, pObj, i)
Definition: saig.h:91
static Aig_Obj_t * Ssw_ObjFrame(Ssw_Man_t *p, Aig_Obj_t *pObj, int i)
Definition: sswInt.h:182
Aig_Obj_t* Ssw_ManSweepBmcConstr_rec ( Ssw_Man_t p,
Aig_Obj_t pObj,
int  f 
)

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

Synopsis [Performs fraiging for the internal nodes.]

Description []

SideEffects []

SeeAlso []

Definition at line 370 of file sswConstr.c.

371 {
372  Aig_Obj_t * pObjNew, * pObjLi;
373  pObjNew = Ssw_ObjFrame( p, pObj, f );
374  if ( pObjNew )
375  return pObjNew;
376  assert( !Saig_ObjIsPi(p->pAig, pObj) );
377  if ( Saig_ObjIsLo(p->pAig, pObj) )
378  {
379  assert( f > 0 );
380  pObjLi = Saig_ObjLoToLi( p->pAig, pObj );
381  pObjNew = Ssw_ManSweepBmcConstr_rec( p, Aig_ObjFanin0(pObjLi), f-1 );
382  pObjNew = Aig_NotCond( pObjNew, Aig_ObjFaninC0(pObjLi) );
383  }
384  else
385  {
386  assert( Aig_ObjIsNode(pObj) );
389  pObjNew = Aig_And( p->pFrames, Ssw_ObjChild0Fra(p, pObj, f), Ssw_ObjChild1Fra(p, pObj, f) );
390  }
391  Ssw_ObjSetFrame( p, pObj, f, pObjNew );
392  assert( pObjNew != NULL );
393  return pObjNew;
394 }
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 Aig_Obj_t * Ssw_ObjChild0Fra(Ssw_Man_t *p, Aig_Obj_t *pObj, int i)
Definition: sswInt.h:185
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
static Aig_Obj_t * Aig_ObjFanin1(Aig_Obj_t *pObj)
Definition: aig.h:309
static Aig_Obj_t * Ssw_ObjChild1Fra(Ssw_Man_t *p, Aig_Obj_t *pObj, int i)
Definition: sswInt.h:186
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
Definition: aig.h:69
static int Aig_ObjFaninC0(Aig_Obj_t *pObj)
Definition: aig.h:306
static void Ssw_ObjSetFrame(Ssw_Man_t *p, Aig_Obj_t *pObj, int i, Aig_Obj_t *pNode)
Definition: sswInt.h:183
#define assert(ex)
Definition: util_old.h:213
Aig_Obj_t * Ssw_ManSweepBmcConstr_rec(Ssw_Man_t *p, Aig_Obj_t *pObj, int f)
Definition: sswConstr.c:370
static Aig_Obj_t * Aig_NotCond(Aig_Obj_t *p, int c)
Definition: aig.h:248
static int Saig_ObjIsPi(Aig_Man_t *p, Aig_Obj_t *pObj)
Definition: saig.h:82
static Aig_Obj_t * Ssw_ObjFrame(Ssw_Man_t *p, Aig_Obj_t *pObj, int i)
Definition: sswInt.h:182
int Ssw_ManSweepConstr ( Ssw_Man_t p)

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

Synopsis [Performs fraiging for the internal nodes.]

Description []

SideEffects []

SeeAlso []

Definition at line 619 of file sswConstr.c.

620 {
621  Bar_Progress_t * pProgress = NULL;
622  Aig_Obj_t * pObj, * pObj2, * pObjNew;
623  int nConstrPairs, i, f, iLits;
624  abctime clk;
625 //Ssw_ManPrintPolarity( p->pAig );
626 
627  // perform speculative reduction
628 clk = Abc_Clock();
629  // create timeframes
630  p->pFrames = Ssw_FramesWithClasses( p );
631  // add constants
632  nConstrPairs = Aig_ManCoNum(p->pFrames)-Aig_ManRegNum(p->pAig);
633  assert( (nConstrPairs & 1) == 0 );
634  for ( i = 0; i < nConstrPairs; i += 2 )
635  {
636  pObj = Aig_ManCo( p->pFrames, i );
637  pObj2 = Aig_ManCo( p->pFrames, i+1 );
639  }
640  // build logic cones for register inputs
641  for ( i = 0; i < Aig_ManRegNum(p->pAig); i++ )
642  {
643  pObj = Aig_ManCo( p->pFrames, nConstrPairs + i );
644  Ssw_CnfNodeAddToSolver( p->pMSat, Aig_ObjFanin0(pObj) );//
645  }
646 
647  // map constants and PIs of the last frame
648  f = p->pPars->nFramesK;
649 // iLits = 0;
650  iLits = f * Saig_ManPiNum(p->pAig);
651  Ssw_ObjSetFrame( p, Aig_ManConst1(p->pAig), f, Aig_ManConst1(p->pFrames) );
652  Saig_ManForEachPi( p->pAig, pObj, i )
653  {
654  pObjNew = Aig_ObjCreateCi(p->pFrames);
655  pObjNew->fPhase = (p->vInits != NULL) && Vec_IntEntry(p->vInits, iLits++);
656  Ssw_ObjSetFrame( p, pObj, f, pObjNew );
657  }
658  assert( Vec_IntSize(p->vInits) == iLits );
659 p->timeReduce += Abc_Clock() - clk;
660 
661  // add constraints to all timeframes
662  for ( f = 0; f <= p->pPars->nFramesK; f++ )
663  {
664  Saig_ManForEachPo( p->pAig, pObj, i )
665  {
666  if ( i < Saig_ManPoNum(p->pAig) - Saig_ManConstrNum(p->pAig) )
667  continue;
669 // if ( Aig_Regular(Ssw_ObjChild0Fra(p,pObj,f)) == Aig_ManConst1(p->pFrames) )
670  if ( Ssw_ObjChild0Fra(p,pObj,f) == Aig_ManConst0(p->pFrames) )
671  continue;
672  assert( Ssw_ObjChild0Fra(p,pObj,f) != Aig_ManConst1(p->pFrames) );
673  if ( Ssw_ObjChild0Fra(p,pObj,f) == Aig_ManConst1(p->pFrames) )
674  {
675  Abc_Print( 1, "Polarity violation.\n" );
676  continue;
677  }
679  }
680  }
681  f = p->pPars->nFramesK;
682  // clean the solver
683  sat_solver_simplify( p->pMSat->pSat );
684 
685 
686  // sweep internal nodes
687  p->fRefined = 0;
688  Ssw_ClassesClearRefined( p->ppClasses );
689  if ( p->pPars->fVerbose )
690  pProgress = Bar_ProgressStart( stdout, Aig_ManObjNumMax(p->pAig) );
691  Aig_ManForEachObj( p->pAig, pObj, i )
692  {
693  if ( p->pPars->fVerbose )
694  Bar_ProgressUpdate( pProgress, i, NULL );
695  if ( Saig_ObjIsLo(p->pAig, pObj) )
696  p->fRefined |= Ssw_ManSweepNodeConstr( p, pObj, f, 0 );
697  else if ( Aig_ObjIsNode(pObj) )
698  {
699  pObjNew = Aig_And( p->pFrames, Ssw_ObjChild0Fra(p, pObj, f), Ssw_ObjChild1Fra(p, pObj, f) );
700  Ssw_ObjSetFrame( p, pObj, f, pObjNew );
701  p->fRefined |= Ssw_ManSweepNodeConstr( p, pObj, f, 0 );
702  }
703  }
704  if ( p->pPars->fVerbose )
705  Bar_ProgressStop( pProgress );
706  // cleanup
707 // Ssw_ClassesCheck( p->ppClasses );
708  return p->fRefined;
709 }
Aig_Man_t * pAig
Definition: llb3Image.c:49
void Ssw_CnfNodeAddToSolver(Ssw_Sat_t *p, Aig_Obj_t *pObj)
Definition: sswCnf.c:351
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
static Aig_Obj_t * Ssw_ObjChild0Fra(Ssw_Man_t *p, Aig_Obj_t *pObj, int i)
Definition: sswInt.h:185
static Aig_Obj_t * Aig_ObjChild0(Aig_Obj_t *pObj)
Definition: aig.h:310
static Llb_Mgr_t * p
Definition: llb3Image.c:950
int Ssw_NodesAreConstrained(Ssw_Man_t *p, Aig_Obj_t *pOld, Aig_Obj_t *pNew)
Definition: sswSat.c:196
int Ssw_ManSweepNodeConstr(Ssw_Man_t *p, Aig_Obj_t *pObj, int f, int fBmc)
Definition: sswConstr.c:314
static Aig_Obj_t * Aig_ObjFanin0(Aig_Obj_t *pObj)
Definition: aig.h:308
Aig_Obj_t * Aig_ObjCreateCi(Aig_Man_t *p)
DECLARATIONS ///.
Definition: aigObj.c:45
static Aig_Obj_t * Aig_ManConst0(Aig_Man_t *p)
Definition: aig.h:263
static abctime Abc_Clock()
Definition: abc_global.h:279
static Aig_Obj_t * Ssw_ObjChild1Fra(Ssw_Man_t *p, Aig_Obj_t *pObj, int i)
Definition: sswInt.h:186
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 int Aig_ManCoNum(Aig_Man_t *p)
Definition: aig.h:252
void Ssw_ClassesClearRefined(Ssw_Cla_t *p)
Definition: sswClass.c:243
static int Saig_ManConstrNum(Aig_Man_t *p)
Definition: saig.h:78
static void Bar_ProgressUpdate(Bar_Progress_t *p, int nItemsCur, char *pString)
Definition: bar.h:63
static int Vec_IntEntry(Vec_Int_t *p, int i)
Definition: bblif.c:268
Definition: aig.h:69
static void Abc_Print(int level, const char *format,...)
Definition: abc_global.h:313
DECLARATIONS ///.
Definition: bar.c:36
static int Aig_ManObjNumMax(Aig_Man_t *p)
Definition: aig.h:259
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 Aig_ManRegNum(Aig_Man_t *p)
Definition: aig.h:260
int sat_solver_simplify(sat_solver *s)
Definition: satSolver.c:1276
static int Vec_IntSize(Vec_Int_t *p)
Definition: bblif.c:252
unsigned int fPhase
Definition: aig.h:78
#define Aig_ManForEachObj(p, pObj, i)
Definition: aig.h:403
static void Ssw_ObjSetFrame(Ssw_Man_t *p, Aig_Obj_t *pObj, int i, Aig_Obj_t *pNode)
Definition: sswInt.h:183
static int Saig_ManPiNum(Aig_Man_t *p)
MACRO DEFINITIONS ///.
Definition: saig.h:73
Aig_Man_t * Ssw_FramesWithClasses(Ssw_Man_t *p)
Definition: sswAig.c:144
#define Saig_ManForEachPo(p, pObj, i)
Definition: saig.h:93
#define assert(ex)
Definition: util_old.h:213
ABC_INT64_T abctime
Definition: abc_global.h:278
void Bar_ProgressStop(Bar_Progress_t *p)
Definition: bar.c:126
Aig_Obj_t * Ssw_FramesWithClasses_rec(Ssw_Man_t *p, Aig_Obj_t *pObj, int f)
Definition: sswConstr.c:581
Bar_Progress_t * Bar_ProgressStart(FILE *pFile, int nItemsTotal)
FUNCTION DEFINITIONS ///.
Definition: bar.c:66
#define Saig_ManForEachPi(p, pObj, i)
Definition: saig.h:91
int Ssw_ManSweepNodeConstr ( Ssw_Man_t p,
Aig_Obj_t pObj,
int  f,
int  fBmc 
)

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

Synopsis [Performs fraiging for one node.]

Description [Returns the fraiged node.]

SideEffects []

SeeAlso []

Definition at line 314 of file sswConstr.c.

315 {
316  Aig_Obj_t * pObjRepr, * pObjFraig, * pObjFraig2, * pObjReprFraig;
317  int RetValue;
318  // get representative of this class
319  pObjRepr = Aig_ObjRepr( p->pAig, pObj );
320  if ( pObjRepr == NULL )
321  return 0;
322  // get the fraiged node
323  pObjFraig = Ssw_ObjFrame( p, pObj, f );
324  // get the fraiged representative
325  pObjReprFraig = Ssw_ObjFrame( p, pObjRepr, f );
326  // check if constant 0 pattern distinquishes these nodes
327  assert( pObjFraig != NULL && pObjReprFraig != NULL );
328  assert( (pObj->fPhase == pObjRepr->fPhase) == (Aig_ObjPhaseReal(pObjFraig) == Aig_ObjPhaseReal(pObjReprFraig)) );
329  // if the fraiged nodes are the same, return
330  if ( Aig_Regular(pObjFraig) == Aig_Regular(pObjReprFraig) )
331  return 0;
332  // call equivalence checking
333  if ( Aig_Regular(pObjFraig) != Aig_ManConst1(p->pFrames) )
334  RetValue = Ssw_NodesAreEquiv( p, Aig_Regular(pObjReprFraig), Aig_Regular(pObjFraig) );
335  else
336  RetValue = Ssw_NodesAreEquiv( p, Aig_Regular(pObjFraig), Aig_Regular(pObjReprFraig) );
337  if ( RetValue == 1 ) // proved equivalent
338  {
339  pObjFraig2 = Aig_NotCond( pObjReprFraig, pObj->fPhase ^ pObjRepr->fPhase );
340  Ssw_ObjSetFrame( p, pObj, f, pObjFraig2 );
341  return 0;
342  }
343  if ( RetValue == -1 ) // timed out
344  {
345  Ssw_ClassesRemoveNode( p->ppClasses, pObj );
346  return 1;
347  }
348  // disproved equivalence
349  Ssw_SmlSavePatternAig( p, f );
350  Ssw_ManResimulateBit( p, pObj, pObjRepr );
351  assert( Aig_ObjRepr( p->pAig, pObj ) != pObjRepr );
352  if ( Aig_ObjRepr( p->pAig, pObj ) == pObjRepr )
353  {
354  Abc_Print( 1, "Ssw_ManSweepNodeConstr(): Failed to refine representative.\n" );
355  }
356  return 1;
357 }
static Aig_Obj_t * Aig_ObjRepr(Aig_Man_t *p, Aig_Obj_t *pObj)
Definition: aig.h:330
Aig_Man_t * pAig
Definition: llb3Image.c:49
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static Aig_Obj_t * Aig_Regular(Aig_Obj_t *p)
Definition: aig.h:246
void Ssw_ClassesRemoveNode(Ssw_Cla_t *p, Aig_Obj_t *pObj)
Definition: sswClass.c:448
static int Aig_ObjPhaseReal(Aig_Obj_t *pObj)
Definition: aig.h:299
Definition: aig.h:69
static void Abc_Print(int level, const char *format,...)
Definition: abc_global.h:313
static Aig_Obj_t * Aig_ManConst1(Aig_Man_t *p)
Definition: aig.h:264
unsigned int fPhase
Definition: aig.h:78
static void Ssw_ObjSetFrame(Ssw_Man_t *p, Aig_Obj_t *pObj, int i, Aig_Obj_t *pNode)
Definition: sswInt.h:183
#define assert(ex)
Definition: util_old.h:213
int Ssw_NodesAreEquiv(Ssw_Man_t *p, Aig_Obj_t *pOld, Aig_Obj_t *pNew)
DECLARATIONS ///.
Definition: sswSat.c:45
static Aig_Obj_t * Aig_NotCond(Aig_Obj_t *p, int c)
Definition: aig.h:248
void Ssw_ManResimulateBit(Ssw_Man_t *p, Aig_Obj_t *pObj, Aig_Obj_t *pRepr)
DECLARATIONS ///.
Definition: sswSimSat.c:45
void Ssw_SmlSavePatternAig(Ssw_Man_t *p, int f)
Definition: sswSweep.c:136
static Aig_Obj_t * Ssw_ObjFrame(Ssw_Man_t *p, Aig_Obj_t *pObj, int i)
Definition: sswInt.h:182