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
719b06f9
Commit
719b06f9
authored
Jan 20, 2012
by
Alan Mishchenko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Variable timeframe abstraction.
parent
b9163754
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
49 additions
and
35 deletions
+49
-35
src/aig/gia/giaAbsVta.c
+0
-0
src/aig/gia/giaFrames.c
+5
-4
src/aig/gia/giaMan.c
+6
-2
src/sat/bsat/satProof.c
+17
-12
src/sat/bsat/satSolver.h
+3
-3
src/sat/bsat/satSolver2.c
+15
-11
src/sat/bsat/satSolver2.h
+3
-3
No files found.
src/aig/gia/giaAbsVta.c
View file @
719b06f9
This diff is collapsed.
Click to expand it.
src/aig/gia/giaFrames.c
View file @
719b06f9
...
...
@@ -189,11 +189,12 @@ Vec_Ptr_t * Gia_ManUnrollAbs( Gia_Man_t * p, int nFrames )
iStop
=
(
f
+
1
<
Vec_IntSize
(
vLimit
))
?
Vec_IntEntry
(
vLimit
,
f
+
1
)
:
0
;
for
(
k
=
iStop
-
1
;
k
>=
iStart
;
k
--
)
{
pObj
=
Gia_ManObj
(
pNew
,
k
);
if
(
Gia_ObjIsCo
(
pObj
)
)
assert
(
Gia_ManObj
(
pNew
,
k
)
->
Value
>
0
);
pObj
=
Gia_ManObj
(
p
,
Gia_ManObj
(
pNew
,
k
)
->
Value
);
if
(
Gia_ObjIsCo
(
pObj
)
||
Gia_ObjIsPi
(
p
,
pObj
)
)
continue
;
assert
(
Gia_ObjIs
Ci
(
pObj
)
||
Gia_ObjIsAnd
(
pObj
)
);
Entry
=
((
fMax
-
f
)
<<
nObjBits
)
|
pObj
->
Value
;
assert
(
Gia_ObjIs
Ro
(
p
,
pObj
)
||
Gia_ObjIsAnd
(
pObj
)
);
Entry
=
((
fMax
-
f
)
<<
nObjBits
)
|
Gia_ObjId
(
p
,
pObj
)
;
Vec_IntPush
(
vOne
,
Entry
);
// printf( "%d ", Gia_ManObj(pNew, k)->Value );
}
...
...
src/aig/gia/giaMan.c
View file @
719b06f9
...
...
@@ -277,6 +277,7 @@ void Gia_ManPrintObjClasses( Gia_Man_t * p )
nObjMask
=
(
1
<<
nObjBits
)
-
1
;
assert
(
Gia_ManObjNum
(
p
)
<=
nObjMask
);
// print info about frames
printf
(
"Frame All F0 F1 F2 F3 ...
\n
"
);
for
(
i
=
0
;
i
<
nFrames
;
i
++
)
{
iStart
=
Vec_IntEntry
(
vAbs
,
i
+
1
);
...
...
@@ -298,10 +299,13 @@ void Gia_ManPrintObjClasses( Gia_Man_t * p )
pCountAll
[
0
]
++
;
}
assert
(
pCountAll
[
0
]
==
(
unsigned
)(
iStop
-
iStart
)
);
printf
(
"%5d%5d "
,
pCountAll
[
0
],
pCountUni
[
0
]
);
// printf( "%5d%5d ", pCountAll[0], pCountUni[0] );
printf
(
"%3d :"
,
i
);
printf
(
"%6d"
,
pCountAll
[
0
]
);
for
(
k
=
0
;
k
<
nFrames
;
k
++
)
if
(
k
<=
i
)
printf
(
"%5d%5d "
,
pCountAll
[
k
+
1
],
pCountUni
[
k
+
1
]
);
// printf( "%5d%5d ", pCountAll[k+1], pCountUni[k+1] );
printf
(
"%4d"
,
pCountAll
[
k
+
1
]
);
printf
(
"
\n
"
);
}
assert
(
iStop
==
Vec_IntSize
(
vAbs
)
);
...
...
src/sat/bsat/satProof.c
View file @
719b06f9
...
...
@@ -443,12 +443,13 @@ void Sat_ProofCheck( sat_solver2 * s )
{
Vec_Int_t
*
vClauses
=
(
Vec_Int_t
*
)
&
s
->
clauses
;
Vec_Int_t
*
vProof
=
(
Vec_Int_t
*
)
&
s
->
proofs
;
int
hRoot
=
veci_begin
(
&
s
->
claProofs
)[
satset_read
(
&
s
->
learnts
,
s
->
hLearntLast
>>
1
)
->
Id
];
Vec_Rec_t
*
vResolves
;
Vec_Int_t
*
vUsed
,
*
vTemp
;
satset
*
pSet
,
*
pSet0
,
*
pSet1
;
int
i
,
k
,
Handle
,
Counter
=
0
,
clk
=
clock
();
int
i
,
k
,
hRoot
,
Handle
,
Counter
=
0
,
clk
=
clock
();
if
(
s
->
hLearntLast
<
0
)
return
;
hRoot
=
veci_begin
(
&
s
->
claProofs
)[
satset_read
(
&
s
->
learnts
,
s
->
hLearntLast
>>
1
)
->
Id
];
// collect visited clauses
vUsed
=
Proof_CollectUsedIter
(
vProof
,
NULL
,
hRoot
);
Proof_CleanCollected
(
vProof
,
vUsed
);
...
...
@@ -509,7 +510,7 @@ Vec_Int_t * Sat_ProofCollectCore( Vec_Int_t * vClauses, Vec_Int_t * vProof, Vec_
if
(
pFanin
&&
!
pFanin
->
mark
)
{
pFanin
->
mark
=
1
;
Vec_IntPush
(
vCore
,
pNode
->
pEnts
[
i
]
>>
2
);
Vec_IntPush
(
vCore
,
pNode
->
pEnts
[
k
]
>>
2
);
}
}
// clean core clauses and reexpress core in terms of clause IDs
...
...
@@ -586,13 +587,14 @@ void * Sat_ProofInterpolant( sat_solver2 * s, void * pGloVars )
Vec_Int_t
*
vClauses
=
(
Vec_Int_t
*
)
&
s
->
clauses
;
Vec_Int_t
*
vProof
=
(
Vec_Int_t
*
)
&
s
->
proofs
;
Vec_Int_t
*
vGlobVars
=
(
Vec_Int_t
*
)
pGloVars
;
int
hRoot
=
veci_begin
(
&
s
->
claProofs
)[
satset_read
(
&
s
->
learnts
,
s
->
hLearntLast
>>
1
)
->
Id
];
Vec_Int_t
*
vUsed
,
*
vCore
,
*
vCoreNums
,
*
vVarMap
;
satset
*
pNode
,
*
pFanin
;
Aig_Man_t
*
pAig
;
Aig_Obj_t
*
pObj
;
int
i
,
k
,
iVar
,
Lit
,
Entry
;
int
i
,
k
,
iVar
,
Lit
,
Entry
,
hRoot
;
if
(
s
->
hLearntLast
<
0
)
return
NULL
;
hRoot
=
veci_begin
(
&
s
->
claProofs
)[
satset_read
(
&
s
->
learnts
,
s
->
hLearntLast
>>
1
)
->
Id
];
Sat_ProofInterpolantCheckVars
(
s
,
vGlobVars
);
...
...
@@ -683,16 +685,17 @@ word * Sat_ProofInterpolantTruth( sat_solver2 * s, void * pGloVars )
Vec_Int_t
*
vClauses
=
(
Vec_Int_t
*
)
&
s
->
clauses
;
Vec_Int_t
*
vProof
=
(
Vec_Int_t
*
)
&
s
->
proofs
;
Vec_Int_t
*
vGlobVars
=
(
Vec_Int_t
*
)
pGloVars
;
int
hRoot
=
veci_begin
(
&
s
->
claProofs
)[
satset_read
(
&
s
->
learnts
,
s
->
hLearntLast
>>
1
)
->
Id
];
Vec_Int_t
*
vUsed
,
*
vCore
,
*
vCoreNums
,
*
vVarMap
;
satset
*
pNode
,
*
pFanin
;
Tru_Man_t
*
pTru
;
int
nVars
=
Vec_IntSize
(
vGlobVars
);
int
nWords
=
(
nVars
<
6
)
?
1
:
(
1
<<
(
nVars
-
6
));
word
*
pRes
=
ABC_ALLOC
(
word
,
nWords
);
int
i
,
k
,
iVar
,
Lit
,
Entry
;
int
i
,
k
,
iVar
,
Lit
,
Entry
,
hRoot
;
assert
(
nVars
>
0
&&
nVars
<=
16
);
if
(
s
->
hLearntLast
<
0
)
return
NULL
;
hRoot
=
veci_begin
(
&
s
->
claProofs
)[
satset_read
(
&
s
->
learnts
,
s
->
hLearntLast
>>
1
)
->
Id
];
Sat_ProofInterpolantCheckVars
(
s
,
vGlobVars
);
...
...
@@ -789,9 +792,11 @@ void * Sat_ProofCore( sat_solver2 * s )
{
Vec_Int_t
*
vClauses
=
(
Vec_Int_t
*
)
&
s
->
clauses
;
Vec_Int_t
*
vProof
=
(
Vec_Int_t
*
)
&
s
->
proofs
;
int
hRoot
=
veci_begin
(
&
s
->
claProofs
)[
satset_read
(
&
s
->
learnts
,
s
->
hLearntLast
>>
1
)
->
Id
];
Vec_Int_t
*
vCore
,
*
vUsed
;
int
hRoot
;
if
(
s
->
hLearntLast
<
0
)
return
NULL
;
hRoot
=
veci_begin
(
&
s
->
claProofs
)[
satset_read
(
&
s
->
learnts
,
s
->
hLearntLast
>>
1
)
->
Id
];
// collect visited clauses
vUsed
=
Proof_CollectUsedIter
(
vProof
,
NULL
,
hRoot
);
// collect core clauses
...
...
src/sat/bsat/satSolver.h
View file @
719b06f9
...
...
@@ -292,19 +292,19 @@ static inline int sat_solver_add_xor( sat_solver * pSat, int iVarA, int iVarB, i
assert
(
Cid
);
return
4
;
}
static
inline
int
sat_solver_add_constraint
(
sat_solver
*
pSat
,
int
iVar
,
int
fCompl
)
static
inline
int
sat_solver_add_constraint
(
sat_solver
*
pSat
,
int
iVar
,
int
iVar2
,
int
fCompl
)
{
lit
Lits
[
2
];
int
Cid
;
assert
(
iVar
>=
0
);
Lits
[
0
]
=
toLitCond
(
iVar
,
fCompl
);
Lits
[
1
]
=
toLitCond
(
iVar
+
1
,
0
);
Lits
[
1
]
=
toLitCond
(
iVar
2
,
0
);
Cid
=
sat_solver_addclause
(
pSat
,
Lits
,
Lits
+
2
);
assert
(
Cid
);
Lits
[
0
]
=
toLitCond
(
iVar
,
fCompl
);
Lits
[
1
]
=
toLitCond
(
iVar
+
1
,
1
);
Lits
[
1
]
=
toLitCond
(
iVar
2
,
1
);
Cid
=
sat_solver_addclause
(
pSat
,
Lits
,
Lits
+
2
);
assert
(
Cid
);
return
2
;
...
...
src/sat/bsat/satSolver2.c
View file @
719b06f9
...
...
@@ -150,7 +150,8 @@ static inline int clause_is_used(sat_solver2* s, cla h) { return (h & 1
static
inline
int
var_reason
(
sat_solver2
*
s
,
int
v
)
{
return
s
->
reasons
[
v
];
}
static
inline
int
lit_reason
(
sat_solver2
*
s
,
int
l
)
{
return
s
->
reasons
[
lit_var
(
l
)];
}
static
inline
satset
*
var_unit_clause
(
sat_solver2
*
s
,
int
v
)
{
return
clause_read
(
s
,
s
->
units
[
v
]);
}
static
inline
void
var_set_unit_clause
(
sat_solver2
*
s
,
int
v
,
cla
i
){
assert
(
v
>=
0
&&
v
<
s
->
size
&&
!
s
->
units
[
v
]);
s
->
units
[
v
]
=
i
;
s
->
nUnits
++
;
}
//static inline void var_set_unit_clause(sat_solver2* s, int v, cla i){ assert(v >= 0 && v < s->size && !s->units[v]); s->units[v] = i; s->nUnits++; }
static
inline
void
var_set_unit_clause
(
sat_solver2
*
s
,
int
v
,
cla
i
){
assert
(
v
>=
0
&&
v
<
s
->
size
);
s
->
units
[
v
]
=
i
;
s
->
nUnits
++
;
}
// these two only work after creating a clause before the solver is called
int
clause_is_partA
(
sat_solver2
*
s
,
int
h
)
{
return
clause_read
(
s
,
h
)
->
partA
;
}
...
...
@@ -1102,7 +1103,8 @@ static lbool solver2_search(sat_solver2* s, ABC_INT64_T nof_conflicts)
if
(
solver2_dlevel
(
s
)
<=
s
->
root_level
){
#ifdef SAT_USE_ANALYZE_FINAL
proof_id
=
solver2_analyze_final
(
s
,
confl
,
0
);
if
(
proof_id
>
0
)
assert
(
proof_id
>
0
);
// if ( proof_id > 0 )
solver2_record
(
s
,
&
s
->
conf_final
,
proof_id
);
#endif
veci_delete
(
&
learnt_clause
);
...
...
@@ -1307,11 +1309,11 @@ void sat_solver2_setnvars(sat_solver2* s,int n)
void
sat_solver2_delete
(
sat_solver2
*
s
)
{
veci
*
pCore
;
//
veci * pCore;
// report statistics
printf
(
"Used %6.2f Mb for proof-logging. Unit clauses = %d.
\n
"
,
2
.
0
*
veci_size
(
&
s
->
proofs
)
/
(
1
<<
20
),
s
->
nUnits
);
/*
pCore = Sat_ProofCore( s );
printf( "UNSAT core contains %d clauses (%6.2f %%).\n", veci_size(pCore), 100.0*veci_size(pCore)/veci_size(&s->clauses) );
veci_delete( pCore );
...
...
@@ -1319,7 +1321,7 @@ void sat_solver2_delete(sat_solver2* s)
if ( s->fProofLogging )
Sat_ProofCheck( s );
*/
// delete vectors
veci_delete
(
&
s
->
order
);
veci_delete
(
&
s
->
trail_lim
);
...
...
@@ -1392,7 +1394,7 @@ int sat_solver2_addclause__(sat_solver2* s, lit* begin, lit* end)
// delete duplicates
last
=
lit_Undef
;
for
(
i
=
j
=
begin
;
i
<
end
;
i
++
){
//printf("lit: "L_LIT", value = %d\n", L_lit(*i), (lit_sign(*i) ? -va
lues[lit_var(*i)] : values[lit_var(*i)]
));
//printf("lit: "L_LIT", value = %d\n", L_lit(*i), (lit_sign(*i) ? -va
r_value(s, lit_var(*i)) : var_value(s, lit_var(*i))
));
if
(
*
i
==
lit_neg
(
last
)
||
var_value
(
s
,
lit_var
(
*
i
))
==
lit_sign
(
*
i
))
return
true
;
// tautology
else
if
(
*
i
!=
last
&&
var_value
(
s
,
lit_var
(
*
i
))
==
varX
)
...
...
@@ -1635,8 +1637,8 @@ int sat_solver2_solve(sat_solver2* s, lit* begin, lit* end, ABC_INT64_T nConfLim
ABC_INT64_T
nof_conflicts
;
ABC_INT64_T
nof_learnts
=
sat_solver2_nclauses
(
s
)
/
3
;
lbool
status
=
l_Undef
;
// lbool* values = s->assigns
;
lit
*
i
;
int
proof_id
;
lit
*
i
;
s
->
hLearntLast
=
-
1
;
...
...
@@ -1659,7 +1661,6 @@ int sat_solver2_solve(sat_solver2* s, lit* begin, lit* end, ABC_INT64_T nConfLim
//printf("solve: "); printlits(begin, end); printf("\n");
for
(
i
=
begin
;
i
<
end
;
i
++
){
// switch (lit_sign(*i) ? -values[lit_var(*i)] : values[lit_var(*i)]){
switch
(
var_value
(
s
,
*
i
))
{
case
var1
:
// l_True:
break
;
...
...
@@ -1723,17 +1724,19 @@ int sat_solver2_solve(sat_solver2* s, lit* begin, lit* end, ABC_INT64_T nConfLim
if
(
r
!=
NULL
)
{
satset
*
confl
=
r
;
solver2_analyze_final
(
s
,
confl
,
1
);
proof_id
=
solver2_analyze_final
(
s
,
confl
,
1
);
veci_push
(
&
s
->
conf_final
,
lit_neg
(
p
));
}
else
{
proof_id
=
-
1
;
// the only case when ProofId is not assigned (conflicting assumptions)
veci_resize
(
&
s
->
conf_final
,
0
);
veci_push
(
&
s
->
conf_final
,
lit_neg
(
p
));
// the two lines below are a bug fix by Siert Wieringa
if
(
var_level
(
s
,
lit_var
(
p
))
>
0
)
veci_push
(
&
s
->
conf_final
,
p
);
}
solver2_record
(
s
,
&
s
->
conf_final
,
proof_id
);
solver2_canceluntil
(
s
,
0
);
return
l_False
;
}
...
...
@@ -1741,9 +1744,10 @@ int sat_solver2_solve(sat_solver2* s, lit* begin, lit* end, ABC_INT64_T nConfLim
{
satset
*
confl
=
solver2_propagate
(
s
);
if
(
confl
!=
NULL
){
solver2_analyze_final
(
s
,
confl
,
0
);
proof_id
=
solver2_analyze_final
(
s
,
confl
,
0
);
assert
(
s
->
conf_final
.
size
>
0
);
solver2_canceluntil
(
s
,
0
);
solver2_record
(
s
,
&
s
->
conf_final
,
proof_id
);
return
l_False
;
}
}
...
...
src/sat/bsat/satSolver2.h
View file @
719b06f9
...
...
@@ -355,20 +355,20 @@ static inline int sat_solver2_add_xor( sat_solver2 * pSat, int iVarA, int iVarB,
clause_set_partA
(
pSat
,
Cid
,
1
);
return
4
;
}
static
inline
int
sat_solver2_add_constraint
(
sat_solver2
*
pSat
,
int
iVar
,
int
fCompl
,
int
fMark
)
static
inline
int
sat_solver2_add_constraint
(
sat_solver2
*
pSat
,
int
iVar
,
int
iVar2
,
int
fCompl
,
int
fMark
)
{
lit
Lits
[
2
];
int
Cid
;
assert
(
iVar
>=
0
);
Lits
[
0
]
=
toLitCond
(
iVar
,
fCompl
);
Lits
[
1
]
=
toLitCond
(
iVar
+
1
,
0
);
Lits
[
1
]
=
toLitCond
(
iVar
2
,
0
);
Cid
=
sat_solver2_addclause
(
pSat
,
Lits
,
Lits
+
2
);
if
(
fMark
)
clause_set_partA
(
pSat
,
Cid
,
1
);
Lits
[
0
]
=
toLitCond
(
iVar
,
fCompl
);
Lits
[
1
]
=
toLitCond
(
iVar
+
1
,
1
);
Lits
[
1
]
=
toLitCond
(
iVar
2
,
1
);
Cid
=
sat_solver2_addclause
(
pSat
,
Lits
,
Lits
+
2
);
if
(
fMark
)
clause_set_partA
(
pSat
,
Cid
,
1
);
...
...
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