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
74157fc0
Commit
74157fc0
authored
Jul 27, 2023
by
Alan Mishchenko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
New command &splitsat.
parent
edb7fb10
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
173 additions
and
0 deletions
+173
-0
src/base/abci/abc.c
+155
-0
src/sat/cnf/cnf.h
+1
-0
src/sat/cnf/cnfMan.c
+17
-0
src/sat/cnf/cnfUtil.c
+0
-0
No files found.
src/base/abci/abc.c
View file @
74157fc0
...
@@ -540,6 +540,7 @@ static int Abc_CommandAbc9PoPart ( Abc_Frame_t * pAbc, int argc, cha
...
@@ -540,6 +540,7 @@ static int Abc_CommandAbc9PoPart ( Abc_Frame_t * pAbc, int argc, cha
static
int
Abc_CommandAbc9GroupProve
(
Abc_Frame_t
*
pAbc
,
int
argc
,
char
**
argv
);
static
int
Abc_CommandAbc9GroupProve
(
Abc_Frame_t
*
pAbc
,
int
argc
,
char
**
argv
);
static
int
Abc_CommandAbc9MultiProve
(
Abc_Frame_t
*
pAbc
,
int
argc
,
char
**
argv
);
static
int
Abc_CommandAbc9MultiProve
(
Abc_Frame_t
*
pAbc
,
int
argc
,
char
**
argv
);
static
int
Abc_CommandAbc9SplitProve
(
Abc_Frame_t
*
pAbc
,
int
argc
,
char
**
argv
);
static
int
Abc_CommandAbc9SplitProve
(
Abc_Frame_t
*
pAbc
,
int
argc
,
char
**
argv
);
static
int
Abc_CommandAbc9SplitSat
(
Abc_Frame_t
*
pAbc
,
int
argc
,
char
**
argv
);
static
int
Abc_CommandAbc9Bmc
(
Abc_Frame_t
*
pAbc
,
int
argc
,
char
**
argv
);
static
int
Abc_CommandAbc9Bmc
(
Abc_Frame_t
*
pAbc
,
int
argc
,
char
**
argv
);
static
int
Abc_CommandAbc9SBmc
(
Abc_Frame_t
*
pAbc
,
int
argc
,
char
**
argv
);
static
int
Abc_CommandAbc9SBmc
(
Abc_Frame_t
*
pAbc
,
int
argc
,
char
**
argv
);
static
int
Abc_CommandAbc9ChainBmc
(
Abc_Frame_t
*
pAbc
,
int
argc
,
char
**
argv
);
static
int
Abc_CommandAbc9ChainBmc
(
Abc_Frame_t
*
pAbc
,
int
argc
,
char
**
argv
);
...
@@ -1300,6 +1301,7 @@ void Abc_Init( Abc_Frame_t * pAbc )
...
@@ -1300,6 +1301,7 @@ void Abc_Init( Abc_Frame_t * pAbc )
Cmd_CommandAdd
(
pAbc
,
"ABC9"
,
"&gprove"
,
Abc_CommandAbc9GroupProve
,
0
);
Cmd_CommandAdd
(
pAbc
,
"ABC9"
,
"&gprove"
,
Abc_CommandAbc9GroupProve
,
0
);
Cmd_CommandAdd
(
pAbc
,
"ABC9"
,
"&mprove"
,
Abc_CommandAbc9MultiProve
,
0
);
Cmd_CommandAdd
(
pAbc
,
"ABC9"
,
"&mprove"
,
Abc_CommandAbc9MultiProve
,
0
);
Cmd_CommandAdd
(
pAbc
,
"ABC9"
,
"&splitprove"
,
Abc_CommandAbc9SplitProve
,
0
);
Cmd_CommandAdd
(
pAbc
,
"ABC9"
,
"&splitprove"
,
Abc_CommandAbc9SplitProve
,
0
);
Cmd_CommandAdd
(
pAbc
,
"ABC9"
,
"&splitsat"
,
Abc_CommandAbc9SplitSat
,
0
);
Cmd_CommandAdd
(
pAbc
,
"ABC9"
,
"&bmc"
,
Abc_CommandAbc9Bmc
,
0
);
Cmd_CommandAdd
(
pAbc
,
"ABC9"
,
"&bmc"
,
Abc_CommandAbc9Bmc
,
0
);
Cmd_CommandAdd
(
pAbc
,
"ABC9"
,
"&bmcs"
,
Abc_CommandAbc9SBmc
,
0
);
Cmd_CommandAdd
(
pAbc
,
"ABC9"
,
"&bmcs"
,
Abc_CommandAbc9SBmc
,
0
);
Cmd_CommandAdd
(
pAbc
,
"ABC9"
,
"&chainbmc"
,
Abc_CommandAbc9ChainBmc
,
0
);
Cmd_CommandAdd
(
pAbc
,
"ABC9"
,
"&chainbmc"
,
Abc_CommandAbc9ChainBmc
,
0
);
...
@@ -46093,6 +46095,159 @@ usage:
...
@@ -46093,6 +46095,159 @@ usage:
SeeAlso []
SeeAlso []
***********************************************************************/
***********************************************************************/
int
Abc_CommandAbc9SplitSat
(
Abc_Frame_t
*
pAbc
,
int
argc
,
char
**
argv
)
{
extern
void
Cnf_SplitSat
(
char
*
pFileName
,
int
iVarBeg
,
int
iVarEnd
,
int
nLits
,
int
Value
,
int
TimeOut
,
int
nProcs
,
int
nIters
,
int
Seed
,
int
fVerbose
);
int
c
,
iVarBeg
=
0
,
iVarEnd
=
ABC_INFINITY
,
nLits
=
10
,
Value
=
2
,
TimeOut
=
5
,
nProcs
=
1
,
nIters
=
1
,
Seed
=
0
,
fVerbose
=
0
;
char
*
pFileName
=
NULL
;
Extra_UtilGetoptReset
();
while
(
(
c
=
Extra_UtilGetopt
(
argc
,
argv
,
"BENVTPISvh"
)
)
!=
EOF
)
{
switch
(
c
)
{
case
'B'
:
if
(
globalUtilOptind
>=
argc
)
{
Abc_Print
(
-
1
,
"Command line switch
\"
-B
\"
should be followed by a positive integer.
\n
"
);
goto
usage
;
}
iVarBeg
=
atoi
(
argv
[
globalUtilOptind
]);
globalUtilOptind
++
;
if
(
iVarBeg
<
0
)
goto
usage
;
break
;
case
'E'
:
if
(
globalUtilOptind
>=
argc
)
{
Abc_Print
(
-
1
,
"Command line switch
\"
-E
\"
should be followed by a positive integer.
\n
"
);
goto
usage
;
}
iVarEnd
=
atoi
(
argv
[
globalUtilOptind
]);
globalUtilOptind
++
;
if
(
iVarEnd
<
0
)
goto
usage
;
break
;
case
'N'
:
if
(
globalUtilOptind
>=
argc
)
{
Abc_Print
(
-
1
,
"Command line switch
\"
-N
\"
should be followed by a positive integer.
\n
"
);
goto
usage
;
}
nLits
=
atoi
(
argv
[
globalUtilOptind
]);
globalUtilOptind
++
;
if
(
nLits
<
0
)
goto
usage
;
break
;
case
'V'
:
if
(
globalUtilOptind
>=
argc
)
{
Abc_Print
(
-
1
,
"Command line switch
\"
-V
\"
should be followed by a positive integer.
\n
"
);
goto
usage
;
}
Value
=
atoi
(
argv
[
globalUtilOptind
]);
globalUtilOptind
++
;
if
(
Value
<
0
||
Value
>
2
)
goto
usage
;
break
;
case
'T'
:
if
(
globalUtilOptind
>=
argc
)
{
Abc_Print
(
-
1
,
"Command line switch
\"
-T
\"
should be followed by a positive integer.
\n
"
);
goto
usage
;
}
TimeOut
=
atoi
(
argv
[
globalUtilOptind
]);
globalUtilOptind
++
;
if
(
TimeOut
<
0
)
goto
usage
;
break
;
case
'P'
:
if
(
globalUtilOptind
>=
argc
)
{
Abc_Print
(
-
1
,
"Command line switch
\"
-P
\"
should be followed by a positive integer.
\n
"
);
goto
usage
;
}
nProcs
=
atoi
(
argv
[
globalUtilOptind
]);
globalUtilOptind
++
;
if
(
nProcs
<=
0
)
goto
usage
;
break
;
case
'I'
:
if
(
globalUtilOptind
>=
argc
)
{
Abc_Print
(
-
1
,
"Command line switch
\"
-I
\"
should be followed by an integer.
\n
"
);
goto
usage
;
}
nIters
=
atoi
(
argv
[
globalUtilOptind
]);
globalUtilOptind
++
;
if
(
nIters
<
0
)
goto
usage
;
break
;
case
'S'
:
if
(
globalUtilOptind
>=
argc
)
{
Abc_Print
(
-
1
,
"Command line switch
\"
-S
\"
should be followed by an integer.
\n
"
);
goto
usage
;
}
Seed
=
atoi
(
argv
[
globalUtilOptind
]);
globalUtilOptind
++
;
if
(
Seed
<
0
)
goto
usage
;
break
;
case
'v'
:
fVerbose
^=
1
;
break
;
case
'h'
:
goto
usage
;
default:
goto
usage
;
}
}
// get the file name
if
(
argc
!=
globalUtilOptind
+
1
)
{
Abc_Print
(
-
1
,
"Abc_CommandAbc9SplitSat(): CNF file names should be given on the command line.
\n
"
);
return
1
;
}
{
FILE
*
pFile
;
pFileName
=
argv
[
globalUtilOptind
];
pFile
=
fopen
(
pFileName
,
"r"
);
if
(
pFile
==
NULL
)
{
Abc_Print
(
-
1
,
"Cannot open file
\"
%s
\"
with the input test patterns.
\n
"
,
pFileName
);
return
0
;
}
fclose
(
pFile
);
}
Cnf_SplitSat
(
pFileName
,
iVarBeg
,
iVarEnd
,
nLits
,
Value
,
TimeOut
,
nProcs
,
nIters
,
Seed
,
fVerbose
);
return
0
;
usage:
Abc_Print
(
-
2
,
"usage: &splitsat [-BENVTPIS num] [-vh]
\n
"
);
Abc_Print
(
-
2
,
"
\t
solves CNF-based SAT problem by randomized case-splitting
\n
"
);
Abc_Print
(
-
2
,
"
\t
-B num : the first CNF variable to use for splitting [default = %d]
\n
"
,
iVarBeg
);
Abc_Print
(
-
2
,
"
\t
-E num : the last CNF variable to use for splitting [default = %d]
\n
"
,
iVarEnd
);
Abc_Print
(
-
2
,
"
\t
-N num : the number of CNF variables to use for splitting [default = %d]
\n
"
,
nLits
);
Abc_Print
(
-
2
,
"
\t
-V num : the variable values to use (0, 1, or 2 for
\"
any
\"
) [default = %d]
\n
"
,
Value
);
Abc_Print
(
-
2
,
"
\t
-T num : the runtime limit in seconds per subproblem [default = %d]
\n
"
,
TimeOut
);
Abc_Print
(
-
2
,
"
\t
-P num : the number of concurrent processes [default = %d]
\n
"
,
nProcs
);
Abc_Print
(
-
2
,
"
\t
-I num : the max number of iterations (0 = infinity) [default = %d]
\n
"
,
nIters
);
Abc_Print
(
-
2
,
"
\t
-S num : the random seed used to generate cofactors [default = %d]
\n
"
,
Seed
);
Abc_Print
(
-
2
,
"
\t
-v : toggle printing verbose information [default = %s]
\n
"
,
fVerbose
?
"yes"
:
"no"
);
Abc_Print
(
-
2
,
"
\t
-h : print the command usage
\n
"
);
return
1
;
}
/**Function*************************************************************
Synopsis []
Description []
SideEffects []
SeeAlso []
***********************************************************************/
int
Abc_CommandAbc9Bmc
(
Abc_Frame_t
*
pAbc
,
int
argc
,
char
**
argv
)
int
Abc_CommandAbc9Bmc
(
Abc_Frame_t
*
pAbc
,
int
argc
,
char
**
argv
)
{
{
int
c
;
int
c
;
src/sat/cnf/cnf.h
View file @
74157fc0
...
@@ -155,6 +155,7 @@ extern Vec_Int_t * Cnf_DataCollectPiSatNums( Cnf_Dat_t * pCnf, Aig_Man_t * p
...
@@ -155,6 +155,7 @@ extern Vec_Int_t * Cnf_DataCollectPiSatNums( Cnf_Dat_t * pCnf, Aig_Man_t * p
extern
Cnf_Dat_t
*
Cnf_DataAlloc
(
Aig_Man_t
*
pAig
,
int
nVars
,
int
nClauses
,
int
nLiterals
);
extern
Cnf_Dat_t
*
Cnf_DataAlloc
(
Aig_Man_t
*
pAig
,
int
nVars
,
int
nClauses
,
int
nLiterals
);
extern
Cnf_Dat_t
*
Cnf_DataDup
(
Cnf_Dat_t
*
p
);
extern
Cnf_Dat_t
*
Cnf_DataDup
(
Cnf_Dat_t
*
p
);
extern
Cnf_Dat_t
*
Cnf_DataDupCof
(
Cnf_Dat_t
*
p
,
int
Lit
);
extern
Cnf_Dat_t
*
Cnf_DataDupCof
(
Cnf_Dat_t
*
p
,
int
Lit
);
extern
Cnf_Dat_t
*
Cnf_DataDupCofArray
(
Cnf_Dat_t
*
p
,
Vec_Int_t
*
vLits
);
extern
void
Cnf_DataFree
(
Cnf_Dat_t
*
p
);
extern
void
Cnf_DataFree
(
Cnf_Dat_t
*
p
);
extern
void
Cnf_DataLift
(
Cnf_Dat_t
*
p
,
int
nVarsPlus
);
extern
void
Cnf_DataLift
(
Cnf_Dat_t
*
p
,
int
nVarsPlus
);
extern
void
Cnf_DataCollectFlipLits
(
Cnf_Dat_t
*
p
,
int
iFlipVar
,
Vec_Int_t
*
vFlips
);
extern
void
Cnf_DataCollectFlipLits
(
Cnf_Dat_t
*
p
,
int
iFlipVar
,
Vec_Int_t
*
vFlips
);
...
...
src/sat/cnf/cnfMan.c
View file @
74157fc0
...
@@ -175,6 +175,23 @@ Cnf_Dat_t * Cnf_DataDupCof( Cnf_Dat_t * p, int Lit )
...
@@ -175,6 +175,23 @@ Cnf_Dat_t * Cnf_DataDupCof( Cnf_Dat_t * p, int Lit )
assert
(
pCnf
->
pClauses
[
p
->
nClauses
+
1
]
==
pCnf
->
pClauses
[
0
]
+
p
->
nLiterals
+
1
);
assert
(
pCnf
->
pClauses
[
p
->
nClauses
+
1
]
==
pCnf
->
pClauses
[
0
]
+
p
->
nLiterals
+
1
);
return
pCnf
;
return
pCnf
;
}
}
Cnf_Dat_t
*
Cnf_DataDupCofArray
(
Cnf_Dat_t
*
p
,
Vec_Int_t
*
vLits
)
{
Cnf_Dat_t
*
pCnf
;
int
i
,
iLit
;
pCnf
=
Cnf_DataAlloc
(
p
->
pMan
,
p
->
nVars
,
p
->
nClauses
+
Vec_IntSize
(
vLits
),
p
->
nLiterals
+
Vec_IntSize
(
vLits
)
);
memcpy
(
pCnf
->
pClauses
[
0
],
p
->
pClauses
[
0
],
sizeof
(
int
)
*
p
->
nLiterals
);
if
(
pCnf
->
pVarNums
)
memcpy
(
pCnf
->
pVarNums
,
p
->
pVarNums
,
sizeof
(
int
)
*
Aig_ManObjNumMax
(
p
->
pMan
)
);
for
(
i
=
1
;
i
<
p
->
nClauses
;
i
++
)
pCnf
->
pClauses
[
i
]
=
pCnf
->
pClauses
[
0
]
+
(
p
->
pClauses
[
i
]
-
p
->
pClauses
[
0
]);
Vec_IntForEachEntry
(
vLits
,
iLit
,
i
)
{
pCnf
->
pClauses
[
p
->
nClauses
+
i
]
=
pCnf
->
pClauses
[
0
]
+
p
->
nLiterals
+
i
;
pCnf
->
pClauses
[
p
->
nClauses
+
i
][
0
]
=
iLit
;
}
assert
(
pCnf
->
pClauses
[
p
->
nClauses
+
Vec_IntSize
(
vLits
)]
==
pCnf
->
pClauses
[
0
]
+
p
->
nLiterals
+
Vec_IntSize
(
vLits
)
);
return
pCnf
;
}
/**Function*************************************************************
/**Function*************************************************************
...
...
src/sat/cnf/cnfUtil.c
View file @
74157fc0
This diff is collapsed.
Click to expand it.
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