abc-master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
satClause.h File Reference

Go to the source code of this file.

Data Structures

struct  clause_t
 
struct  Sat_Mem_t_
 

Macros

#define LEARNT_MAX_START_DEFAULT   10000
 INCLUDES ///. More...
 
#define LEARNT_MAX_INCRE_DEFAULT   1000
 
#define LEARNT_MAX_RATIO_DEFAULT   50
 
#define Sat_MemForEachClause(p, c, i, k)
 
#define Sat_MemForEachClause2(p, c, i, k)
 
#define Sat_MemForEachLearned(p, c, i, k)
 

Typedefs

typedef struct clause_t clause
 STRUCTURE DEFINITIONS ///. More...
 
typedef struct Sat_Mem_t_ Sat_Mem_t
 

Functions

static int Sat_MemLimit (int *p)
 
static int Sat_MemIncLimit (int *p, int nInts)
 
static void Sat_MemWriteLimit (int *p, int nInts)
 
static int Sat_MemHandPage (Sat_Mem_t *p, cla h)
 
static int Sat_MemHandShift (Sat_Mem_t *p, cla h)
 
static int Sat_MemIntSize (int size, int lrn)
 
static int Sat_MemClauseSize (clause *p)
 
static int Sat_MemClauseSize2 (clause *p)
 
static clauseSat_MemClause (Sat_Mem_t *p, int i, int k)
 
static clauseSat_MemClauseHand (Sat_Mem_t *p, cla h)
 
static int Sat_MemEntryNum (Sat_Mem_t *p, int lrn)
 
static cla Sat_MemHand (Sat_Mem_t *p, int i, int k)
 
static cla Sat_MemHandCurrent (Sat_Mem_t *p, int lrn)
 
static int Sat_MemClauseUsed (Sat_Mem_t *p, cla h)
 
static double Sat_MemMemoryHand (Sat_Mem_t *p, cla h)
 
static double Sat_MemMemoryUsed (Sat_Mem_t *p, int lrn)
 
static double Sat_MemMemoryAllUsed (Sat_Mem_t *p)
 
static double Sat_MemMemoryAll (Sat_Mem_t *p)
 
static int clause_from_lit (lit l)
 GLOBAL VARIABLES ///. More...
 
static int clause_is_lit (cla h)
 
static lit clause_read_lit (cla h)
 
static int clause_learnt_h (Sat_Mem_t *p, cla h)
 
static int clause_learnt (clause *c)
 
static int clause_id (clause *c)
 
static void clause_set_id (clause *c, int id)
 
static int clause_size (clause *c)
 
static litclause_begin (clause *c)
 
static litclause_end (clause *c)
 
static void clause_print (clause *c)
 
static int Sat_MemCountL (Sat_Mem_t *p)
 FUNCTION DECLARATIONS ///. More...
 
static void Sat_MemAlloc_ (Sat_Mem_t *p, int nPageSize)
 
static Sat_Mem_tSat_MemAlloc (int nPageSize)
 
static void Sat_MemRestart (Sat_Mem_t *p)
 
static void Sat_MemBookMark (Sat_Mem_t *p)
 
static void Sat_MemRollBack (Sat_Mem_t *p)
 
static void Sat_MemFree_ (Sat_Mem_t *p)
 
static void Sat_MemFree (Sat_Mem_t *p)
 
static int Sat_MemAppend (Sat_Mem_t *p, int *pArray, int nSize, int lrn, int fPlus1)
 
static void Sat_MemShrink (Sat_Mem_t *p, int h, int lrn)
 
static int Sat_MemCompactLearned (Sat_Mem_t *p, int fDoMove)
 

Macro Definition Documentation

#define LEARNT_MAX_INCRE_DEFAULT   1000

Definition at line 38 of file satClause.h.

#define LEARNT_MAX_RATIO_DEFAULT   50

Definition at line 39 of file satClause.h.

#define LEARNT_MAX_START_DEFAULT   10000

INCLUDES ///.

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

FileName [satMem.h]

SystemName [ABC: Logic synthesis and verification system.]

PackageName [SAT solver.]

Synopsis [Memory management.]

Author [Alan Mishchenko alanm.nosp@m.i@ee.nosp@m.cs.be.nosp@m.rkel.nosp@m.ey.ed.nosp@m.u]

Affiliation [UC Berkeley]

Date [Ver. 1.0. Started - January 1, 2004.]

Revision [

Id:
satMem.h,v 1.0 2004/01/01 1:00:00 alanmi Exp

]PARAMETERS ///

Definition at line 37 of file satClause.h.

#define Sat_MemForEachClause (   p,
  c,
  i,
 
)
Value:
for ( i = 0; i <= p->iPage[0]; i += 2 ) \
for ( k = 2; k < Sat_MemLimit(p->pPages[i]) && ((c) = Sat_MemClause( p, i, k )); k += Sat_MemClauseSize(c) ) if ( i == 0 && k == 2 ) {} else
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static clause * Sat_MemClause(Sat_Mem_t *p, int i, int k)
Definition: satClause.h:96
static int Sat_MemLimit(int *p)
Definition: satClause.h:84
static int Sat_MemClauseSize(clause *p)
Definition: satClause.h:92

Definition at line 117 of file satClause.h.

#define Sat_MemForEachClause2 (   p,
  c,
  i,
 
)
Value:
for ( i = 0; i <= p->iPage[0]; i += 2 ) \
for ( k = 2; k < Sat_MemLimit(p->pPages[i]) && ((c) = Sat_MemClause( p, i, k )); k += Sat_MemClauseSize2(c) ) if ( i == 0 && k == 2 ) {} else
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static clause * Sat_MemClause(Sat_Mem_t *p, int i, int k)
Definition: satClause.h:96
static int Sat_MemLimit(int *p)
Definition: satClause.h:84
static int Sat_MemClauseSize2(clause *p)
Definition: satClause.h:93

Definition at line 122 of file satClause.h.

#define Sat_MemForEachLearned (   p,
  c,
  i,
 
)
Value:
for ( i = 1; i <= p->iPage[1]; i += 2 ) \
for ( k = 2; k < Sat_MemLimit(p->pPages[i]) && ((c) = Sat_MemClause( p, i, k )); k += Sat_MemClauseSize(c) )
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static clause * Sat_MemClause(Sat_Mem_t *p, int i, int k)
Definition: satClause.h:96
static int Sat_MemLimit(int *p)
Definition: satClause.h:84
static int Sat_MemClauseSize(clause *p)
Definition: satClause.h:92

Definition at line 126 of file satClause.h.

Typedef Documentation

typedef struct clause_t clause

STRUCTURE DEFINITIONS ///.

Definition at line 48 of file satClause.h.

typedef struct Sat_Mem_t_ Sat_Mem_t

Definition at line 70 of file satClause.h.

Function Documentation

static lit* clause_begin ( clause c)
inlinestatic

Definition at line 147 of file satClause.h.

147 { return c->lits; }
lit lits[0]
Definition: satClause.h:56
static lit* clause_end ( clause c)
inlinestatic

Definition at line 148 of file satClause.h.

148 { return c->lits + c->size; }
lit lits[0]
Definition: satClause.h:56
unsigned size
Definition: satClause.h:55
static int clause_from_lit ( lit  l)
inlinestatic

GLOBAL VARIABLES ///.

MACRO DEFINITIONS ///

Definition at line 138 of file satClause.h.

138 { return l + l + 1; }
static int clause_id ( clause c)
inlinestatic

Definition at line 144 of file satClause.h.

144 { return c->lits[c->size]; }
lit lits[0]
Definition: satClause.h:56
unsigned size
Definition: satClause.h:55
static int clause_is_lit ( cla  h)
inlinestatic

Definition at line 139 of file satClause.h.

139 { return (h & 1); }
static int clause_learnt ( clause c)
inlinestatic

Definition at line 143 of file satClause.h.

143 { return c->lrn; }
unsigned lrn
Definition: satClause.h:51
static int clause_learnt_h ( Sat_Mem_t p,
cla  h 
)
inlinestatic

Definition at line 142 of file satClause.h.

142 { return (h & p->uLearnedMask) > 0; }
unsigned uLearnedMask
Definition: satClause.h:79
static void clause_print ( clause c)
inlinestatic

Definition at line 149 of file satClause.h.

150 {
151  int i;
152  printf( "{ " );
153  for ( i = 0; i < clause_size(c); i++ )
154  printf( "%d ", (clause_begin(c)[i] & 1)? -(clause_begin(c)[i] >> 1) : clause_begin(c)[i] >> 1 );
155  printf( "}\n" );
156 }
static int clause_size(clause *c)
Definition: satClause.h:146
static lit * clause_begin(clause *c)
Definition: satClause.h:147
static lit clause_read_lit ( cla  h)
inlinestatic

Definition at line 140 of file satClause.h.

140 { return (lit)(h >> 1); }
int lit
Definition: satVec.h:130
static void clause_set_id ( clause c,
int  id 
)
inlinestatic

Definition at line 145 of file satClause.h.

145 { c->lits[c->size] = id; }
lit lits[0]
Definition: satClause.h:56
unsigned size
Definition: satClause.h:55
static int clause_size ( clause c)
inlinestatic

Definition at line 146 of file satClause.h.

146 { return c->size; }
unsigned size
Definition: satClause.h:55
static Sat_Mem_t* Sat_MemAlloc ( int  nPageSize)
inlinestatic

Definition at line 209 of file satClause.h.

210 {
211  Sat_Mem_t * p;
212  p = ABC_CALLOC( Sat_Mem_t, 1 );
213  Sat_MemAlloc_( p, nPageSize );
214  return p;
215 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
#define ABC_CALLOC(type, num)
Definition: abc_global.h:230
static void Sat_MemAlloc_(Sat_Mem_t *p, int nPageSize)
Definition: satClause.h:193
static void Sat_MemAlloc_ ( Sat_Mem_t p,
int  nPageSize 
)
inlinestatic

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

Synopsis [Allocating vector.]

Description []

SideEffects []

SeeAlso []

Definition at line 193 of file satClause.h.

194 {
195  assert( nPageSize > 8 && nPageSize < 32 );
196  memset( p, 0, sizeof(Sat_Mem_t) );
197  p->nPageSize = nPageSize;
198  p->uLearnedMask = (unsigned)(1 << nPageSize);
199  p->uPageMask = (unsigned)((1 << nPageSize) - 1);
200  p->nPagesAlloc = 256;
201  p->pPages = ABC_CALLOC( int *, p->nPagesAlloc );
202  p->pPages[0] = ABC_ALLOC( int, (1 << p->nPageSize) );
203  p->pPages[1] = ABC_ALLOC( int, (1 << p->nPageSize) );
204  p->iPage[0] = 0;
205  p->iPage[1] = 1;
206  Sat_MemWriteLimit( p->pPages[0], 2 );
207  Sat_MemWriteLimit( p->pPages[1], 2 );
208 }
char * memset()
int ** pPages
Definition: satClause.h:81
#define ABC_ALLOC(type, num)
Definition: abc_global.h:229
unsigned uPageMask
Definition: satClause.h:78
int nPagesAlloc
Definition: satClause.h:80
#define ABC_CALLOC(type, num)
Definition: abc_global.h:230
int iPage[2]
Definition: satClause.h:76
#define assert(ex)
Definition: util_old.h:213
int nPageSize
Definition: satClause.h:77
static void Sat_MemWriteLimit(int *p, int nInts)
Definition: satClause.h:86
unsigned uLearnedMask
Definition: satClause.h:79
static int Sat_MemAppend ( Sat_Mem_t p,
int *  pArray,
int  nSize,
int  lrn,
int  fPlus1 
)
inlinestatic

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

Synopsis [Creates new clause.]

Description [The resulting clause is fully initialized.]

SideEffects []

SeeAlso []

Definition at line 301 of file satClause.h.

302 {
303  clause * c;
304  int * pPage = p->pPages[p->iPage[lrn]];
305  int nInts = Sat_MemIntSize( nSize, lrn | fPlus1 );
306  assert( nInts + 3 < (1 << p->nPageSize) );
307  // need two extra at the begining of the page and one extra in the end
308  if ( Sat_MemLimit(pPage) + nInts + 2 >= (1 << p->nPageSize) )
309  {
310  p->iPage[lrn] += 2;
311  if ( p->iPage[lrn] >= p->nPagesAlloc )
312  {
313  p->pPages = ABC_REALLOC( int *, p->pPages, p->nPagesAlloc * 2 );
314  memset( p->pPages + p->nPagesAlloc, 0, sizeof(int *) * p->nPagesAlloc );
315  p->nPagesAlloc *= 2;
316  }
317  if ( p->pPages[p->iPage[lrn]] == NULL )
318  p->pPages[p->iPage[lrn]] = ABC_ALLOC( int, (1 << p->nPageSize) );
319  pPage = p->pPages[p->iPage[lrn]];
320  Sat_MemWriteLimit( pPage, 2 );
321  }
322  pPage[Sat_MemLimit(pPage)] = 0;
323  c = (clause *)(pPage + Sat_MemLimit(pPage));
324  c->size = nSize;
325  c->lrn = lrn;
326  if ( pArray )
327  memcpy( c->lits, pArray, sizeof(int) * nSize );
328  if ( lrn | fPlus1 )
329  c->lits[c->size] = p->nEntries[lrn];
330  p->nEntries[lrn]++;
331  Sat_MemIncLimit( pPage, nInts );
332  return Sat_MemHandCurrent(p, lrn) - nInts;
333 }
char * memset()
int ** pPages
Definition: satClause.h:81
lit lits[0]
Definition: satClause.h:56
#define ABC_REALLOC(type, obj, num)
Definition: abc_global.h:233
static cla Sat_MemHandCurrent(Sat_Mem_t *p, int lrn)
Definition: satClause.h:102
char * memcpy()
#define ABC_ALLOC(type, num)
Definition: abc_global.h:229
static int Sat_MemIntSize(int size, int lrn)
Definition: satClause.h:91
static int Sat_MemLimit(int *p)
Definition: satClause.h:84
int nPagesAlloc
Definition: satClause.h:80
unsigned size
Definition: satClause.h:55
int nEntries[2]
Definition: satClause.h:73
static int Sat_MemIncLimit(int *p, int nInts)
Definition: satClause.h:85
int iPage[2]
Definition: satClause.h:76
unsigned lrn
Definition: satClause.h:51
#define assert(ex)
Definition: util_old.h:213
int nPageSize
Definition: satClause.h:77
static void Sat_MemWriteLimit(int *p, int nInts)
Definition: satClause.h:86
static void Sat_MemBookMark ( Sat_Mem_t p)
inlinestatic

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

Synopsis [Sets the bookmark.]

Description []

SideEffects []

SeeAlso []

Definition at line 249 of file satClause.h.

250 {
251  p->BookMarkE[0] = p->nEntries[0];
252  p->BookMarkE[1] = p->nEntries[1];
253  p->BookMarkH[0] = Sat_MemHandCurrent( p, 0 );
254  p->BookMarkH[1] = Sat_MemHandCurrent( p, 1 );
255 }
static cla Sat_MemHandCurrent(Sat_Mem_t *p, int lrn)
Definition: satClause.h:102
int BookMarkH[2]
Definition: satClause.h:74
int nEntries[2]
Definition: satClause.h:73
int BookMarkE[2]
Definition: satClause.h:75
static clause* Sat_MemClause ( Sat_Mem_t p,
int  i,
int  k 
)
inlinestatic

Definition at line 96 of file satClause.h.

96 { assert( k ); return (clause *)(p->pPages[i] + k); }
int ** pPages
Definition: satClause.h:81
#define assert(ex)
Definition: util_old.h:213
static clause* Sat_MemClauseHand ( Sat_Mem_t p,
cla  h 
)
inlinestatic

Definition at line 98 of file satClause.h.

98 { return h ? Sat_MemClause( p, Sat_MemHandPage(p, h), Sat_MemHandShift(p, h) ) : NULL; }
static int Sat_MemHandShift(Sat_Mem_t *p, cla h)
Definition: satClause.h:89
static clause * Sat_MemClause(Sat_Mem_t *p, int i, int k)
Definition: satClause.h:96
static int Sat_MemHandPage(Sat_Mem_t *p, cla h)
Definition: satClause.h:88
static int Sat_MemClauseSize ( clause p)
inlinestatic

Definition at line 92 of file satClause.h.

92 { return Sat_MemIntSize(p->size, p->lrn); }
static int Sat_MemIntSize(int size, int lrn)
Definition: satClause.h:91
unsigned size
Definition: satClause.h:55
unsigned lrn
Definition: satClause.h:51
static int Sat_MemClauseSize2 ( clause p)
inlinestatic

Definition at line 93 of file satClause.h.

93 { return Sat_MemIntSize(p->size, 1); }
static int Sat_MemIntSize(int size, int lrn)
Definition: satClause.h:91
unsigned size
Definition: satClause.h:55
static int Sat_MemClauseUsed ( Sat_Mem_t p,
cla  h 
)
inlinestatic

Definition at line 104 of file satClause.h.

104 { return h < p->BookMarkH[(h & p->uLearnedMask) > 0]; }
int BookMarkH[2]
Definition: satClause.h:74
unsigned uLearnedMask
Definition: satClause.h:79
static int Sat_MemCompactLearned ( Sat_Mem_t p,
int  fDoMove 
)
inlinestatic

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

Synopsis [Compacts learned clauses by removing marked entries.]

Description [Returns the number of remaining entries.]

SideEffects []

SeeAlso []

Definition at line 366 of file satClause.h.

367 {
368  clause * c, * cPivot = NULL;
369  int i, k, iNew = 1, kNew = 2, nInts, fStartLooking, Counter = 0;
370  int hLimit = Sat_MemHandCurrent(p, 1);
371  if ( hLimit == Sat_MemHand(p, 1, 2) )
372  return 0;
373  if ( fDoMove && p->BookMarkH[1] )
374  {
375  // move the pivot
376  assert( p->BookMarkH[1] >= Sat_MemHand(p, 1, 2) && p->BookMarkH[1] <= hLimit );
377  // get the pivot and remember it may be pointed offlimit
378  cPivot = Sat_MemClauseHand( p, p->BookMarkH[1] );
379  if ( p->BookMarkH[1] < hLimit && !cPivot->mark )
380  {
381  p->BookMarkH[1] = cPivot->lits[cPivot->size];
382  cPivot = NULL;
383  }
384  // else find the next used clause after cPivot
385  }
386  // iterate through the learned clauses
387  fStartLooking = 0;
388  Sat_MemForEachLearned( p, c, i, k )
389  {
390  assert( c->lrn );
391  // skip marked entry
392  if ( c->mark )
393  {
394  // if pivot is a marked clause, start looking for the next non-marked one
395  if ( cPivot && cPivot == c )
396  {
397  fStartLooking = 1;
398  cPivot = NULL;
399  }
400  continue;
401  }
402  // if we started looking before, we found it!
403  if ( fStartLooking )
404  {
405  fStartLooking = 0;
406  p->BookMarkH[1] = c->lits[c->size];
407  }
408  // compute entry size
409  nInts = Sat_MemClauseSize(c);
410  assert( !(nInts & 1) );
411  // check if we need to scroll to the next page
412  if ( kNew + nInts >= (1 << p->nPageSize) )
413  {
414  // set the limit of the current page
415  if ( fDoMove )
416  Sat_MemWriteLimit( p->pPages[iNew], kNew );
417  // move writing position to the new page
418  iNew += 2;
419  kNew = 2;
420  }
421  if ( fDoMove )
422  {
423  // make sure the result is the same as previous dry run
424  assert( c->lits[c->size] == Sat_MemHand(p, iNew, kNew) );
425  // only copy the clause if it has changed
426  if ( i != iNew || k != kNew )
427  {
428  memmove( p->pPages[iNew] + kNew, c, sizeof(int) * nInts );
429 // c = Sat_MemClause( p, iNew, kNew ); // assersions do not hold during dry run
430  c = (clause *)(p->pPages[iNew] + kNew);
431  assert( nInts == Sat_MemClauseSize(c) );
432  }
433  // set the new ID value
434  c->lits[c->size] = Counter;
435  }
436  else // remember the address of the clause in the new location
437  c->lits[c->size] = Sat_MemHand(p, iNew, kNew);
438  // update writing position
439  kNew += nInts;
440  assert( iNew <= i && kNew < (1 << p->nPageSize) );
441  // update counter
442  Counter++;
443  }
444  if ( fDoMove )
445  {
446  // update the counter
447  p->nEntries[1] = Counter;
448  // update the page count
449  p->iPage[1] = iNew;
450  // set the limit of the last page
451  Sat_MemWriteLimit( p->pPages[iNew], kNew );
452  // check if the pivot need to be updated
453  if ( p->BookMarkH[1] )
454  {
455  if ( cPivot )
456  {
457  p->BookMarkH[1] = Sat_MemHandCurrent(p, 1);
458  p->BookMarkE[1] = p->nEntries[1];
459  }
460  else
461  p->BookMarkE[1] = clause_id(Sat_MemClauseHand( p, p->BookMarkH[1] ));
462  }
463 
464  }
465  return Counter;
466 }
int ** pPages
Definition: satClause.h:81
lit lits[0]
Definition: satClause.h:56
static cla Sat_MemHandCurrent(Sat_Mem_t *p, int lrn)
Definition: satClause.h:102
static int clause_id(clause *c)
Definition: satClause.h:144
#define Sat_MemForEachLearned(p, c, i, k)
Definition: satClause.h:126
char * memmove()
int BookMarkH[2]
Definition: satClause.h:74
unsigned mark
Definition: satClause.h:52
static int Counter
static clause * Sat_MemClauseHand(Sat_Mem_t *p, cla h)
Definition: satClause.h:98
unsigned size
Definition: satClause.h:55
int nEntries[2]
Definition: satClause.h:73
int BookMarkE[2]
Definition: satClause.h:75
int iPage[2]
Definition: satClause.h:76
static int Sat_MemClauseSize(clause *p)
Definition: satClause.h:92
unsigned lrn
Definition: satClause.h:51
#define assert(ex)
Definition: util_old.h:213
int nPageSize
Definition: satClause.h:77
static void Sat_MemWriteLimit(int *p, int nInts)
Definition: satClause.h:86
static cla Sat_MemHand(Sat_Mem_t *p, int i, int k)
Definition: satClause.h:101
static int Sat_MemCountL ( Sat_Mem_t p)
inlinestatic

FUNCTION DECLARATIONS ///.

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

Synopsis [Allocating vector.]

Description []

SideEffects []

SeeAlso []

Definition at line 173 of file satClause.h.

174 {
175  clause * c;
176  int i, k, Count = 0;
177  Sat_MemForEachLearned( p, c, i, k )
178  Count++;
179  return Count;
180 }
#define Sat_MemForEachLearned(p, c, i, k)
Definition: satClause.h:126
static int Sat_MemEntryNum ( Sat_Mem_t p,
int  lrn 
)
inlinestatic

Definition at line 99 of file satClause.h.

99 { return p->nEntries[lrn]; }
int nEntries[2]
Definition: satClause.h:73
static void Sat_MemFree ( Sat_Mem_t p)
inlinestatic

Definition at line 284 of file satClause.h.

285 {
286  Sat_MemFree_( p );
287  ABC_FREE( p );
288 }
static void Sat_MemFree_(Sat_Mem_t *p)
Definition: satClause.h:277
#define ABC_FREE(obj)
Definition: abc_global.h:232
static void Sat_MemFree_ ( Sat_Mem_t p)
inlinestatic

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

Synopsis [Freeing vector.]

Description []

SideEffects []

SeeAlso []

Definition at line 277 of file satClause.h.

278 {
279  int i;
280  for ( i = 0; i < p->nPagesAlloc; i++ )
281  ABC_FREE( p->pPages[i] );
282  ABC_FREE( p->pPages );
283 }
int ** pPages
Definition: satClause.h:81
int nPagesAlloc
Definition: satClause.h:80
#define ABC_FREE(obj)
Definition: abc_global.h:232
static cla Sat_MemHand ( Sat_Mem_t p,
int  i,
int  k 
)
inlinestatic

Definition at line 101 of file satClause.h.

101 { return (i << p->nPageSize) | k; }
int nPageSize
Definition: satClause.h:77
static cla Sat_MemHandCurrent ( Sat_Mem_t p,
int  lrn 
)
inlinestatic

Definition at line 102 of file satClause.h.

102 { return (p->iPage[lrn] << p->nPageSize) | Sat_MemLimit( p->pPages[p->iPage[lrn]] ); }
int ** pPages
Definition: satClause.h:81
static int Sat_MemLimit(int *p)
Definition: satClause.h:84
int iPage[2]
Definition: satClause.h:76
int nPageSize
Definition: satClause.h:77
static int Sat_MemHandPage ( Sat_Mem_t p,
cla  h 
)
inlinestatic

Definition at line 88 of file satClause.h.

88 { return h >> p->nPageSize; }
int nPageSize
Definition: satClause.h:77
static int Sat_MemHandShift ( Sat_Mem_t p,
cla  h 
)
inlinestatic

Definition at line 89 of file satClause.h.

89 { return h & p->uPageMask; }
unsigned uPageMask
Definition: satClause.h:78
static int Sat_MemIncLimit ( int *  p,
int  nInts 
)
inlinestatic

Definition at line 85 of file satClause.h.

85 { return p[0] += nInts; }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static int Sat_MemIntSize ( int  size,
int  lrn 
)
inlinestatic

Definition at line 91 of file satClause.h.

91 { return (size + 2 + lrn) & ~01; }
static int size
Definition: cuddSign.c:86
static int Sat_MemLimit ( int *  p)
inlinestatic

Definition at line 84 of file satClause.h.

84 { return p[0]; }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static double Sat_MemMemoryAll ( Sat_Mem_t p)
inlinestatic

Definition at line 109 of file satClause.h.

109 { return 1.0 * (p->iPage[0] + p->iPage[1] + 2) * (1 << (p->nPageSize+2)); }
int iPage[2]
Definition: satClause.h:76
int nPageSize
Definition: satClause.h:77
static double Sat_MemMemoryAllUsed ( Sat_Mem_t p)
inlinestatic

Definition at line 108 of file satClause.h.

108 { return Sat_MemMemoryUsed( p, 0 ) + Sat_MemMemoryUsed( p, 1 ); }
static double Sat_MemMemoryUsed(Sat_Mem_t *p, int lrn)
Definition: satClause.h:107
static double Sat_MemMemoryHand ( Sat_Mem_t p,
cla  h 
)
inlinestatic

Definition at line 106 of file satClause.h.

106 { return 1.0 * ((Sat_MemHandPage(p, h) + 2)/2 * (1 << (p->nPageSize+2)) + Sat_MemHandShift(p, h) * 4); }
static int Sat_MemHandShift(Sat_Mem_t *p, cla h)
Definition: satClause.h:89
static int Sat_MemHandPage(Sat_Mem_t *p, cla h)
Definition: satClause.h:88
int nPageSize
Definition: satClause.h:77
static double Sat_MemMemoryUsed ( Sat_Mem_t p,
int  lrn 
)
inlinestatic

Definition at line 107 of file satClause.h.

107 { return Sat_MemMemoryHand( p, Sat_MemHandCurrent(p, lrn) ); }
static cla Sat_MemHandCurrent(Sat_Mem_t *p, int lrn)
Definition: satClause.h:102
static double Sat_MemMemoryHand(Sat_Mem_t *p, cla h)
Definition: satClause.h:106
static void Sat_MemRestart ( Sat_Mem_t p)
inlinestatic

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

Synopsis [Resetting vector.]

Description []

SideEffects []

SeeAlso []

Definition at line 228 of file satClause.h.

229 {
230  p->nEntries[0] = 0;
231  p->nEntries[1] = 0;
232  p->iPage[0] = 0;
233  p->iPage[1] = 1;
234  Sat_MemWriteLimit( p->pPages[0], 2 );
235  Sat_MemWriteLimit( p->pPages[1], 2 );
236 }
int ** pPages
Definition: satClause.h:81
int nEntries[2]
Definition: satClause.h:73
int iPage[2]
Definition: satClause.h:76
static void Sat_MemWriteLimit(int *p, int nInts)
Definition: satClause.h:86
static void Sat_MemRollBack ( Sat_Mem_t p)
inlinestatic

Definition at line 256 of file satClause.h.

257 {
258  p->nEntries[0] = p->BookMarkE[0];
259  p->nEntries[1] = p->BookMarkE[1];
260  p->iPage[0] = Sat_MemHandPage( p, p->BookMarkH[0] );
261  p->iPage[1] = Sat_MemHandPage( p, p->BookMarkH[1] );
262  Sat_MemWriteLimit( p->pPages[p->iPage[0]], Sat_MemHandShift( p, p->BookMarkH[0] ) );
263  Sat_MemWriteLimit( p->pPages[p->iPage[1]], Sat_MemHandShift( p, p->BookMarkH[1] ) );
264 }
int ** pPages
Definition: satClause.h:81
static int Sat_MemHandShift(Sat_Mem_t *p, cla h)
Definition: satClause.h:89
int BookMarkH[2]
Definition: satClause.h:74
static int Sat_MemHandPage(Sat_Mem_t *p, cla h)
Definition: satClause.h:88
int nEntries[2]
Definition: satClause.h:73
int BookMarkE[2]
Definition: satClause.h:75
int iPage[2]
Definition: satClause.h:76
static void Sat_MemWriteLimit(int *p, int nInts)
Definition: satClause.h:86
static void Sat_MemShrink ( Sat_Mem_t p,
int  h,
int  lrn 
)
inlinestatic

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

Synopsis [Shrinking vector size.]

Description []

SideEffects [This procedure does not update the number of entries.]

SeeAlso []

Definition at line 346 of file satClause.h.

347 {
348  assert( clause_learnt_h(p, h) == lrn );
349  assert( h && h <= Sat_MemHandCurrent(p, lrn) );
350  p->iPage[lrn] = Sat_MemHandPage(p, h);
351  Sat_MemWriteLimit( p->pPages[p->iPage[lrn]], Sat_MemHandShift(p, h) );
352 }
int ** pPages
Definition: satClause.h:81
static cla Sat_MemHandCurrent(Sat_Mem_t *p, int lrn)
Definition: satClause.h:102
static int Sat_MemHandShift(Sat_Mem_t *p, cla h)
Definition: satClause.h:89
static int clause_learnt_h(Sat_Mem_t *p, cla h)
Definition: satClause.h:142
static int Sat_MemHandPage(Sat_Mem_t *p, cla h)
Definition: satClause.h:88
int iPage[2]
Definition: satClause.h:76
#define assert(ex)
Definition: util_old.h:213
static void Sat_MemWriteLimit(int *p, int nInts)
Definition: satClause.h:86
static void Sat_MemWriteLimit ( int *  p,
int  nInts 
)
inlinestatic

Definition at line 86 of file satClause.h.

86 { p[0] = nInts; }
static Llb_Mgr_t * p
Definition: llb3Image.c:950