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
7bcfe643
Commit
7bcfe643
authored
Nov 23, 2017
by
Baruch Sterin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
C++ comaptibility: add namespace support to Glucose
parent
d438d9c1
Hide whitespace changes
Inline
Side-by-side
Showing
26 changed files
with
124 additions
and
14 deletions
+124
-14
src/base/abc/abc.h
+2
-0
src/misc/util/abc_namespaces.h
+6
-0
src/sat/glucose/AbcGlucose.cpp
+2
-5
src/sat/glucose/AbcGlucose.h
+2
-2
src/sat/glucose/AbcGlucoseCmd.cpp
+8
-3
src/sat/glucose/Alg.h
+4
-0
src/sat/glucose/Alloc.h
+4
-0
src/sat/glucose/BoundedQueue.h
+4
-0
src/sat/glucose/Dimacs.h
+4
-0
src/sat/glucose/Glucose.cpp
+5
-2
src/sat/glucose/Heap.h
+4
-0
src/sat/glucose/IntTypes.h
+2
-0
src/sat/glucose/Map.h
+4
-0
src/sat/glucose/Options.cpp
+3
-0
src/sat/glucose/Options.h
+4
-0
src/sat/glucose/ParseUtils.h
+4
-0
src/sat/glucose/Queue.h
+4
-0
src/sat/glucose/SimpSolver.cpp
+3
-1
src/sat/glucose/SimpSolver.h
+3
-0
src/sat/glucose/Solver.h
+3
-0
src/sat/glucose/SolverTypes.h
+4
-1
src/sat/glucose/Sort.h
+3
-0
src/sat/glucose/System.cpp
+19
-0
src/sat/glucose/System.h
+13
-0
src/sat/glucose/Vec.h
+4
-0
src/sat/glucose/XAlloc.h
+6
-0
No files found.
src/base/abc/abc.h
View file @
7bcfe643
...
...
@@ -1043,6 +1043,8 @@ extern ABC_DLL void Abc_NtkPrintCiLevels( Abc_Ntk_t * pNtk );
extern
ABC_DLL
void
Abc_NtkReverseTopoOrder
(
Abc_Ntk_t
*
pNtk
);
extern
ABC_DLL
int
Abc_NtkIsTopo
(
Abc_Ntk_t
*
pNtk
);
extern
ABC_DLL
void
Abc_NtkTransferPhases
(
Abc_Ntk_t
*
pNtkNew
,
Abc_Ntk_t
*
pNtk
);
extern
ABC_DLL
Gia_Man_t
*
Abc_SopSynthesizeOne
(
char
*
pSop
,
int
fClp
);
/*=== abcVerify.c ==========================================================*/
...
...
src/misc/util/abc_namespaces.h
View file @
7bcfe643
...
...
@@ -30,6 +30,8 @@
# ifdef ABC_NAMESPACE
# define ABC_NAMESPACE_HEADER_START namespace ABC_NAMESPACE {
# define ABC_NAMESPACE_HEADER_END }
# define ABC_NAMESPACE_CXX_HEADER_START ABC_NAMESPACE_HEADER_START
# define ABC_NAMESPACE_CXX_HEADER_END ABC_NAMESPACE_HEADER_END
# define ABC_NAMESPACE_IMPL_START namespace ABC_NAMESPACE {
# define ABC_NAMESPACE_IMPL_END }
# define ABC_NAMESPACE_PREFIX ABC_NAMESPACE::
...
...
@@ -37,6 +39,8 @@
# else
# define ABC_NAMESPACE_HEADER_START extern "C" {
# define ABC_NAMESPACE_HEADER_END }
# define ABC_NAMESPACE_CXX_HEADER_START
# define ABC_NAMESPACE_CXX_HEADER_END
# define ABC_NAMESPACE_IMPL_START
# define ABC_NAMESPACE_IMPL_END
# define ABC_NAMESPACE_PREFIX
...
...
@@ -45,6 +49,8 @@
#else
# define ABC_NAMESPACE_HEADER_START
# define ABC_NAMESPACE_HEADER_END
# define ABC_NAMESPACE_CXX_HEADER_START
# define ABC_NAMESPACE_CXX_HEADER_END
# define ABC_NAMESPACE_IMPL_START
# define ABC_NAMESPACE_IMPL_END
# define ABC_NAMESPACE_PREFIX
...
...
src/sat/glucose/AbcGlucose.cpp
View file @
7bcfe643
...
...
@@ -26,15 +26,14 @@
#include "sat/glucose/AbcGlucose.h"
#include "base/abc/abc.h"
#include "aig/gia/gia.h"
#include "sat/cnf/cnf.h"
#include "misc/extra/extra.h"
using
namespace
Gluco
;
ABC_NAMESPACE_IMPL_START
extern
"C"
{
using
namespace
Gluco
;
////////////////////////////////////////////////////////////////////////
/// DECLARATIONS ///
...
...
@@ -1367,6 +1366,4 @@ int Glucose_SolveAig(Gia_Man_t * p, Glucose_Pars * pPars)
/// END OF FILE ///
////////////////////////////////////////////////////////////////////////
}
ABC_NAMESPACE_IMPL_END
src/sat/glucose/AbcGlucose.h
View file @
7bcfe643
...
...
@@ -31,13 +31,13 @@
/// PARAMETERS ///
////////////////////////////////////////////////////////////////////////
ABC_NAMESPACE_HEADER_START
#define GLUCOSE_UNSAT -1
#define GLUCOSE_SAT 1
#define GLUCOSE_UNDEC 0
ABC_NAMESPACE_HEADER_START
////////////////////////////////////////////////////////////////////////
/// BASIC TYPES ///
////////////////////////////////////////////////////////////////////////
...
...
src/sat/glucose/AbcGlucoseCmd.cpp
View file @
7bcfe643
...
...
@@ -23,6 +23,14 @@
#include "sat/glucose/AbcGlucose.h"
ABC_NAMESPACE_HEADER_START
void
Glucose_Init
(
Abc_Frame_t
*
pAbc
);
void
Glucose_End
(
Abc_Frame_t
*
pAbc
);
ABC_NAMESPACE_HEADER_END
ABC_NAMESPACE_IMPL_START
////////////////////////////////////////////////////////////////////////
...
...
@@ -46,7 +54,6 @@ static int Abc_CommandGlucose( Abc_Frame_t * pAbc, int argc, char ** argv );
SeeAlso []
***********************************************************************/
extern
"C"
{
void
Glucose_Init
(
Abc_Frame_t
*
pAbc
)
{
...
...
@@ -57,8 +64,6 @@ void Glucose_End( Abc_Frame_t * pAbc )
{
}
}
/**Function*************************************************************
Synopsis []
...
...
src/sat/glucose/Alg.h
View file @
7bcfe643
...
...
@@ -23,6 +23,8 @@ OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWA
#include "sat/glucose/Vec.h"
ABC_NAMESPACE_CXX_HEADER_START
namespace
Gluco
{
//=================================================================================================
...
...
@@ -81,4 +83,6 @@ static inline void append(const vec<T>& from, vec<T>& to){ copy(from, to, true);
//=================================================================================================
}
ABC_NAMESPACE_CXX_HEADER_END
#endif
src/sat/glucose/Alloc.h
View file @
7bcfe643
...
...
@@ -24,6 +24,8 @@ OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWA
#include "sat/glucose/XAlloc.h"
#include "sat/glucose/Vec.h"
ABC_NAMESPACE_CXX_HEADER_START
namespace
Gluco
{
//=================================================================================================
...
...
@@ -129,4 +131,6 @@ RegionAllocator<T>::alloc(int size)
//=================================================================================================
}
ABC_NAMESPACE_CXX_HEADER_END
#endif
src/sat/glucose/BoundedQueue.h
View file @
7bcfe643
...
...
@@ -25,6 +25,8 @@ OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWA
#include "sat/glucose/Vec.h"
ABC_NAMESPACE_CXX_HEADER_START
//=================================================================================================
namespace
Gluco
{
...
...
@@ -107,4 +109,6 @@ public:
}
//=================================================================================================
ABC_NAMESPACE_CXX_HEADER_END
#endif
src/sat/glucose/Dimacs.h
View file @
7bcfe643
...
...
@@ -26,6 +26,8 @@ OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWA
#include "sat/glucose/ParseUtils.h"
#include "sat/glucose/SolverTypes.h"
ABC_NAMESPACE_CXX_HEADER_START
namespace
Gluco
{
//=================================================================================================
...
...
@@ -86,4 +88,6 @@ static void parse_DIMACS(gzFile input_stream, Solver& S) {
//=================================================================================================
}
ABC_NAMESPACE_CXX_HEADER_END
#endif
src/sat/glucose/Glucose.cpp
View file @
7bcfe643
...
...
@@ -34,6 +34,8 @@ OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWA
#include "sat/glucose/Constants.h"
#include "sat/glucose/System.h"
ABC_NAMESPACE_IMPL_START
using
namespace
Gluco
;
//=================================================================================================
...
...
@@ -1490,4 +1492,6 @@ void Solver::reset()
add_tmp
.
clear
(
false
);
assumptionPositions
.
clear
(
false
);
initialPositions
.
clear
(
false
);
}
\ No newline at end of file
}
ABC_NAMESPACE_IMPL_END
src/sat/glucose/Heap.h
View file @
7bcfe643
...
...
@@ -23,6 +23,8 @@ OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWA
#include "sat/glucose/Vec.h"
ABC_NAMESPACE_CXX_HEADER_START
namespace
Gluco
{
//=================================================================================================
...
...
@@ -147,4 +149,6 @@ class Heap {
//=================================================================================================
}
ABC_NAMESPACE_CXX_HEADER_END
#endif
src/sat/glucose/IntTypes.h
View file @
7bcfe643
...
...
@@ -44,4 +44,6 @@ OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWA
#endif
//=================================================================================================
#include <misc/util/abc_namespaces.h>
#endif
src/sat/glucose/Map.h
View file @
7bcfe643
...
...
@@ -23,6 +23,8 @@ OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWA
#include "sat/glucose/IntTypes.h"
#include "sat/glucose/Vec.h"
ABC_NAMESPACE_CXX_HEADER_START
namespace
Gluco
{
//=================================================================================================
...
...
@@ -190,4 +192,6 @@ class Map {
//=================================================================================================
}
ABC_NAMESPACE_CXX_HEADER_END
#endif
src/sat/glucose/Options.cpp
View file @
7bcfe643
...
...
@@ -21,6 +21,8 @@ OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWA
#include "sat/glucose/Options.h"
#include "sat/glucose/ParseUtils.h"
ABC_NAMESPACE_IMPL_START
using
namespace
Gluco
;
void
Gluco
::
parseOptions
(
int
&
argc
,
char
**
argv
,
bool
strict
)
...
...
@@ -90,3 +92,4 @@ void Gluco::printUsageAndExit (int argc, char** argv, bool verbose)
exit
(
0
);
}
ABC_NAMESPACE_IMPL_END
src/sat/glucose/Options.h
View file @
7bcfe643
...
...
@@ -31,6 +31,8 @@ OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWA
#include "sat/glucose/Vec.h"
#include "sat/glucose/ParseUtils.h"
ABC_NAMESPACE_CXX_HEADER_START
namespace
Gluco
{
//==================================================================================================
...
...
@@ -385,4 +387,6 @@ class BoolOption : public Option
//=================================================================================================
}
ABC_NAMESPACE_CXX_HEADER_END
#endif
src/sat/glucose/ParseUtils.h
View file @
7bcfe643
...
...
@@ -27,6 +27,8 @@ OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWA
#include "misc/zlib/zlib.h"
ABC_NAMESPACE_CXX_HEADER_START
namespace
Gluco
{
//-------------------------------------------------------------------------------------------------
...
...
@@ -148,4 +150,6 @@ static bool eagerMatch(B& in, const char* str) {
//=================================================================================================
}
ABC_NAMESPACE_CXX_HEADER_END
#endif
src/sat/glucose/Queue.h
View file @
7bcfe643
...
...
@@ -23,6 +23,8 @@ OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWA
#include "sat/glucose/Vec.h"
ABC_NAMESPACE_CXX_HEADER_START
namespace
Gluco
{
//=================================================================================================
...
...
@@ -66,4 +68,6 @@ public:
//=================================================================================================
}
ABC_NAMESPACE_CXX_HEADER_END
#endif
src/sat/glucose/SimpSolver.cpp
View file @
7bcfe643
...
...
@@ -22,6 +22,8 @@ OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWA
#include "sat/glucose/SimpSolver.h"
#include "sat/glucose/System.h"
ABC_NAMESPACE_IMPL_START
using
namespace
Gluco
;
//=================================================================================================
...
...
@@ -771,4 +773,4 @@ void SimpSolver::reset()
remove_satisfied
=
false
;
}
ABC_NAMESPACE_IMPL_END
src/sat/glucose/SimpSolver.h
View file @
7bcfe643
...
...
@@ -24,6 +24,7 @@ OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWA
#include "sat/glucose/Queue.h"
#include "sat/glucose/Solver.h"
ABC_NAMESPACE_CXX_HEADER_START
namespace
Gluco
{
...
...
@@ -201,4 +202,6 @@ inline void SimpSolver::addVar(Var v) { while (v >= nVars()) newVar(); }
//=================================================================================================
}
ABC_NAMESPACE_CXX_HEADER_END
#endif
src/sat/glucose/Solver.h
View file @
7bcfe643
...
...
@@ -37,6 +37,7 @@ OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWA
#include "sat/glucose/BoundedQueue.h"
#include "sat/glucose/Constants.h"
ABC_NAMESPACE_CXX_HEADER_START
namespace
Gluco
{
...
...
@@ -488,4 +489,6 @@ inline void Solver::printInitialClause(CRef cr)
//=================================================================================================
}
ABC_NAMESPACE_CXX_HEADER_END
#endif
src/sat/glucose/SolverTypes.h
View file @
7bcfe643
...
...
@@ -38,6 +38,8 @@ OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWA
#include "sat/glucose/Map.h"
#include "sat/glucose/Alloc.h"
ABC_NAMESPACE_CXX_HEADER_START
namespace
Gluco
{
//=================================================================================================
...
...
@@ -430,5 +432,6 @@ inline void Clause::strengthen(Lit p)
//=================================================================================================
}
ABC_NAMESPACE_CXX_HEADER_END
#endif
src/sat/glucose/Sort.h
View file @
7bcfe643
...
...
@@ -26,6 +26,7 @@ OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWA
//=================================================================================================
// Some sorting algorithms for vec's
ABC_NAMESPACE_CXX_HEADER_START
namespace
Gluco
{
...
...
@@ -95,4 +96,6 @@ template <class T> void sort(vec<T>& v) {
//=================================================================================================
}
ABC_NAMESPACE_CXX_HEADER_END
#endif
src/sat/glucose/System.cpp
View file @
7bcfe643
...
...
@@ -25,6 +25,8 @@ OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWA
#include <stdio.h>
#include <stdlib.h>
ABC_NAMESPACE_IMPL_START
using
namespace
Gluco
;
// TODO: split the memory reading functions into two: one for reading high-watermark of RSS, and
...
...
@@ -72,24 +74,41 @@ double Gluco::memUsedPeak() {
double
peak
=
memReadPeak
()
/
1024
;
return
peak
==
0
?
memUsed
()
:
peak
;
}
ABC_NAMESPACE_IMPL_END
#elif defined(__FreeBSD__)
ABC_NAMESPACE_IMPL_START
double
Gluco
::
memUsed
(
void
)
{
struct
rusage
ru
;
getrusage
(
RUSAGE_SELF
,
&
ru
);
return
(
double
)
ru
.
ru_maxrss
/
1024
;
}
double
MiniSat
::
memUsedPeak
(
void
)
{
return
memUsed
();
}
ABC_NAMESPACE_IMPL_END
#elif defined(__APPLE__)
#include <malloc/malloc.h>
ABC_NAMESPACE_IMPL_START
double
Gluco
::
memUsed
(
void
)
{
malloc_statistics_t
t
;
malloc_zone_statistics
(
NULL
,
&
t
);
return
(
double
)
t
.
max_size_in_use
/
(
1024
*
1024
);
}
ABC_NAMESPACE_IMPL_END
#else
ABC_NAMESPACE_IMPL_START
double
Gluco
::
memUsed
()
{
return
0
;
}
ABC_NAMESPACE_IMPL_END
#endif
src/sat/glucose/System.h
View file @
7bcfe643
...
...
@@ -27,6 +27,8 @@ OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWA
#include "sat/glucose/IntTypes.h"
ABC_NAMESPACE_CXX_HEADER_START
//-------------------------------------------------------------------------------------------------
namespace
Gluco
{
...
...
@@ -37,24 +39,35 @@ extern double memUsedPeak(); // Peak-memory in mega bytes (returns 0 for
}
ABC_NAMESPACE_CXX_HEADER_END
//-------------------------------------------------------------------------------------------------
// Implementation of inline functions:
#if defined(_MSC_VER) || defined(__MINGW32__)
#include <time.h>
ABC_NAMESPACE_CXX_HEADER_START
static
inline
double
Gluco
::
cpuTime
(
void
)
{
return
(
double
)
clock
()
/
CLOCKS_PER_SEC
;
}
ABC_NAMESPACE_CXX_HEADER_END
#else
#include <sys/time.h>
#include <sys/resource.h>
#include <unistd.h>
ABC_NAMESPACE_CXX_HEADER_START
static
inline
double
Gluco
::
cpuTime
(
void
)
{
struct
rusage
ru
;
getrusage
(
RUSAGE_SELF
,
&
ru
);
return
(
double
)
ru
.
ru_utime
.
tv_sec
+
(
double
)
ru
.
ru_utime
.
tv_usec
/
1000000
;
}
ABC_NAMESPACE_CXX_HEADER_END
#endif
#endif
src/sat/glucose/Vec.h
View file @
7bcfe643
...
...
@@ -27,6 +27,8 @@ OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWA
#include "sat/glucose/IntTypes.h"
#include "sat/glucose/XAlloc.h"
ABC_NAMESPACE_CXX_HEADER_START
namespace
Gluco
{
//=================================================================================================
...
...
@@ -127,4 +129,6 @@ void vec<T>::clear(bool dealloc) {
//=================================================================================================
}
ABC_NAMESPACE_CXX_HEADER_END
#endif
src/sat/glucose/XAlloc.h
View file @
7bcfe643
...
...
@@ -25,6 +25,10 @@ OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWA
#include <stdlib.h>
#include <stdio.h>
#include <misc/util/abc_namespaces.h>
ABC_NAMESPACE_CXX_HEADER_START
namespace
Gluco
{
//=================================================================================================
...
...
@@ -44,4 +48,6 @@ static inline void* xrealloc(void *ptr, size_t size)
//=================================================================================================
}
ABC_NAMESPACE_CXX_HEADER_END
#endif
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