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
123b4250
Commit
123b4250
authored
Dec 13, 2016
by
Bruno Schmitt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixes to make xSAT compile with old compilers.
Small typos and variables renaming.
parent
cb49c5d0
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
36 additions
and
43 deletions
+36
-43
src/sat/xsat/xsatBQueue.h
+6
-9
src/sat/xsat/xsatClause.h
+4
-4
src/sat/xsat/xsatHeap.h
+2
-2
src/sat/xsat/xsatMemory.h
+3
-7
src/sat/xsat/xsatSolver.c
+0
-0
src/sat/xsat/xsatSolver.h
+13
-13
src/sat/xsat/xsatSolverAPI.c
+1
-1
src/sat/xsat/xsatWatchList.h
+7
-7
No files found.
src/sat/xsat/xsatBQueue.h
View file @
123b4250
...
...
@@ -24,7 +24,6 @@
////////////////////////////////////////////////////////////////////////
/// INCLUDES ///
////////////////////////////////////////////////////////////////////////
#include "misc/util/abc_global.h"
ABC_NAMESPACE_HEADER_START
...
...
@@ -32,7 +31,6 @@ ABC_NAMESPACE_HEADER_START
////////////////////////////////////////////////////////////////////////
/// STRUCTURE DEFINITIONS ///
////////////////////////////////////////////////////////////////////////
typedef
struct
xSAT_BQueue_t_
xSAT_BQueue_t
;
struct
xSAT_BQueue_t_
{
...
...
@@ -41,13 +39,12 @@ struct xSAT_BQueue_t_
int
iFirst
;
int
iEmpty
;
word
nSum
;
wor
d
*
pData
;
unsigne
d
*
pData
;
};
////////////////////////////////////////////////////////////////////////
/// FUNCTION DECLARATIONS ///
////////////////////////////////////////////////////////////////////////
/**Function*************************************************************
Synopsis []
...
...
@@ -63,7 +60,7 @@ static inline xSAT_BQueue_t * xSAT_BQueueNew( int nCap )
{
xSAT_BQueue_t
*
p
=
ABC_CALLOC
(
xSAT_BQueue_t
,
1
);
p
->
nCap
=
nCap
;
p
->
pData
=
ABC_CALLOC
(
wor
d
,
nCap
);
p
->
pData
=
ABC_CALLOC
(
unsigne
d
,
nCap
);
return
p
;
}
...
...
@@ -95,7 +92,7 @@ static inline void xSAT_BQueueFree( xSAT_BQueue_t * p )
SeeAlso []
***********************************************************************/
static
inline
void
xSAT_BQueuePush
(
xSAT_BQueue_t
*
p
,
wor
d
Value
)
static
inline
void
xSAT_BQueuePush
(
xSAT_BQueue_t
*
p
,
unsigne
d
Value
)
{
if
(
p
->
nSize
==
p
->
nCap
)
{
...
...
@@ -128,8 +125,8 @@ static inline void xSAT_BQueuePush( xSAT_BQueue_t * p, word Value )
***********************************************************************/
static
inline
int
xSAT_BQueuePop
(
xSAT_BQueue_t
*
p
)
{
int
RetValue
=
p
->
pData
[
p
->
iFirst
];
assert
(
p
->
nSize
>=
1
);
int
RetValue
=
p
->
pData
[
p
->
iFirst
];
p
->
nSum
-=
RetValue
;
p
->
iFirst
=
(
p
->
iFirst
+
1
)
%
p
->
nCap
;
p
->
nSize
--
;
...
...
@@ -147,9 +144,9 @@ static inline int xSAT_BQueuePop( xSAT_BQueue_t * p )
SeeAlso []
***********************************************************************/
static
inline
wor
d
xSAT_BQueueAvg
(
xSAT_BQueue_t
*
p
)
static
inline
unsigne
d
xSAT_BQueueAvg
(
xSAT_BQueue_t
*
p
)
{
return
(
wor
d
)(
p
->
nSum
/
(
(
word
)
p
->
nSize
)
);
return
(
unsigne
d
)(
p
->
nSum
/
(
(
word
)
p
->
nSize
)
);
}
/**Function*************************************************************
...
...
src/sat/xsat/xsatClause.h
View file @
123b4250
...
...
@@ -39,7 +39,7 @@ struct xSAT_Clause_t_
unsigned
fReallocd
:
1
;
unsigned
fCanBeDel
:
1
;
unsigned
nLBD
:
28
;
unsigned
nSize
;
int
nSize
;
union
{
int
Lit
;
unsigned
Act
;
...
...
@@ -60,7 +60,7 @@ struct xSAT_Clause_t_
SeeAlso []
***********************************************************************/
static
int
xSAT_ClauseCompare
(
const
void
*
p1
,
const
void
*
p2
)
static
in
line
in
t
xSAT_ClauseCompare
(
const
void
*
p1
,
const
void
*
p2
)
{
xSAT_Clause_t
*
pC1
=
(
xSAT_Clause_t
*
)
p1
;
xSAT_Clause_t
*
pC2
=
(
xSAT_Clause_t
*
)
p2
;
...
...
@@ -91,12 +91,12 @@ static int xSAT_ClauseCompare( const void * p1, const void * p2 )
SeeAlso []
***********************************************************************/
static
void
xSAT_ClausePrint
(
xSAT_Clause_t
*
pCla
)
static
inline
void
xSAT_ClausePrint
(
xSAT_Clause_t
*
pCla
)
{
int
i
;
printf
(
"{ "
);
for
(
i
=
0
;
i
<
(
int
)
pCla
->
nSize
;
i
++
)
for
(
i
=
0
;
i
<
pCla
->
nSize
;
i
++
)
printf
(
"%d "
,
pCla
->
pData
[
i
].
Lit
);
printf
(
"}
\n
"
);
}
...
...
src/sat/xsat/xsatHeap.h
View file @
123b4250
...
...
@@ -48,7 +48,7 @@ struct xSAT_Heap_t_
SeeAlso []
***********************************************************************/
static
inline
int
xSAT_HeapSize
(
xSAT_Heap_t
*
h
)
inline
int
xSAT_HeapSize
(
xSAT_Heap_t
*
h
)
{
return
Vec_IntSize
(
h
->
vHeap
);
}
...
...
@@ -64,7 +64,7 @@ static inline int xSAT_HeapSize( xSAT_Heap_t * h )
SeeAlso []
***********************************************************************/
static
inline
int
xSAT_HeapInHeap
(
xSAT_Heap_t
*
h
,
int
Var
)
inline
int
xSAT_HeapInHeap
(
xSAT_Heap_t
*
h
,
int
Var
)
{
return
(
Var
<
Vec_IntSize
(
h
->
vIndices
)
)
&&
(
Vec_IntEntry
(
h
->
vIndices
,
Var
)
>=
0
);
}
...
...
src/sat/xsat/xsatMemory.h
View file @
123b4250
...
...
@@ -77,16 +77,14 @@ static inline void xSAT_MemGrow( xSAT_Mem_t * p, unsigned nCap )
unsigned
nPrevCap
=
p
->
nCap
;
if
(
p
->
nCap
>=
nCap
)
return
;
while
(
p
->
nCap
<
nCap
)
{
unsigned
delta
=
(
(
p
->
nCap
>>
1
)
+
(
p
->
nCap
>>
3
)
+
2
)
&
~
1
;
unsigned
delta
=
(
(
p
->
nCap
>>
1
)
+
(
p
->
nCap
>>
3
)
+
2
)
&
~
1
;
p
->
nCap
+=
delta
;
assert
(
p
->
nCap
>=
nPrevCap
);
}
assert
(
p
->
nCap
>
0
);
p
->
pData
=
ABC_REALLOC
(
unsigned
,
p
->
pData
,
p
->
nCap
);
p
->
pData
=
ABC_REALLOC
(
unsigned
,
p
->
pData
,
p
->
nCap
);
}
/**Function*************************************************************
...
...
@@ -160,12 +158,10 @@ static inline unsigned xSAT_MemAppend( xSAT_Mem_t * p, int nSize )
{
unsigned
nPrevSize
;
assert
(
nSize
>
0
);
xSAT_MemGrow
(
p
,
p
->
nSize
+
nSize
);
xSAT_MemGrow
(
p
,
p
->
nSize
+
nSize
);
nPrevSize
=
p
->
nSize
;
p
->
nSize
+=
nSize
;
assert
(
p
->
nSize
>
nPrevSize
);
return
nPrevSize
;
}
...
...
src/sat/xsat/xsatSolver.c
View file @
123b4250
This diff is collapsed.
Click to expand it.
src/sat/xsat/xsatSolver.h
View file @
123b4250
...
...
@@ -81,9 +81,9 @@ struct xSAT_SolverOptions_t_
char
fVerbose
;
// Limits
word
nConfLimit
;
// external limit on the number of conflicts
word
nInsLimit
;
// external limit on the number of implications
abctime
nRuntimeLimit
;
// external limit on runtime
iword
nConfLimit
;
// external limit on the number of conflicts
iword
nInsLimit
;
// external limit on the number of implications
abctime
nRuntimeLimit
;
// external limit on runtime
// Constants used for restart heuristic
double
K
;
// Forces a restart
...
...
@@ -105,13 +105,13 @@ struct xSAT_Stats_t_
unsigned
nStarts
;
unsigned
nReduceDB
;
word
nDecisions
;
word
nPropagations
;
word
nInspects
;
word
nConflicts
;
i
word
nDecisions
;
i
word
nPropagations
;
i
word
nInspects
;
i
word
nConflicts
;
word
nClauseLits
;
word
nLearntLits
;
i
word
nClauseLits
;
i
word
nLearntLits
;
};
struct
xSAT_Solver_t_
...
...
@@ -143,7 +143,7 @@ struct xSAT_Solver_t_
int
nAssignSimplify
;
/* Number of top-level assignments since last
* execution of 'simplify()'. */
word
nPropSimplify
;
/* Remaining number of propagations that must be
int64_t
nPropSimplify
;
/* Remaining number of propagations that must be
* made before next execution of 'simplify()'. */
/* Temporary data used by Search method */
...
...
@@ -203,10 +203,10 @@ static inline xSAT_Clause_t * xSAT_SolverReadClause( xSAT_Solver_t * s, unsigned
static
inline
int
xSAT_SolverIsClauseSatisfied
(
xSAT_Solver_t
*
s
,
xSAT_Clause_t
*
pCla
)
{
int
i
;
int
*
l
its
=
&
(
pCla
->
pData
[
0
].
Lit
);
int
*
L
its
=
&
(
pCla
->
pData
[
0
].
Lit
);
for
(
i
=
0
;
i
<
(
int
)
pCla
->
nSize
;
i
++
)
if
(
Vec_StrEntry
(
s
->
vAssigns
,
xSAT_Lit2Var
(
lits
[
i
]
)
)
==
xSAT_LitSign
(
(
l
its
[
i
]
)
)
)
for
(
i
=
0
;
i
<
pCla
->
nSize
;
i
++
)
if
(
Vec_StrEntry
(
s
->
vAssigns
,
xSAT_Lit2Var
(
Lits
[
i
]
)
)
==
xSAT_LitSign
(
(
L
its
[
i
]
)
)
)
return
true
;
return
false
;
...
...
src/sat/xsat/xsatSolverAPI.c
View file @
123b4250
...
...
@@ -51,6 +51,7 @@ xSAT_SolverOptions_t DefaultConfig =
30
//.nLBDFrozenClause = 30
};
/**Function*************************************************************
Synopsis []
...
...
@@ -125,7 +126,6 @@ void xSAT_SolverDestroy( xSAT_Solver_t * s )
xSAT_VecWatchListFree
(
s
->
vWatches
);
xSAT_VecWatchListFree
(
s
->
vBinWatches
);
// delete vectors
xSAT_HeapFree
(
s
->
hOrder
);
Vec_IntFree
(
s
->
vTrailLim
);
Vec_IntFree
(
s
->
vTrail
);
...
...
src/sat/xsat/xsatWatchList.h
View file @
123b4250
...
...
@@ -118,9 +118,9 @@ static inline void xSAT_WatchListShrink( xSAT_WatchList_t * v, int k )
static
inline
void
xSAT_WatchListPush
(
xSAT_WatchList_t
*
v
,
xSAT_Watcher_t
e
)
{
assert
(
v
);
if
(
v
->
nSize
==
v
->
nCap
)
if
(
v
->
nSize
==
v
->
nCap
)
{
int
newsize
=
(
v
->
nCap
<
4
)
?
4
:
(
v
->
nCap
/
2
)
*
3
;
int
newsize
=
(
v
->
nCap
<
4
)
?
4
:
(
v
->
nCap
/
2
)
*
3
;
v
->
pArray
=
ABC_REALLOC
(
xSAT_Watcher_t
,
v
->
pArray
,
newsize
);
if
(
v
->
pArray
==
NULL
)
...
...
@@ -167,9 +167,9 @@ static inline void xSAT_WatchListRemove( xSAT_WatchList_t * v, unsigned CRef )
xSAT_Watcher_t
*
ws
=
xSAT_WatchListArray
(
v
);
int
j
=
0
;
for
(
;
ws
[
j
].
CRef
!=
CRef
;
j
++
);
assert
(
j
<
xSAT_WatchListSize
(
v
)
);
memmove
(
v
->
pArray
+
j
,
v
->
pArray
+
j
+
1
,
(
v
->
nSize
-
j
-
1
)
*
sizeof
(
xSAT_Watcher_t
)
);
for
(
;
ws
[
j
].
CRef
!=
CRef
;
j
++
);
assert
(
j
<
xSAT_WatchListSize
(
v
)
);
memmove
(
v
->
pArray
+
j
,
v
->
pArray
+
j
+
1
,
(
v
->
nSize
-
j
-
1
)
*
sizeof
(
xSAT_Watcher_t
)
);
v
->
nSize
-=
1
;
}
...
...
@@ -190,7 +190,7 @@ static inline xSAT_VecWatchList_t * xSAT_VecWatchListAlloc( int nCap )
v
->
nCap
=
4
;
v
->
nSize
=
0
;
v
->
pArray
=
(
xSAT_WatchList_t
*
)
ABC_CALLOC
(
xSAT_WatchList_t
,
sizeof
(
xSAT_WatchList_t
)
*
v
->
nCap
);
v
->
pArray
=
(
xSAT_WatchList_t
*
)
ABC_CALLOC
(
xSAT_WatchList_t
,
sizeof
(
xSAT_WatchList_t
)
*
v
->
nCap
);
return
v
;
}
...
...
@@ -233,7 +233,7 @@ static inline void xSAT_VecWatchListPush( xSAT_VecWatchList_t* v )
int
newsize
=
(
v
->
nCap
<
4
)
?
v
->
nCap
*
2
:
(
v
->
nCap
/
2
)
*
3
;
v
->
pArray
=
ABC_REALLOC
(
xSAT_WatchList_t
,
v
->
pArray
,
newsize
);
memset
(
v
->
pArray
+
v
->
nCap
,
0
,
sizeof
(
xSAT_WatchList_t
)
*
(
newsize
-
v
->
nCap
)
);
memset
(
v
->
pArray
+
v
->
nCap
,
0
,
sizeof
(
xSAT_WatchList_t
)
*
(
newsize
-
v
->
nCap
)
);
if
(
v
->
pArray
==
NULL
)
{
printf
(
"Failed to realloc memory from %.1f MB to %.1f MB.
\n
"
,
...
...
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