abc-master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
pdrUtil.c File Reference
#include "pdrInt.h"

Go to the source code of this file.

Macros

#define PDR_VAL0   1
 
#define PDR_VAL1   2
 
#define PDR_VALX   3
 

Functions

ABC_NAMESPACE_IMPL_START
Pdr_Set_t
Pdr_SetAlloc (int nSize)
 DECLARATIONS ///. More...
 
Pdr_Set_tPdr_SetCreate (Vec_Int_t *vLits, Vec_Int_t *vPiLits)
 
Pdr_Set_tPdr_SetCreateFrom (Pdr_Set_t *pSet, int iRemove)
 
Pdr_Set_tPdr_SetCreateSubset (Pdr_Set_t *pSet, int *pLits, int nLits)
 
Pdr_Set_tPdr_SetDup (Pdr_Set_t *pSet)
 
Pdr_Set_tPdr_SetRef (Pdr_Set_t *p)
 
void Pdr_SetDeref (Pdr_Set_t *p)
 
void Pdr_SetPrint (FILE *pFile, Pdr_Set_t *p, int nRegs, Vec_Int_t *vFlopCounts)
 
int Pdr_SetContains (Pdr_Set_t *pOld, Pdr_Set_t *pNew)
 
int Pdr_SetContainsSimple (Pdr_Set_t *pOld, Pdr_Set_t *pNew)
 
int Pdr_SetIsInit (Pdr_Set_t *pCube, int iRemove)
 
int Pdr_SetCompare (Pdr_Set_t **pp1, Pdr_Set_t **pp2)
 
Pdr_Obl_tPdr_OblStart (int k, int prio, Pdr_Set_t *pState, Pdr_Obl_t *pNext)
 
Pdr_Obl_tPdr_OblRef (Pdr_Obl_t *p)
 
void Pdr_OblDeref (Pdr_Obl_t *p)
 
int Pdr_QueueIsEmpty (Pdr_Man_t *p)
 
Pdr_Obl_tPdr_QueueHead (Pdr_Man_t *p)
 
Pdr_Obl_tPdr_QueuePop (Pdr_Man_t *p)
 
void Pdr_QueueClean (Pdr_Man_t *p)
 
void Pdr_QueuePush (Pdr_Man_t *p, Pdr_Obl_t *pObl)
 
void Pdr_QueuePrint (Pdr_Man_t *p)
 
void Pdr_QueueStop (Pdr_Man_t *p)
 
static int Pdr_ObjSatValue (Aig_Man_t *pAig, Aig_Obj_t *pNode, int fCompl)
 
int Pdr_NtkFindSatAssign_rec (Aig_Man_t *pAig, Aig_Obj_t *pNode, int Value, Pdr_Set_t *pCube, int Heur)
 
int Pdr_ManCubeJust (Pdr_Man_t *p, int k, Pdr_Set_t *pCube)
 

Macro Definition Documentation

#define PDR_VAL0   1

Definition at line 593 of file pdrUtil.c.

#define PDR_VAL1   2

Definition at line 594 of file pdrUtil.c.

#define PDR_VALX   3

Definition at line 595 of file pdrUtil.c.

Function Documentation

int Pdr_ManCubeJust ( Pdr_Man_t p,
int  k,
Pdr_Set_t pCube 
)

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

Synopsis [Returns 1 if SAT assignment is found; 0 otherwise.]

Description []

SideEffects []

SeeAlso []

Definition at line 688 of file pdrUtil.c.

689 {
690  Aig_Obj_t * pNode;
691  int i, v, fCompl;
692 // return 0;
693  for ( i = 0; i < 4; i++ )
694  {
695  // derive new assignment
696  p->pCubeJust->nLits = 0;
697  p->pCubeJust->Sign = 0;
699  for ( v = 0; v < pCube->nLits; v++ )
700  {
701  if ( pCube->Lits[v] == -1 )
702  continue;
703  pNode = Saig_ManLi( p->pAig, lit_var(pCube->Lits[v]) );
704  fCompl = lit_sign(pCube->Lits[v]) ^ Aig_ObjFaninC0(pNode);
705  if ( !Pdr_NtkFindSatAssign_rec( p->pAig, Aig_ObjFanin0(pNode), !fCompl, p->pCubeJust, i ) )
706  break;
707  }
708  if ( v < pCube->nLits )
709  continue;
710  // figure this out!!!
711  if ( p->pCubeJust->nLits == 0 )
712  continue;
713  // successfully derived new assignment
714  Vec_IntSelectSort( p->pCubeJust->Lits, p->pCubeJust->nLits );
715  // check assignment against this cube
716  if ( Pdr_SetContainsSimple( p->pCubeJust, pCube ) )
717  continue;
718 //printf( "\n" );
719 //Pdr_SetPrint( stdout, pCube, Saig_ManRegNum(p->pAig), NULL ); printf( "\n" );
720 //Pdr_SetPrint( stdout, p->pCubeJust, Saig_ManRegNum(p->pAig), NULL ); printf( "\n" );
721  // check assignment against the clauses
722  if ( Pdr_ManCheckContainment( p, k, p->pCubeJust ) )
723  continue;
724  // find good assignment
725  return 1;
726  }
727  return 0;
728 }
Aig_Man_t * pAig
Definition: pdrInt.h:70
static int lit_var(lit l)
Definition: satVec.h:145
static Aig_Obj_t * Aig_ObjFanin0(Aig_Obj_t *pObj)
Definition: aig.h:308
Pdr_Set_t * pCubeJust
Definition: pdrInt.h:102
void Aig_ManIncrementTravId(Aig_Man_t *p)
DECLARATIONS ///.
Definition: aigUtil.c:44
static void Vec_IntSelectSort(int *pArray, int nSize)
Definition: vecInt.h:1740
int Pdr_NtkFindSatAssign_rec(Aig_Man_t *pAig, Aig_Obj_t *pNode, int Value, Pdr_Set_t *pCube, int Heur)
Definition: pdrUtil.c:626
static Aig_Obj_t * Saig_ManLi(Aig_Man_t *p, int i)
Definition: saig.h:80
Definition: aig.h:69
static int Aig_ObjFaninC0(Aig_Obj_t *pObj)
Definition: aig.h:306
int Pdr_ManCheckContainment(Pdr_Man_t *p, int k, Pdr_Set_t *pSet)
Definition: pdrCore.c:241
static int lit_sign(lit l)
Definition: satVec.h:146
int Pdr_SetContainsSimple(Pdr_Set_t *pOld, Pdr_Set_t *pNew)
Definition: pdrUtil.c:301
int Pdr_NtkFindSatAssign_rec ( Aig_Man_t pAig,
Aig_Obj_t pNode,
int  Value,
Pdr_Set_t pCube,
int  Heur 
)

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

Synopsis [Recursively searched for a satisfying assignment.]

Description []

SideEffects []

SeeAlso []

Definition at line 626 of file pdrUtil.c.

627 {
628  int Value0, Value1;
629  if ( Aig_ObjIsConst1(pNode) )
630  return 1;
631  if ( Aig_ObjIsTravIdCurrent(pAig, pNode) )
632  return ((int)pNode->fMarkA == Value);
633  Aig_ObjSetTravIdCurrent(pAig, pNode);
634  pNode->fMarkA = Value;
635  if ( Aig_ObjIsCi(pNode) )
636  {
637 // if ( vSuppLits )
638 // Vec_IntPush( vSuppLits, Abc_Var2Lit( Aig_ObjCioId(pNode), !Value ) );
639  if ( Saig_ObjIsLo(pAig, pNode) )
640  {
641 // pCube->Lits[pCube->nLits++] = Abc_Var2Lit( Aig_ObjCioId(pNode) - Saig_ManPiNum(pAig), !Value );
642  pCube->Lits[pCube->nLits++] = Abc_Var2Lit( Aig_ObjCioId(pNode) - Saig_ManPiNum(pAig), Value );
643  pCube->Sign |= ((word)1 << (pCube->Lits[pCube->nLits-1] % 63));
644  }
645  return 1;
646  }
647  assert( Aig_ObjIsNode(pNode) );
648  // propagation
649  if ( Value )
650  {
651  if ( !Pdr_NtkFindSatAssign_rec(pAig, Aig_ObjFanin0(pNode), !Aig_ObjFaninC0(pNode), pCube, Heur) )
652  return 0;
653  return Pdr_NtkFindSatAssign_rec(pAig, Aig_ObjFanin1(pNode), !Aig_ObjFaninC1(pNode), pCube, Heur);
654  }
655  // justification
656  Value0 = Pdr_ObjSatValue( pAig, Aig_ObjFanin0(pNode), Aig_ObjFaninC0(pNode) );
657  if ( Value0 == PDR_VAL0 )
658  return 1;
659  Value1 = Pdr_ObjSatValue( pAig, Aig_ObjFanin1(pNode), Aig_ObjFaninC1(pNode) );
660  if ( Value1 == PDR_VAL0 )
661  return 1;
662  if ( Value0 == PDR_VAL1 && Value1 == PDR_VAL1 )
663  return 0;
664  if ( Value0 == PDR_VAL1 )
665  return Pdr_NtkFindSatAssign_rec(pAig, Aig_ObjFanin1(pNode), Aig_ObjFaninC1(pNode), pCube, Heur);
666  if ( Value1 == PDR_VAL1 )
667  return Pdr_NtkFindSatAssign_rec(pAig, Aig_ObjFanin0(pNode), Aig_ObjFaninC0(pNode), pCube, Heur);
668  assert( Value0 == PDR_VALX && Value1 == PDR_VALX );
669  // decision making
670 // if ( rand() % 10 == Heur )
671  if ( Aig_ObjId(pNode) % 4 == Heur )
672  return Pdr_NtkFindSatAssign_rec(pAig, Aig_ObjFanin1(pNode), Aig_ObjFaninC1(pNode), pCube, Heur);
673  else
674  return Pdr_NtkFindSatAssign_rec(pAig, Aig_ObjFanin0(pNode), Aig_ObjFaninC0(pNode), pCube, Heur);
675 }
static int Saig_ObjIsLo(Aig_Man_t *p, Aig_Obj_t *pObj)
Definition: saig.h:84
static int Aig_ObjIsTravIdCurrent(Aig_Man_t *p, Aig_Obj_t *pObj)
Definition: aig.h:295
static Aig_Obj_t * Aig_ObjFanin0(Aig_Obj_t *pObj)
Definition: aig.h:308
static int Abc_Var2Lit(int Var, int fCompl)
Definition: abc_global.h:263
unsigned int fMarkA
Definition: aig.h:79
static Aig_Obj_t * Aig_ObjFanin1(Aig_Obj_t *pObj)
Definition: aig.h:309
static void Aig_ObjSetTravIdCurrent(Aig_Man_t *p, Aig_Obj_t *pObj)
Definition: aig.h:293
static int Pdr_ObjSatValue(Aig_Man_t *pAig, Aig_Obj_t *pNode, int fCompl)
Definition: pdrUtil.c:608
static int Aig_ObjIsNode(Aig_Obj_t *pObj)
Definition: aig.h:280
int Pdr_NtkFindSatAssign_rec(Aig_Man_t *pAig, Aig_Obj_t *pNode, int Value, Pdr_Set_t *pCube, int Heur)
Definition: pdrUtil.c:626
unsigned __int64 word
DECLARATIONS ///.
Definition: kitPerm.c:36
static int Aig_ObjIsConst1(Aig_Obj_t *pObj)
Definition: aig.h:274
#define PDR_VALX
Definition: pdrUtil.c:595
#define PDR_VAL1
Definition: pdrUtil.c:594
static int Aig_ObjFaninC0(Aig_Obj_t *pObj)
Definition: aig.h:306
static int Saig_ManPiNum(Aig_Man_t *p)
MACRO DEFINITIONS ///.
Definition: saig.h:73
#define PDR_VAL0
Definition: pdrUtil.c:593
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 int Aig_ObjIsCi(Aig_Obj_t *pObj)
Definition: aig.h:275
static int Aig_ObjCioId(Aig_Obj_t *pObj)
Definition: aig.h:285
static int Pdr_ObjSatValue ( Aig_Man_t pAig,
Aig_Obj_t pNode,
int  fCompl 
)
inlinestatic

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

Synopsis [Returns value (0 or 1) or X if unassigned.]

Description []

SideEffects []

SeeAlso []

Definition at line 608 of file pdrUtil.c.

609 {
610  if ( Aig_ObjIsTravIdCurrent(pAig, pNode) )
611  return (pNode->fMarkA ^ fCompl) ? PDR_VAL1 : PDR_VAL0;
612  return PDR_VALX;
613 }
static int Aig_ObjIsTravIdCurrent(Aig_Man_t *p, Aig_Obj_t *pObj)
Definition: aig.h:295
unsigned int fMarkA
Definition: aig.h:79
#define PDR_VALX
Definition: pdrUtil.c:595
#define PDR_VAL1
Definition: pdrUtil.c:594
#define PDR_VAL0
Definition: pdrUtil.c:593
void Pdr_OblDeref ( Pdr_Obl_t p)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 437 of file pdrUtil.c.

438 {
439  if ( --p->nRefs == 0 )
440  {
441  if ( p->pNext )
442  Pdr_OblDeref( p->pNext );
443  Pdr_SetDeref( p->pState );
444  ABC_FREE( p );
445  }
446 }
Pdr_Set_t * pState
Definition: pdrInt.h:60
int nRefs
Definition: pdrInt.h:59
Pdr_Obl_t * pNext
Definition: pdrInt.h:61
void Pdr_SetDeref(Pdr_Set_t *p)
Definition: pdrUtil.c:208
void Pdr_OblDeref(Pdr_Obl_t *p)
Definition: pdrUtil.c:437
#define ABC_FREE(obj)
Definition: abc_global.h:232
Pdr_Obl_t* Pdr_OblRef ( Pdr_Obl_t p)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 420 of file pdrUtil.c.

421 {
422  p->nRefs++;
423  return p;
424 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
int nRefs
Definition: pdrInt.h:59
Pdr_Obl_t* Pdr_OblStart ( int  k,
int  prio,
Pdr_Set_t pState,
Pdr_Obl_t pNext 
)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 396 of file pdrUtil.c.

397 {
398  Pdr_Obl_t * p;
399  p = ABC_ALLOC( Pdr_Obl_t, 1 );
400  p->iFrame = k;
401  p->prio = prio;
402  p->nRefs = 1;
403  p->pState = pState;
404  p->pNext = pNext;
405  p->pLink = NULL;
406  return p;
407 }
int prio
Definition: pdrInt.h:58
static Llb_Mgr_t * p
Definition: llb3Image.c:950
Pdr_Set_t * pState
Definition: pdrInt.h:60
int nRefs
Definition: pdrInt.h:59
Pdr_Obl_t * pNext
Definition: pdrInt.h:61
#define ABC_ALLOC(type, num)
Definition: abc_global.h:229
int iFrame
Definition: pdrInt.h:57
Pdr_Obl_t * pLink
Definition: pdrInt.h:62
void Pdr_QueueClean ( Pdr_Man_t p)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 513 of file pdrUtil.c.

514 {
515  Pdr_Obl_t * pThis;
516  while ( (pThis = Pdr_QueuePop(p)) )
517  Pdr_OblDeref( pThis );
518  pThis = NULL;
519 }
Pdr_Obl_t * Pdr_QueuePop(Pdr_Man_t *p)
Definition: pdrUtil.c:491
void Pdr_OblDeref(Pdr_Obl_t *p)
Definition: pdrUtil.c:437
Pdr_Obl_t* Pdr_QueueHead ( Pdr_Man_t p)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 475 of file pdrUtil.c.

476 {
477  return p->pQueue;
478 }
Pdr_Obl_t * pQueue
Definition: pdrInt.h:85
int Pdr_QueueIsEmpty ( Pdr_Man_t p)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 459 of file pdrUtil.c.

460 {
461  return p->pQueue == NULL;
462 }
Pdr_Obl_t * pQueue
Definition: pdrInt.h:85
Pdr_Obl_t* Pdr_QueuePop ( Pdr_Man_t p)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 491 of file pdrUtil.c.

492 {
493  Pdr_Obl_t * pRes = p->pQueue;
494  if ( p->pQueue == NULL )
495  return NULL;
496  p->pQueue = p->pQueue->pLink;
497  Pdr_OblDeref( pRes );
498  p->nQueCur--;
499  return pRes;
500 }
Pdr_Obl_t * pQueue
Definition: pdrInt.h:85
Pdr_Obl_t * pLink
Definition: pdrInt.h:62
void Pdr_OblDeref(Pdr_Obl_t *p)
Definition: pdrUtil.c:437
int nQueCur
Definition: pdrInt.h:117
void Pdr_QueuePrint ( Pdr_Man_t p)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 562 of file pdrUtil.c.

563 {
564  Pdr_Obl_t * pObl;
565  for ( pObl = p->pQueue; pObl; pObl = pObl->pLink )
566  Abc_Print( 1, "Frame = %2d. Prio = %8d.\n", pObl->iFrame, pObl->prio );
567 }
Pdr_Obl_t * pQueue
Definition: pdrInt.h:85
int prio
Definition: pdrInt.h:58
int iFrame
Definition: pdrInt.h:57
Pdr_Obl_t * pLink
Definition: pdrInt.h:62
static void Abc_Print(int level, const char *format,...)
Definition: abc_global.h:313
void Pdr_QueuePush ( Pdr_Man_t p,
Pdr_Obl_t pObl 
)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 532 of file pdrUtil.c.

533 {
534  Pdr_Obl_t * pTemp, ** ppPrev;
535  p->nObligs++;
536  p->nQueCur++;
537  p->nQueMax = Abc_MaxInt( p->nQueMax, p->nQueCur );
538  Pdr_OblRef( pObl );
539  if ( p->pQueue == NULL )
540  {
541  p->pQueue = pObl;
542  return;
543  }
544  for ( ppPrev = &p->pQueue, pTemp = p->pQueue; pTemp; ppPrev = &pTemp->pLink, pTemp = pTemp->pLink )
545  if ( pTemp->iFrame > pObl->iFrame || (pTemp->iFrame == pObl->iFrame && pTemp->prio > pObl->prio) )
546  break;
547  *ppPrev = pObl;
548  pObl->pLink = pTemp;
549 }
Pdr_Obl_t * pQueue
Definition: pdrInt.h:85
int nObligs
Definition: pdrInt.h:106
int prio
Definition: pdrInt.h:58
int nQueMax
Definition: pdrInt.h:118
static int Abc_MaxInt(int a, int b)
Definition: abc_global.h:238
int iFrame
Definition: pdrInt.h:57
Pdr_Obl_t * pLink
Definition: pdrInt.h:62
Pdr_Obl_t * Pdr_OblRef(Pdr_Obl_t *p)
Definition: pdrUtil.c:420
int nQueCur
Definition: pdrInt.h:117
void Pdr_QueueStop ( Pdr_Man_t p)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 580 of file pdrUtil.c.

581 {
582  Pdr_Obl_t * pObl;
583  while ( !Pdr_QueueIsEmpty(p) )
584  {
585  pObl = Pdr_QueuePop(p);
586  Pdr_OblDeref( pObl );
587  }
588  p->pQueue = NULL;
589  p->nQueCur = 0;
590 }
Pdr_Obl_t * pQueue
Definition: pdrInt.h:85
int Pdr_QueueIsEmpty(Pdr_Man_t *p)
Definition: pdrUtil.c:459
Pdr_Obl_t * Pdr_QueuePop(Pdr_Man_t *p)
Definition: pdrUtil.c:491
void Pdr_OblDeref(Pdr_Obl_t *p)
Definition: pdrUtil.c:437
int nQueCur
Definition: pdrInt.h:117
ABC_NAMESPACE_IMPL_START Pdr_Set_t* Pdr_SetAlloc ( int  nSize)

DECLARATIONS ///.

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

FileName [pdrUtil.c]

SystemName [ABC: Logic synthesis and verification system.]

PackageName [Property driven reachability.]

Synopsis [Various utilities.]

Author [Alan Mishchenko]

Affiliation [UC Berkeley]

Date [Ver. 1.0. Started - November 20, 2010.]

Revision [

Id:
pdrUtil.c,v 1.00 2010/11/20 00:00:00 alanmi Exp

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 46 of file pdrUtil.c.

47 {
48  Pdr_Set_t * p;
49  assert( nSize >= 0 && nSize < (1<<30) );
50  p = (Pdr_Set_t *)ABC_CALLOC( char, sizeof(Pdr_Set_t) + nSize * sizeof(int) );
51  return p;
52 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
typedefABC_NAMESPACE_HEADER_START struct Pdr_Set_t_ Pdr_Set_t
INCLUDES ///.
Definition: pdrInt.h:44
#define ABC_CALLOC(type, num)
Definition: abc_global.h:230
#define assert(ex)
Definition: util_old.h:213
int Pdr_SetCompare ( Pdr_Set_t **  pp1,
Pdr_Set_t **  pp2 
)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 366 of file pdrUtil.c.

367 {
368  Pdr_Set_t * p1 = *pp1;
369  Pdr_Set_t * p2 = *pp2;
370  int i;
371  for ( i = 0; i < p1->nLits && i < p2->nLits; i++ )
372  {
373  if ( p1->Lits[i] > p2->Lits[i] )
374  return -1;
375  if ( p1->Lits[i] < p2->Lits[i] )
376  return 1;
377  }
378  if ( i == p1->nLits && i < p2->nLits )
379  return -1;
380  if ( i < p1->nLits && i == p2->nLits )
381  return 1;
382  return 0;
383 }
typedefABC_NAMESPACE_HEADER_START struct Pdr_Set_t_ Pdr_Set_t
INCLUDES ///.
Definition: pdrInt.h:44
int Pdr_SetContains ( Pdr_Set_t pOld,
Pdr_Set_t pNew 
)

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

Synopsis [Return 1 if pOld set-theoretically contains pNew.]

Description []

SideEffects []

SeeAlso []

Definition at line 263 of file pdrUtil.c.

264 {
265  int * pOldInt, * pNewInt;
266  assert( pOld->nLits > 0 );
267  assert( pNew->nLits > 0 );
268  if ( pOld->nLits < pNew->nLits )
269  return 0;
270  if ( (pOld->Sign & pNew->Sign) != pNew->Sign )
271  return 0;
272  pOldInt = pOld->Lits + pOld->nLits - 1;
273  pNewInt = pNew->Lits + pNew->nLits - 1;
274  while ( pNew->Lits <= pNewInt )
275  {
276  if ( pOld->Lits > pOldInt )
277  return 0;
278  assert( *pNewInt != -1 );
279  assert( *pOldInt != -1 );
280  if ( *pNewInt == *pOldInt )
281  pNewInt--, pOldInt--;
282  else if ( *pNewInt < *pOldInt )
283  pOldInt--;
284  else
285  return 0;
286  }
287  return 1;
288 }
#define assert(ex)
Definition: util_old.h:213
int Pdr_SetContainsSimple ( Pdr_Set_t pOld,
Pdr_Set_t pNew 
)

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

Synopsis [Return 1 if pOld set-theoretically contains pNew.]

Description []

SideEffects []

SeeAlso []

Definition at line 301 of file pdrUtil.c.

302 {
303  int * pOldInt, * pNewInt;
304  assert( pOld->nLits > 0 );
305  assert( pNew->nLits > 0 );
306  pOldInt = pOld->Lits + pOld->nLits - 1;
307  pNewInt = pNew->Lits + pNew->nLits - 1;
308  while ( pNew->Lits <= pNewInt )
309  {
310  assert( *pOldInt != -1 );
311  if ( *pNewInt == -1 )
312  {
313  pNewInt--;
314  continue;
315  }
316  if ( pOld->Lits > pOldInt )
317  return 0;
318  assert( *pNewInt != -1 );
319  assert( *pOldInt != -1 );
320  if ( *pNewInt == *pOldInt )
321  pNewInt--, pOldInt--;
322  else if ( *pNewInt < *pOldInt )
323  pOldInt--;
324  else
325  return 0;
326  }
327  return 1;
328 }
#define assert(ex)
Definition: util_old.h:213
Pdr_Set_t* Pdr_SetCreate ( Vec_Int_t vLits,
Vec_Int_t vPiLits 
)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 65 of file pdrUtil.c.

66 {
67  Pdr_Set_t * p;
68  int i;
69  assert( Vec_IntSize(vLits) + Vec_IntSize(vPiLits) < (1<<30) );
70  p = (Pdr_Set_t *)ABC_ALLOC( char, sizeof(Pdr_Set_t) + (Vec_IntSize(vLits) + Vec_IntSize(vPiLits)) * sizeof(int) );
71  p->nLits = Vec_IntSize(vLits);
72  p->nTotal = Vec_IntSize(vLits) + Vec_IntSize(vPiLits);
73  p->nRefs = 1;
74  p->Sign = 0;
75  for ( i = 0; i < p->nLits; i++ )
76  {
77  p->Lits[i] = Vec_IntEntry(vLits, i);
78  p->Sign |= ((word)1 << (p->Lits[i] % 63));
79  }
80  Vec_IntSelectSort( p->Lits, p->nLits );
81  // remember PI literals
82  for ( i = p->nLits; i < p->nTotal; i++ )
83  p->Lits[i] = Vec_IntEntry(vPiLits, i-p->nLits);
84  return p;
85 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
#define ABC_ALLOC(type, num)
Definition: abc_global.h:229
static void Vec_IntSelectSort(int *pArray, int nSize)
Definition: vecInt.h:1740
static int Vec_IntEntry(Vec_Int_t *p, int i)
Definition: bblif.c:268
unsigned __int64 word
DECLARATIONS ///.
Definition: kitPerm.c:36
typedefABC_NAMESPACE_HEADER_START struct Pdr_Set_t_ Pdr_Set_t
INCLUDES ///.
Definition: pdrInt.h:44
static int Vec_IntSize(Vec_Int_t *p)
Definition: bblif.c:252
#define assert(ex)
Definition: util_old.h:213
int nTotal
DECLARATIONS ///.
Definition: cutTruth.c:37
Pdr_Set_t* Pdr_SetCreateFrom ( Pdr_Set_t pSet,
int  iRemove 
)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 98 of file pdrUtil.c.

99 {
100  Pdr_Set_t * p;
101  int i, k = 0;
102  assert( iRemove >= 0 && iRemove < pSet->nLits );
103  p = (Pdr_Set_t *)ABC_ALLOC( char, sizeof(Pdr_Set_t) + (pSet->nTotal - 1) * sizeof(int) );
104  p->nLits = pSet->nLits - 1;
105  p->nTotal = pSet->nTotal - 1;
106  p->nRefs = 1;
107  p->Sign = 0;
108  for ( i = 0; i < pSet->nTotal; i++ )
109  {
110  if ( i == iRemove )
111  continue;
112  p->Lits[k++] = pSet->Lits[i];
113  if ( i >= pSet->nLits )
114  continue;
115  p->Sign |= ((word)1 << (pSet->Lits[i] % 63));
116  }
117  assert( k == p->nTotal );
118  return p;
119 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
#define ABC_ALLOC(type, num)
Definition: abc_global.h:229
unsigned __int64 word
DECLARATIONS ///.
Definition: kitPerm.c:36
typedefABC_NAMESPACE_HEADER_START struct Pdr_Set_t_ Pdr_Set_t
INCLUDES ///.
Definition: pdrInt.h:44
#define assert(ex)
Definition: util_old.h:213
Pdr_Set_t* Pdr_SetCreateSubset ( Pdr_Set_t pSet,
int *  pLits,
int  nLits 
)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 132 of file pdrUtil.c.

133 {
134  Pdr_Set_t * p;
135  int i, k = 0;
136  assert( nLits >= 0 && nLits <= pSet->nLits );
137  p = (Pdr_Set_t *)ABC_ALLOC( char, sizeof(Pdr_Set_t) + (nLits + pSet->nTotal - pSet->nLits) * sizeof(int) );
138  p->nLits = nLits;
139  p->nTotal = nLits + pSet->nTotal - pSet->nLits;
140  p->nRefs = 1;
141  p->Sign = 0;
142  for ( i = 0; i < nLits; i++ )
143  {
144  assert( pLits[i] >= 0 );
145  p->Lits[k++] = pLits[i];
146  p->Sign |= ((word)1 << (pLits[i] % 63));
147  }
148  Vec_IntSelectSort( p->Lits, p->nLits );
149  for ( i = pSet->nLits; i < pSet->nTotal; i++ )
150  p->Lits[k++] = pSet->Lits[i];
151  assert( k == p->nTotal );
152  return p;
153 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
#define ABC_ALLOC(type, num)
Definition: abc_global.h:229
static void Vec_IntSelectSort(int *pArray, int nSize)
Definition: vecInt.h:1740
unsigned __int64 word
DECLARATIONS ///.
Definition: kitPerm.c:36
typedefABC_NAMESPACE_HEADER_START struct Pdr_Set_t_ Pdr_Set_t
INCLUDES ///.
Definition: pdrInt.h:44
#define assert(ex)
Definition: util_old.h:213
int nTotal
DECLARATIONS ///.
Definition: cutTruth.c:37
void Pdr_SetDeref ( Pdr_Set_t p)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 208 of file pdrUtil.c.

209 {
210  if ( --p->nRefs == 0 )
211  ABC_FREE( p );
212 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
#define ABC_FREE(obj)
Definition: abc_global.h:232
Pdr_Set_t* Pdr_SetDup ( Pdr_Set_t pSet)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 166 of file pdrUtil.c.

167 {
168  Pdr_Set_t * p;
169  int i;
170  p = (Pdr_Set_t *)ABC_ALLOC( char, sizeof(Pdr_Set_t) + pSet->nTotal * sizeof(int) );
171  p->nLits = pSet->nLits;
172  p->nTotal = pSet->nTotal;
173  p->nRefs = 1;
174  p->Sign = pSet->Sign;
175  for ( i = 0; i < pSet->nTotal; i++ )
176  p->Lits[i] = pSet->Lits[i];
177  return p;
178 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
#define ABC_ALLOC(type, num)
Definition: abc_global.h:229
typedefABC_NAMESPACE_HEADER_START struct Pdr_Set_t_ Pdr_Set_t
INCLUDES ///.
Definition: pdrInt.h:44
int Pdr_SetIsInit ( Pdr_Set_t pCube,
int  iRemove 
)

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

Synopsis [Return 1 if the state cube contains init state (000...0).]

Description []

SideEffects []

SeeAlso []

Definition at line 341 of file pdrUtil.c.

342 {
343  int i;
344  for ( i = 0; i < pCube->nLits; i++ )
345  {
346  assert( pCube->Lits[i] != -1 );
347  if ( i == iRemove )
348  continue;
349  if ( lit_sign( pCube->Lits[i] ) == 0 )
350  return 0;
351  }
352  return 1;
353 }
static int lit_sign(lit l)
Definition: satVec.h:146
#define assert(ex)
Definition: util_old.h:213
void Pdr_SetPrint ( FILE *  pFile,
Pdr_Set_t p,
int  nRegs,
Vec_Int_t vFlopCounts 
)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 225 of file pdrUtil.c.

226 {
227  char * pBuff;
228  int i, k, Entry;
229  pBuff = ABC_ALLOC( char, nRegs + 1 );
230  for ( i = 0; i < nRegs; i++ )
231  pBuff[i] = '-';
232  pBuff[i] = 0;
233  for ( i = 0; i < p->nLits; i++ )
234  {
235  if ( p->Lits[i] == -1 )
236  continue;
237  pBuff[lit_var(p->Lits[i])] = (lit_sign(p->Lits[i])? '0':'1');
238  }
239  if ( vFlopCounts )
240  {
241  // skip some literals
242  k = 0;
243  Vec_IntForEachEntry( vFlopCounts, Entry, i )
244  if ( Entry )
245  pBuff[k++] = pBuff[i];
246  pBuff[k] = 0;
247  }
248  fprintf( pFile, "%s", pBuff );
249  ABC_FREE( pBuff );
250 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static int lit_var(lit l)
Definition: satVec.h:145
#define ABC_ALLOC(type, num)
Definition: abc_global.h:229
if(last==0)
Definition: sparse_int.h:34
static int lit_sign(lit l)
Definition: satVec.h:146
#define ABC_FREE(obj)
Definition: abc_global.h:232
#define Vec_IntForEachEntry(vVec, Entry, i)
MACRO DEFINITIONS ///.
Definition: vecInt.h:54
Pdr_Set_t* Pdr_SetRef ( Pdr_Set_t p)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 191 of file pdrUtil.c.

192 {
193  p->nRefs++;
194  return p;
195 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950