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
f765e666
Commit
f765e666
authored
Apr 02, 2017
by
Alan Mishchenko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Experiments with don't-cares.
parent
3898ba54
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
59 additions
and
34 deletions
+59
-34
src/base/abci/abc.c
+16
-16
src/base/acb/acb.h
+4
-1
src/base/acb/acbAbc.c
+2
-3
src/base/acb/acbMfs.c
+0
-0
src/base/acb/acbPar.h
+1
-2
src/base/acb/acbUtil.c
+27
-3
src/opt/sfm/sfmCore.c
+2
-2
src/sat/bsat/satUtil.c
+2
-2
src/sat/cnf/cnf.h
+1
-1
src/sat/cnf/cnfMan.c
+4
-4
No files found.
src/base/abci/abc.c
View file @
f765e666
...
...
@@ -5676,41 +5676,41 @@ int Abc_CommandMfse( Abc_Frame_t * pAbc, int argc, char ** argv )
Acb_Par_t
Pars
,
*
pPars
=
&
Pars
;
int
c
;
Acb_ParSetDefault
(
pPars
);
Extra_UtilGetoptReset
();
while
(
(
c
=
Extra_UtilGetopt
(
argc
,
argv
,
"
MDO
FLCavwh"
)
)
!=
EOF
)
while
(
(
c
=
Extra_UtilGetopt
(
argc
,
argv
,
"
IOW
FLCavwh"
)
)
!=
EOF
)
{
switch
(
c
)
{
case
'
M
'
:
case
'
I
'
:
if
(
globalUtilOptind
>=
argc
)
{
Abc_Print
(
-
1
,
"Command line switch
\"
-
M
\"
should be followed by an integer.
\n
"
);
Abc_Print
(
-
1
,
"Command line switch
\"
-
I
\"
should be followed by an integer.
\n
"
);
goto
usage
;
}
pPars
->
nT
aboo
Max
=
atoi
(
argv
[
globalUtilOptind
]);
pPars
->
nT
fiLev
Max
=
atoi
(
argv
[
globalUtilOptind
]);
globalUtilOptind
++
;
if
(
pPars
->
nT
aboo
Max
<
0
)
if
(
pPars
->
nT
fiLev
Max
<
0
)
goto
usage
;
break
;
case
'
D
'
:
case
'
O
'
:
if
(
globalUtilOptind
>=
argc
)
{
Abc_Print
(
-
1
,
"Command line switch
\"
-
D
\"
should be followed by an integer.
\n
"
);
Abc_Print
(
-
1
,
"Command line switch
\"
-
O
\"
should be followed by an integer.
\n
"
);
goto
usage
;
}
pPars
->
n
Di
vMax
=
atoi
(
argv
[
globalUtilOptind
]);
pPars
->
n
TfoLe
vMax
=
atoi
(
argv
[
globalUtilOptind
]);
globalUtilOptind
++
;
if
(
pPars
->
n
Di
vMax
<
0
)
if
(
pPars
->
n
TfoLe
vMax
<
0
)
goto
usage
;
break
;
case
'
O
'
:
case
'
W
'
:
if
(
globalUtilOptind
>=
argc
)
{
Abc_Print
(
-
1
,
"Command line switch
\"
-
O
\"
should be followed by an integer.
\n
"
);
Abc_Print
(
-
1
,
"Command line switch
\"
-
W
\"
should be followed by an integer.
\n
"
);
goto
usage
;
}
pPars
->
n
TfoLev
Max
=
atoi
(
argv
[
globalUtilOptind
]);
pPars
->
n
WinNode
Max
=
atoi
(
argv
[
globalUtilOptind
]);
globalUtilOptind
++
;
if
(
pPars
->
n
TfoLev
Max
<
0
)
if
(
pPars
->
n
WinNode
Max
<
0
)
goto
usage
;
break
;
case
'F'
:
...
...
@@ -5788,11 +5788,11 @@ int Abc_CommandMfse( Abc_Frame_t * pAbc, int argc, char ** argv )
return
0
;
usage:
Abc_Print
(
-
2
,
"usage: mfse [-
MDO
FLC <num>] [-avwh]
\n
"
);
Abc_Print
(
-
2
,
"usage: mfse [-
IOW
FLC <num>] [-avwh]
\n
"
);
Abc_Print
(
-
2
,
"
\t
performs don't-care-based optimization of logic networks
\n
"
);
Abc_Print
(
-
2
,
"
\t
-M <num> : the max number of fanin nodes to skip (num >= 1) [default = %d]
\n
"
,
pPars
->
nTabooMax
);
Abc_Print
(
-
2
,
"
\t
-D <num> : the max number of divisors [default = %d]
\n
"
,
pPars
->
nDivMax
);
Abc_Print
(
-
2
,
"
\t
-I <num> : the number of levels in the TFI cone (2 <= num) [default = %d]
\n
"
,
pPars
->
nTfiLevMax
);
Abc_Print
(
-
2
,
"
\t
-O <num> : the number of levels in the TFO cone (0 <= num) [default = %d]
\n
"
,
pPars
->
nTfoLevMax
);
Abc_Print
(
-
2
,
"
\t
-W <num> : the max number of nodes in the window (1 <= num) [default = %d]
\n
"
,
pPars
->
nWinNodeMax
);
Abc_Print
(
-
2
,
"
\t
-F <num> : the max number of fanouts to skip (1 <= num) [default = %d]
\n
"
,
pPars
->
nFanoutMax
);
Abc_Print
(
-
2
,
"
\t
-L <num> : the max increase in node level after resynthesis (0 <= num) [default = %d]
\n
"
,
pPars
->
nGrowthLevel
);
Abc_Print
(
-
2
,
"
\t
-C <num> : the max number of conflicts in one SAT run (0 = no limit) [default = %d]
\n
"
,
pPars
->
nBTLimit
);
src/base/acb/acb.h
View file @
f765e666
...
...
@@ -503,7 +503,10 @@ static inline void Acb_ObjRemoveFaninFanout( Acb_Ntk_t * p, int iObj )
{
int
k
,
iFanin
,
*
pFanins
;
Acb_ObjForEachFaninFast
(
p
,
iObj
,
pFanins
,
iFanin
,
k
)
Vec_IntRemove
(
Vec_WecEntry
(
&
p
->
vFanouts
,
iFanin
),
iObj
);
{
int
RetValue
=
Vec_IntRemove
(
Vec_WecEntry
(
&
p
->
vFanouts
,
iFanin
),
iObj
);
assert
(
RetValue
);
}
}
static
inline
void
Acb_NtkCreateFanout
(
Acb_Ntk_t
*
p
)
{
...
...
src/base/acb/acbAbc.c
View file @
f765e666
...
...
@@ -210,10 +210,9 @@ void Acb_ParSetDefault( Acb_Par_t * pPars )
memset
(
pPars
,
0
,
sizeof
(
Acb_Par_t
)
);
pPars
->
nLutSize
=
4
;
// LUT size
pPars
->
nTfoLevMax
=
2
;
// the maximum fanout levels
pPars
->
nTfiLevMax
=
2
;
// the maximum fanin levels
pPars
->
nTfiLevMax
=
3
;
// the maximum fanin levels
pPars
->
nFanoutMax
=
20
;
// the maximum number of fanouts
pPars
->
nDivMax
=
24
;
// the maximum divisor count
pPars
->
nTabooMax
=
1
;
// the minimum MFFC size
pPars
->
nWinNodeMax
=
100
;
// the maximum number of nodes in the window
pPars
->
nGrowthLevel
=
0
;
// the maximum allowed growth in level
pPars
->
nBTLimit
=
0
;
// the maximum number of conflicts in one SAT run
pPars
->
nNodesMax
=
0
;
// the maximum number of nodes to try
...
...
src/base/acb/acbMfs.c
View file @
f765e666
This diff is collapsed.
Click to expand it.
src/base/acb/acbPar.h
View file @
f765e666
...
...
@@ -42,8 +42,7 @@ struct Acb_Par_t_
int
nTfoLevMax
;
// the maximum fanout levels
int
nTfiLevMax
;
// the maximum fanin levels
int
nFanoutMax
;
// the maximum number of fanouts
int
nDivMax
;
// the maximum divisor count
int
nTabooMax
;
// the minimum MFFC size
int
nWinNodeMax
;
// the maximum number of nodes in the window
int
nGrowthLevel
;
// the maximum allowed growth in level
int
nBTLimit
;
// the maximum number of conflicts in one SAT run
int
nNodesMax
;
// the maximum number of nodes to try
...
...
src/base/acb/acbUtil.c
View file @
f765e666
...
...
@@ -308,14 +308,38 @@ void Acb_NtkCreateNode( Acb_Ntk_t * p, word uTruth, Vec_Int_t * vSupp )
Acb_ObjAddFaninFanout
(
p
,
Pivot
);
Acb_ObjComputeLevelD
(
p
,
Pivot
);
}
void
Acb_Ntk
Update
Node
(
Acb_Ntk_t
*
p
,
int
Pivot
,
word
uTruth
,
Vec_Int_t
*
vSupp
)
void
Acb_Ntk
Reset
Node
(
Acb_Ntk_t
*
p
,
int
Pivot
,
word
uTruth
,
Vec_Int_t
*
vSupp
)
{
// remember old fanins
int
k
,
iFanin
,
*
pFanins
;
Vec_Int_t
*
vFanins
=
Vec_IntAlloc
(
6
);
assert
(
!
Acb_ObjIsCio
(
p
,
Pivot
)
);
Acb_ObjForEachFaninFast
(
p
,
Pivot
,
pFanins
,
iFanin
,
k
)
Vec_IntPush
(
vFanins
,
iFanin
);
// update function
Vec_WrdSetEntry
(
&
p
->
vObjTruth
,
Pivot
,
uTruth
);
Vec_IntErase
(
Vec_WecEntry
(
&
p
->
vCnfs
,
Pivot
)
);
// remove old fanins
Acb_ObjRemoveFaninFanout
(
p
,
Pivot
);
Acb_ObjRemoveFanins
(
p
,
Pivot
);
Acb_ObjAddFanins
(
p
,
Pivot
,
vSupp
);
Acb_ObjAddFaninFanout
(
p
,
Pivot
);
// add new fanins
if
(
vSupp
!=
NULL
)
{
assert
(
Acb_ObjFanoutNum
(
p
,
Pivot
)
>
0
);
Acb_ObjAddFanins
(
p
,
Pivot
,
vSupp
);
Acb_ObjAddFaninFanout
(
p
,
Pivot
);
}
else
if
(
Acb_ObjFanoutNum
(
p
,
Pivot
)
==
0
)
Acb_ObjCleanType
(
p
,
Pivot
);
// delete dangling fanins
Vec_IntForEachEntry
(
vFanins
,
iFanin
,
k
)
if
(
!
Acb_ObjIsCio
(
p
,
iFanin
)
&&
Acb_ObjFanoutNum
(
p
,
iFanin
)
==
0
)
Acb_NtkResetNode
(
p
,
iFanin
,
0
,
NULL
);
Vec_IntFree
(
vFanins
);
}
void
Acb_NtkUpdateNode
(
Acb_Ntk_t
*
p
,
int
Pivot
,
word
uTruth
,
Vec_Int_t
*
vSupp
)
{
Acb_NtkResetNode
(
p
,
Pivot
,
uTruth
,
vSupp
);
if
(
p
->
vQue
==
NULL
)
Acb_NtkUpdateLevelD
(
p
,
Pivot
);
else
...
...
src/opt/sfm/sfmCore.c
View file @
f765e666
...
...
@@ -73,8 +73,8 @@ void Sfm_ParSetDefault( Sfm_Par_t * pPars )
void
Sfm_NtkPrintStats
(
Sfm_Ntk_t
*
p
)
{
p
->
timeOther
=
p
->
timeTotal
-
p
->
timeWin
-
p
->
timeDiv
-
p
->
timeCnf
-
p
->
timeSat
;
printf
(
"Nodes = %d. Try = %d. Resub = %d. Div = %d. SAT calls = %d. Timeouts = %d. MaxDivs = %d.
\n
"
,
Sfm_NtkNodeNum
(
p
),
p
->
nNodesTried
,
p
->
nRemoves
+
p
->
nResubs
,
p
->
nTotalDivs
,
p
->
nSatCalls
,
p
->
nTimeOuts
,
p
->
nMaxDivs
);
printf
(
"Nodes = %d. Try = %d. Resub = %d. Div = %d
(ave = %d)
. SAT calls = %d. Timeouts = %d. MaxDivs = %d.
\n
"
,
Sfm_NtkNodeNum
(
p
),
p
->
nNodesTried
,
p
->
nRemoves
+
p
->
nResubs
,
p
->
nTotalDivs
,
p
->
n
TotalDivs
/
Abc_MaxInt
(
1
,
p
->
nNodesTried
),
p
->
n
SatCalls
,
p
->
nTimeOuts
,
p
->
nMaxDivs
);
printf
(
"Attempts : "
);
printf
(
"Remove %6d out of %6d (%6.2f %%) "
,
p
->
nRemoves
,
p
->
nTryRemoves
,
100
.
0
*
p
->
nRemoves
/
Abc_MaxInt
(
1
,
p
->
nTryRemoves
)
);
...
...
src/sat/bsat/satUtil.c
View file @
f765e666
...
...
@@ -85,7 +85,7 @@ void Sat_SolverWriteDimacs( sat_solver * p, char * pFileName, lit* assumpBegin,
nUnits
++
;
// start the file
pFile
=
fopen
(
pFileName
,
"wb"
)
;
pFile
=
pFileName
?
fopen
(
pFileName
,
"wb"
)
:
stdout
;
if
(
pFile
==
NULL
)
{
printf
(
"Sat_SolverWriteDimacs(): Cannot open the ouput file.
\n
"
);
...
...
@@ -121,7 +121,7 @@ void Sat_SolverWriteDimacs( sat_solver * p, char * pFileName, lit* assumpBegin,
}
fprintf
(
pFile
,
"
\n
"
);
fclose
(
pFile
);
if
(
pFileName
)
fclose
(
pFile
);
}
void
Sat_Solver2WriteDimacs
(
sat_solver2
*
p
,
char
*
pFileName
,
lit
*
assumpBegin
,
lit
*
assumpEnd
,
int
incrementVars
)
{
...
...
src/sat/cnf/cnf.h
View file @
f765e666
...
...
@@ -156,7 +156,7 @@ extern Cnf_Dat_t * Cnf_DataAlloc( Aig_Man_t * pAig, int nVars, int nClauses,
extern
Cnf_Dat_t
*
Cnf_DataDup
(
Cnf_Dat_t
*
p
);
extern
void
Cnf_DataFree
(
Cnf_Dat_t
*
p
);
extern
void
Cnf_DataLift
(
Cnf_Dat_t
*
p
,
int
nVarsPlus
);
extern
Vec_Int_t
*
Cnf_DataCollectFlipLits
(
Cnf_Dat_t
*
p
,
int
iFlipVar
);
extern
void
Cnf_DataCollectFlipLits
(
Cnf_Dat_t
*
p
,
int
iFlipVar
,
Vec_Int_t
*
vFlips
);
extern
void
Cnf_DataLiftAndFlipLits
(
Cnf_Dat_t
*
p
,
int
nVarsPlus
,
Vec_Int_t
*
vLits
);
extern
void
Cnf_DataPrint
(
Cnf_Dat_t
*
p
,
int
fReadable
);
extern
void
Cnf_DataWriteIntoFile
(
Cnf_Dat_t
*
p
,
char
*
pFileName
,
int
fReadable
,
Vec_Int_t
*
vForAlls
,
Vec_Int_t
*
vExists
);
...
...
src/sat/cnf/cnfMan.c
View file @
f765e666
...
...
@@ -215,14 +215,14 @@ void Cnf_DataLift( Cnf_Dat_t * p, int nVarsPlus )
for
(
v
=
0
;
v
<
p
->
nLiterals
;
v
++
)
p
->
pClauses
[
0
][
v
]
+=
2
*
nVarsPlus
;
}
Vec_Int_t
*
Cnf_DataCollectFlipLits
(
Cnf_Dat_t
*
p
,
int
iFlipVar
)
void
Cnf_DataCollectFlipLits
(
Cnf_Dat_t
*
p
,
int
iFlipVar
,
Vec_Int_t
*
vFlips
)
{
Vec_Int_t
*
vLits
=
Vec_IntAlloc
(
100
);
int
v
;
int
v
;
assert
(
p
->
pMan
==
NULL
);
Vec_IntClear
(
vFlips
);
for
(
v
=
0
;
v
<
p
->
nLiterals
;
v
++
)
if
(
Abc_Lit2Var
(
p
->
pClauses
[
0
][
v
])
==
iFlipVar
)
Vec_IntPush
(
vLits
,
v
);
return
vLits
;
Vec_IntPush
(
vFlips
,
v
);
}
void
Cnf_DataLiftAndFlipLits
(
Cnf_Dat_t
*
p
,
int
nVarsPlus
,
Vec_Int_t
*
vLits
)
{
...
...
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