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

Go to the source code of this file.

Data Structures

struct  Tas_Par_t_
 
struct  Tas_Cls_t_
 
struct  Tas_Sto_t_
 
struct  Tas_Que_t_
 
struct  Tas_Man_t_
 

Macros

#define Tas_QueForEachEntry(Que, pObj, i)   for ( i = (Que).iHead; (i < (Que).iTail) && ((pObj) = (Que).pData[i]); i++ )
 
#define Tas_ClauseForEachVar(p, hClause, pObj)   for ( (p)->pIter = (p)->pClauses.pData + hClause; (pObj = *pIter); (p)->pIter++ )
 
#define Tas_ClauseForEachVar1(p, hClause, pObj)   for ( (p)->pIter = (p)->pClauses.pData+hClause+1; (pObj = *pIter); (p)->pIter++ )
 

Typedefs

typedef
typedefABC_NAMESPACE_IMPL_START
struct Tas_Par_t_ 
Tas_Par_t
 DECLARATIONS ///. More...
 
typedef struct Tas_Cls_t_ Tas_Cls_t
 
typedef struct Tas_Sto_t_ Tas_Sto_t
 
typedef struct Tas_Que_t_ Tas_Que_t
 

Functions

static int Tas_VarIsAssigned (Gia_Obj_t *pVar)
 
static void Tas_VarAssign (Gia_Obj_t *pVar)
 
static void Tas_VarUnassign (Gia_Obj_t *pVar)
 
static int Tas_VarValue (Gia_Obj_t *pVar)
 
static void Tas_VarSetValue (Gia_Obj_t *pVar, int v)
 
static int Tas_VarIsJust (Gia_Obj_t *pVar)
 
static int Tas_VarFanin0Value (Gia_Obj_t *pVar)
 
static int Tas_VarFanin1Value (Gia_Obj_t *pVar)
 
static int Tas_VarToLit (Tas_Man_t *p, Gia_Obj_t *pObj)
 
static int Tas_LitIsTrue (Gia_Obj_t *pObj, int Lit)
 
static int Tas_ClsHandle (Tas_Man_t *p, Tas_Cls_t *pClause)
 
static Tas_Cls_tTas_ClsFromHandle (Tas_Man_t *p, int h)
 
static int Tas_VarDecLevel (Tas_Man_t *p, Gia_Obj_t *pVar)
 
static Gia_Obj_tTas_VarReason0 (Tas_Man_t *p, Gia_Obj_t *pVar)
 
static Gia_Obj_tTas_VarReason1 (Tas_Man_t *p, Gia_Obj_t *pVar)
 
static int Tas_ClauseDecLevel (Tas_Man_t *p, int hClause)
 
static int Tas_VarHasReasonCls (Tas_Man_t *p, Gia_Obj_t *pVar)
 
static Tas_Cls_tTas_VarReasonCls (Tas_Man_t *p, Gia_Obj_t *pVar)
 
void Tas_SetDefaultParams (Tas_Par_t *pPars)
 FUNCTION DEFINITIONS ///. More...
 
Tas_Man_tTas_ManAlloc (Gia_Man_t *pAig, int nBTLimit)
 
void Tas_ManStop (Tas_Man_t *p)
 
Vec_Int_tTas_ReadModel (Tas_Man_t *p)
 
static int Tas_ManCheckLimits (Tas_Man_t *p)
 
static void Tas_ManSaveModel (Tas_Man_t *p, Vec_Int_t *vCex)
 
static int Tas_QueIsEmpty (Tas_Que_t *p)
 
static void Tas_QuePush (Tas_Que_t *p, Gia_Obj_t *pObj)
 
static int Tas_QueHasNode (Tas_Que_t *p, Gia_Obj_t *pObj)
 
static void Tas_QueStore (Tas_Que_t *p, int *piHeadOld, int *piTailOld)
 
static void Tas_QueRestore (Tas_Que_t *p, int iHeadOld, int iTailOld)
 
static int Tas_QueFinish (Tas_Que_t *p)
 
static int Tas_VarFaninFanoutMax (Tas_Man_t *p, Gia_Obj_t *pObj)
 
static Gia_Obj_tTas_ManFindActive (Tas_Man_t *p)
 
static Gia_Obj_tTas_ManDecideHighestFanin (Tas_Man_t *p)
 
static Gia_Obj_tTas_ManDecideHighest (Tas_Man_t *p)
 
static Gia_Obj_tTas_ManDecideHighestA (Tas_Man_t *p)
 
static Gia_Obj_tTas_ManDecideLowest (Tas_Man_t *p)
 
static Gia_Obj_tTas_ManDecideMaxFF (Tas_Man_t *p)
 
static void Tas_ManCancelUntil (Tas_Man_t *p, int iBound)
 
static void Tas_ManAssign (Tas_Man_t *p, Gia_Obj_t *pObj, int Level, Gia_Obj_t *pRes0, Gia_Obj_t *pRes1)
 
static int Tas_ManClauseSize (Tas_Man_t *p, int hClause)
 
static void Tas_ManPrintClause (Tas_Man_t *p, int Level, int hClause)
 
static void Tas_ManPrintClauseNew (Tas_Man_t *p, int Level, int hClause)
 
static void Tas_ManDeriveReason (Tas_Man_t *p, int Level)
 
static int Tas_ManAnalyze (Tas_Man_t *p, int Level, Gia_Obj_t *pVar, Gia_Obj_t *pFan0, Gia_Obj_t *pFan1)
 
static int Tas_ManResolve (Tas_Man_t *p, int Level, int hClause0, int hClause1)
 
static Tas_Cls_tTas_ManAllocCls (Tas_Man_t *p, int nSize)
 
static void Tas_ManWatchClause (Tas_Man_t *p, Tas_Cls_t *pClause, int Lit)
 
static Tas_Cls_tTas_ManCreateCls (Tas_Man_t *p, int hClause)
 
static int Tas_ManCreateFromCls (Tas_Man_t *p, Tas_Cls_t *pCls, int Level)
 
static int Tas_ManPropagateWatch (Tas_Man_t *p, int Level, int Lit)
 
static int Tas_ManPropagateOne (Tas_Man_t *p, Gia_Obj_t *pVar, int Level)
 
static int Tas_ManPropagateTwo (Tas_Man_t *p, Gia_Obj_t *pVar, int Level)
 
int Tas_ManPropagate (Tas_Man_t *p, int Level)
 
int Tas_ManSolve_rec (Tas_Man_t *p, int Level)
 
int Tas_ManSolve (Tas_Man_t *p, Gia_Obj_t *pObj, Gia_Obj_t *pObj2)
 
int Tas_ManSolveArray (Tas_Man_t *p, Vec_Ptr_t *vObjs)
 
void Tas_ManSatPrintStats (Tas_Man_t *p)
 
Vec_Int_tTas_ManSolveMiterNc (Gia_Man_t *pAig, int nConfs, Vec_Str_t **pvStatus, int fVerbose)
 
int Tas_StorePatternTry (Vec_Ptr_t *vInfo, Vec_Ptr_t *vPres, int iBit, int *pLits, int nLits)
 
int Tas_StorePattern (Vec_Ptr_t *vSimInfo, Vec_Ptr_t *vPres, Vec_Int_t *vCex)
 
void Tas_ManSolveMiterNc2 (Gia_Man_t *pAig, int nConfs, Gia_Man_t *pAigOld, Vec_Ptr_t *vOldRoots, Vec_Ptr_t *vSimInfo)
 

Variables

int s_Counter2 = 0
 
int s_Counter3 = 0
 
int s_Counter4 = 0
 

Macro Definition Documentation

#define Tas_ClauseForEachVar (   p,
  hClause,
  pObj 
)    for ( (p)->pIter = (p)->pClauses.pData + hClause; (pObj = *pIter); (p)->pIter++ )

Definition at line 142 of file giaCTas.c.

#define Tas_ClauseForEachVar1 (   p,
  hClause,
  pObj 
)    for ( (p)->pIter = (p)->pClauses.pData+hClause+1; (pObj = *pIter); (p)->pIter++ )

Definition at line 144 of file giaCTas.c.

#define Tas_QueForEachEntry (   Que,
  pObj,
 
)    for ( i = (Que).iHead; (i < (Que).iTail) && ((pObj) = (Que).pData[i]); i++ )

Definition at line 139 of file giaCTas.c.

Typedef Documentation

typedef struct Tas_Cls_t_ Tas_Cls_t

Definition at line 57 of file giaCTas.c.

typedef typedefABC_NAMESPACE_IMPL_START struct Tas_Par_t_ Tas_Par_t

DECLARATIONS ///.

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

FileName [giaCSat.c]

SystemName [ABC: Logic synthesis and verification system.]

PackageName [Scalable AIG package.]

Synopsis [A simple circuit-based solver.]

Author [Alan Mishchenko]

Affiliation [UC Berkeley]

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

Revision [

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

]

Definition at line 33 of file giaCTas.c.

typedef struct Tas_Que_t_ Tas_Que_t

Definition at line 73 of file giaCTas.c.

typedef struct Tas_Sto_t_ Tas_Sto_t

Definition at line 65 of file giaCTas.c.

Function Documentation

static int Tas_ClauseDecLevel ( Tas_Man_t p,
int  hClause 
)
inlinestatic

Definition at line 134 of file giaCTas.c.

134 { return Tas_VarDecLevel( p, p->pClauses.pData[hClause] ); }
Gia_Obj_t ** pData
Definition: giaCTas.c:79
static int Tas_VarDecLevel(Tas_Man_t *p, Gia_Obj_t *pVar)
Definition: giaCTas.c:131
Tas_Que_t pClauses
Definition: giaCTas.c:88
static Tas_Cls_t* Tas_ClsFromHandle ( Tas_Man_t p,
int  h 
)
inlinestatic

Definition at line 129 of file giaCTas.c.

129 { return (Tas_Cls_t *)(p->pStore.pData + h); }
Tas_Sto_t pStore
Definition: giaCTas.c:94
int * pData
Definition: giaCTas.c:70
static int Tas_ClsHandle ( Tas_Man_t p,
Tas_Cls_t pClause 
)
inlinestatic

Definition at line 128 of file giaCTas.c.

128 { return ((int *)pClause) - p->pStore.pData; }
Tas_Sto_t pStore
Definition: giaCTas.c:94
int * pData
Definition: giaCTas.c:70
static int Tas_LitIsTrue ( Gia_Obj_t pObj,
int  Lit 
)
inlinestatic

Definition at line 126 of file giaCTas.c.

126 { assert( Tas_VarIsAssigned(pObj) ); return Tas_VarValue(pObj) != Abc_LitIsCompl(Lit); }
static int Tas_VarValue(Gia_Obj_t *pVar)
Definition: giaCTas.c:120
static int Tas_VarIsAssigned(Gia_Obj_t *pVar)
Definition: giaCTas.c:117
static int Abc_LitIsCompl(int Lit)
Definition: abc_global.h:265
#define assert(ex)
Definition: util_old.h:213
Tas_Man_t* Tas_ManAlloc ( Gia_Man_t pAig,
int  nBTLimit 
)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 187 of file giaCTas.c.

188 {
189  Tas_Man_t * p;
190  p = ABC_CALLOC( Tas_Man_t, 1 );
191  Tas_SetDefaultParams( &p->Pars );
192  p->pAig = pAig;
193  p->Pars.nBTLimit = nBTLimit;
194  p->pProp.nSize = p->pJust.nSize = p->pClauses.nSize = 10000;
195  p->pProp.pData = ABC_ALLOC( Gia_Obj_t *, p->pProp.nSize );
196  p->pJust.pData = ABC_ALLOC( Gia_Obj_t *, p->pJust.nSize );
198  p->pClauses.iHead = p->pClauses.iTail = 1;
199  p->vModel = Vec_IntAlloc( 1000 );
200  p->vLevReas = Vec_IntAlloc( 1000 );
201  p->vTemp = Vec_PtrAlloc( 1000 );
202  p->pStore.iCur = 16;
203  p->pStore.nSize = 10000;
204  p->pStore.pData = ABC_ALLOC( int, p->pStore.nSize );
205  p->pWatches = ABC_CALLOC( int, 2 * Gia_ManObjNum(pAig) );
206  p->vWatchLits = Vec_IntAlloc( 100 );
207  p->pActivity = ABC_CALLOC( float, Gia_ManObjNum(pAig) );
208  p->vActiveVars = Vec_IntAlloc( 100 );
209  return p;
210 }
int nSize
Definition: giaCTas.c:69
int * pWatches
Definition: giaCTas.c:95
static Llb_Mgr_t * p
Definition: llb3Image.c:950
Vec_Int_t * vActiveVars
Definition: giaCTas.c:100
Gia_Man_t * pAig
Definition: giaCTas.c:85
Tas_Que_t pProp
Definition: giaCTas.c:86
int iHead
Definition: giaCTas.c:76
#define ABC_ALLOC(type, num)
Definition: abc_global.h:229
float * pActivity
Definition: giaCTas.c:99
Definition: gia.h:75
Gia_Obj_t ** pData
Definition: giaCTas.c:79
int iCur
Definition: giaCTas.c:68
Tas_Sto_t pStore
Definition: giaCTas.c:94
static Vec_Int_t * Vec_IntAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: bblif.c:149
int * pData
Definition: giaCTas.c:70
int nSize
Definition: giaCTas.c:78
Vec_Int_t * vLevReas
Definition: giaCTas.c:90
void Tas_SetDefaultParams(Tas_Par_t *pPars)
FUNCTION DEFINITIONS ///.
Definition: giaCTas.c:162
Vec_Int_t * vWatchLits
Definition: giaCTas.c:96
static Vec_Ptr_t * Vec_PtrAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: vecPtr.h:83
#define ABC_CALLOC(type, num)
Definition: abc_global.h:230
Tas_Que_t pClauses
Definition: giaCTas.c:88
Tas_Que_t pJust
Definition: giaCTas.c:87
int iTail
Definition: giaCTas.c:77
Vec_Ptr_t * vTemp
Definition: giaCTas.c:92
Vec_Int_t * vModel
Definition: giaCTas.c:91
static int Gia_ManObjNum(Gia_Man_t *p)
Definition: gia.h:388
Tas_Par_t Pars
Definition: giaCTas.c:84
static Tas_Cls_t* Tas_ManAllocCls ( Tas_Man_t p,
int  nSize 
)
inlinestatic

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

Synopsis [Allocates clause of the given size.]

Description []

SideEffects []

SeeAlso []

Definition at line 929 of file giaCTas.c.

930 {
931  Tas_Cls_t * pCls;
932  if ( p->pStore.iCur + nSize > p->pStore.nSize )
933  {
934  p->pStore.nSize *= 2;
935  p->pStore.pData = ABC_REALLOC( int, p->pStore.pData, p->pStore.nSize );
936  }
937  pCls = Tas_ClsFromHandle( p, p->pStore.iCur ); p->pStore.iCur += nSize;
938  memset( pCls, 0, sizeof(int) * nSize );
939  p->nClauses++;
940  return pCls;
941 }
char * memset()
int nSize
Definition: giaCTas.c:69
#define ABC_REALLOC(type, obj, num)
Definition: abc_global.h:233
int iCur
Definition: giaCTas.c:68
int nClauses
Definition: giaCTas.c:97
Tas_Sto_t pStore
Definition: giaCTas.c:94
int * pData
Definition: giaCTas.c:70
static Tas_Cls_t * Tas_ClsFromHandle(Tas_Man_t *p, int h)
Definition: giaCTas.c:129
static int Tas_ManAnalyze ( Tas_Man_t p,
int  Level,
Gia_Obj_t pVar,
Gia_Obj_t pFan0,
Gia_Obj_t pFan1 
)
inlinestatic

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

Synopsis [Returns conflict clause.]

Description [Performs conflict analysis.]

SideEffects []

SeeAlso []

Definition at line 845 of file giaCTas.c.

846 {
847  Tas_Que_t * pQue = &(p->pClauses);
848  assert( Tas_VarIsAssigned(pVar) );
849  assert( Tas_VarIsAssigned(pFan0) );
850  assert( pFan1 == NULL || Tas_VarIsAssigned(pFan1) );
851  assert( Tas_QueIsEmpty( pQue ) );
852  Tas_QuePush( pQue, NULL );
853  Tas_QuePush( pQue, pVar );
854  Tas_QuePush( pQue, pFan0 );
855  if ( pFan1 )
856  Tas_QuePush( pQue, pFan1 );
857  Tas_ManDeriveReason( p, Level );
858  return Tas_QueFinish( pQue );
859 }
static void Tas_ManDeriveReason(Tas_Man_t *p, int Level)
Definition: giaCTas.c:756
static int Tas_VarIsAssigned(Gia_Obj_t *pVar)
Definition: giaCTas.c:117
static void Tas_QuePush(Tas_Que_t *p, Gia_Obj_t *pObj)
Definition: giaCTas.c:338
Tas_Que_t pClauses
Definition: giaCTas.c:88
static int Tas_QueIsEmpty(Tas_Que_t *p)
Definition: giaCTas.c:322
#define assert(ex)
Definition: util_old.h:213
static int Tas_QueFinish(Tas_Que_t *p)
Definition: giaCTas.c:418
static void Tas_ManAssign ( Tas_Man_t p,
Gia_Obj_t pObj,
int  Level,
Gia_Obj_t pRes0,
Gia_Obj_t pRes1 
)
inlinestatic

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

Synopsis [Assigns the variables a value.]

Description [Returns 1 if conflict; 0 if no conflict.]

SideEffects []

SeeAlso []

Definition at line 654 of file giaCTas.c.

655 {
656  Gia_Obj_t * pObjR = Gia_Regular(pObj);
657  assert( Gia_ObjIsCand(pObjR) );
658  assert( !Tas_VarIsAssigned(pObjR) );
659  Tas_VarAssign( pObjR );
660  Tas_VarSetValue( pObjR, !Gia_IsComplement(pObj) );
661  assert( pObjR->Value == ~0 );
662  pObjR->Value = p->pProp.iTail;
663  Tas_QuePush( &p->pProp, pObjR );
664  Vec_IntPush( p->vLevReas, Level );
665  if ( pRes0 == NULL && pRes1 != 0 ) // clause
666  {
667  Vec_IntPush( p->vLevReas, 0 );
668  Vec_IntPush( p->vLevReas, Tas_ClsHandle( p, (Tas_Cls_t *)pRes1 ) );
669  }
670  else
671  {
672  Vec_IntPush( p->vLevReas, pRes0 ? pRes0-pObjR : 0 );
673  Vec_IntPush( p->vLevReas, pRes1 ? pRes1-pObjR : 0 );
674  }
675  assert( Vec_IntSize(p->vLevReas) == 3 * p->pProp.iTail );
676  s_Counter2++;
677 }
static Gia_Obj_t * Gia_Regular(Gia_Obj_t *p)
Definition: gia.h:377
static int Gia_ObjIsCand(Gia_Obj_t *pObj)
Definition: gia.h:429
Tas_Que_t pProp
Definition: giaCTas.c:86
Definition: gia.h:75
static int Tas_VarIsAssigned(Gia_Obj_t *pVar)
Definition: giaCTas.c:117
Vec_Int_t * vLevReas
Definition: giaCTas.c:90
static void Tas_QuePush(Tas_Que_t *p, Gia_Obj_t *pObj)
Definition: giaCTas.c:338
static void Vec_IntPush(Vec_Int_t *p, int Entry)
Definition: bblif.c:468
static int Vec_IntSize(Vec_Int_t *p)
Definition: bblif.c:252
static int Gia_IsComplement(Gia_Obj_t *p)
Definition: gia.h:380
int s_Counter2
Definition: giaCTas.c:639
int iTail
Definition: giaCTas.c:77
#define assert(ex)
Definition: util_old.h:213
unsigned Value
Definition: gia.h:87
static void Tas_VarAssign(Gia_Obj_t *pVar)
Definition: giaCTas.c:118
static int Tas_ClsHandle(Tas_Man_t *p, Tas_Cls_t *pClause)
Definition: giaCTas.c:128
static void Tas_VarSetValue(Gia_Obj_t *pVar, int v)
Definition: giaCTas.c:121
static void Tas_ManCancelUntil ( Tas_Man_t p,
int  iBound 
)
inlinestatic

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 627 of file giaCTas.c.

628 {
629  Gia_Obj_t * pVar;
630  int i;
631  assert( iBound <= p->pProp.iTail );
632  p->pProp.iHead = iBound;
633  Tas_QueForEachEntry( p->pProp, pVar, i )
634  Tas_VarUnassign( pVar );
635  p->pProp.iTail = iBound;
636  Vec_IntShrink( p->vLevReas, 3*iBound );
637 }
Tas_Que_t pProp
Definition: giaCTas.c:86
int iHead
Definition: giaCTas.c:76
Definition: gia.h:75
#define Tas_QueForEachEntry(Que, pObj, i)
Definition: giaCTas.c:139
static void Tas_VarUnassign(Gia_Obj_t *pVar)
Definition: giaCTas.c:119
static void Vec_IntShrink(Vec_Int_t *p, int nSizeNew)
Definition: bblif.c:435
#define assert(ex)
Definition: util_old.h:213
static int Tas_ManCheckLimits ( Tas_Man_t p)
inlinestatic

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

Synopsis [Returns 1 if the solver is out of limits.]

Description []

SideEffects []

SeeAlso []

Definition at line 269 of file giaCTas.c.

270 {
271  return p->Pars.nJustThis > p->Pars.nJustLimit || p->Pars.nBTThis > p->Pars.nBTLimit;
272 }
Tas_Par_t Pars
Definition: giaCTas.c:84
static int Tas_ManClauseSize ( Tas_Man_t p,
int  hClause 
)
inlinestatic

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

Synopsis [Returns clause size.]

Description []

SideEffects []

SeeAlso []

Definition at line 691 of file giaCTas.c.

692 {
693  Tas_Que_t * pQue = &(p->pClauses);
694  Gia_Obj_t ** pIter;
695  for ( pIter = pQue->pData + hClause; *pIter; pIter++ );
696  return pIter - pQue->pData - hClause ;
697 }
Definition: gia.h:75
Gia_Obj_t ** pData
Definition: giaCTas.c:79
Tas_Que_t pClauses
Definition: giaCTas.c:88
static Tas_Cls_t* Tas_ManCreateCls ( Tas_Man_t p,
int  hClause 
)
inlinestatic

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

Synopsis [Creates clause of the given size.]

Description []

SideEffects []

SeeAlso []

Definition at line 979 of file giaCTas.c.

980 {
981  Tas_Cls_t * pClause;
982  Tas_Que_t * pQue = &(p->pClauses);
983  Gia_Obj_t * pObj;
984  int i, nLits = 0;
985  assert( Tas_QueIsEmpty( pQue ) );
986  assert( pQue->pData[hClause] != NULL );
987  for ( i = hClause; (pObj = pQue->pData[i]); i++ )
988  nLits++;
989  if ( nLits == 1 )
990  return NULL;
991  // create this clause
992  pClause = Tas_ManAllocCls( p, nLits + 3 );
993  pClause->nLits = nLits;
994  for ( i = hClause; (pObj = pQue->pData[i]); i++ )
995  {
996  assert( Tas_VarIsAssigned( pObj ) );
997  pClause->pLits[i-hClause] = Abc_LitNot( Tas_VarToLit(p, pObj) );
998  }
999  // add the clause as watched one
1000  if ( nLits >= 2 )
1001  {
1002  Tas_ManWatchClause( p, pClause, pClause->pLits[0] );
1003  Tas_ManWatchClause( p, pClause, pClause->pLits[1] );
1004  }
1005  // increment activity
1006 // p->Pars.VarInc /= p->Pars.VarDecay;
1007  return pClause;
1008 }
int nLits
Definition: giaCTas.c:61
Definition: gia.h:75
static int Tas_VarToLit(Tas_Man_t *p, Gia_Obj_t *pObj)
Definition: giaCTas.c:125
static void Tas_ManWatchClause(Tas_Man_t *p, Tas_Cls_t *pClause, int Lit)
Definition: giaCTas.c:954
Gia_Obj_t ** pData
Definition: giaCTas.c:79
static int Tas_VarIsAssigned(Gia_Obj_t *pVar)
Definition: giaCTas.c:117
static int Abc_LitNot(int Lit)
Definition: abc_global.h:266
static Tas_Cls_t * Tas_ManAllocCls(Tas_Man_t *p, int nSize)
Definition: giaCTas.c:929
Tas_Que_t pClauses
Definition: giaCTas.c:88
static int Tas_QueIsEmpty(Tas_Que_t *p)
Definition: giaCTas.c:322
#define assert(ex)
Definition: util_old.h:213
int pLits[0]
Definition: giaCTas.c:62
static int Tas_ManCreateFromCls ( Tas_Man_t p,
Tas_Cls_t pCls,
int  Level 
)
inlinestatic

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

Synopsis [Creates clause of the given size.]

Description []

SideEffects []

SeeAlso []

Definition at line 1021 of file giaCTas.c.

1022 {
1023  Tas_Que_t * pQue = &(p->pClauses);
1024  Gia_Obj_t * pObj;
1025  int i;
1026  assert( Tas_QueIsEmpty( pQue ) );
1027  Tas_QuePush( pQue, NULL );
1028  for ( i = 0; i < pCls->nLits; i++ )
1029  {
1030  pObj = Gia_ManObj( p->pAig, Abc_Lit2Var(pCls->pLits[i]) );
1031  assert( Tas_VarIsAssigned(pObj) );
1032  assert( !Tas_LitIsTrue( pObj, pCls->pLits[i] ) );
1033  Tas_QuePush( pQue, pObj );
1034  }
1035  Tas_ManDeriveReason( p, Level );
1036  return Tas_QueFinish( pQue );
1037 }
Gia_Man_t * pAig
Definition: giaCTas.c:85
static void Tas_ManDeriveReason(Tas_Man_t *p, int Level)
Definition: giaCTas.c:756
static Gia_Obj_t * Gia_ManObj(Gia_Man_t *p, int v)
Definition: gia.h:402
int nLits
Definition: giaCTas.c:61
Definition: gia.h:75
static int Tas_VarIsAssigned(Gia_Obj_t *pVar)
Definition: giaCTas.c:117
static void Tas_QuePush(Tas_Que_t *p, Gia_Obj_t *pObj)
Definition: giaCTas.c:338
static int Tas_LitIsTrue(Gia_Obj_t *pObj, int Lit)
Definition: giaCTas.c:126
static int Abc_Lit2Var(int Lit)
Definition: abc_global.h:264
Tas_Que_t pClauses
Definition: giaCTas.c:88
static int Tas_QueIsEmpty(Tas_Que_t *p)
Definition: giaCTas.c:322
#define assert(ex)
Definition: util_old.h:213
int pLits[0]
Definition: giaCTas.c:62
static int Tas_QueFinish(Tas_Que_t *p)
Definition: giaCTas.c:418
static Gia_Obj_t* Tas_ManDecideHighest ( Tas_Man_t p)
inlinestatic

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

Synopsis [Find variable with the highest ID.]

Description []

SideEffects []

SeeAlso []

Definition at line 526 of file giaCTas.c.

527 {
528  Gia_Obj_t * pObj, * pObjMax = NULL;
529  int i;
530  Tas_QueForEachEntry( p->pJust, pObj, i )
531  {
532 //printf( "%d %6.2f ", Gia_ObjId(p->pAig, pObj), p->pActivity[Gia_ObjId(p->pAig, pObj)] );
533  if ( pObjMax == NULL || pObjMax < pObj )
534  pObjMax = pObj;
535  }
536 //printf( "\n" );
537  return pObjMax;
538 }
Definition: gia.h:75
#define Tas_QueForEachEntry(Que, pObj, i)
Definition: giaCTas.c:139
Tas_Que_t pJust
Definition: giaCTas.c:87
static Gia_Obj_t* Tas_ManDecideHighestA ( Tas_Man_t p)
inlinestatic

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

Synopsis [Find variable with the highest ID.]

Description []

SideEffects []

SeeAlso []

Definition at line 551 of file giaCTas.c.

552 {
553  Gia_Obj_t * pObj, * pObjMax = NULL;
554  int i;
555  Tas_QueForEachEntry( p->pJust, pObj, i )
556  {
557  if ( pObjMax == NULL ||
558  p->pActivity[Gia_ObjId(p->pAig, pObjMax)] < p->pActivity[Gia_ObjId(p->pAig, pObj)] )
559  pObjMax = pObj;
560  }
561  return pObjMax;
562 }
Gia_Man_t * pAig
Definition: giaCTas.c:85
float * pActivity
Definition: giaCTas.c:99
Definition: gia.h:75
#define Tas_QueForEachEntry(Que, pObj, i)
Definition: giaCTas.c:139
static int Gia_ObjId(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:410
Tas_Que_t pJust
Definition: giaCTas.c:87
static Gia_Obj_t* Tas_ManDecideHighestFanin ( Tas_Man_t p)
inlinestatic

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

Synopsis [Find variable with the highest activity.]

Description []

SideEffects []

SeeAlso []

Definition at line 499 of file giaCTas.c.

500 {
501  Gia_Obj_t * pObj, * pObjMax = NULL;
502  int i, ObjId;
503  Tas_QueForEachEntry( p->pJust, pObj, i )
504  {
505  assert( Gia_ObjIsAnd(pObj) );
506  ObjId = Gia_ObjId( p->pAig, pObj );
507  if ( pObjMax == NULL || pObjMax < Gia_ObjFanin0(pObj) )
508  pObjMax = Gia_ObjFanin0(pObj);
509  if ( pObjMax < Gia_ObjFanin1(pObj) )
510  pObjMax = Gia_ObjFanin1(pObj);
511  }
512  return pObjMax;
513 }
Gia_Man_t * pAig
Definition: giaCTas.c:85
Definition: gia.h:75
#define Tas_QueForEachEntry(Que, pObj, i)
Definition: giaCTas.c:139
static Gia_Obj_t * Gia_ObjFanin0(Gia_Obj_t *pObj)
Definition: gia.h:454
static int Gia_ObjId(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:410
static int Gia_ObjIsAnd(Gia_Obj_t *pObj)
Definition: gia.h:422
static Gia_Obj_t * Gia_ObjFanin1(Gia_Obj_t *pObj)
Definition: gia.h:455
Tas_Que_t pJust
Definition: giaCTas.c:87
#define assert(ex)
Definition: util_old.h:213
static Gia_Obj_t* Tas_ManDecideLowest ( Tas_Man_t p)
inlinestatic

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

Synopsis [Find variable with the lowest ID.]

Description []

SideEffects []

SeeAlso []

Definition at line 575 of file giaCTas.c.

576 {
577  Gia_Obj_t * pObj, * pObjMin = NULL;
578  int i;
579  Tas_QueForEachEntry( p->pJust, pObj, i )
580  if ( pObjMin == NULL || pObjMin > pObj )
581  pObjMin = pObj;
582  return pObjMin;
583 }
Definition: gia.h:75
#define Tas_QueForEachEntry(Que, pObj, i)
Definition: giaCTas.c:139
if(last==0)
Definition: sparse_int.h:34
Tas_Que_t pJust
Definition: giaCTas.c:87
static Gia_Obj_t* Tas_ManDecideMaxFF ( Tas_Man_t p)
inlinestatic

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

Synopsis [Find variable with the maximum number of fanin fanouts.]

Description []

SideEffects []

SeeAlso []

Definition at line 596 of file giaCTas.c.

597 {
598  Gia_Obj_t * pObj, * pObjMax = NULL;
599  int i, iMaxFF = 0, iCurFF;
600  assert( p->pAig->pRefs != NULL );
601  Tas_QueForEachEntry( p->pJust, pObj, i )
602  {
603  iCurFF = Tas_VarFaninFanoutMax( p, pObj );
604  assert( iCurFF > 0 );
605  if ( iMaxFF < iCurFF )
606  {
607  iMaxFF = iCurFF;
608  pObjMax = pObj;
609  }
610  }
611  return pObjMax;
612 }
Gia_Man_t * pAig
Definition: giaCTas.c:85
int * pRefs
Definition: gia.h:114
Definition: gia.h:75
#define Tas_QueForEachEntry(Que, pObj, i)
Definition: giaCTas.c:139
Tas_Que_t pJust
Definition: giaCTas.c:87
#define assert(ex)
Definition: util_old.h:213
static int Tas_VarFaninFanoutMax(Tas_Man_t *p, Gia_Obj_t *pObj)
Definition: giaCTas.c:439
static void Tas_ManDeriveReason ( Tas_Man_t p,
int  Level 
)
inlinestatic

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

Synopsis [Returns conflict clause.]

Description [Performs conflict analysis.]

SideEffects []

SeeAlso []

Definition at line 756 of file giaCTas.c.

757 {
758  Tas_Que_t * pQue = &(p->pClauses);
759  Gia_Obj_t * pObj, * pReason;
760  int i, k, j, iLitLevel, iLitLevel2;//, Id;
761  assert( pQue->pData[pQue->iHead] == NULL );
762  assert( pQue->iHead + 1 < pQue->iTail );
763 /*
764  for ( i = pQue->iHead + 1; i < pQue->iTail; i++ )
765  {
766  pObj = pQue->pData[i];
767  assert( pObj->fPhase == 0 );
768  }
769 */
770  // compact literals
771  Vec_PtrClear( p->vTemp );
772  for ( i = k = pQue->iHead + 1; i < pQue->iTail; i++ )
773  {
774  pObj = pQue->pData[i];
775  if ( pObj->fPhase ) // unassigned - seen again
776  continue;
777  // assigned - seen first time
778  pObj->fPhase = 1;
779  Vec_PtrPush( p->vTemp, pObj );
780  // bump activity
781 // Id = Gia_ObjId( p->pAig, pObj );
782 // if ( p->pActivity[Id] == 0.0 )
783 // Vec_IntPush( p->vActiveVars, Id );
784 // p->pActivity[Id] += p->Pars.VarInc;
785  // check decision level
786  iLitLevel = Tas_VarDecLevel( p, pObj );
787  if ( iLitLevel < Level )
788  {
789  pQue->pData[k++] = pObj;
790  continue;
791  }
792  assert( iLitLevel == Level );
793  if ( Tas_VarHasReasonCls( p, pObj ) )
794  {
795  Tas_Cls_t * pCls = Tas_VarReasonCls( p, pObj );
796  pReason = Gia_ManObj( p->pAig, Abc_Lit2Var(pCls->pLits[0]) );
797  assert( pReason == pObj );
798  for ( j = 1; j < pCls->nLits; j++ )
799  {
800  pReason = Gia_ManObj( p->pAig, Abc_Lit2Var(pCls->pLits[j]) );
801  iLitLevel2 = Tas_VarDecLevel( p, pReason );
802  assert( Tas_VarIsAssigned( pReason ) );
803  assert( !Tas_LitIsTrue( pReason, pCls->pLits[j] ) );
804  Tas_QuePush( pQue, pReason );
805  }
806  }
807  else
808  {
809  pReason = Tas_VarReason0( p, pObj );
810  if ( pReason == pObj ) // no reason
811  {
812  assert( pQue->pData[pQue->iHead] == NULL || Level == 0 );
813  if ( pQue->pData[pQue->iHead] == NULL )
814  pQue->pData[pQue->iHead] = pObj;
815  else
816  Tas_QuePush( pQue, pObj );
817  continue;
818  }
819  Tas_QuePush( pQue, pReason );
820  pReason = Tas_VarReason1( p, pObj );
821  if ( pReason != pObj ) // second reason
822  Tas_QuePush( pQue, pReason );
823  }
824  }
825  assert( pQue->pData[pQue->iHead] != NULL );
826  if ( pQue->pData[pQue->iHead] == NULL )
827  printf( "Tas_ManDeriveReason(): Failed to derive the clause!!!\n" );
828  pQue->iTail = k;
829  // clear the marks
830  Vec_PtrForEachEntry( Gia_Obj_t *, p->vTemp, pObj, i )
831  pObj->fPhase = 0;
832 }
static Gia_Obj_t * Tas_VarReason1(Tas_Man_t *p, Gia_Obj_t *pVar)
Definition: giaCTas.c:133
Gia_Man_t * pAig
Definition: giaCTas.c:85
int iHead
Definition: giaCTas.c:76
static void Vec_PtrPush(Vec_Ptr_t *p, void *Entry)
Definition: vecPtr.h:606
static Gia_Obj_t * Gia_ManObj(Gia_Man_t *p, int v)
Definition: gia.h:402
int nLits
Definition: giaCTas.c:61
Definition: gia.h:75
Gia_Obj_t ** pData
Definition: giaCTas.c:79
static int Tas_VarIsAssigned(Gia_Obj_t *pVar)
Definition: giaCTas.c:117
static int Tas_VarHasReasonCls(Tas_Man_t *p, Gia_Obj_t *pVar)
Definition: giaCTas.c:136
static void Tas_QuePush(Tas_Que_t *p, Gia_Obj_t *pObj)
Definition: giaCTas.c:338
static int Tas_LitIsTrue(Gia_Obj_t *pObj, int Lit)
Definition: giaCTas.c:126
unsigned fPhase
Definition: gia.h:85
static int Tas_VarDecLevel(Tas_Man_t *p, Gia_Obj_t *pVar)
Definition: giaCTas.c:131
static int Abc_Lit2Var(int Lit)
Definition: abc_global.h:264
Tas_Que_t pClauses
Definition: giaCTas.c:88
int iTail
Definition: giaCTas.c:77
#define assert(ex)
Definition: util_old.h:213
static void Vec_PtrClear(Vec_Ptr_t *p)
Definition: vecPtr.h:545
static Tas_Cls_t * Tas_VarReasonCls(Tas_Man_t *p, Gia_Obj_t *pVar)
Definition: giaCTas.c:137
int pLits[0]
Definition: giaCTas.c:62
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.
Definition: vecPtr.h:55
Vec_Ptr_t * vTemp
Definition: giaCTas.c:92
static Gia_Obj_t * Tas_VarReason0(Tas_Man_t *p, Gia_Obj_t *pVar)
Definition: giaCTas.c:132
static Gia_Obj_t* Tas_ManFindActive ( Tas_Man_t p)
inlinestatic

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

Synopsis [Find variable with the highest activity.]

Description []

SideEffects []

SeeAlso []

Definition at line 462 of file giaCTas.c.

463 {
464  Gia_Obj_t * pObj, * pObjMax = NULL;
465  float BestCost = 0.0;
466  int i, ObjId;
467  Tas_QueForEachEntry( p->pJust, pObj, i )
468  {
469  assert( Gia_ObjIsAnd(pObj) );
470  ObjId = Gia_ObjId( p->pAig, pObj );
471  if ( pObjMax == NULL ||
472  p->pActivity[Gia_ObjFaninId0(pObj,ObjId)] > BestCost ||
473  (p->pActivity[Gia_ObjFaninId0(pObj,ObjId)] == BestCost && pObjMax < Gia_ObjFanin0(pObj)) )
474  {
475  pObjMax = Gia_ObjFanin0(pObj);
476  BestCost = p->pActivity[Gia_ObjFaninId0(pObj,ObjId)];
477  }
478  if ( p->pActivity[Gia_ObjFaninId1(pObj,ObjId)] > BestCost ||
479  (p->pActivity[Gia_ObjFaninId1(pObj,ObjId)] == BestCost && pObjMax < Gia_ObjFanin1(pObj)) )
480  {
481  pObjMax = Gia_ObjFanin1(pObj);
482  BestCost = p->pActivity[Gia_ObjFaninId1(pObj,ObjId)];
483  }
484  }
485  return pObjMax;
486 }
Gia_Man_t * pAig
Definition: giaCTas.c:85
float * pActivity
Definition: giaCTas.c:99
Definition: gia.h:75
#define Tas_QueForEachEntry(Que, pObj, i)
Definition: giaCTas.c:139
static Gia_Obj_t * Gia_ObjFanin0(Gia_Obj_t *pObj)
Definition: gia.h:454
static int Gia_ObjId(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:410
static int Gia_ObjIsAnd(Gia_Obj_t *pObj)
Definition: gia.h:422
static Gia_Obj_t * Gia_ObjFanin1(Gia_Obj_t *pObj)
Definition: gia.h:455
Tas_Que_t pJust
Definition: giaCTas.c:87
#define assert(ex)
Definition: util_old.h:213
static int Gia_ObjFaninId1(Gia_Obj_t *pObj, int ObjId)
Definition: gia.h:461
static int Gia_ObjFaninId0(Gia_Obj_t *pObj, int ObjId)
Definition: gia.h:460
static void Tas_ManPrintClause ( Tas_Man_t p,
int  Level,
int  hClause 
)
inlinestatic

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

Synopsis [Prints conflict clause.]

Description []

SideEffects []

SeeAlso []

Definition at line 710 of file giaCTas.c.

711 {
712  Tas_Que_t * pQue = &(p->pClauses);
713  Gia_Obj_t * pObj;
714  int i;
715  assert( Tas_QueIsEmpty( pQue ) );
716  printf( "Level %2d : ", Level );
717  for ( i = hClause; (pObj = pQue->pData[i]); i++ )
718  printf( "%d=%d(%d) ", Gia_ObjId(p->pAig, pObj), Tas_VarValue(pObj), Tas_VarDecLevel(p, pObj) );
719  printf( "\n" );
720 }
Gia_Man_t * pAig
Definition: giaCTas.c:85
static int Tas_VarValue(Gia_Obj_t *pVar)
Definition: giaCTas.c:120
Definition: gia.h:75
Gia_Obj_t ** pData
Definition: giaCTas.c:79
static int Gia_ObjId(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:410
static int Tas_VarDecLevel(Tas_Man_t *p, Gia_Obj_t *pVar)
Definition: giaCTas.c:131
Tas_Que_t pClauses
Definition: giaCTas.c:88
static int Tas_QueIsEmpty(Tas_Que_t *p)
Definition: giaCTas.c:322
#define assert(ex)
Definition: util_old.h:213
static void Tas_ManPrintClauseNew ( Tas_Man_t p,
int  Level,
int  hClause 
)
inlinestatic

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

Synopsis [Prints conflict clause.]

Description []

SideEffects []

SeeAlso []

Definition at line 733 of file giaCTas.c.

734 {
735  Tas_Que_t * pQue = &(p->pClauses);
736  Gia_Obj_t * pObj;
737  int i;
738  assert( Tas_QueIsEmpty( pQue ) );
739  printf( "Level %2d : ", Level );
740  for ( i = hClause; (pObj = pQue->pData[i]); i++ )
741  printf( "%c%d ", Tas_VarValue(pObj)? '+':'-', Gia_ObjId(p->pAig, pObj) );
742  printf( "\n" );
743 }
Gia_Man_t * pAig
Definition: giaCTas.c:85
static int Tas_VarValue(Gia_Obj_t *pVar)
Definition: giaCTas.c:120
Definition: gia.h:75
Gia_Obj_t ** pData
Definition: giaCTas.c:79
static int Gia_ObjId(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:410
Tas_Que_t pClauses
Definition: giaCTas.c:88
static int Tas_QueIsEmpty(Tas_Que_t *p)
Definition: giaCTas.c:322
#define assert(ex)
Definition: util_old.h:213
int Tas_ManPropagate ( Tas_Man_t p,
int  Level 
)

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

Synopsis [Propagates all variables.]

Description [Returns 1 if conflict; 0 if no conflict.]

SideEffects []

SeeAlso []

Definition at line 1244 of file giaCTas.c.

1245 {
1246  int hClause;
1247  Gia_Obj_t * pVar;
1248  int i, k;//, nIter = 0;
1249  while ( 1 )
1250  {
1251 // nIter++;
1252  Tas_QueForEachEntry( p->pProp, pVar, i )
1253  {
1254  if ( (hClause = Tas_ManPropagateOne( p, pVar, Level )) )
1255  return hClause;
1256  }
1257  p->pProp.iHead = p->pProp.iTail;
1258  k = p->pJust.iHead;
1259  Tas_QueForEachEntry( p->pJust, pVar, i )
1260  {
1261  if ( Tas_VarIsJust( pVar ) )
1262  p->pJust.pData[k++] = pVar;
1263  else if ( (hClause = Tas_ManPropagateTwo( p, pVar, Level )) )
1264  return hClause;
1265  }
1266  if ( k == p->pJust.iTail )
1267  break;
1268  p->pJust.iTail = k;
1269  }
1270 // printf( "%d ", nIter );
1271  return 0;
1272 }
Tas_Que_t pProp
Definition: giaCTas.c:86
int iHead
Definition: giaCTas.c:76
Definition: gia.h:75
static int Tas_ManPropagateOne(Tas_Man_t *p, Gia_Obj_t *pVar, int Level)
Definition: giaCTas.c:1142
Gia_Obj_t ** pData
Definition: giaCTas.c:79
#define Tas_QueForEachEntry(Que, pObj, i)
Definition: giaCTas.c:139
static int Tas_VarIsJust(Gia_Obj_t *pVar)
Definition: giaCTas.c:122
Tas_Que_t pJust
Definition: giaCTas.c:87
int iTail
Definition: giaCTas.c:77
static int Tas_ManPropagateTwo(Tas_Man_t *p, Gia_Obj_t *pVar, int Level)
Definition: giaCTas.c:1210
static int Tas_ManPropagateOne ( Tas_Man_t p,
Gia_Obj_t pVar,
int  Level 
)
inlinestatic

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

Synopsis [Propagates a variable.]

Description [Returns clause handle if conflict; 0 if no conflict.]

SideEffects []

SeeAlso []

Definition at line 1142 of file giaCTas.c.

1143 {
1144  int Value0, Value1, hClause;
1145  assert( !Gia_IsComplement(pVar) );
1146  assert( Tas_VarIsAssigned(pVar) );
1147  s_Counter3++;
1148  if ( (hClause = Tas_ManPropagateWatch( p, Level, Tas_VarToLit(p, pVar) )) )
1149  return hClause;
1150  if ( Gia_ObjIsCi(pVar) )
1151  return 0;
1152 /*
1153  if ( pVar->iDiff0 == 570869 && pVar->iDiff1 == 546821 && Level == 3 )
1154  {
1155  Gia_Obj_t * pFan0 = Gia_ObjFanin0(pVar);
1156  Gia_Obj_t * pFan1 = Gia_ObjFanin1(pVar);
1157  int s = 0;
1158  }
1159 */
1160  assert( Gia_ObjIsAnd(pVar) );
1161  Value0 = Tas_VarFanin0Value(pVar);
1162  Value1 = Tas_VarFanin1Value(pVar);
1163  if ( Tas_VarValue(pVar) )
1164  { // value is 1
1165  if ( Value0 == 0 || Value1 == 0 ) // one is 0
1166  {
1167  if ( Value0 == 0 && Value1 != 0 )
1168  return Tas_ManAnalyze( p, Level, pVar, Gia_ObjFanin0(pVar), NULL );
1169  if ( Value0 != 0 && Value1 == 0 )
1170  return Tas_ManAnalyze( p, Level, pVar, Gia_ObjFanin1(pVar), NULL );
1171  assert( Value0 == 0 && Value1 == 0 );
1172  return Tas_ManAnalyze( p, Level, pVar, Gia_ObjFanin0(pVar), Gia_ObjFanin1(pVar) );
1173  }
1174  if ( Value0 == 2 ) // first is unassigned
1175  Tas_ManAssign( p, Gia_ObjChild0(pVar), Level, pVar, NULL );
1176  if ( Value1 == 2 ) // first is unassigned
1177  Tas_ManAssign( p, Gia_ObjChild1(pVar), Level, pVar, NULL );
1178  return 0;
1179  }
1180  // value is 0
1181  if ( Value0 == 0 || Value1 == 0 ) // one is 0
1182  return 0;
1183  if ( Value0 == 1 && Value1 == 1 ) // both are 1
1184  return Tas_ManAnalyze( p, Level, pVar, Gia_ObjFanin0(pVar), Gia_ObjFanin1(pVar) );
1185  if ( Value0 == 1 || Value1 == 1 ) // one is 1
1186  {
1187  if ( Value0 == 2 ) // first is unassigned
1188  Tas_ManAssign( p, Gia_Not(Gia_ObjChild0(pVar)), Level, pVar, Gia_ObjFanin1(pVar) );
1189  if ( Value1 == 2 ) // second is unassigned
1190  Tas_ManAssign( p, Gia_Not(Gia_ObjChild1(pVar)), Level, pVar, Gia_ObjFanin0(pVar) );
1191  return 0;
1192  }
1193  assert( Tas_VarIsJust(pVar) );
1194  assert( !Tas_QueHasNode( &p->pJust, pVar ) );
1195  Tas_QuePush( &p->pJust, pVar );
1196  return 0;
1197 }
static Gia_Obj_t * Gia_ObjChild0(Gia_Obj_t *pObj)
Definition: gia.h:457
static int Tas_VarFanin1Value(Gia_Obj_t *pVar)
Definition: giaCTas.c:124
static int Tas_VarValue(Gia_Obj_t *pVar)
Definition: giaCTas.c:120
static void Tas_ManAssign(Tas_Man_t *p, Gia_Obj_t *pObj, int Level, Gia_Obj_t *pRes0, Gia_Obj_t *pRes1)
Definition: giaCTas.c:654
static int Tas_VarFanin0Value(Gia_Obj_t *pVar)
Definition: giaCTas.c:123
static int Tas_ManAnalyze(Tas_Man_t *p, int Level, Gia_Obj_t *pVar, Gia_Obj_t *pFan0, Gia_Obj_t *pFan1)
Definition: giaCTas.c:845
static int Tas_VarToLit(Tas_Man_t *p, Gia_Obj_t *pObj)
Definition: giaCTas.c:125
static Gia_Obj_t * Gia_ObjChild1(Gia_Obj_t *pObj)
Definition: gia.h:458
static Gia_Obj_t * Gia_Not(Gia_Obj_t *p)
Definition: gia.h:378
static int Tas_QueHasNode(Tas_Que_t *p, Gia_Obj_t *pObj)
Definition: giaCTas.c:359
static int Tas_VarIsAssigned(Gia_Obj_t *pVar)
Definition: giaCTas.c:117
static Gia_Obj_t * Gia_ObjFanin0(Gia_Obj_t *pObj)
Definition: gia.h:454
int s_Counter3
Definition: giaCTas.c:640
static void Tas_QuePush(Tas_Que_t *p, Gia_Obj_t *pObj)
Definition: giaCTas.c:338
static int Tas_VarIsJust(Gia_Obj_t *pVar)
Definition: giaCTas.c:122
static int Gia_IsComplement(Gia_Obj_t *p)
Definition: gia.h:380
static int Gia_ObjIsAnd(Gia_Obj_t *pObj)
Definition: gia.h:422
static int Tas_ManPropagateWatch(Tas_Man_t *p, int Level, int Lit)
Definition: giaCTas.c:1050
static Gia_Obj_t * Gia_ObjFanin1(Gia_Obj_t *pObj)
Definition: gia.h:455
Tas_Que_t pJust
Definition: giaCTas.c:87
#define assert(ex)
Definition: util_old.h:213
static int Gia_ObjIsCi(Gia_Obj_t *pObj)
Definition: gia.h:420
static int Tas_ManPropagateTwo ( Tas_Man_t p,
Gia_Obj_t pVar,
int  Level 
)
inlinestatic

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

Synopsis [Propagates a variable.]

Description [Returns 1 if conflict; 0 if no conflict.]

SideEffects []

SeeAlso []

Definition at line 1210 of file giaCTas.c.

1211 {
1212  int Value0, Value1;
1213  s_Counter4++;
1214  assert( !Gia_IsComplement(pVar) );
1215  assert( Gia_ObjIsAnd(pVar) );
1216  assert( Tas_VarIsAssigned(pVar) );
1217  assert( !Tas_VarValue(pVar) );
1218  Value0 = Tas_VarFanin0Value(pVar);
1219  Value1 = Tas_VarFanin1Value(pVar);
1220  // value is 0
1221  if ( Value0 == 0 || Value1 == 0 ) // one is 0
1222  return 0;
1223  if ( Value0 == 1 && Value1 == 1 ) // both are 1
1224  return Tas_ManAnalyze( p, Level, pVar, Gia_ObjFanin0(pVar), Gia_ObjFanin1(pVar) );
1225  assert( Value0 == 1 || Value1 == 1 );
1226  if ( Value0 == 2 ) // first is unassigned
1227  Tas_ManAssign( p, Gia_Not(Gia_ObjChild0(pVar)), Level, pVar, Gia_ObjFanin1(pVar) );
1228  if ( Value1 == 2 ) // first is unassigned
1229  Tas_ManAssign( p, Gia_Not(Gia_ObjChild1(pVar)), Level, pVar, Gia_ObjFanin0(pVar) );
1230  return 0;
1231 }
static Gia_Obj_t * Gia_ObjChild0(Gia_Obj_t *pObj)
Definition: gia.h:457
static int Tas_VarFanin1Value(Gia_Obj_t *pVar)
Definition: giaCTas.c:124
static int Tas_VarValue(Gia_Obj_t *pVar)
Definition: giaCTas.c:120
static void Tas_ManAssign(Tas_Man_t *p, Gia_Obj_t *pObj, int Level, Gia_Obj_t *pRes0, Gia_Obj_t *pRes1)
Definition: giaCTas.c:654
static int Tas_VarFanin0Value(Gia_Obj_t *pVar)
Definition: giaCTas.c:123
static int Tas_ManAnalyze(Tas_Man_t *p, int Level, Gia_Obj_t *pVar, Gia_Obj_t *pFan0, Gia_Obj_t *pFan1)
Definition: giaCTas.c:845
static Gia_Obj_t * Gia_ObjChild1(Gia_Obj_t *pObj)
Definition: gia.h:458
static Gia_Obj_t * Gia_Not(Gia_Obj_t *p)
Definition: gia.h:378
static int Tas_VarIsAssigned(Gia_Obj_t *pVar)
Definition: giaCTas.c:117
static Gia_Obj_t * Gia_ObjFanin0(Gia_Obj_t *pObj)
Definition: gia.h:454
int s_Counter4
Definition: giaCTas.c:641
static int Gia_IsComplement(Gia_Obj_t *p)
Definition: gia.h:380
static int Gia_ObjIsAnd(Gia_Obj_t *pObj)
Definition: gia.h:422
static Gia_Obj_t * Gia_ObjFanin1(Gia_Obj_t *pObj)
Definition: gia.h:455
#define assert(ex)
Definition: util_old.h:213
static int Tas_ManPropagateWatch ( Tas_Man_t p,
int  Level,
int  Lit 
)
inlinestatic

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

Synopsis [Propagate one assignment.]

Description []

SideEffects []

SeeAlso []

Definition at line 1050 of file giaCTas.c.

1051 {
1052  Gia_Obj_t * pObj;
1053  Tas_Cls_t * pCur;
1054  int * piPrev, iCur, iTemp;
1055  int i, LitF = Abc_LitNot(Lit);
1056  // iterate through the clauses
1057  piPrev = p->pWatches + Lit;
1058  for ( iCur = p->pWatches[Lit]; iCur; iCur = *piPrev )
1059  {
1060  pCur = Tas_ClsFromHandle( p, iCur );
1061  // make sure the false literal is in the second literal of the clause
1062  if ( pCur->pLits[0] == LitF )
1063  {
1064  pCur->pLits[0] = pCur->pLits[1];
1065  pCur->pLits[1] = LitF;
1066  iTemp = pCur->iNext[0];
1067  pCur->iNext[0] = pCur->iNext[1];
1068  pCur->iNext[1] = iTemp;
1069  }
1070  assert( pCur->pLits[1] == LitF );
1071 
1072  // if the first literal is true, the clause is satisfied
1073 // if ( pCur->pLits[0] == p->pAssigns[Abc_Lit2Var(pCur->pLits[0])] )
1074  pObj = Gia_ManObj( p->pAig, Abc_Lit2Var(pCur->pLits[0]) );
1075  if ( Tas_VarIsAssigned(pObj) && Tas_LitIsTrue( pObj, pCur->pLits[0] ) )
1076  {
1077  piPrev = &pCur->iNext[1];
1078  continue;
1079  }
1080 
1081  // look for a new literal to watch
1082  for ( i = 2; i < (int)pCur->nLits; i++ )
1083  {
1084  // skip the case when the literal is false
1085 // if ( Abc_LitNot(pCur->pLits[i]) == p->pAssigns[Abc_Lit2Var(pCur->pLits[i])] )
1086  pObj = Gia_ManObj( p->pAig, Abc_Lit2Var(pCur->pLits[i]) );
1087  if ( Tas_VarIsAssigned(pObj) && !Tas_LitIsTrue( pObj, pCur->pLits[i] ) )
1088  continue;
1089  // the literal is either true or unassigned - watch it
1090  pCur->pLits[1] = pCur->pLits[i];
1091  pCur->pLits[i] = LitF;
1092  // remove this clause from the watch list of Lit
1093  *piPrev = pCur->iNext[1];
1094  // add this clause to the watch list of pCur->pLits[i] (now it is pCur->pLits[1])
1095  Tas_ManWatchClause( p, pCur, pCur->pLits[1] );
1096  break;
1097  }
1098  if ( i < (int)pCur->nLits ) // found new watch
1099  continue;
1100 
1101  // clause is unit - enqueue new implication
1102  pObj = Gia_ManObj( p->pAig, Abc_Lit2Var(pCur->pLits[0]) );
1103  if ( !Tas_VarIsAssigned(pObj) )
1104  {
1105 /*
1106  {
1107  int iLitLevel, iPlace;
1108  for ( i = 1; i < (int)pCur->nLits; i++ )
1109  {
1110  pObj = Gia_ManObj( p->pAig, Abc_Lit2Var(pCur->pLits[i]) );
1111  iLitLevel = Tas_VarDecLevel( p, pObj );
1112  iPlace = pObj->Value;
1113  printf( "Lit = %d. Level = %d. Place = %d.\n", pCur->pLits[i], iLitLevel, iPlace );
1114  i = i;
1115  }
1116  }
1117 */
1118  Tas_ManAssign( p, Gia_ObjFromLit(p->pAig, pCur->pLits[0]), Level, NULL, (Gia_Obj_t *)pCur );
1119  piPrev = &pCur->iNext[1];
1120  continue;
1121  }
1122  // conflict detected - return the conflict clause
1123  assert( !Tas_LitIsTrue( pObj, pCur->pLits[0] ) );
1124  return Tas_ManCreateFromCls( p, pCur, Level );
1125  }
1126  return 0;
1127 }
static int Tas_ManCreateFromCls(Tas_Man_t *p, Tas_Cls_t *pCls, int Level)
Definition: giaCTas.c:1021
int * pWatches
Definition: giaCTas.c:95
static Gia_Obj_t * Gia_ObjFromLit(Gia_Man_t *p, int iLit)
Definition: gia.h:496
Gia_Man_t * pAig
Definition: giaCTas.c:85
int iNext[2]
Definition: giaCTas.c:60
static void Tas_ManAssign(Tas_Man_t *p, Gia_Obj_t *pObj, int Level, Gia_Obj_t *pRes0, Gia_Obj_t *pRes1)
Definition: giaCTas.c:654
static Gia_Obj_t * Gia_ManObj(Gia_Man_t *p, int v)
Definition: gia.h:402
int nLits
Definition: giaCTas.c:61
Definition: gia.h:75
static void Tas_ManWatchClause(Tas_Man_t *p, Tas_Cls_t *pClause, int Lit)
Definition: giaCTas.c:954
static int Tas_VarIsAssigned(Gia_Obj_t *pVar)
Definition: giaCTas.c:117
static int Tas_LitIsTrue(Gia_Obj_t *pObj, int Lit)
Definition: giaCTas.c:126
static int Abc_LitNot(int Lit)
Definition: abc_global.h:266
static Tas_Cls_t * Tas_ClsFromHandle(Tas_Man_t *p, int h)
Definition: giaCTas.c:129
static int Abc_Lit2Var(int Lit)
Definition: abc_global.h:264
#define assert(ex)
Definition: util_old.h:213
int pLits[0]
Definition: giaCTas.c:62
static int Tas_ManResolve ( Tas_Man_t p,
int  Level,
int  hClause0,
int  hClause1 
)
inlinestatic

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

Synopsis [Performs resolution of two clauses.]

Description []

SideEffects []

SeeAlso []

Definition at line 873 of file giaCTas.c.

874 {
875  Tas_Que_t * pQue = &(p->pClauses);
876  Gia_Obj_t * pObj;
877  int i, LevelMax = -1, LevelCur;
878  assert( pQue->pData[hClause0] != NULL );
879  assert( pQue->pData[hClause0] == pQue->pData[hClause1] );
880 /*
881  for ( i = hClause0 + 1; (pObj = pQue->pData[i]); i++ )
882  assert( pObj->fPhase == 0 );
883  for ( i = hClause1 + 1; (pObj = pQue->pData[i]); i++ )
884  assert( pObj->fPhase == 0 );
885 */
886  assert( Tas_QueIsEmpty( pQue ) );
887  Tas_QuePush( pQue, NULL );
888  for ( i = hClause0 + 1; (pObj = pQue->pData[i]); i++ )
889  {
890  if ( pObj->fPhase ) // unassigned - seen again
891  continue;
892  // assigned - seen first time
893  pObj->fPhase = 1;
894  Tas_QuePush( pQue, pObj );
895  LevelCur = Tas_VarDecLevel( p, pObj );
896  if ( LevelMax < LevelCur )
897  LevelMax = LevelCur;
898  }
899  for ( i = hClause1 + 1; (pObj = pQue->pData[i]); i++ )
900  {
901  if ( pObj->fPhase ) // unassigned - seen again
902  continue;
903  // assigned - seen first time
904  pObj->fPhase = 1;
905  Tas_QuePush( pQue, pObj );
906  LevelCur = Tas_VarDecLevel( p, pObj );
907  if ( LevelMax < LevelCur )
908  LevelMax = LevelCur;
909  }
910  for ( i = pQue->iHead + 1; i < pQue->iTail; i++ )
911  pQue->pData[i]->fPhase = 0;
912  Tas_ManDeriveReason( p, LevelMax );
913  return Tas_QueFinish( pQue );
914 }
static void Tas_ManDeriveReason(Tas_Man_t *p, int Level)
Definition: giaCTas.c:756
int iHead
Definition: giaCTas.c:76
Definition: gia.h:75
Gia_Obj_t ** pData
Definition: giaCTas.c:79
static void Tas_QuePush(Tas_Que_t *p, Gia_Obj_t *pObj)
Definition: giaCTas.c:338
unsigned fPhase
Definition: gia.h:85
static int Tas_VarDecLevel(Tas_Man_t *p, Gia_Obj_t *pVar)
Definition: giaCTas.c:131
Tas_Que_t pClauses
Definition: giaCTas.c:88
static int Tas_QueIsEmpty(Tas_Que_t *p)
Definition: giaCTas.c:322
#define assert(ex)
Definition: util_old.h:213
static int Tas_QueFinish(Tas_Que_t *p)
Definition: giaCTas.c:418
void Tas_ManSatPrintStats ( Tas_Man_t p)

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

Synopsis [Prints statistics of the manager.]

Description []

SideEffects []

SeeAlso []

Definition at line 1487 of file giaCTas.c.

1488 {
1489  printf( "CO = %8d ", Gia_ManCoNum(p->pAig) );
1490  printf( "AND = %8d ", Gia_ManAndNum(p->pAig) );
1491  printf( "Conf = %6d ", p->Pars.nBTLimit );
1492  printf( "JustMax = %5d ", p->Pars.nJustLimit );
1493  printf( "\n" );
1494  printf( "Unsat calls %6d (%6.2f %%) Ave conf = %8.1f ",
1495  p->nSatUnsat, p->nSatTotal? 100.0*p->nSatUnsat/p->nSatTotal :0.0, p->nSatUnsat? 1.0*p->nConfUnsat/p->nSatUnsat :0.0 );
1496  ABC_PRTP( "Time", p->timeSatUnsat, p->timeTotal );
1497  printf( "Sat calls %6d (%6.2f %%) Ave conf = %8.1f ",
1498  p->nSatSat, p->nSatTotal? 100.0*p->nSatSat/p->nSatTotal :0.0, p->nSatSat? 1.0*p->nConfSat/p->nSatSat : 0.0 );
1499  ABC_PRTP( "Time", p->timeSatSat, p->timeTotal );
1500  printf( "Undef calls %6d (%6.2f %%) Ave conf = %8.1f ",
1501  p->nSatUndec, p->nSatTotal? 100.0*p->nSatUndec/p->nSatTotal :0.0, p->nSatUndec? 1.0*p->nConfUndec/p->nSatUndec : 0.0 );
1502  ABC_PRTP( "Time", p->timeSatUndec, p->timeTotal );
1503  ABC_PRT( "Total time", p->timeTotal );
1504 }
abctime timeSatUndec
Definition: giaCTas.c:113
abctime timeTotal
Definition: giaCTas.c:114
Gia_Man_t * pAig
Definition: giaCTas.c:85
int nSatTotal
Definition: giaCTas.c:105
#define ABC_PRTP(a, t, T)
Definition: abc_global.h:223
int nConfUnsat
Definition: giaCTas.c:107
int nConfSat
Definition: giaCTas.c:108
static int Gia_ManAndNum(Gia_Man_t *p)
Definition: gia.h:389
int nSatUnsat
Definition: giaCTas.c:102
int nSatSat
Definition: giaCTas.c:103
abctime timeSatSat
Definition: giaCTas.c:112
abctime timeSatUnsat
Definition: giaCTas.c:111
#define ABC_PRT(a, t)
Definition: abc_global.h:220
int nConfUndec
Definition: giaCTas.c:109
int nSatUndec
Definition: giaCTas.c:104
static int Gia_ManCoNum(Gia_Man_t *p)
Definition: gia.h:384
Tas_Par_t Pars
Definition: giaCTas.c:84
static void Tas_ManSaveModel ( Tas_Man_t p,
Vec_Int_t vCex 
)
inlinestatic

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

Synopsis [Saves the satisfying assignment as an array of literals.]

Description []

SideEffects []

SeeAlso []

Definition at line 285 of file giaCTas.c.

286 {
287  Gia_Obj_t * pVar;
288  int i;
289  Vec_IntClear( vCex );
290  p->pProp.iHead = 0;
291 // printf( "\n" );
292  Tas_QueForEachEntry( p->pProp, pVar, i )
293  {
294  if ( Gia_ObjIsCi(pVar) )
295 // Vec_IntPush( vCex, Abc_Var2Lit(Gia_ObjId(p->pAig,pVar), !Tas_VarValue(pVar)) );
296  Vec_IntPush( vCex, Abc_Var2Lit(Gia_ObjCioId(pVar), !Tas_VarValue(pVar)) );
297 /*
298  printf( "%5d(%d) = ", Gia_ObjId(p->pAig, pVar), Tas_VarValue(pVar) );
299  if ( Gia_ObjIsCi(pVar) )
300  printf( "pi %d\n", Gia_ObjCioId(pVar) );
301  else
302  {
303  printf( "%5d %d & ", Gia_ObjFaninId0p(p->pAig, pVar), Gia_ObjFaninC0(pVar) );
304  printf( "%5d %d ", Gia_ObjFaninId1p(p->pAig, pVar), Gia_ObjFaninC1(pVar) );
305  printf( "\n" );
306  }
307 */
308  }
309 }
static int Abc_Var2Lit(int Var, int fCompl)
Definition: abc_global.h:263
Tas_Que_t pProp
Definition: giaCTas.c:86
int iHead
Definition: giaCTas.c:76
static int Tas_VarValue(Gia_Obj_t *pVar)
Definition: giaCTas.c:120
Definition: gia.h:75
#define Tas_QueForEachEntry(Que, pObj, i)
Definition: giaCTas.c:139
static void Vec_IntPush(Vec_Int_t *p, int Entry)
Definition: bblif.c:468
static void Vec_IntClear(Vec_Int_t *p)
Definition: bblif.c:452
static int Gia_ObjIsCi(Gia_Obj_t *pObj)
Definition: gia.h:420
static int Gia_ObjCioId(Gia_Obj_t *pObj)
Definition: gia.h:411
int Tas_ManSolve ( Tas_Man_t p,
Gia_Obj_t pObj,
Gia_Obj_t pObj2 
)

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

Synopsis [Looking for a satisfying assignment of the node.]

Description [Assumes that each node has flag pObj->fMark0 set to 0. Returns 1 if unsatisfiable, 0 if satisfiable, and -1 if undecided. The node may be complemented. ]

SideEffects []

SeeAlso []

Definition at line 1366 of file giaCTas.c.

1367 {
1368  int i, Entry, RetValue = 0;
1369  s_Counter2 = 0;
1370  Vec_IntClear( p->vModel );
1371  if ( pObj == Gia_ManConst0(p->pAig) || pObj2 == Gia_ManConst0(p->pAig) || pObj == Gia_Not(pObj2) )
1372  return 1;
1373  if ( pObj == Gia_ManConst1(p->pAig) && (pObj2 == NULL || pObj2 == Gia_ManConst1(p->pAig)) )
1374  return 0;
1375  assert( !p->pProp.iHead && !p->pProp.iTail );
1376  assert( !p->pJust.iHead && !p->pJust.iTail );
1377  assert( p->pClauses.iHead == 1 && p->pClauses.iTail == 1 );
1378  p->Pars.nBTThis = p->Pars.nJustThis = p->Pars.nBTThisNc = 0;
1379  Tas_ManAssign( p, pObj, 0, NULL, NULL );
1380  if ( pObj2 && !Tas_VarIsAssigned(Gia_Regular(pObj2)) )
1381  Tas_ManAssign( p, pObj2, 0, NULL, NULL );
1382  if ( !Tas_ManSolve_rec(p, 0) && !Tas_ManCheckLimits(p) )
1383  Tas_ManSaveModel( p, p->vModel );
1384  else
1385  RetValue = 1;
1386  Tas_ManCancelUntil( p, 0 );
1387  p->pJust.iHead = p->pJust.iTail = 0;
1388  p->pClauses.iHead = p->pClauses.iTail = 1;
1389  // clauses
1390  if ( p->nClauses > 0 )
1391  {
1392  p->pStore.iCur = 16;
1393  Vec_IntForEachEntry( p->vWatchLits, Entry, i )
1394  p->pWatches[Entry] = 0;
1395  Vec_IntClear( p->vWatchLits );
1396  p->nClauses = 0;
1397  }
1398  // activity
1399  Vec_IntForEachEntry( p->vActiveVars, Entry, i )
1400  p->pActivity[Entry] = 0.0;
1401  Vec_IntClear( p->vActiveVars );
1402  // statistics
1403  p->Pars.nBTTotal += p->Pars.nBTThis;
1404  p->Pars.nJustTotal = Abc_MaxInt( p->Pars.nJustTotal, p->Pars.nJustThis );
1405  if ( Tas_ManCheckLimits( p ) )
1406  RetValue = -1;
1407  return RetValue;
1408 }
static Gia_Obj_t * Gia_Regular(Gia_Obj_t *p)
Definition: gia.h:377
static void Tas_ManSaveModel(Tas_Man_t *p, Vec_Int_t *vCex)
Definition: giaCTas.c:285
Gia_Man_t * pAig
Definition: giaCTas.c:85
Tas_Que_t pProp
Definition: giaCTas.c:86
int iHead
Definition: giaCTas.c:76
static void Tas_ManAssign(Tas_Man_t *p, Gia_Obj_t *pObj, int Level, Gia_Obj_t *pRes0, Gia_Obj_t *pRes1)
Definition: giaCTas.c:654
static int Abc_MaxInt(int a, int b)
Definition: abc_global.h:238
static Gia_Obj_t * Gia_ManConst1(Gia_Man_t *p)
Definition: gia.h:401
static Gia_Obj_t * Gia_Not(Gia_Obj_t *p)
Definition: gia.h:378
static int Tas_VarIsAssigned(Gia_Obj_t *pVar)
Definition: giaCTas.c:117
int iCur
Definition: giaCTas.c:68
int nClauses
Definition: giaCTas.c:97
Tas_Sto_t pStore
Definition: giaCTas.c:94
if(last==0)
Definition: sparse_int.h:34
int Tas_ManSolve_rec(Tas_Man_t *p, int Level)
Definition: giaCTas.c:1285
Vec_Int_t * vWatchLits
Definition: giaCTas.c:96
static Gia_Obj_t * Gia_ManConst0(Gia_Man_t *p)
Definition: gia.h:400
Tas_Que_t pClauses
Definition: giaCTas.c:88
Tas_Que_t pJust
Definition: giaCTas.c:87
int s_Counter2
Definition: giaCTas.c:639
int iTail
Definition: giaCTas.c:77
#define assert(ex)
Definition: util_old.h:213
static void Tas_ManCancelUntil(Tas_Man_t *p, int iBound)
Definition: giaCTas.c:627
static void Vec_IntClear(Vec_Int_t *p)
Definition: bblif.c:452
static int Tas_ManCheckLimits(Tas_Man_t *p)
Definition: giaCTas.c:269
#define Vec_IntForEachEntry(vVec, Entry, i)
MACRO DEFINITIONS ///.
Definition: vecInt.h:54
Vec_Int_t * vModel
Definition: giaCTas.c:91
Tas_Par_t Pars
Definition: giaCTas.c:84
int Tas_ManSolve_rec ( Tas_Man_t p,
int  Level 
)

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

Synopsis [Solve the problem recursively.]

Description [Returns learnt clause if unsat, NULL if sat or undecided.]

SideEffects []

SeeAlso []

Definition at line 1285 of file giaCTas.c.

1286 {
1287  Tas_Que_t * pQue = &(p->pClauses);
1288  Gia_Obj_t * pVar, * pDecVar = NULL;
1289  int hClause, hLearn0, hLearn1;
1290  int iPropHead, iJustHead, iJustTail;
1291  // propagate assignments
1292  assert( !Tas_QueIsEmpty(&p->pProp) );
1293  if ( (hClause = Tas_ManPropagate( p, Level )) )
1294  {
1295  Tas_ManCreateCls( p, hClause );
1296  return hClause;
1297  }
1298  // check for satisfying assignment
1299  assert( Tas_QueIsEmpty(&p->pProp) );
1300  if ( Tas_QueIsEmpty(&p->pJust) )
1301  return 0;
1302  // quit using resource limits
1303  p->Pars.nJustThis = Abc_MaxInt( p->Pars.nJustThis, p->pJust.iTail - p->pJust.iHead );
1304  if ( Tas_ManCheckLimits( p ) )
1305  return 0;
1306  // remember the state before branching
1307  iPropHead = p->pProp.iHead;
1308  Tas_QueStore( &p->pJust, &iJustHead, &iJustTail );
1309  // find the decision variable
1310  if ( p->Pars.fUseActive )
1311  pVar = NULL, pDecVar = Tas_ManFindActive( p );
1312  else if ( p->Pars.fUseHighest )
1313 // pVar = NULL, pDecVar = Tas_ManDecideHighestFanin( p );
1314  pVar = Tas_ManDecideHighest( p );
1315  else if ( p->Pars.fUseLowest )
1316  pVar = Tas_ManDecideLowest( p );
1317  else if ( p->Pars.fUseMaxFF )
1318  pVar = Tas_ManDecideMaxFF( p );
1319  else assert( 0 );
1320  // chose decision variable using fanout count
1321  if ( pVar != NULL )
1322  {
1323  assert( Tas_VarIsJust( pVar ) );
1324  if ( Gia_ObjRefNum(p->pAig, Gia_ObjFanin0(pVar)) > Gia_ObjRefNum(p->pAig, Gia_ObjFanin1(pVar)) )
1325  pDecVar = Gia_Not(Gia_ObjChild0(pVar));
1326  else
1327  pDecVar = Gia_Not(Gia_ObjChild1(pVar));
1328 // pDecVar = Gia_NotCond( pDecVar, Gia_Regular(pDecVar)->fMark1 ^ !Gia_IsComplement(pDecVar) );
1329  }
1330  // decide on first fanin
1331  Tas_ManAssign( p, pDecVar, Level+1, NULL, NULL );
1332  if ( !(hLearn0 = Tas_ManSolve_rec( p, Level+1 )) )
1333  return 0;
1334  if ( pQue->pData[hLearn0] != Gia_Regular(pDecVar) )
1335  return hLearn0;
1336  Tas_ManCancelUntil( p, iPropHead );
1337  Tas_QueRestore( &p->pJust, iJustHead, iJustTail );
1338  // decide on second fanin
1339  Tas_ManAssign( p, Gia_Not(pDecVar), Level+1, NULL, NULL );
1340  if ( !(hLearn1 = Tas_ManSolve_rec( p, Level+1 )) )
1341  return 0;
1342  if ( pQue->pData[hLearn1] != Gia_Regular(pDecVar) )
1343  return hLearn1;
1344  hClause = Tas_ManResolve( p, Level, hLearn0, hLearn1 );
1345  Tas_ManCreateCls( p, hClause );
1346 // Tas_ManPrintClauseNew( p, Level, hClause );
1347 // if ( Level > Tas_ClauseDecLevel(p, hClause) )
1348 // p->Pars.nBTThisNc++;
1349  p->Pars.nBTThis++;
1350  return hClause;
1351 }
static Gia_Obj_t * Gia_ObjChild0(Gia_Obj_t *pObj)
Definition: gia.h:457
static int Tas_ManResolve(Tas_Man_t *p, int Level, int hClause0, int hClause1)
Definition: giaCTas.c:873
static void Tas_QueRestore(Tas_Que_t *p, int iHeadOld, int iTailOld)
Definition: giaCTas.c:401
static Gia_Obj_t * Tas_ManDecideLowest(Tas_Man_t *p)
Definition: giaCTas.c:575
static Gia_Obj_t * Gia_Regular(Gia_Obj_t *p)
Definition: gia.h:377
Gia_Man_t * pAig
Definition: giaCTas.c:85
Tas_Que_t pProp
Definition: giaCTas.c:86
int iHead
Definition: giaCTas.c:76
static void Tas_ManAssign(Tas_Man_t *p, Gia_Obj_t *pObj, int Level, Gia_Obj_t *pRes0, Gia_Obj_t *pRes1)
Definition: giaCTas.c:654
static int Gia_ObjRefNum(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:521
static int Abc_MaxInt(int a, int b)
Definition: abc_global.h:238
Definition: gia.h:75
static Gia_Obj_t * Gia_ObjChild1(Gia_Obj_t *pObj)
Definition: gia.h:458
Gia_Obj_t ** pData
Definition: giaCTas.c:79
static Gia_Obj_t * Gia_Not(Gia_Obj_t *p)
Definition: gia.h:378
static Gia_Obj_t * Gia_ObjFanin0(Gia_Obj_t *pObj)
Definition: gia.h:454
static Gia_Obj_t * Tas_ManDecideMaxFF(Tas_Man_t *p)
Definition: giaCTas.c:596
int Tas_ManPropagate(Tas_Man_t *p, int Level)
Definition: giaCTas.c:1244
static Gia_Obj_t * Tas_ManDecideHighest(Tas_Man_t *p)
Definition: giaCTas.c:526
static int Tas_VarIsJust(Gia_Obj_t *pVar)
Definition: giaCTas.c:122
int Tas_ManSolve_rec(Tas_Man_t *p, int Level)
Definition: giaCTas.c:1285
static Gia_Obj_t * Tas_ManFindActive(Tas_Man_t *p)
Definition: giaCTas.c:462
Tas_Que_t pClauses
Definition: giaCTas.c:88
static int Tas_QueIsEmpty(Tas_Que_t *p)
Definition: giaCTas.c:322
static Gia_Obj_t * Gia_ObjFanin1(Gia_Obj_t *pObj)
Definition: gia.h:455
Tas_Que_t pJust
Definition: giaCTas.c:87
static Tas_Cls_t * Tas_ManCreateCls(Tas_Man_t *p, int hClause)
Definition: giaCTas.c:979
int iTail
Definition: giaCTas.c:77
#define assert(ex)
Definition: util_old.h:213
static void Tas_ManCancelUntil(Tas_Man_t *p, int iBound)
Definition: giaCTas.c:627
static int Tas_ManCheckLimits(Tas_Man_t *p)
Definition: giaCTas.c:269
static void Tas_QueStore(Tas_Que_t *p, int *piHeadOld, int *piTailOld)
Definition: giaCTas.c:380
Tas_Par_t Pars
Definition: giaCTas.c:84
int Tas_ManSolveArray ( Tas_Man_t p,
Vec_Ptr_t vObjs 
)

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

Synopsis [Looking for a satisfying assignment of the node.]

Description [Assumes that each node has flag pObj->fMark0 set to 0. Returns 1 if unsatisfiable, 0 if satisfiable, and -1 if undecided. The node may be complemented. ]

SideEffects []

SeeAlso []

Definition at line 1423 of file giaCTas.c.

1424 {
1425  Gia_Obj_t * pObj;
1426  int i, Entry, RetValue = 0;
1427  s_Counter2 = 0;
1428  s_Counter3 = 0;
1429  s_Counter4 = 0;
1430  Vec_IntClear( p->vModel );
1431  Vec_PtrForEachEntry( Gia_Obj_t *, vObjs, pObj, i )
1432  if ( pObj == Gia_ManConst0(p->pAig) )
1433  return 1;
1434  assert( !p->pProp.iHead && !p->pProp.iTail );
1435  assert( !p->pJust.iHead && !p->pJust.iTail );
1436  assert( p->pClauses.iHead == 1 && p->pClauses.iTail == 1 );
1437  p->Pars.nBTThis = p->Pars.nJustThis = p->Pars.nBTThisNc = 0;
1438  Vec_PtrForEachEntry( Gia_Obj_t *, vObjs, pObj, i )
1439  if ( pObj != Gia_ManConst1(p->pAig) && !Tas_VarIsAssigned(Gia_Regular(pObj)) )
1440  Tas_ManAssign( p, pObj, 0, NULL, NULL );
1441  if ( !Tas_ManSolve_rec(p, 0) && !Tas_ManCheckLimits(p) )
1442  Tas_ManSaveModel( p, p->vModel );
1443  else
1444  RetValue = 1;
1445  Tas_ManCancelUntil( p, 0 );
1446  p->pJust.iHead = p->pJust.iTail = 0;
1447  p->pClauses.iHead = p->pClauses.iTail = 1;
1448  // clauses
1449  if ( p->nClauses > 0 )
1450  {
1451  p->pStore.iCur = 16;
1452  Vec_IntForEachEntry( p->vWatchLits, Entry, i )
1453  p->pWatches[Entry] = 0;
1454  Vec_IntClear( p->vWatchLits );
1455  p->nClauses = 0;
1456  }
1457  // activity
1458  Vec_IntForEachEntry( p->vActiveVars, Entry, i )
1459  p->pActivity[Entry] = 0.0;
1460  Vec_IntClear( p->vActiveVars );
1461  // statistics
1462  p->Pars.nBTTotal += p->Pars.nBTThis;
1463  p->Pars.nJustTotal = Abc_MaxInt( p->Pars.nJustTotal, p->Pars.nJustThis );
1464  if ( Tas_ManCheckLimits( p ) )
1465  RetValue = -1;
1466 
1467 // printf( "%d ", Gia_ManObjNum(p->pAig) );
1468 // printf( "%d ", p->Pars.nBTThis );
1469 // printf( "%d ", p->Pars.nJustThis );
1470 // printf( "%d ", s_Counter2 );
1471 // printf( "%d ", s_Counter3 );
1472 // printf( "%d ", s_Counter4 );
1473  return RetValue;
1474 }
static Gia_Obj_t * Gia_Regular(Gia_Obj_t *p)
Definition: gia.h:377
static void Tas_ManSaveModel(Tas_Man_t *p, Vec_Int_t *vCex)
Definition: giaCTas.c:285
static void Tas_ManAssign(Tas_Man_t *p, Gia_Obj_t *pObj, int Level, Gia_Obj_t *pRes0, Gia_Obj_t *pRes1)
Definition: giaCTas.c:654
static int Abc_MaxInt(int a, int b)
Definition: abc_global.h:238
Definition: gia.h:75
static Gia_Obj_t * Gia_ManConst1(Gia_Man_t *p)
Definition: gia.h:401
static int Tas_VarIsAssigned(Gia_Obj_t *pVar)
Definition: giaCTas.c:117
int s_Counter3
Definition: giaCTas.c:640
if(last==0)
Definition: sparse_int.h:34
else
Definition: sparse_int.h:55
int Tas_ManSolve_rec(Tas_Man_t *p, int Level)
Definition: giaCTas.c:1285
int s_Counter4
Definition: giaCTas.c:641
static Gia_Obj_t * Gia_ManConst0(Gia_Man_t *p)
Definition: gia.h:400
int s_Counter2
Definition: giaCTas.c:639
#define assert(ex)
Definition: util_old.h:213
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.
Definition: vecPtr.h:55
static void Tas_ManCancelUntil(Tas_Man_t *p, int iBound)
Definition: giaCTas.c:627
static void Vec_IntClear(Vec_Int_t *p)
Definition: bblif.c:452
static int Tas_ManCheckLimits(Tas_Man_t *p)
Definition: giaCTas.c:269
#define Vec_IntForEachEntry(vVec, Entry, i)
MACRO DEFINITIONS ///.
Definition: vecInt.h:54
Vec_Int_t * vModel
Definition: giaCTas.c:91
Vec_Int_t* Tas_ManSolveMiterNc ( Gia_Man_t pAig,
int  nConfs,
Vec_Str_t **  pvStatus,
int  fVerbose 
)

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

Synopsis [Procedure to test the new SAT solver.]

Description []

SideEffects []

SeeAlso []

Definition at line 1517 of file giaCTas.c.

1518 {
1519  extern void Gia_ManCollectTest( Gia_Man_t * pAig );
1520  extern void Cec_ManSatAddToStore( Vec_Int_t * vCexStore, Vec_Int_t * vCex, int Out );
1521  Tas_Man_t * p;
1522  Vec_Int_t * vCex, * vVisit, * vCexStore;
1523  Vec_Str_t * vStatus;
1524  Gia_Obj_t * pRoot;//, * pRootCopy;
1525 // Gia_Man_t * pAigCopy = Gia_ManDup( pAig ), * pAigTemp;
1526 
1527  int i, status;
1528  abctime clk, clkTotal = Abc_Clock();
1529  assert( Gia_ManRegNum(pAig) == 0 );
1530 // Gia_ManCollectTest( pAig );
1531  // prepare AIG
1532  Gia_ManCreateRefs( pAig );
1533  Gia_ManCleanMark0( pAig );
1534  Gia_ManCleanMark1( pAig );
1535  Gia_ManFillValue( pAig ); // maps nodes into trail ids
1536  Gia_ManCleanPhase( pAig ); // maps nodes into trail ids
1537  // create logic network
1538  p = Tas_ManAlloc( pAig, nConfs );
1539  p->pAig = pAig;
1540  // create resulting data-structures
1541  vStatus = Vec_StrAlloc( Gia_ManPoNum(pAig) );
1542  vCexStore = Vec_IntAlloc( 10000 );
1543  vVisit = Vec_IntAlloc( 100 );
1544  vCex = Tas_ReadModel( p );
1545  // solve for each output
1546  Gia_ManForEachCo( pAig, pRoot, i )
1547  {
1548 // printf( "%d=", i );
1549 
1550  Vec_IntClear( vCex );
1551  if ( Gia_ObjIsConst0(Gia_ObjFanin0(pRoot)) )
1552  {
1553  if ( Gia_ObjFaninC0(pRoot) )
1554  {
1555 // printf( "Constant 1 output of SRM!!!\n" );
1556  Cec_ManSatAddToStore( vCexStore, vCex, i ); // trivial counter-example
1557  Vec_StrPush( vStatus, 0 );
1558  }
1559  else
1560  {
1561 // printf( "Constant 0 output of SRM!!!\n" );
1562  Vec_StrPush( vStatus, 1 );
1563  }
1564  continue;
1565  }
1566  clk = Abc_Clock();
1567 // p->Pars.fUseActive = 1;
1568  p->Pars.fUseHighest = 1;
1569  p->Pars.fUseLowest = 0;
1570  status = Tas_ManSolve( p, Gia_ObjChild0(pRoot), NULL );
1571 // printf( "\n" );
1572 /*
1573  if ( status == -1 )
1574  {
1575  p->Pars.fUseHighest = 0;
1576  p->Pars.fUseLowest = 1;
1577  status = Tas_ManSolve( p, Gia_ObjChild0(pRoot) );
1578  }
1579 */
1580  Vec_StrPush( vStatus, (char)status );
1581  if ( status == -1 )
1582  {
1583 // printf( "Unsolved %d.\n", i );
1584 
1585  p->nSatUndec++;
1586  p->nConfUndec += p->Pars.nBTThis;
1587  Cec_ManSatAddToStore( vCexStore, NULL, i ); // timeout
1588  p->timeSatUndec += Abc_Clock() - clk;
1589  continue;
1590  }
1591 
1592 // pRootCopy = Gia_ManCo( pAigCopy, i );
1593 // pRootCopy->iDiff0 = Gia_ObjId( pAigCopy, pRootCopy );
1594 // pRootCopy->fCompl0 = 0;
1595 
1596  if ( status == 1 )
1597  {
1598  p->nSatUnsat++;
1599  p->nConfUnsat += p->Pars.nBTThis;
1600  p->timeSatUnsat += Abc_Clock() - clk;
1601  continue;
1602  }
1603  p->nSatSat++;
1604  p->nConfSat += p->Pars.nBTThis;
1605 // Gia_SatVerifyPattern( pAig, pRoot, vCex, vVisit );
1606  Cec_ManSatAddToStore( vCexStore, vCex, i );
1607  p->timeSatSat += Abc_Clock() - clk;
1608 
1609 // printf( "%d ", Vec_IntSize(vCex) );
1610  }
1611 // pAigCopy = Gia_ManCleanup( pAigTemp = pAigCopy );
1612 // Gia_ManStop( pAigTemp );
1613 // Gia_DumpAiger( pAigCopy, "test", 0, 2 );
1614 // Gia_ManStop( pAigCopy );
1615 
1616  Vec_IntFree( vVisit );
1617  p->nSatTotal = Gia_ManPoNum(pAig);
1618  p->timeTotal = Abc_Clock() - clkTotal;
1619  if ( fVerbose )
1620  Tas_ManSatPrintStats( p );
1621 // printf( "RecCalls = %8d. RecClause = %8d. RecNonChro = %8d.\n", p->nRecCall, p->nRecClause, p->nRecNonChro );
1622  Tas_ManStop( p );
1623  *pvStatus = vStatus;
1624 
1625 // printf( "Total number of cex literals = %d. (Ave = %d)\n",
1626 // Vec_IntSize(vCexStore)-2*p->nSatUndec-2*p->nSatSat,
1627 // (Vec_IntSize(vCexStore)-2*p->nSatUndec-2*p->nSatSat)/p->nSatSat );
1628  return vCexStore;
1629 }
void Gia_ManCreateRefs(Gia_Man_t *p)
Definition: giaUtil.c:715
void Gia_ManCleanPhase(Gia_Man_t *p)
Definition: giaUtil.c:431
static Gia_Obj_t * Gia_ObjChild0(Gia_Obj_t *pObj)
Definition: gia.h:457
abctime timeSatUndec
Definition: giaCTas.c:113
#define Gia_ManForEachCo(p, pObj, i)
Definition: gia.h:1022
static int Gia_ManPoNum(Gia_Man_t *p)
Definition: gia.h:386
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
abctime timeTotal
Definition: giaCTas.c:114
Gia_Man_t * pAig
Definition: giaCTas.c:85
void Gia_ManCleanMark0(Gia_Man_t *p)
Definition: giaUtil.c:215
static int Gia_ObjIsConst0(Gia_Obj_t *pObj)
Definition: gia.h:430
static Vec_Str_t * Vec_StrAlloc(int nCap)
Definition: bblif.c:495
static abctime Abc_Clock()
Definition: abc_global.h:279
int nSatTotal
Definition: giaCTas.c:105
static void Vec_StrPush(Vec_Str_t *p, char Entry)
Definition: vecStr.h:535
Definition: gia.h:75
void Gia_ManCleanMark1(Gia_Man_t *p)
Definition: giaUtil.c:272
int nConfUnsat
Definition: giaCTas.c:107
int nConfSat
Definition: giaCTas.c:108
void Tas_ManStop(Tas_Man_t *p)
Definition: giaCTas.c:223
static Gia_Obj_t * Gia_ObjFanin0(Gia_Obj_t *pObj)
Definition: gia.h:454
int nSatUnsat
Definition: giaCTas.c:102
static Vec_Int_t * Vec_IntAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: bblif.c:149
int Tas_ManSolve(Tas_Man_t *p, Gia_Obj_t *pObj, Gia_Obj_t *pObj2)
Definition: giaCTas.c:1366
int nSatSat
Definition: giaCTas.c:103
abctime timeSatSat
Definition: giaCTas.c:112
void Gia_ManFillValue(Gia_Man_t *p)
Definition: giaUtil.c:328
abctime timeSatUnsat
Definition: giaCTas.c:111
void Cec_ManSatAddToStore(Vec_Int_t *vCexStore, Vec_Int_t *vCex, int Out)
Definition: cecSolve.c:952
Definition: gia.h:95
int nConfUndec
Definition: giaCTas.c:109
#define assert(ex)
Definition: util_old.h:213
void Gia_ManCollectTest(Gia_Man_t *p)
Definition: giaDfs.c:208
void Tas_ManSatPrintStats(Tas_Man_t *p)
Definition: giaCTas.c:1487
Vec_Int_t * Tas_ReadModel(Tas_Man_t *p)
Definition: giaCTas.c:250
static int Gia_ObjFaninC0(Gia_Obj_t *pObj)
Definition: gia.h:451
static void Vec_IntFree(Vec_Int_t *p)
Definition: bblif.c:235
Tas_Man_t * Tas_ManAlloc(Gia_Man_t *pAig, int nBTLimit)
Definition: giaCTas.c:187
static void Vec_IntClear(Vec_Int_t *p)
Definition: bblif.c:452
ABC_INT64_T abctime
Definition: abc_global.h:278
int nSatUndec
Definition: giaCTas.c:104
Tas_Par_t Pars
Definition: giaCTas.c:84
static int Gia_ManRegNum(Gia_Man_t *p)
Definition: gia.h:387
void Tas_ManSolveMiterNc2 ( Gia_Man_t pAig,
int  nConfs,
Gia_Man_t pAigOld,
Vec_Ptr_t vOldRoots,
Vec_Ptr_t vSimInfo 
)

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

Synopsis [Procedure to test the new SAT solver.]

Description []

SideEffects []

SeeAlso []

Definition at line 1696 of file giaCTas.c.

1697 {
1698  int nPatMax = 1000;
1699  int fVerbose = 1;
1700  extern void Gia_ManCollectTest( Gia_Man_t * pAig );
1701  extern void Cec_ManSatAddToStore( Vec_Int_t * vCexStore, Vec_Int_t * vCex, int Out );
1702  Tas_Man_t * p;
1703  Vec_Ptr_t * vPres;
1704  Vec_Int_t * vCex, * vVisit, * vCexStore;
1705  Vec_Str_t * vStatus;
1706  Gia_Obj_t * pRoot, * pOldRoot;
1707  int i, status;
1708  abctime clk, clkTotal = Abc_Clock();
1709  int Tried = 0, Stored = 0, Step = Gia_ManCoNum(pAig) / nPatMax;
1710  assert( Gia_ManRegNum(pAig) == 0 );
1711 // Gia_ManCollectTest( pAig );
1712  // prepare AIG
1713  Gia_ManCreateRefs( pAig );
1714  Gia_ManCleanMark0( pAig );
1715  Gia_ManCleanMark1( pAig );
1716  Gia_ManFillValue( pAig ); // maps nodes into trail ids
1717  Gia_ManCleanPhase( pAig ); // maps nodes into trail ids
1718  // create logic network
1719  p = Tas_ManAlloc( pAig, nConfs );
1720  p->pAig = pAig;
1721  // create resulting data-structures
1722  vStatus = Vec_StrAlloc( Gia_ManPoNum(pAig) );
1723  vCexStore = Vec_IntAlloc( 10000 );
1724  vVisit = Vec_IntAlloc( 100 );
1725  vCex = Tas_ReadModel( p );
1726  // solve for each output
1727  vPres = Vec_PtrAllocSimInfo( Gia_ManCiNum(pAig), 1 );
1728  Vec_PtrCleanSimInfo( vPres, 0, 1 );
1729 
1730  Gia_ManForEachCo( pAig, pRoot, i )
1731  {
1732  assert( !Gia_ObjIsConst0(Gia_ObjFanin0(pRoot)) );
1733  Vec_IntClear( vCex );
1734  clk = Abc_Clock();
1735  p->Pars.fUseHighest = 1;
1736  p->Pars.fUseLowest = 0;
1737  status = Tas_ManSolve( p, Gia_ObjChild0(pRoot), NULL );
1738  Vec_StrPush( vStatus, (char)status );
1739  if ( status == -1 )
1740  {
1741  p->nSatUndec++;
1742  p->nConfUndec += p->Pars.nBTThis;
1743 // Cec_ManSatAddToStore( vCexStore, NULL, i ); // timeout
1744  p->timeSatUndec += Abc_Clock() - clk;
1745 
1746  i += Step;
1747  continue;
1748  }
1749  if ( status == 1 )
1750  {
1751  p->nSatUnsat++;
1752  p->nConfUnsat += p->Pars.nBTThis;
1753  p->timeSatUnsat += Abc_Clock() - clk;
1754  // record proved
1755  pOldRoot = (Gia_Obj_t *)Vec_PtrEntry( vOldRoots, i );
1756  assert( !Gia_ObjProved( pAigOld, Gia_ObjId(pAigOld, pOldRoot) ) );
1757  Gia_ObjSetProved( pAigOld, Gia_ObjId(pAigOld, pOldRoot) );
1758 
1759  i += Step;
1760  continue;
1761  }
1762  p->nSatSat++;
1763  p->nConfSat += p->Pars.nBTThis;
1764 // Gia_SatVerifyPattern( pAig, pRoot, vCex, vVisit );
1765 // Cec_ManSatAddToStore( vCexStore, vCex, i );
1766 
1767  // save pattern
1768  Tried++;
1769  Stored += Tas_StorePattern( vSimInfo, vPres, vCex );
1770  p->timeSatSat += Abc_Clock() - clk;
1771  i += Step;
1772  }
1773  printf( "Tried = %d Stored = %d\n", Tried, Stored );
1774  Vec_IntFree( vVisit );
1775  p->nSatTotal = Gia_ManPoNum(pAig);
1776  p->timeTotal = Abc_Clock() - clkTotal;
1777  if ( fVerbose )
1778  Tas_ManSatPrintStats( p );
1779  Tas_ManStop( p );
1780  Vec_PtrFree( vPres );
1781 }
void Gia_ManCreateRefs(Gia_Man_t *p)
Definition: giaUtil.c:715
void Gia_ManCleanPhase(Gia_Man_t *p)
Definition: giaUtil.c:431
static Gia_Obj_t * Gia_ObjChild0(Gia_Obj_t *pObj)
Definition: gia.h:457
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition: vecPtr.h:42
abctime timeSatUndec
Definition: giaCTas.c:113
#define Gia_ManForEachCo(p, pObj, i)
Definition: gia.h:1022
static int Gia_ManPoNum(Gia_Man_t *p)
Definition: gia.h:386
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
abctime timeTotal
Definition: giaCTas.c:114
Gia_Man_t * pAig
Definition: giaCTas.c:85
void Gia_ManCleanMark0(Gia_Man_t *p)
Definition: giaUtil.c:215
static int Gia_ObjIsConst0(Gia_Obj_t *pObj)
Definition: gia.h:430
static void Vec_PtrCleanSimInfo(Vec_Ptr_t *vInfo, int iWord, int nWords)
Definition: vecPtr.h:968
static Vec_Str_t * Vec_StrAlloc(int nCap)
Definition: bblif.c:495
static abctime Abc_Clock()
Definition: abc_global.h:279
int nSatTotal
Definition: giaCTas.c:105
static void Vec_StrPush(Vec_Str_t *p, char Entry)
Definition: vecStr.h:535
Definition: gia.h:75
void Gia_ManCleanMark1(Gia_Man_t *p)
Definition: giaUtil.c:272
int nConfUnsat
Definition: giaCTas.c:107
int nConfSat
Definition: giaCTas.c:108
void Tas_ManStop(Tas_Man_t *p)
Definition: giaCTas.c:223
static Gia_Obj_t * Gia_ObjFanin0(Gia_Obj_t *pObj)
Definition: gia.h:454
int nSatUnsat
Definition: giaCTas.c:102
static Vec_Int_t * Vec_IntAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: bblif.c:149
static void Gia_ObjSetProved(Gia_Man_t *p, int Id)
Definition: gia.h:897
int Tas_ManSolve(Tas_Man_t *p, Gia_Obj_t *pObj, Gia_Obj_t *pObj2)
Definition: giaCTas.c:1366
int Tas_StorePattern(Vec_Ptr_t *vSimInfo, Vec_Ptr_t *vPres, Vec_Int_t *vCex)
Definition: giaCTas.c:1676
int nSatSat
Definition: giaCTas.c:103
abctime timeSatSat
Definition: giaCTas.c:112
static int Gia_ObjId(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:410
void Gia_ManFillValue(Gia_Man_t *p)
Definition: giaUtil.c:328
abctime timeSatUnsat
Definition: giaCTas.c:111
void Cec_ManSatAddToStore(Vec_Int_t *vCexStore, Vec_Int_t *vCex, int Out)
Definition: cecSolve.c:952
static void * Vec_PtrEntry(Vec_Ptr_t *p, int i)
Definition: vecPtr.h:362
static int Gia_ManCiNum(Gia_Man_t *p)
Definition: gia.h:383
Definition: gia.h:95
int nConfUndec
Definition: giaCTas.c:109
static int Gia_ObjProved(Gia_Man_t *p, int Id)
Definition: gia.h:896
#define assert(ex)
Definition: util_old.h:213
void Gia_ManCollectTest(Gia_Man_t *p)
Definition: giaDfs.c:208
void Tas_ManSatPrintStats(Tas_Man_t *p)
Definition: giaCTas.c:1487
Vec_Int_t * Tas_ReadModel(Tas_Man_t *p)
Definition: giaCTas.c:250
static void Vec_IntFree(Vec_Int_t *p)
Definition: bblif.c:235
Tas_Man_t * Tas_ManAlloc(Gia_Man_t *pAig, int nBTLimit)
Definition: giaCTas.c:187
static void Vec_IntClear(Vec_Int_t *p)
Definition: bblif.c:452
ABC_INT64_T abctime
Definition: abc_global.h:278
int nSatUndec
Definition: giaCTas.c:104
static Vec_Ptr_t * Vec_PtrAllocSimInfo(int nEntries, int nWords)
Definition: vecPtr.h:929
static void Vec_PtrFree(Vec_Ptr_t *p)
Definition: vecPtr.h:223
static int Gia_ManCoNum(Gia_Man_t *p)
Definition: gia.h:384
Tas_Par_t Pars
Definition: giaCTas.c:84
static int Gia_ManRegNum(Gia_Man_t *p)
Definition: gia.h:387
void Tas_ManStop ( Tas_Man_t p)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 223 of file giaCTas.c.

224 {
225  Vec_IntFree( p->vActiveVars );
226  Vec_IntFree( p->vWatchLits );
227  Vec_IntFree( p->vLevReas );
228  Vec_IntFree( p->vModel );
229  Vec_PtrFree( p->vTemp );
230  ABC_FREE( p->pActivity );
231  ABC_FREE( p->pWatches );
232  ABC_FREE( p->pStore.pData );
233  ABC_FREE( p->pClauses.pData );
234  ABC_FREE( p->pProp.pData );
235  ABC_FREE( p->pJust.pData );
236  ABC_FREE( p );
237 }
int * pWatches
Definition: giaCTas.c:95
Vec_Int_t * vActiveVars
Definition: giaCTas.c:100
Tas_Que_t pProp
Definition: giaCTas.c:86
float * pActivity
Definition: giaCTas.c:99
Gia_Obj_t ** pData
Definition: giaCTas.c:79
Tas_Sto_t pStore
Definition: giaCTas.c:94
int * pData
Definition: giaCTas.c:70
Vec_Int_t * vLevReas
Definition: giaCTas.c:90
Vec_Int_t * vWatchLits
Definition: giaCTas.c:96
#define ABC_FREE(obj)
Definition: abc_global.h:232
Tas_Que_t pClauses
Definition: giaCTas.c:88
Tas_Que_t pJust
Definition: giaCTas.c:87
static void Vec_IntFree(Vec_Int_t *p)
Definition: bblif.c:235
Vec_Ptr_t * vTemp
Definition: giaCTas.c:92
Vec_Int_t * vModel
Definition: giaCTas.c:91
static void Vec_PtrFree(Vec_Ptr_t *p)
Definition: vecPtr.h:223
static void Tas_ManWatchClause ( Tas_Man_t p,
Tas_Cls_t pClause,
int  Lit 
)
inlinestatic

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

Synopsis [Adds one clause to the watcher list.]

Description []

SideEffects []

SeeAlso []

Definition at line 954 of file giaCTas.c.

955 {
956  assert( Abc_Lit2Var(Lit) < Gia_ManObjNum(p->pAig) );
957  assert( pClause->nLits >= 2 );
958  assert( pClause->pLits[0] == Lit || pClause->pLits[1] == Lit );
959  if ( pClause->pLits[0] == Lit )
960  pClause->iNext[0] = p->pWatches[Abc_LitNot(Lit)];
961  else
962  pClause->iNext[1] = p->pWatches[Abc_LitNot(Lit)];
963  if ( p->pWatches[Abc_LitNot(Lit)] == 0 )
964  Vec_IntPush( p->vWatchLits, Abc_LitNot(Lit) );
965  p->pWatches[Abc_LitNot(Lit)] = Tas_ClsHandle( p, pClause );
966 }
int * pWatches
Definition: giaCTas.c:95
Gia_Man_t * pAig
Definition: giaCTas.c:85
int iNext[2]
Definition: giaCTas.c:60
int nLits
Definition: giaCTas.c:61
static void Vec_IntPush(Vec_Int_t *p, int Entry)
Definition: bblif.c:468
static int Abc_LitNot(int Lit)
Definition: abc_global.h:266
Vec_Int_t * vWatchLits
Definition: giaCTas.c:96
static int Abc_Lit2Var(int Lit)
Definition: abc_global.h:264
#define assert(ex)
Definition: util_old.h:213
int pLits[0]
Definition: giaCTas.c:62
static int Tas_ClsHandle(Tas_Man_t *p, Tas_Cls_t *pClause)
Definition: giaCTas.c:128
static int Gia_ManObjNum(Gia_Man_t *p)
Definition: gia.h:388
static int Tas_QueFinish ( Tas_Que_t p)
inlinestatic

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

Synopsis [Finalized the clause.]

Description []

SideEffects []

SeeAlso []

Definition at line 418 of file giaCTas.c.

419 {
420  int iHeadOld = p->iHead;
421  assert( p->iHead < p->iTail );
422  Tas_QuePush( p, NULL );
423  p->iHead = p->iTail;
424  return iHeadOld;
425 }
int iHead
Definition: giaCTas.c:76
static void Tas_QuePush(Tas_Que_t *p, Gia_Obj_t *pObj)
Definition: giaCTas.c:338
int iTail
Definition: giaCTas.c:77
#define assert(ex)
Definition: util_old.h:213
static int Tas_QueHasNode ( Tas_Que_t p,
Gia_Obj_t pObj 
)
inlinestatic

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

Synopsis [Returns 1 if the object in the queue.]

Description []

SideEffects []

SeeAlso []

Definition at line 359 of file giaCTas.c.

360 {
361  Gia_Obj_t * pTemp;
362  int i;
363  Tas_QueForEachEntry( *p, pTemp, i )
364  if ( pTemp == pObj )
365  return 1;
366  return 0;
367 }
Definition: gia.h:75
#define Tas_QueForEachEntry(Que, pObj, i)
Definition: giaCTas.c:139
if(last==0)
Definition: sparse_int.h:34
static int Tas_QueIsEmpty ( Tas_Que_t p)
inlinestatic

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 322 of file giaCTas.c.

323 {
324  return p->iHead == p->iTail;
325 }
int iHead
Definition: giaCTas.c:76
int iTail
Definition: giaCTas.c:77
static void Tas_QuePush ( Tas_Que_t p,
Gia_Obj_t pObj 
)
inlinestatic

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 338 of file giaCTas.c.

339 {
340  if ( p->iTail == p->nSize )
341  {
342  p->nSize *= 2;
343  p->pData = ABC_REALLOC( Gia_Obj_t *, p->pData, p->nSize );
344  }
345  p->pData[p->iTail++] = pObj;
346 }
#define ABC_REALLOC(type, obj, num)
Definition: abc_global.h:233
Definition: gia.h:75
Gia_Obj_t ** pData
Definition: giaCTas.c:79
int nSize
Definition: giaCTas.c:78
int iTail
Definition: giaCTas.c:77
static void Tas_QueRestore ( Tas_Que_t p,
int  iHeadOld,
int  iTailOld 
)
inlinestatic

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 401 of file giaCTas.c.

402 {
403  p->iHead = iHeadOld;
404  p->iTail = iTailOld;
405 }
int iHead
Definition: giaCTas.c:76
int iTail
Definition: giaCTas.c:77
static void Tas_QueStore ( Tas_Que_t p,
int *  piHeadOld,
int *  piTailOld 
)
inlinestatic

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 380 of file giaCTas.c.

381 {
382  int i;
383  *piHeadOld = p->iHead;
384  *piTailOld = p->iTail;
385  for ( i = *piHeadOld; i < *piTailOld; i++ )
386  Tas_QuePush( p, p->pData[i] );
387  p->iHead = *piTailOld;
388 }
int iHead
Definition: giaCTas.c:76
Gia_Obj_t ** pData
Definition: giaCTas.c:79
static void Tas_QuePush(Tas_Que_t *p, Gia_Obj_t *pObj)
Definition: giaCTas.c:338
int iTail
Definition: giaCTas.c:77
Vec_Int_t* Tas_ReadModel ( Tas_Man_t p)

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

Synopsis [Returns satisfying assignment.]

Description []

SideEffects []

SeeAlso []

Definition at line 250 of file giaCTas.c.

251 {
252  return p->vModel;
253 }
Vec_Int_t * vModel
Definition: giaCTas.c:91
void Tas_SetDefaultParams ( Tas_Par_t pPars)

FUNCTION DEFINITIONS ///.

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

Synopsis [Sets default values of the parameters.]

Description []

SideEffects []

SeeAlso []

Definition at line 162 of file giaCTas.c.

163 {
164  memset( pPars, 0, sizeof(Tas_Par_t) );
165  pPars->nBTLimit = 2000; // limit on the number of conflicts
166  pPars->nJustLimit = 2000; // limit on the size of justification queue
167  pPars->fUseActive = 0; // use node with the highest activity
168  pPars->fUseHighest = 1; // use node with the highest ID
169  pPars->fUseLowest = 0; // use node with the lowest ID
170  pPars->fUseMaxFF = 0; // use node with the largest fanin fanout
171  pPars->fVerbose = 1; // print detailed statistics
172  pPars->VarDecay = (float)0.95; // variable decay
173  pPars->VarInc = 1.0; // variable increment
174 }
char * memset()
typedefABC_NAMESPACE_IMPL_START struct Tas_Par_t_ Tas_Par_t
DECLARATIONS ///.
Definition: giaCTas.c:33
int Tas_StorePattern ( Vec_Ptr_t vSimInfo,
Vec_Ptr_t vPres,
Vec_Int_t vCex 
)

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

Synopsis [Procedure to test the new SAT solver.]

Description []

SideEffects []

SeeAlso []

Definition at line 1676 of file giaCTas.c.

1677 {
1678  int k;
1679  for ( k = 1; k < 32; k++ )
1680  if ( Tas_StorePatternTry( vSimInfo, vPres, k, (int *)Vec_IntArray(vCex), Vec_IntSize(vCex) ) )
1681  break;
1682  return (int)(k < 32);
1683 }
int Tas_StorePatternTry(Vec_Ptr_t *vInfo, Vec_Ptr_t *vPres, int iBit, int *pLits, int nLits)
Definition: giaCTas.c:1642
static int * Vec_IntArray(Vec_Int_t *p)
Definition: vecInt.h:328
static int Vec_IntSize(Vec_Int_t *p)
Definition: bblif.c:252
int Tas_StorePatternTry ( Vec_Ptr_t vInfo,
Vec_Ptr_t vPres,
int  iBit,
int *  pLits,
int  nLits 
)

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

Synopsis [Packs patterns into array of simulation info.]

Description []

SideEffects []

SeeAlso []

                               ` 

Definition at line 1642 of file giaCTas.c.

1643 {
1644  unsigned * pInfo, * pPres;
1645  int i;
1646  for ( i = 0; i < nLits; i++ )
1647  {
1648  pInfo = (unsigned *)Vec_PtrEntry(vInfo, Abc_Lit2Var(pLits[i]));
1649  pPres = (unsigned *)Vec_PtrEntry(vPres, Abc_Lit2Var(pLits[i]));
1650  if ( Abc_InfoHasBit( pPres, iBit ) &&
1651  Abc_InfoHasBit( pInfo, iBit ) == Abc_LitIsCompl(pLits[i]) )
1652  return 0;
1653  }
1654  for ( i = 0; i < nLits; i++ )
1655  {
1656  pInfo = (unsigned *)Vec_PtrEntry(vInfo, Abc_Lit2Var(pLits[i]));
1657  pPres = (unsigned *)Vec_PtrEntry(vPres, Abc_Lit2Var(pLits[i]));
1658  Abc_InfoSetBit( pPres, iBit );
1659  if ( Abc_InfoHasBit( pInfo, iBit ) == Abc_LitIsCompl(pLits[i]) )
1660  Abc_InfoXorBit( pInfo, iBit );
1661  }
1662  return 1;
1663 }
static int Abc_InfoHasBit(unsigned *p, int i)
Definition: abc_global.h:258
static void Abc_InfoXorBit(unsigned *p, int i)
Definition: abc_global.h:260
static int Abc_LitIsCompl(int Lit)
Definition: abc_global.h:265
static void * Vec_PtrEntry(Vec_Ptr_t *p, int i)
Definition: vecPtr.h:362
static void Abc_InfoSetBit(unsigned *p, int i)
Definition: abc_global.h:259
static int Abc_Lit2Var(int Lit)
Definition: abc_global.h:264
static void Tas_VarAssign ( Gia_Obj_t pVar)
inlinestatic

Definition at line 118 of file giaCTas.c.

118 { assert(!pVar->fMark0); pVar->fMark0 = 1; }
unsigned fMark0
Definition: gia.h:79
#define assert(ex)
Definition: util_old.h:213
static int Tas_VarDecLevel ( Tas_Man_t p,
Gia_Obj_t pVar 
)
inlinestatic

Definition at line 131 of file giaCTas.c.

131 { assert( pVar->Value != ~0 ); return Vec_IntEntry(p->vLevReas, 3*pVar->Value); }
Vec_Int_t * vLevReas
Definition: giaCTas.c:90
static int Vec_IntEntry(Vec_Int_t *p, int i)
Definition: bblif.c:268
#define assert(ex)
Definition: util_old.h:213
unsigned Value
Definition: gia.h:87
static int Tas_VarFanin0Value ( Gia_Obj_t pVar)
inlinestatic

Definition at line 123 of file giaCTas.c.

123 { return !Tas_VarIsAssigned(Gia_ObjFanin0(pVar)) ? 2 : (Tas_VarValue(Gia_ObjFanin0(pVar)) ^ Gia_ObjFaninC0(pVar)); }
static int Tas_VarValue(Gia_Obj_t *pVar)
Definition: giaCTas.c:120
static int Tas_VarIsAssigned(Gia_Obj_t *pVar)
Definition: giaCTas.c:117
static Gia_Obj_t * Gia_ObjFanin0(Gia_Obj_t *pObj)
Definition: gia.h:454
static int Gia_ObjFaninC0(Gia_Obj_t *pObj)
Definition: gia.h:451
static int Tas_VarFanin1Value ( Gia_Obj_t pVar)
inlinestatic

Definition at line 124 of file giaCTas.c.

124 { return !Tas_VarIsAssigned(Gia_ObjFanin1(pVar)) ? 2 : (Tas_VarValue(Gia_ObjFanin1(pVar)) ^ Gia_ObjFaninC1(pVar)); }
static int Gia_ObjFaninC1(Gia_Obj_t *pObj)
Definition: gia.h:452
static int Tas_VarValue(Gia_Obj_t *pVar)
Definition: giaCTas.c:120
static int Tas_VarIsAssigned(Gia_Obj_t *pVar)
Definition: giaCTas.c:117
static Gia_Obj_t * Gia_ObjFanin1(Gia_Obj_t *pObj)
Definition: gia.h:455
static int Tas_VarFaninFanoutMax ( Tas_Man_t p,
Gia_Obj_t pObj 
)
inlinestatic

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

Synopsis [Max number of fanins fanouts.]

Description []

SideEffects []

SeeAlso []

Definition at line 439 of file giaCTas.c.

440 {
441  int Count0, Count1;
442  assert( !Gia_IsComplement(pObj) );
443  assert( Gia_ObjIsAnd(pObj) );
444  Count0 = Gia_ObjRefNum( p->pAig, Gia_ObjFanin0(pObj) );
445  Count1 = Gia_ObjRefNum( p->pAig, Gia_ObjFanin1(pObj) );
446  return Abc_MaxInt( Count0, Count1 );
447 }
Gia_Man_t * pAig
Definition: giaCTas.c:85
static int Gia_ObjRefNum(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:521
static int Abc_MaxInt(int a, int b)
Definition: abc_global.h:238
static Gia_Obj_t * Gia_ObjFanin0(Gia_Obj_t *pObj)
Definition: gia.h:454
static int Gia_IsComplement(Gia_Obj_t *p)
Definition: gia.h:380
static int Gia_ObjIsAnd(Gia_Obj_t *pObj)
Definition: gia.h:422
static Gia_Obj_t * Gia_ObjFanin1(Gia_Obj_t *pObj)
Definition: gia.h:455
#define assert(ex)
Definition: util_old.h:213
static int Tas_VarHasReasonCls ( Tas_Man_t p,
Gia_Obj_t pVar 
)
inlinestatic

Definition at line 136 of file giaCTas.c.

136 { assert( pVar->Value != ~0 ); return Vec_IntEntry(p->vLevReas, 3*pVar->Value+1) == 0 && Vec_IntEntry(p->vLevReas, 3*pVar->Value+2) != 0; }
Vec_Int_t * vLevReas
Definition: giaCTas.c:90
static int Vec_IntEntry(Vec_Int_t *p, int i)
Definition: bblif.c:268
#define assert(ex)
Definition: util_old.h:213
unsigned Value
Definition: gia.h:87
static int Tas_VarIsAssigned ( Gia_Obj_t pVar)
inlinestatic

Definition at line 117 of file giaCTas.c.

117 { return pVar->fMark0; }
unsigned fMark0
Definition: gia.h:79
static int Tas_VarIsJust ( Gia_Obj_t pVar)
inlinestatic

Definition at line 122 of file giaCTas.c.

122 { return Gia_ObjIsAnd(pVar) && !Tas_VarIsAssigned(Gia_ObjFanin0(pVar)) && !Tas_VarIsAssigned(Gia_ObjFanin1(pVar)); }
static int Tas_VarIsAssigned(Gia_Obj_t *pVar)
Definition: giaCTas.c:117
static Gia_Obj_t * Gia_ObjFanin0(Gia_Obj_t *pObj)
Definition: gia.h:454
static int Gia_ObjIsAnd(Gia_Obj_t *pObj)
Definition: gia.h:422
static Gia_Obj_t * Gia_ObjFanin1(Gia_Obj_t *pObj)
Definition: gia.h:455
static Gia_Obj_t* Tas_VarReason0 ( Tas_Man_t p,
Gia_Obj_t pVar 
)
inlinestatic

Definition at line 132 of file giaCTas.c.

132 { assert( pVar->Value != ~0 ); return pVar + Vec_IntEntry(p->vLevReas, 3*pVar->Value+1); }
Vec_Int_t * vLevReas
Definition: giaCTas.c:90
static int Vec_IntEntry(Vec_Int_t *p, int i)
Definition: bblif.c:268
#define assert(ex)
Definition: util_old.h:213
unsigned Value
Definition: gia.h:87
static Gia_Obj_t* Tas_VarReason1 ( Tas_Man_t p,
Gia_Obj_t pVar 
)
inlinestatic

Definition at line 133 of file giaCTas.c.

133 { assert( pVar->Value != ~0 ); return pVar + Vec_IntEntry(p->vLevReas, 3*pVar->Value+2); }
Vec_Int_t * vLevReas
Definition: giaCTas.c:90
static int Vec_IntEntry(Vec_Int_t *p, int i)
Definition: bblif.c:268
#define assert(ex)
Definition: util_old.h:213
unsigned Value
Definition: gia.h:87
static Tas_Cls_t* Tas_VarReasonCls ( Tas_Man_t p,
Gia_Obj_t pVar 
)
inlinestatic

Definition at line 137 of file giaCTas.c.

137 { assert( pVar->Value != ~0 ); return Tas_ClsFromHandle( p, Vec_IntEntry(p->vLevReas, 3*pVar->Value+2) ); }
Vec_Int_t * vLevReas
Definition: giaCTas.c:90
static int Vec_IntEntry(Vec_Int_t *p, int i)
Definition: bblif.c:268
static Tas_Cls_t * Tas_ClsFromHandle(Tas_Man_t *p, int h)
Definition: giaCTas.c:129
#define assert(ex)
Definition: util_old.h:213
unsigned Value
Definition: gia.h:87
static void Tas_VarSetValue ( Gia_Obj_t pVar,
int  v 
)
inlinestatic

Definition at line 121 of file giaCTas.c.

121 { assert(pVar->fMark0); pVar->fMark1 = v; }
unsigned fMark1
Definition: gia.h:84
unsigned fMark0
Definition: gia.h:79
#define assert(ex)
Definition: util_old.h:213
static int Tas_VarToLit ( Tas_Man_t p,
Gia_Obj_t pObj 
)
inlinestatic

Definition at line 125 of file giaCTas.c.

125 { assert( Tas_VarIsAssigned(pObj) ); return Abc_Var2Lit( Gia_ObjId(p->pAig, pObj), !Tas_VarValue(pObj) ); }
Gia_Man_t * pAig
Definition: giaCTas.c:85
static int Abc_Var2Lit(int Var, int fCompl)
Definition: abc_global.h:263
static int Tas_VarValue(Gia_Obj_t *pVar)
Definition: giaCTas.c:120
static int Tas_VarIsAssigned(Gia_Obj_t *pVar)
Definition: giaCTas.c:117
static int Gia_ObjId(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:410
#define assert(ex)
Definition: util_old.h:213
static void Tas_VarUnassign ( Gia_Obj_t pVar)
inlinestatic

Definition at line 119 of file giaCTas.c.

119 { assert(pVar->fMark0); pVar->fMark0 = 0; pVar->fMark1 = 0; pVar->Value = ~0; }
unsigned fMark1
Definition: gia.h:84
unsigned fMark0
Definition: gia.h:79
#define assert(ex)
Definition: util_old.h:213
unsigned Value
Definition: gia.h:87
static int Tas_VarValue ( Gia_Obj_t pVar)
inlinestatic

Definition at line 120 of file giaCTas.c.

120 { assert(pVar->fMark0); return pVar->fMark1; }
unsigned fMark1
Definition: gia.h:84
unsigned fMark0
Definition: gia.h:79
#define assert(ex)
Definition: util_old.h:213

Variable Documentation

int s_Counter2 = 0

Definition at line 639 of file giaCTas.c.

int s_Counter3 = 0

Definition at line 640 of file giaCTas.c.

int s_Counter4 = 0

Definition at line 641 of file giaCTas.c.