Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
abc
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lvzhengyang
abc
Commits
72f01030
Commit
72f01030
authored
Oct 27, 2013
by
Alan Mishchenko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Getting rid of a recursive procedure during CNF construction in bmc3.
parent
3b30fb2a
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
71 additions
and
8 deletions
+71
-8
src/sat/bmc/bmcBmc3.c
+71
-8
No files found.
src/sat/bmc/bmcBmc3.c
View file @
72f01030
...
@@ -22,6 +22,7 @@
...
@@ -22,6 +22,7 @@
#include "sat/cnf/cnf.h"
#include "sat/cnf/cnf.h"
#include "sat/bsat/satStore.h"
#include "sat/bsat/satStore.h"
#include "misc/vec/vecHsh.h"
#include "misc/vec/vecHsh.h"
#include "misc/vec/vecWec.h"
#include "bmc.h"
#include "bmc.h"
ABC_NAMESPACE_IMPL_START
ABC_NAMESPACE_IMPL_START
...
@@ -40,10 +41,11 @@ struct Gia_ManBmc_t_
...
@@ -40,10 +41,11 @@ struct Gia_ManBmc_t_
// intermediate data
// intermediate data
Vec_Int_t
*
vMapping
;
// mapping
Vec_Int_t
*
vMapping
;
// mapping
Vec_Int_t
*
vMapRefs
;
// mapping references
Vec_Int_t
*
vMapRefs
;
// mapping references
Vec_Vec_t
*
vSects
;
// sections
//
Vec_Vec_t * vSects; // sections
Vec_Int_t
*
vId2Num
;
// number of each node
Vec_Int_t
*
vId2Num
;
// number of each node
Vec_Ptr_t
*
vTerInfo
;
// ternary information
Vec_Ptr_t
*
vTerInfo
;
// ternary information
Vec_Ptr_t
*
vId2Var
;
// SAT vars for each object
Vec_Ptr_t
*
vId2Var
;
// SAT vars for each object
Vec_Wec_t
*
vVisited
;
// visited nodes
abctime
*
pTime4Outs
;
// timeout per output
abctime
*
pTime4Outs
;
// timeout per output
// hash table
// hash table
Vec_Int_t
*
vData
;
// storage for cuts
Vec_Int_t
*
vData
;
// storage for cuts
...
@@ -716,7 +718,7 @@ Gia_ManBmc_t * Saig_Bmc3ManStart( Aig_Man_t * pAig, int nTimeOutOne )
...
@@ -716,7 +718,7 @@ Gia_ManBmc_t * Saig_Bmc3ManStart( Aig_Man_t * pAig, int nTimeOutOne )
p
->
vMapping
=
Cnf_DeriveMappingArray
(
pAig
);
p
->
vMapping
=
Cnf_DeriveMappingArray
(
pAig
);
p
->
vMapRefs
=
Saig_ManBmcComputeMappingRefs
(
pAig
,
p
->
vMapping
);
p
->
vMapRefs
=
Saig_ManBmcComputeMappingRefs
(
pAig
,
p
->
vMapping
);
// create sections
// create sections
p
->
vSects
=
Saig_ManBmcSections
(
pAig
);
//
p->vSects = Saig_ManBmcSections( pAig );
// map object IDs into their numbers and section numbers
// map object IDs into their numbers and section numbers
p
->
nObjNums
=
0
;
p
->
nObjNums
=
0
;
p
->
vId2Num
=
Vec_IntStartFull
(
Aig_ManObjNumMax
(
pAig
)
);
p
->
vId2Num
=
Vec_IntStartFull
(
Aig_ManObjNumMax
(
pAig
)
);
...
@@ -730,6 +732,7 @@ Gia_ManBmc_t * Saig_Bmc3ManStart( Aig_Man_t * pAig, int nTimeOutOne )
...
@@ -730,6 +732,7 @@ Gia_ManBmc_t * Saig_Bmc3ManStart( Aig_Man_t * pAig, int nTimeOutOne )
Vec_IntWriteEntry
(
p
->
vId2Num
,
Aig_ObjId
(
pObj
),
p
->
nObjNums
++
);
Vec_IntWriteEntry
(
p
->
vId2Num
,
Aig_ObjId
(
pObj
),
p
->
nObjNums
++
);
p
->
vId2Var
=
Vec_PtrAlloc
(
100
);
p
->
vId2Var
=
Vec_PtrAlloc
(
100
);
p
->
vTerInfo
=
Vec_PtrAlloc
(
100
);
p
->
vTerInfo
=
Vec_PtrAlloc
(
100
);
p
->
vVisited
=
Vec_WecAlloc
(
100
);
// create solver
// create solver
p
->
nSatVars
=
1
;
p
->
nSatVars
=
1
;
p
->
pSat
=
sat_solver_new
();
p
->
pSat
=
sat_solver_new
();
...
@@ -781,9 +784,10 @@ void Saig_Bmc3ManStop( Gia_ManBmc_t * p )
...
@@ -781,9 +784,10 @@ void Saig_Bmc3ManStop( Gia_ManBmc_t * p )
p
->
vCexes
=
NULL
;
p
->
vCexes
=
NULL
;
}
}
// Vec_PtrFreeFree( p->vCexes );
// Vec_PtrFreeFree( p->vCexes );
Vec_WecFree
(
p
->
vVisited
);
Vec_IntFree
(
p
->
vMapping
);
Vec_IntFree
(
p
->
vMapping
);
Vec_IntFree
(
p
->
vMapRefs
);
Vec_IntFree
(
p
->
vMapRefs
);
Vec_VecFree
(
p
->
vSects
);
//
Vec_VecFree( p->vSects );
Vec_IntFree
(
p
->
vId2Num
);
Vec_IntFree
(
p
->
vId2Num
);
Vec_VecFree
(
(
Vec_Vec_t
*
)
p
->
vId2Var
);
Vec_VecFree
(
(
Vec_Vec_t
*
)
p
->
vId2Var
);
Vec_PtrFreeFree
(
p
->
vTerInfo
);
Vec_PtrFreeFree
(
p
->
vTerInfo
);
...
@@ -1072,6 +1076,46 @@ int Saig_ManBmcCreateCnf_rec( Gia_ManBmc_t * p, Aig_Obj_t * pObj, int iFrame )
...
@@ -1072,6 +1076,46 @@ int Saig_ManBmcCreateCnf_rec( Gia_ManBmc_t * p, Aig_Obj_t * pObj, int iFrame )
/**Function*************************************************************
/**Function*************************************************************
Synopsis [Derives CNF for one node.]
Description []
SideEffects []
SeeAlso []
***********************************************************************/
void
Saig_ManBmcCreateCnf_iter
(
Gia_ManBmc_t
*
p
,
Aig_Obj_t
*
pObj
,
int
iFrame
,
Vec_Int_t
*
vVisit
)
{
if
(
Saig_ManBmcLiteral
(
p
,
pObj
,
iFrame
)
!=
~
0
)
return
;
if
(
Aig_ObjIsTravIdCurrent
(
p
->
pAig
,
pObj
)
)
return
;
Aig_ObjSetTravIdCurrent
(
p
->
pAig
,
pObj
);
if
(
Aig_ObjIsCi
(
pObj
)
)
{
if
(
Saig_ObjIsLo
(
p
->
pAig
,
pObj
)
)
Vec_IntPush
(
vVisit
,
Saig_ObjLoToLi
(
p
->
pAig
,
pObj
)
->
Id
);
return
;
}
if
(
Aig_ObjIsCo
(
pObj
)
)
{
Saig_ManBmcCreateCnf_iter
(
p
,
Aig_ObjFanin0
(
pObj
),
iFrame
,
vVisit
);
return
;
}
else
{
int
*
pMapping
,
i
;
assert
(
Aig_ObjIsNode
(
pObj
)
);
pMapping
=
Saig_ManBmcMapping
(
p
,
pObj
);
for
(
i
=
0
;
i
<
4
;
i
++
)
if
(
pMapping
[
i
+
1
]
!=
-
1
)
Saig_ManBmcCreateCnf_iter
(
p
,
Aig_ManObj
(
p
->
pAig
,
pMapping
[
i
+
1
]),
iFrame
,
vVisit
);
}
}
/**Function*************************************************************
Synopsis [Recursively performs terminary simulation.]
Synopsis [Recursively performs terminary simulation.]
Description []
Description []
...
@@ -1158,13 +1202,32 @@ int Saig_ManBmcRunTerSim_rec( Gia_ManBmc_t * p, Aig_Obj_t * pObj, int iFrame )
...
@@ -1158,13 +1202,32 @@ int Saig_ManBmcRunTerSim_rec( Gia_ManBmc_t * p, Aig_Obj_t * pObj, int iFrame )
***********************************************************************/
***********************************************************************/
int
Saig_ManBmcCreateCnf
(
Gia_ManBmc_t
*
p
,
Aig_Obj_t
*
pObj
,
int
iFrame
)
int
Saig_ManBmcCreateCnf
(
Gia_ManBmc_t
*
p
,
Aig_Obj_t
*
pObj
,
int
iFrame
)
{
{
int
Lit
;
Vec_Int_t
*
vVisit
,
*
vVisit2
;
// perform terminary simulation
Aig_Obj_t
*
pTemp
;
int
Lit
,
f
,
i
;
// perform ternary simulation
int
Value
=
Saig_ManBmcRunTerSim_rec
(
p
,
pObj
,
iFrame
);
int
Value
=
Saig_ManBmcRunTerSim_rec
(
p
,
pObj
,
iFrame
);
if
(
Value
!=
SAIG_TER_UND
)
if
(
Value
!=
SAIG_TER_UND
)
return
(
int
)(
Value
==
SAIG_TER_ONE
);
return
(
int
)(
Value
==
SAIG_TER_ONE
);
// construct CNF if value is ternary
// construct CNF if value is ternary
Lit
=
Saig_ManBmcCreateCnf_rec
(
p
,
pObj
,
iFrame
);
// Lit = Saig_ManBmcCreateCnf_rec( p, pObj, iFrame );
Vec_WecClear
(
p
->
vVisited
);
vVisit
=
Vec_WecPushLevel
(
p
->
vVisited
);
Vec_IntPush
(
vVisit
,
Aig_ObjId
(
pObj
)
);
for
(
f
=
iFrame
;
f
>=
0
;
f
--
)
{
Aig_ManIncrementTravId
(
p
->
pAig
);
vVisit2
=
Vec_WecPushLevel
(
p
->
vVisited
);
vVisit
=
Vec_WecEntry
(
p
->
vVisited
,
Vec_WecSize
(
p
->
vVisited
)
-
2
);
Aig_ManForEachObjVec
(
vVisit
,
p
->
pAig
,
pTemp
,
i
)
Saig_ManBmcCreateCnf_iter
(
p
,
pTemp
,
f
,
vVisit2
);
if
(
Vec_IntSize
(
vVisit2
)
==
0
)
break
;
}
Vec_WecForEachLevelReverse
(
p
->
vVisited
,
vVisit
,
f
)
Aig_ManForEachObjVec
(
vVisit
,
p
->
pAig
,
pTemp
,
i
)
Saig_ManBmcCreateCnf_rec
(
p
,
pTemp
,
iFrame
-
f
);
Lit
=
Saig_ManBmcLiteral
(
p
,
pObj
,
iFrame
);
// extend the SAT solver
// extend the SAT solver
if
(
p
->
nSatVars
>
sat_solver_nvars
(
p
->
pSat
)
)
if
(
p
->
nSatVars
>
sat_solver_nvars
(
p
->
pSat
)
)
sat_solver_setnvars
(
p
->
pSat
,
p
->
nSatVars
);
sat_solver_setnvars
(
p
->
pSat
,
p
->
nSatVars
);
...
@@ -1325,9 +1388,9 @@ int Saig_ManBmcScalable( Aig_Man_t * pAig, Saig_ParBmc_t * pPars )
...
@@ -1325,9 +1388,9 @@ int Saig_ManBmcScalable( Aig_Man_t * pAig, Saig_ParBmc_t * pPars )
p
->
vCexes
=
Vec_PtrStart
(
Saig_ManPoNum
(
pAig
)
);
p
->
vCexes
=
Vec_PtrStart
(
Saig_ManPoNum
(
pAig
)
);
if
(
pPars
->
fVerbose
)
if
(
pPars
->
fVerbose
)
{
{
Abc_Print
(
1
,
"Running
\"
bmc3
\"
. PI/PO/Reg = %d/%d/%d. And =%7d. Lev =%6d. ObjNums =%6d. Sect =%3d.
\n
"
,
Abc_Print
(
1
,
"Running
\"
bmc3
\"
. PI/PO/Reg = %d/%d/%d. And =%7d. Lev =%6d. ObjNums =%6d.
\n
"
,
//
Sect =%3d.\n",
Saig_ManPiNum
(
pAig
),
Saig_ManPoNum
(
pAig
),
Saig_ManRegNum
(
pAig
),
Saig_ManPiNum
(
pAig
),
Saig_ManPoNum
(
pAig
),
Saig_ManRegNum
(
pAig
),
Aig_ManNodeNum
(
pAig
),
Aig_ManLevelNum
(
pAig
),
p
->
nObjNums
,
Vec_VecSize
(
p
->
vSects
)
);
Aig_ManNodeNum
(
pAig
),
Aig_ManLevelNum
(
pAig
),
p
->
nObjNums
);
//
, Vec_VecSize(p->vSects) );
Abc_Print
(
1
,
"Params: FramesMax = %d. Start = %d. ConfLimit = %d. TimeOut = %d. SolveAll = %d.
\n
"
,
Abc_Print
(
1
,
"Params: FramesMax = %d. Start = %d. ConfLimit = %d. TimeOut = %d. SolveAll = %d.
\n
"
,
pPars
->
nFramesMax
,
pPars
->
nStart
,
pPars
->
nConfLimit
,
pPars
->
nTimeOut
,
pPars
->
fSolveAll
);
pPars
->
nFramesMax
,
pPars
->
nStart
,
pPars
->
nConfLimit
,
pPars
->
nTimeOut
,
pPars
->
fSolveAll
);
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment