ABC: A System for Sequential Synthesis and Verification
 
Loading...
Searching...
No Matches
bmcLoad.c File Reference
#include "bmc.h"
#include "sat/bsat/satStore.h"
Include dependency graph for bmcLoad.c:

Go to the source code of this file.

Classes

struct  Bmc_Load_t_
 

Typedefs

typedef typedefABC_NAMESPACE_IMPL_START struct Bmc_Load_t_ Bmc_Load_t
 DECLARATIONS ///.
 

Functions

int Bmc_LoadGetSatVar (Bmc_Load_t *p, int Id)
 FUNCTION DEFINITIONS ///.
 
int Bmc_LoadAddCnf (void *pMan, int iLit)
 
int Bmc_LoadAddCnf_rec (Bmc_Load_t *p, int Id)
 
Bmc_Load_tBmc_LoadStart (Gia_Man_t *pGia)
 
void Bmc_LoadStop (Bmc_Load_t *p)
 
void Bmc_LoadTest (Gia_Man_t *pGia, int fLoadCnf, int fVerbose)
 

Typedef Documentation

◆ Bmc_Load_t

typedef typedefABC_NAMESPACE_IMPL_START struct Bmc_Load_t_ Bmc_Load_t

DECLARATIONS ///.

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

FileName [bmcLoad.c]

SystemName [ABC: Logic synthesis and verification system.]

PackageName [SAT-based bounded model checking.]

Synopsis [Experiments with CNF loading.]

Author [Alan Mishchenko]

Affiliation [UC Berkeley]

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

Revision [

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

]

Definition at line 31 of file bmcLoad.c.

Function Documentation

◆ Bmc_LoadAddCnf()

int Bmc_LoadAddCnf ( void * pMan,
int iLit )

Definition at line 71 of file bmcLoad.c.

72{
73 Bmc_Load_t * p = (Bmc_Load_t *)pMan;
74 int Lits[3], iVar = Abc_Lit2Var(iLit);
75 Gia_Obj_t * pObj = Gia_ManObj( p->pGia, Vec_IntEntry(p->vSat2Id, iVar) );
76 p->nCallBacks1++;
77 if ( Gia_ObjIsCi(pObj) || Gia_ObjIsConst0(pObj) )
78 return 0;
79 assert( Gia_ObjIsAnd(pObj) );
80 if ( (Abc_LitIsCompl(iLit) ? pObj->fMark1 : pObj->fMark0) )
81 return 0;
82 Lits[0] = Abc_LitNot(iLit);
83 if ( Abc_LitIsCompl(iLit) )
84 {
85 Lits[1] = Abc_Var2Lit( Bmc_LoadGetSatVar(p, Gia_ObjFaninId0p(p->pGia, pObj)), !Gia_ObjFaninC0(pObj) );
86 Lits[2] = Abc_Var2Lit( Bmc_LoadGetSatVar(p, Gia_ObjFaninId1p(p->pGia, pObj)), !Gia_ObjFaninC1(pObj) );
87 sat_solver_clause_new( p->pSat, Lits, Lits + 3, 0 );
88 pObj->fMark1 = 1;
89 }
90 else
91 {
92 Lits[1] = Abc_Var2Lit( Bmc_LoadGetSatVar(p, Gia_ObjFaninId0p(p->pGia, pObj)), Gia_ObjFaninC0(pObj) );
93 sat_solver_clause_new( p->pSat, Lits, Lits + 2, 0 );
94 Lits[1] = Abc_Var2Lit( Bmc_LoadGetSatVar(p, Gia_ObjFaninId1p(p->pGia, pObj)), Gia_ObjFaninC1(pObj) );
95 sat_solver_clause_new( p->pSat, Lits, Lits + 2, 0 );
96 pObj->fMark0 = 1;
97 }
98 p->nCallBacks2++;
99 return 1;
100}
int Bmc_LoadGetSatVar(Bmc_Load_t *p, int Id)
FUNCTION DEFINITIONS ///.
Definition bmcLoad.c:60
typedefABC_NAMESPACE_IMPL_START struct Bmc_Load_t_ Bmc_Load_t
DECLARATIONS ///.
Definition bmcLoad.c:31
Cube * p
Definition exorList.c:222
struct Gia_Obj_t_ Gia_Obj_t
Definition gia.h:76
int sat_solver_clause_new(sat_solver *s, lit *begin, lit *end, int learnt)
Definition satSolver.c:533
unsigned fMark1
Definition gia.h:86
unsigned fMark0
Definition gia.h:81
#define assert(ex)
Definition util_old.h:213
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Bmc_LoadAddCnf_rec()

int Bmc_LoadAddCnf_rec ( Bmc_Load_t * p,
int Id )

Definition at line 101 of file bmcLoad.c.

102{
103 int iVar = Bmc_LoadGetSatVar( p, Id );
104 Gia_Obj_t * pObj = Gia_ManObj( p->pGia, Id );
105 if ( Gia_ObjIsAnd(pObj) && !(pObj->fMark0 && pObj->fMark1) )
106 {
107 Bmc_LoadAddCnf( p, Abc_Var2Lit(iVar, 0) );
108 Bmc_LoadAddCnf( p, Abc_Var2Lit(iVar, 1) );
109 Bmc_LoadAddCnf_rec( p, Gia_ObjFaninId0(pObj, Id) );
110 Bmc_LoadAddCnf_rec( p, Gia_ObjFaninId1(pObj, Id) );
111 }
112 return iVar;
113}
int Bmc_LoadAddCnf(void *pMan, int iLit)
Definition bmcLoad.c:71
int Bmc_LoadAddCnf_rec(Bmc_Load_t *p, int Id)
Definition bmcLoad.c:101
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Bmc_LoadGetSatVar()

int Bmc_LoadGetSatVar ( Bmc_Load_t * p,
int Id )

FUNCTION DEFINITIONS ///.

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

Synopsis [Load CNF for the cone.]

Description []

SideEffects []

SeeAlso []

Definition at line 60 of file bmcLoad.c.

61{
62 Gia_Obj_t * pObj = Gia_ManObj( p->pGia, Id );
63 if ( pObj->Value == 0 )
64 {
65 pObj->Value = Vec_IntSize( p->vSat2Id );
66 Vec_IntPush( p->vSat2Id, Id );
67 sat_solver_setnvars( p->pSat, Vec_IntSize(p->vSat2Id) );
68 }
69 return pObj->Value;
70}
void sat_solver_setnvars(sat_solver *s, int n)
Definition satSolver.c:1272
unsigned Value
Definition gia.h:89
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Bmc_LoadStart()

Bmc_Load_t * Bmc_LoadStart ( Gia_Man_t * pGia)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 126 of file bmcLoad.c.

127{
128 Bmc_Load_t * p;
129 int Lit;
130 Gia_ManSetPhase( pGia );
131 Gia_ManCleanValue( pGia );
132 Gia_ManCreateRefs( pGia );
133 p = ABC_CALLOC( Bmc_Load_t, 1 );
134 p->pGia = pGia;
135 p->pSat = sat_solver_new();
136 p->vSat2Id = Vec_IntAlloc( 1000 );
137 Vec_IntPush( p->vSat2Id, 0 );
138 // create constant node
139 Lit = Abc_Var2Lit( Bmc_LoadGetSatVar(p, 0), 1 );
140 sat_solver_addclause( p->pSat, &Lit, &Lit + 1 );
141 return p;
142}
#define ABC_CALLOC(type, num)
Definition abc_global.h:265
#define sat_solver_addclause
Definition cecSatG2.c:37
void Gia_ManCleanValue(Gia_Man_t *p)
Definition giaUtil.c:351
void Gia_ManCreateRefs(Gia_Man_t *p)
Definition giaUtil.c:779
void Gia_ManSetPhase(Gia_Man_t *p)
Definition giaUtil.c:420
sat_solver * sat_solver_new(void)
Definition satSolver.c:1137
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Bmc_LoadStop()

void Bmc_LoadStop ( Bmc_Load_t * p)

Definition at line 143 of file bmcLoad.c.

144{
145 Vec_IntFree( p->vSat2Id );
146 sat_solver_delete( p->pSat );
147 ABC_FREE( p );
148}
#define ABC_FREE(obj)
Definition abc_global.h:267
void sat_solver_delete(sat_solver *s)
Definition satSolver.c:1341
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Bmc_LoadTest()

void Bmc_LoadTest ( Gia_Man_t * pGia,
int fLoadCnf,
int fVerbose )

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 161 of file bmcLoad.c.

162{
163 int nConfLimit = 0;
164 Bmc_Load_t * p;
165 Gia_Obj_t * pObj;
166 int i, status, Lit;
167 abctime clk = Abc_Clock();
168 // create the loading manager
169 p = Bmc_LoadStart( pGia );
170 // add callback for CNF loading
171 if ( fLoadCnf )
172 {
173 p->pSat->pCnfMan = p;
174 p->pSat->pCnfFunc = Bmc_LoadAddCnf;
175 }
176 // solve SAT problem for each PO
177 Gia_ManForEachPo( pGia, pObj, i )
178 {
179 if ( fLoadCnf )
180 Lit = Abc_Var2Lit( Bmc_LoadGetSatVar(p, Gia_ObjFaninId0p(pGia, pObj)), Gia_ObjFaninC0(pObj) );
181 else
182 Lit = Abc_Var2Lit( Bmc_LoadAddCnf_rec(p, Gia_ObjFaninId0p(pGia, pObj)), Gia_ObjFaninC0(pObj) );
183 if ( fVerbose )
184 {
185 printf( "Frame%4d : ", i );
186 printf( "Vars = %6d ", Vec_IntSize(p->vSat2Id) );
187 printf( "Clas = %6d ", sat_solver_nclauses(p->pSat) );
188 }
189 status = sat_solver_solve( p->pSat, &Lit, &Lit + 1, (ABC_INT64_T)nConfLimit, (ABC_INT64_T)0, (ABC_INT64_T)0, (ABC_INT64_T)0 );
190 if ( fVerbose )
191 {
192 printf( "Conf = %6d ", sat_solver_nconflicts(p->pSat) );
193 if ( status == l_False )
194 printf( "UNSAT " );
195 else if ( status == l_True )
196 printf( "SAT " );
197 else // if ( status == l_Undec )
198 printf( "UNDEC " );
199 Abc_PrintTime( 1, "Time", Abc_Clock() - clk );
200 }
201 }
202 printf( "Callbacks = %d. Loadings = %d.\n", p->nCallBacks1, p->nCallBacks2 );
203 Bmc_LoadStop( p );
204}
ABC_INT64_T abctime
Definition abc_global.h:332
#define l_True
Definition bmcBmcS.c:35
#define l_False
Definition bmcBmcS.c:36
Bmc_Load_t * Bmc_LoadStart(Gia_Man_t *pGia)
Definition bmcLoad.c:126
void Bmc_LoadStop(Bmc_Load_t *p)
Definition bmcLoad.c:143
#define sat_solver_solve
Definition cecSatG2.c:45
#define Gia_ManForEachPo(p, pObj, i)
Definition gia.h:1250
int sat_solver_nconflicts(sat_solver *s)
Definition satSolver.c:2381
int sat_solver_nclauses(sat_solver *s)
Definition satSolver.c:2375
Here is the call graph for this function: