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

Go to the source code of this file.

Functions

static ABC_NAMESPACE_IMPL_START int Sat_ObjXValue (Gia_Obj_t *pObj)
 DECLARATIONS ///. More...
 
static void Sat_ObjSetXValue (Gia_Obj_t *pObj, int v)
 
void Gia_SatCollectCone_rec (Gia_Man_t *p, Gia_Obj_t *pObj, Vec_Int_t *vVisit)
 FUNCTION DEFINITIONS ///. More...
 
void Gia_SatCollectCone (Gia_Man_t *p, Gia_Obj_t *pObj, Vec_Int_t *vVisit)
 
void Gia_SatVerifyPattern (Gia_Man_t *p, Gia_Obj_t *pRoot, Vec_Int_t *vCex, Vec_Int_t *vVisit)
 

Function Documentation

void Gia_SatCollectCone ( Gia_Man_t p,
Gia_Obj_t pObj,
Vec_Int_t vVisit 
)

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

Synopsis [Collects nodes in the cone and initialized them to x.]

Description []

SideEffects []

SeeAlso []

Definition at line 73 of file giaPat.c.

74 {
75  assert( !Gia_IsComplement(pObj) );
76  assert( !Gia_ObjIsConst0(pObj) );
77  assert( Sat_ObjXValue(pObj) == 0 );
78  Vec_IntClear( vVisit );
79  Gia_SatCollectCone_rec( p, pObj, vVisit );
80 }
void Gia_SatCollectCone_rec(Gia_Man_t *p, Gia_Obj_t *pObj, Vec_Int_t *vVisit)
FUNCTION DEFINITIONS ///.
Definition: giaPat.c:48
static int Gia_ObjIsConst0(Gia_Obj_t *pObj)
Definition: gia.h:430
static int Gia_IsComplement(Gia_Obj_t *p)
Definition: gia.h:380
#define assert(ex)
Definition: util_old.h:213
static void Vec_IntClear(Vec_Int_t *p)
Definition: bblif.c:452
static ABC_NAMESPACE_IMPL_START int Sat_ObjXValue(Gia_Obj_t *pObj)
DECLARATIONS ///.
Definition: giaPat.c:30
void Gia_SatCollectCone_rec ( Gia_Man_t p,
Gia_Obj_t pObj,
Vec_Int_t vVisit 
)

FUNCTION DEFINITIONS ///.

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

Synopsis [Collects nodes in the cone and initialized them to x.]

Description []

SideEffects []

SeeAlso []

Definition at line 48 of file giaPat.c.

49 {
50  if ( Sat_ObjXValue(pObj) == GIA_UND )
51  return;
52  if ( Gia_ObjIsAnd(pObj) )
53  {
54  Gia_SatCollectCone_rec( p, Gia_ObjFanin0(pObj), vVisit );
55  Gia_SatCollectCone_rec( p, Gia_ObjFanin1(pObj), vVisit );
56  }
57  assert( Sat_ObjXValue(pObj) == 0 );
58  Sat_ObjSetXValue( pObj, GIA_UND );
59  Vec_IntPush( vVisit, Gia_ObjId(p, pObj) );
60 }
#define GIA_UND
Definition: gia.h:749
static void Sat_ObjSetXValue(Gia_Obj_t *pObj, int v)
Definition: giaPat.c:31
void Gia_SatCollectCone_rec(Gia_Man_t *p, Gia_Obj_t *pObj, Vec_Int_t *vVisit)
FUNCTION DEFINITIONS ///.
Definition: giaPat.c:48
static Gia_Obj_t * Gia_ObjFanin0(Gia_Obj_t *pObj)
Definition: gia.h:454
static void Vec_IntPush(Vec_Int_t *p, int Entry)
Definition: bblif.c:468
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
#define assert(ex)
Definition: util_old.h:213
static ABC_NAMESPACE_IMPL_START int Sat_ObjXValue(Gia_Obj_t *pObj)
DECLARATIONS ///.
Definition: giaPat.c:30
void Gia_SatVerifyPattern ( Gia_Man_t p,
Gia_Obj_t pRoot,
Vec_Int_t vCex,
Vec_Int_t vVisit 
)

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

Synopsis [Checks if the counter-examples asserts the output.]

Description [Assumes that fMark0 and fMark1 are clean. Leaves them clean.]

SideEffects []

SeeAlso []

Definition at line 93 of file giaPat.c.

94 {
95  Gia_Obj_t * pObj;
96  int i, Entry, Value, Value0, Value1;
97  assert( Gia_ObjIsCo(pRoot) );
99  // collect nodes and initialized them to x
100  Gia_SatCollectCone( p, Gia_ObjFanin0(pRoot), vVisit );
101  // set binary values to nodes in the counter-example
102  Vec_IntForEachEntry( vCex, Entry, i )
103 // Sat_ObjSetXValue( Gia_ManObj(p, Abc_Lit2Var(Entry)), Abc_LitIsCompl(Entry)? GIA_ZER : GIA_ONE );
105  // simulate
106  Gia_ManForEachObjVec( vVisit, p, pObj, i )
107  {
108  if ( Gia_ObjIsCi(pObj) )
109  continue;
110  assert( Gia_ObjIsAnd(pObj) );
111  Value0 = Sat_ObjXValue( Gia_ObjFanin0(pObj) );
112  Value1 = Sat_ObjXValue( Gia_ObjFanin1(pObj) );
113  Value = Gia_XsimAndCond( Value0, Gia_ObjFaninC0(pObj), Value1, Gia_ObjFaninC1(pObj) );
114  Sat_ObjSetXValue( pObj, Value );
115  }
116  Value = Sat_ObjXValue( Gia_ObjFanin0(pRoot) );
117  Value = Gia_XsimNotCond( Value, Gia_ObjFaninC0(pRoot) );
118  if ( Value != GIA_ONE )
119  printf( "Gia_SatVerifyPattern(): Verification FAILED.\n" );
120 // else
121 // printf( "Gia_SatVerifyPattern(): Verification succeeded.\n" );
122 // assert( Value == GIA_ONE );
123  // clean the nodes
124  Gia_ManForEachObjVec( vVisit, p, pObj, i )
125  Sat_ObjSetXValue( pObj, 0 );
126 }
static void Sat_ObjSetXValue(Gia_Obj_t *pObj, int v)
Definition: giaPat.c:31
static int Gia_ObjFaninC1(Gia_Obj_t *pObj)
Definition: gia.h:452
static Gia_Obj_t * Gia_ManCi(Gia_Man_t *p, int v)
Definition: gia.h:403
#define GIA_ZER
Definition: gia.h:747
static int Gia_ObjIsConst0(Gia_Obj_t *pObj)
Definition: gia.h:430
static int Gia_XsimNotCond(int Value, int fCompl)
Definition: gia.h:751
static int Gia_XsimAndCond(int Value0, int fCompl0, int Value1, int fCompl1)
Definition: gia.h:759
Definition: gia.h:75
static int Abc_LitIsCompl(int Lit)
Definition: abc_global.h:265
void Gia_SatCollectCone(Gia_Man_t *p, Gia_Obj_t *pObj, Vec_Int_t *vVisit)
Definition: giaPat.c:73
static Gia_Obj_t * Gia_ObjFanin0(Gia_Obj_t *pObj)
Definition: gia.h:454
static int Gia_ObjIsCo(Gia_Obj_t *pObj)
Definition: gia.h:421
#define Gia_ManForEachObjVec(vVec, p, pObj, i)
Definition: gia.h:988
static int Gia_ObjIsAnd(Gia_Obj_t *pObj)
Definition: gia.h:422
static int Abc_Lit2Var(int Lit)
Definition: abc_global.h:264
static Gia_Obj_t * Gia_ObjFanin1(Gia_Obj_t *pObj)
Definition: gia.h:455
#define assert(ex)
Definition: util_old.h:213
static int Gia_ObjFaninC0(Gia_Obj_t *pObj)
Definition: gia.h:451
static int Gia_ObjIsCi(Gia_Obj_t *pObj)
Definition: gia.h:420
#define Vec_IntForEachEntry(vVec, Entry, i)
MACRO DEFINITIONS ///.
Definition: vecInt.h:54
static ABC_NAMESPACE_IMPL_START int Sat_ObjXValue(Gia_Obj_t *pObj)
DECLARATIONS ///.
Definition: giaPat.c:30
#define GIA_ONE
Definition: gia.h:748
static void Sat_ObjSetXValue ( Gia_Obj_t pObj,
int  v 
)
inlinestatic

Definition at line 31 of file giaPat.c.

31 { pObj->fMark0 = (v & 1); pObj->fMark1 = ((v >> 1) & 1); }
unsigned fMark1
Definition: gia.h:84
unsigned fMark0
Definition: gia.h:79
static ABC_NAMESPACE_IMPL_START int Sat_ObjXValue ( Gia_Obj_t pObj)
inlinestatic

DECLARATIONS ///.

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

FileName [gia.c]

SystemName [ABC: Logic synthesis and verification system.]

PackageName [Scalable AIG package.]

Synopsis []

Author [Alan Mishchenko]

Affiliation [UC Berkeley]

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

Revision [

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

]

Definition at line 30 of file giaPat.c.

30 { return (pObj->fMark1 << 1) | pObj->fMark0; }
unsigned fMark1
Definition: gia.h:84
unsigned fMark0
Definition: gia.h:79