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
a207f6c0
Commit
a207f6c0
authored
Sep 04, 2015
by
Alan Mishchenko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Experiments with SAT-based collapsing.
parent
1ffd9aad
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
268 additions
and
77 deletions
+268
-77
src/base/abc/abc.h
+1
-0
src/base/abci/abc.c
+124
-11
src/base/abci/abcCollapse.c
+0
-0
src/sat/bmc/bmcClp.c
+143
-66
No files found.
src/base/abc/abc.h
View file @
a207f6c0
...
@@ -596,6 +596,7 @@ extern ABC_DLL int Abc_NtkCheckUniqueCoNames( Abc_Ntk_t * pNtk );
...
@@ -596,6 +596,7 @@ extern ABC_DLL int Abc_NtkCheckUniqueCoNames( Abc_Ntk_t * pNtk );
extern
ABC_DLL
int
Abc_NtkCheckUniqueCioNames
(
Abc_Ntk_t
*
pNtk
);
extern
ABC_DLL
int
Abc_NtkCheckUniqueCioNames
(
Abc_Ntk_t
*
pNtk
);
/*=== abcCollapse.c ==========================================================*/
/*=== abcCollapse.c ==========================================================*/
extern
ABC_DLL
Abc_Ntk_t
*
Abc_NtkCollapse
(
Abc_Ntk_t
*
pNtk
,
int
fBddSizeMax
,
int
fDualRail
,
int
fReorder
,
int
fVerbose
);
extern
ABC_DLL
Abc_Ntk_t
*
Abc_NtkCollapse
(
Abc_Ntk_t
*
pNtk
,
int
fBddSizeMax
,
int
fDualRail
,
int
fReorder
,
int
fVerbose
);
extern
ABC_DLL
Abc_Ntk_t
*
Abc_NtkCollapseSat
(
Abc_Ntk_t
*
pNtk
,
int
nCubeLim
,
int
nBTLimit
,
int
fCanon
,
int
fVerbose
);
/*=== abcCut.c ==========================================================*/
/*=== abcCut.c ==========================================================*/
extern
ABC_DLL
void
*
Abc_NodeGetCutsRecursive
(
void
*
p
,
Abc_Obj_t
*
pObj
,
int
fDag
,
int
fTree
);
extern
ABC_DLL
void
*
Abc_NodeGetCutsRecursive
(
void
*
p
,
Abc_Obj_t
*
pObj
,
int
fDag
,
int
fTree
);
extern
ABC_DLL
void
*
Abc_NodeGetCuts
(
void
*
p
,
Abc_Obj_t
*
pObj
,
int
fDag
,
int
fTree
);
extern
ABC_DLL
void
*
Abc_NodeGetCuts
(
void
*
p
,
Abc_Obj_t
*
pObj
,
int
fDag
,
int
fTree
);
...
...
src/base/abci/abc.c
View file @
a207f6c0
...
@@ -95,6 +95,7 @@ static int Abc_CommandShowBdd ( Abc_Frame_t * pAbc, int argc, cha
...
@@ -95,6 +95,7 @@ static int Abc_CommandShowBdd ( Abc_Frame_t * pAbc, int argc, cha
static
int
Abc_CommandShowCut
(
Abc_Frame_t
*
pAbc
,
int
argc
,
char
**
argv
);
static
int
Abc_CommandShowCut
(
Abc_Frame_t
*
pAbc
,
int
argc
,
char
**
argv
);
static
int
Abc_CommandCollapse
(
Abc_Frame_t
*
pAbc
,
int
argc
,
char
**
argv
);
static
int
Abc_CommandCollapse
(
Abc_Frame_t
*
pAbc
,
int
argc
,
char
**
argv
);
static
int
Abc_CommandSatClp
(
Abc_Frame_t
*
pAbc
,
int
argc
,
char
**
argv
);
static
int
Abc_CommandStrash
(
Abc_Frame_t
*
pAbc
,
int
argc
,
char
**
argv
);
static
int
Abc_CommandStrash
(
Abc_Frame_t
*
pAbc
,
int
argc
,
char
**
argv
);
static
int
Abc_CommandBalance
(
Abc_Frame_t
*
pAbc
,
int
argc
,
char
**
argv
);
static
int
Abc_CommandBalance
(
Abc_Frame_t
*
pAbc
,
int
argc
,
char
**
argv
);
static
int
Abc_CommandMuxStruct
(
Abc_Frame_t
*
pAbc
,
int
argc
,
char
**
argv
);
static
int
Abc_CommandMuxStruct
(
Abc_Frame_t
*
pAbc
,
int
argc
,
char
**
argv
);
...
@@ -714,6 +715,7 @@ void Abc_Init( Abc_Frame_t * pAbc )
...
@@ -714,6 +715,7 @@ void Abc_Init( Abc_Frame_t * pAbc )
Cmd_CommandAdd
(
pAbc
,
"Printing"
,
"show_cut"
,
Abc_CommandShowCut
,
0
);
Cmd_CommandAdd
(
pAbc
,
"Printing"
,
"show_cut"
,
Abc_CommandShowCut
,
0
);
Cmd_CommandAdd
(
pAbc
,
"Synthesis"
,
"collapse"
,
Abc_CommandCollapse
,
1
);
Cmd_CommandAdd
(
pAbc
,
"Synthesis"
,
"collapse"
,
Abc_CommandCollapse
,
1
);
Cmd_CommandAdd
(
pAbc
,
"Synthesis"
,
"satclp"
,
Abc_CommandSatClp
,
1
);
Cmd_CommandAdd
(
pAbc
,
"Synthesis"
,
"strash"
,
Abc_CommandStrash
,
1
);
Cmd_CommandAdd
(
pAbc
,
"Synthesis"
,
"strash"
,
Abc_CommandStrash
,
1
);
Cmd_CommandAdd
(
pAbc
,
"Synthesis"
,
"balance"
,
Abc_CommandBalance
,
1
);
Cmd_CommandAdd
(
pAbc
,
"Synthesis"
,
"balance"
,
Abc_CommandBalance
,
1
);
Cmd_CommandAdd
(
pAbc
,
"Synthesis"
,
"mux_struct"
,
Abc_CommandMuxStruct
,
1
);
Cmd_CommandAdd
(
pAbc
,
"Synthesis"
,
"mux_struct"
,
Abc_CommandMuxStruct
,
1
);
...
@@ -3079,6 +3081,108 @@ usage:
...
@@ -3079,6 +3081,108 @@ usage:
SeeAlso []
SeeAlso []
***********************************************************************/
***********************************************************************/
int
Abc_CommandSatClp
(
Abc_Frame_t
*
pAbc
,
int
argc
,
char
**
argv
)
{
Abc_Ntk_t
*
pNtk
=
Abc_FrameReadNtk
(
pAbc
),
*
pNtkRes
;
int
nCubeLim
=
1000
;
int
nBTLimit
=
1000000
;
int
fCanon
=
0
;
int
fVerbose
=
0
;
int
c
;
// set defaults
Extra_UtilGetoptReset
();
while
(
(
c
=
Extra_UtilGetopt
(
argc
,
argv
,
"CLcvh"
)
)
!=
EOF
)
{
switch
(
c
)
{
case
'C'
:
if
(
globalUtilOptind
>=
argc
)
{
Abc_Print
(
-
1
,
"Command line switch
\"
-C
\"
should be followed by an integer.
\n
"
);
goto
usage
;
}
nCubeLim
=
atoi
(
argv
[
globalUtilOptind
]);
globalUtilOptind
++
;
if
(
nCubeLim
<
0
)
goto
usage
;
break
;
case
'L'
:
if
(
globalUtilOptind
>=
argc
)
{
Abc_Print
(
-
1
,
"Command line switch
\"
-L
\"
should be followed by an integer.
\n
"
);
goto
usage
;
}
nBTLimit
=
atoi
(
argv
[
globalUtilOptind
]);
globalUtilOptind
++
;
if
(
nBTLimit
<
0
)
goto
usage
;
break
;
case
'c'
:
fCanon
^=
1
;
break
;
case
'v'
:
fVerbose
^=
1
;
break
;
case
'h'
:
goto
usage
;
default:
goto
usage
;
}
}
if
(
pNtk
==
NULL
)
{
Abc_Print
(
-
1
,
"Empty network.
\n
"
);
return
1
;
}
if
(
!
Abc_NtkIsLogic
(
pNtk
)
&&
!
Abc_NtkIsStrash
(
pNtk
)
)
{
Abc_Print
(
-
1
,
"Can only collapse a logic network or an AIG.
\n
"
);
return
1
;
}
// get the new network
if
(
Abc_NtkIsStrash
(
pNtk
)
)
pNtkRes
=
Abc_NtkCollapseSat
(
pNtk
,
nCubeLim
,
nBTLimit
,
fCanon
,
fVerbose
);
else
{
pNtk
=
Abc_NtkStrash
(
pNtk
,
0
,
0
,
0
);
pNtkRes
=
Abc_NtkCollapseSat
(
pNtk
,
nCubeLim
,
nBTLimit
,
fCanon
,
fVerbose
);
Abc_NtkDelete
(
pNtk
);
}
if
(
pNtkRes
==
NULL
)
{
Abc_Print
(
-
1
,
"Collapsing has failed.
\n
"
);
return
1
;
}
// replace the current network
Abc_FrameReplaceCurrentNetwork
(
pAbc
,
pNtkRes
);
return
0
;
usage:
Abc_Print
(
-
2
,
"usage: satclp [-CL num] [-cvh]
\n
"
);
Abc_Print
(
-
2
,
"
\t
performs SAT based collapsing
\n
"
);
Abc_Print
(
-
2
,
"
\t
-C num : the limit on the SOP size of one output [default = %d]
\n
"
,
nCubeLim
);
Abc_Print
(
-
2
,
"
\t
-L num : the limit on the number of conflicts in one SAT call [default = %d]
\n
"
,
nBTLimit
);
Abc_Print
(
-
2
,
"
\t
-c : toggles using canonical ISOP computation [default = %s]
\n
"
,
fCanon
?
"yes"
:
"no"
);
Abc_Print
(
-
2
,
"
\t
-v : toggles 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_CommandStrash
(
Abc_Frame_t
*
pAbc
,
int
argc
,
char
**
argv
)
int
Abc_CommandStrash
(
Abc_Frame_t
*
pAbc
,
int
argc
,
char
**
argv
)
{
{
Abc_Ntk_t
*
pNtk
,
*
pNtkRes
;
Abc_Ntk_t
*
pNtk
,
*
pNtkRes
;
...
@@ -37135,19 +37239,23 @@ usage:
...
@@ -37135,19 +37239,23 @@ usage:
***********************************************************************/
***********************************************************************/
int
Abc_CommandAbc9SatClp
(
Abc_Frame_t
*
pAbc
,
int
argc
,
char
**
argv
)
int
Abc_CommandAbc9SatClp
(
Abc_Frame_t
*
pAbc
,
int
argc
,
char
**
argv
)
{
{
extern
int
Bmc_CollapseOne
(
Gia_Man_t
*
p
,
int
nCubeLim
,
int
nBTLimit
,
int
fVerbose
);
extern
Vec_Str_t
*
Bmc_CollapseOne
(
Gia_Man_t
*
p
,
int
nCubeLim
,
int
nBTLimit
,
int
fCanon
,
int
fVerbose
);
int
nCubeLim
=
1000
;
int
nCubeLim
=
1000
;
int
nBTLimit
=
1000000
;
int
nBTLimit
=
1000000
;
int
c
,
fVerbose
=
0
;
int
fCanon
=
0
;
int
fVerbose
=
0
;
int
c
;
Vec_Str_t
*
vSop
;
Extra_UtilGetoptReset
();
Extra_UtilGetoptReset
();
while
(
(
c
=
Extra_UtilGetopt
(
argc
,
argv
,
"
LC
vh"
)
)
!=
EOF
)
while
(
(
c
=
Extra_UtilGetopt
(
argc
,
argv
,
"
CLc
vh"
)
)
!=
EOF
)
{
{
switch
(
c
)
switch
(
c
)
{
{
case
'
L
'
:
case
'
C
'
:
if
(
globalUtilOptind
>=
argc
)
if
(
globalUtilOptind
>=
argc
)
{
{
Abc_Print
(
-
1
,
"Command line switch
\"
-
L
\"
should be followed by an integer.
\n
"
);
Abc_Print
(
-
1
,
"Command line switch
\"
-
C
\"
should be followed by an integer.
\n
"
);
goto
usage
;
goto
usage
;
}
}
nCubeLim
=
atoi
(
argv
[
globalUtilOptind
]);
nCubeLim
=
atoi
(
argv
[
globalUtilOptind
]);
...
@@ -37155,10 +37263,10 @@ int Abc_CommandAbc9SatClp( Abc_Frame_t * pAbc, int argc, char ** argv )
...
@@ -37155,10 +37263,10 @@ int Abc_CommandAbc9SatClp( Abc_Frame_t * pAbc, int argc, char ** argv )
if
(
nCubeLim
<
0
)
if
(
nCubeLim
<
0
)
goto
usage
;
goto
usage
;
break
;
break
;
case
'
C
'
:
case
'
L
'
:
if
(
globalUtilOptind
>=
argc
)
if
(
globalUtilOptind
>=
argc
)
{
{
Abc_Print
(
-
1
,
"Command line switch
\"
-
C
\"
should be followed by an integer.
\n
"
);
Abc_Print
(
-
1
,
"Command line switch
\"
-
L
\"
should be followed by an integer.
\n
"
);
goto
usage
;
goto
usage
;
}
}
nBTLimit
=
atoi
(
argv
[
globalUtilOptind
]);
nBTLimit
=
atoi
(
argv
[
globalUtilOptind
]);
...
@@ -37166,6 +37274,9 @@ int Abc_CommandAbc9SatClp( Abc_Frame_t * pAbc, int argc, char ** argv )
...
@@ -37166,6 +37274,9 @@ int Abc_CommandAbc9SatClp( Abc_Frame_t * pAbc, int argc, char ** argv )
if
(
nBTLimit
<
0
)
if
(
nBTLimit
<
0
)
goto
usage
;
goto
usage
;
break
;
break
;
case
'c'
:
fCanon
^=
1
;
break
;
case
'v'
:
case
'v'
:
fVerbose
^=
1
;
fVerbose
^=
1
;
break
;
break
;
...
@@ -37180,14 +37291,16 @@ int Abc_CommandAbc9SatClp( Abc_Frame_t * pAbc, int argc, char ** argv )
...
@@ -37180,14 +37291,16 @@ int Abc_CommandAbc9SatClp( Abc_Frame_t * pAbc, int argc, char ** argv )
Abc_Print
(
-
1
,
"Abc_CommandAbc9SatClp(): There is no AIG.
\n
"
);
Abc_Print
(
-
1
,
"Abc_CommandAbc9SatClp(): There is no AIG.
\n
"
);
return
0
;
return
0
;
}
}
Bmc_CollapseOne
(
pAbc
->
pGia
,
nCubeLim
,
nBTLimit
,
fVerbose
);
vSop
=
Bmc_CollapseOne
(
pAbc
->
pGia
,
nCubeLim
,
nBTLimit
,
fCanon
,
fVerbose
);
Vec_StrFree
(
vSop
);
return
0
;
return
0
;
usage:
usage:
Abc_Print
(
-
2
,
"usage: &satclp [-
LC num] [-
vh]
\n
"
);
Abc_Print
(
-
2
,
"usage: &satclp [-
CL num] [-c
vh]
\n
"
);
Abc_Print
(
-
2
,
"
\t
performs SAT based collapsing
\n
"
);
Abc_Print
(
-
2
,
"
\t
performs SAT based collapsing
\n
"
);
Abc_Print
(
-
2
,
"
\t
-L num : the limit on the SOP size of one output [default = %d]
\n
"
,
nCubeLim
);
Abc_Print
(
-
2
,
"
\t
-C num : the limit on the SOP size of one output [default = %d]
\n
"
,
nCubeLim
);
Abc_Print
(
-
2
,
"
\t
-C num : the limit on the number of conflicts in one call [default = %d]
\n
"
,
nBTLimit
);
Abc_Print
(
-
2
,
"
\t
-L num : the limit on the number of conflicts in one SAT call [default = %d]
\n
"
,
nBTLimit
);
Abc_Print
(
-
2
,
"
\t
-c : toggles using canonical ISOP computation [default = %s]
\n
"
,
fCanon
?
"yes"
:
"no"
);
Abc_Print
(
-
2
,
"
\t
-v : toggles printing verbose information [default = %s]
\n
"
,
fVerbose
?
"yes"
:
"no"
);
Abc_Print
(
-
2
,
"
\t
-v : toggles printing verbose information [default = %s]
\n
"
,
fVerbose
?
"yes"
:
"no"
);
Abc_Print
(
-
2
,
"
\t
-h : print the command usage
\n
"
);
Abc_Print
(
-
2
,
"
\t
-h : print the command usage
\n
"
);
return
1
;
return
1
;
src/base/abci/abcCollapse.c
View file @
a207f6c0
This diff is collapsed.
Click to expand it.
src/sat/bmc/bmcClp.c
View file @
a207f6c0
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