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
6da21b8b
Commit
6da21b8b
authored
Mar 05, 2015
by
Alan Mishchenko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Experiments with SAT-based cube enumeration.
parent
ddc522a0
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
133 additions
and
33 deletions
+133
-33
abclib.dsp
+4
-0
src/aig/gia/giaDup.c
+33
-0
src/aig/gia/giaMf.c
+2
-2
src/aig/gia/giaQbf.c
+3
-3
src/base/abci/abc.c
+68
-0
src/map/if/ifSat.c
+4
-3
src/sat/bmc/bmcEco.c
+0
-6
src/sat/bmc/bmcFx.c
+0
-0
src/sat/bsat/satSolver.h
+19
-19
No files found.
abclib.dsp
View file @
6da21b8b
...
...
@@ -1583,6 +1583,10 @@ SOURCE=.\src\sat\bmc\bmcFault.c
# End Source File
# Begin Source File
SOURCE=.\src\sat\bmc\bmcFx.c
# End Source File
# Begin Source File
SOURCE=.\src\sat\bmc\bmcICheck.c
# End Source File
# Begin Source File
...
...
src/aig/gia/giaDup.c
View file @
6da21b8b
...
...
@@ -426,6 +426,39 @@ Gia_Man_t * Gia_ManDupOrderAiger( Gia_Man_t * p )
SeeAlso []
***********************************************************************/
Gia_Man_t
*
Gia_ManDupOnsetOffset
(
Gia_Man_t
*
p
)
{
Gia_Man_t
*
pNew
;
Gia_Obj_t
*
pObj
;
int
i
;
pNew
=
Gia_ManStart
(
Gia_ManObjNum
(
p
)
);
pNew
->
pName
=
Abc_UtilStrsav
(
p
->
pName
);
pNew
->
pSpec
=
Abc_UtilStrsav
(
p
->
pSpec
);
Gia_ManConst0
(
p
)
->
Value
=
0
;
Gia_ManForEachCi
(
p
,
pObj
,
i
)
pObj
->
Value
=
Gia_ManAppendCi
(
pNew
);
Gia_ManForEachAnd
(
p
,
pObj
,
i
)
pObj
->
Value
=
Gia_ManAppendAnd
(
pNew
,
Gia_ObjFanin0Copy
(
pObj
),
Gia_ObjFanin1Copy
(
pObj
)
);
Gia_ManForEachCo
(
p
,
pObj
,
i
)
{
pObj
->
Value
=
Gia_ManAppendCo
(
pNew
,
Gia_ObjFanin0Copy
(
pObj
)
);
pObj
->
Value
=
Gia_ManAppendCo
(
pNew
,
Abc_LitNot
(
Gia_ObjFanin0Copy
(
pObj
))
);
}
Gia_ManSetRegNum
(
pNew
,
Gia_ManRegNum
(
p
)
);
return
pNew
;
}
/**Function*************************************************************
Synopsis [Duplicates AIG while putting first PIs, then nodes, then POs.]
Description []
SideEffects []
SeeAlso []
***********************************************************************/
Gia_Man_t
*
Gia_ManDupLastPis
(
Gia_Man_t
*
p
,
int
nLastPis
)
{
Gia_Man_t
*
pNew
;
...
...
src/aig/gia/giaMf.c
View file @
6da21b8b
...
...
@@ -346,9 +346,9 @@ Cnf_Dat_t * Mf_ManDeriveCnf( Mf_Man_t * p, int fCnfObjIds, int fAddOrCla )
Gia_ManForEachAndReverseId
(
p
->
pGia
,
Id
)
if
(
Mf_ObjMapRefNum
(
p
,
Id
)
)
Vec_IntWriteEntry
(
vCnfIds
,
Id
,
Id
),
iVar
++
;
Vec_IntWriteEntry
(
vCnfIds
,
0
,
0
);
Gia_ManForEachCiId
(
p
->
pGia
,
Id
,
i
)
Vec_IntWriteEntry
(
vCnfIds
,
Id
,
Id
);
Vec_IntWriteEntry
(
vCnfIds
,
0
,
0
);
assert
(
iVar
==
nVars
);
}
else
...
...
@@ -358,9 +358,9 @@ Cnf_Dat_t * Mf_ManDeriveCnf( Mf_Man_t * p, int fCnfObjIds, int fAddOrCla )
Gia_ManForEachAndReverseId
(
p
->
pGia
,
Id
)
if
(
Mf_ObjMapRefNum
(
p
,
Id
)
)
Vec_IntWriteEntry
(
vCnfIds
,
Id
,
iVar
++
);
Vec_IntWriteEntry
(
vCnfIds
,
0
,
iVar
++
);
Gia_ManForEachCiId
(
p
->
pGia
,
Id
,
i
)
Vec_IntWriteEntry
(
vCnfIds
,
Id
,
iVar
++
);
Vec_IntWriteEntry
(
vCnfIds
,
0
,
iVar
++
);
assert
(
iVar
==
nVars
);
}
// generate CNF
...
...
src/aig/gia/giaQbf.c
View file @
6da21b8b
...
...
@@ -75,7 +75,7 @@ int Gia_ManSatEnum( Gia_Man_t * pGia, int nConfLimit, int nTimeOut, int fVerbose
abctime
clkStart
=
Abc_Clock
();
pCnf
=
Mf_ManGenerateCnf
(
pGia
,
8
,
0
,
1
,
0
);
pSat
=
(
sat_solver
*
)
Cnf_DataWriteIntoSolver
(
pCnf
,
1
,
0
);
iParVarBeg
=
pCnf
->
nVars
-
Gia_ManPiNum
(
pGia
)
-
1
;
iParVarBeg
=
pCnf
->
nVars
-
Gia_ManPiNum
(
pGia
)
;
//
- 1;
Cnf_DataFree
(
pCnf
);
// iterate through the SAT assignment
vLits
=
Vec_IntAlloc
(
Gia_ManPiNum
(
pGia
)
);
...
...
@@ -180,7 +180,7 @@ Qbf_Man_t * Gia_QbfAlloc( Gia_Man_t * pGia, int nPars, int fVerbose )
p
->
nPars
=
nPars
;
p
->
nVars
=
Gia_ManPiNum
(
pGia
)
-
nPars
;
p
->
fVerbose
=
fVerbose
;
p
->
iParVarBeg
=
pCnf
->
nVars
-
Gia_ManPiNum
(
pGia
)
-
1
;
p
->
iParVarBeg
=
pCnf
->
nVars
-
Gia_ManPiNum
(
pGia
)
;
//
- 1;
p
->
pSatVer
=
(
sat_solver
*
)
Cnf_DataWriteIntoSolver
(
pCnf
,
1
,
0
);
p
->
pSatSyn
=
sat_solver_new
();
p
->
vValues
=
Vec_IntAlloc
(
Gia_ManPiNum
(
pGia
)
);
...
...
@@ -280,7 +280,7 @@ Gia_Man_t * Gia_QbfCofactor( Gia_Man_t * p, int nPars, Vec_Int_t * vValues, Vec_
int
Gia_QbfAddCofactor
(
Qbf_Man_t
*
p
,
Gia_Man_t
*
pCof
)
{
Cnf_Dat_t
*
pCnf
=
Mf_ManGenerateCnf
(
pCof
,
8
,
0
,
1
,
0
);
int
i
,
iFirstVar
=
sat_solver_nvars
(
p
->
pSatSyn
)
+
pCnf
->
nVars
-
Gia_ManPiNum
(
pCof
)
-
1
;
int
i
,
iFirstVar
=
sat_solver_nvars
(
p
->
pSatSyn
)
+
pCnf
->
nVars
-
Gia_ManPiNum
(
pCof
)
;
//
- 1;
pCnf
->
pMan
=
NULL
;
Cnf_DataLift
(
pCnf
,
sat_solver_nvars
(
p
->
pSatSyn
)
);
for
(
i
=
0
;
i
<
pCnf
->
nClauses
;
i
++
)
...
...
src/base/abci/abc.c
View file @
6da21b8b
...
...
@@ -437,6 +437,7 @@ static int Abc_CommandAbc9ICheck ( Abc_Frame_t * pAbc, int argc, cha
static
int
Abc_CommandAbc9SatTest
(
Abc_Frame_t
*
pAbc
,
int
argc
,
char
**
argv
);
static
int
Abc_CommandAbc9FFTest
(
Abc_Frame_t
*
pAbc
,
int
argc
,
char
**
argv
);
static
int
Abc_CommandAbc9Qbf
(
Abc_Frame_t
*
pAbc
,
int
argc
,
char
**
argv
);
static
int
Abc_CommandAbc9SatFx
(
Abc_Frame_t
*
pAbc
,
int
argc
,
char
**
argv
);
static
int
Abc_CommandAbc9Inse
(
Abc_Frame_t
*
pAbc
,
int
argc
,
char
**
argv
);
static
int
Abc_CommandAbc9Maxi
(
Abc_Frame_t
*
pAbc
,
int
argc
,
char
**
argv
);
static
int
Abc_CommandAbc9Bmci
(
Abc_Frame_t
*
pAbc
,
int
argc
,
char
**
argv
);
...
...
@@ -1043,6 +1044,7 @@ void Abc_Init( Abc_Frame_t * pAbc )
Cmd_CommandAdd
(
pAbc
,
"ABC9"
,
"&sattest"
,
Abc_CommandAbc9SatTest
,
0
);
Cmd_CommandAdd
(
pAbc
,
"ABC9"
,
"&fftest"
,
Abc_CommandAbc9FFTest
,
0
);
Cmd_CommandAdd
(
pAbc
,
"ABC9"
,
"&qbf"
,
Abc_CommandAbc9Qbf
,
0
);
Cmd_CommandAdd
(
pAbc
,
"ABC9"
,
"&satfx"
,
Abc_CommandAbc9SatFx
,
0
);
Cmd_CommandAdd
(
pAbc
,
"ABC9"
,
"&inse"
,
Abc_CommandAbc9Inse
,
0
);
Cmd_CommandAdd
(
pAbc
,
"ABC9"
,
"&maxi"
,
Abc_CommandAbc9Maxi
,
0
);
Cmd_CommandAdd
(
pAbc
,
"ABC9"
,
"&bmci"
,
Abc_CommandAbc9Bmci
,
0
);
...
...
@@ -36545,6 +36547,72 @@ usage:
SeeAlso []
***********************************************************************/
int
Abc_CommandAbc9SatFx
(
Abc_Frame_t
*
pAbc
,
int
argc
,
char
**
argv
)
{
extern
int
Bmc_FxCompute
(
Gia_Man_t
*
p
);
extern
int
Bmc_FxComputeOne
(
Gia_Man_t
*
p
);
int
c
,
nFrames
=
1000
,
fDec
=
0
,
fVerbose
=
0
;
Extra_UtilGetoptReset
();
while
(
(
c
=
Extra_UtilGetopt
(
argc
,
argv
,
"Fdvh"
)
)
!=
EOF
)
{
switch
(
c
)
{
case
'F'
:
if
(
globalUtilOptind
>=
argc
)
{
Abc_Print
(
-
1
,
"Command line switch
\"
-F
\"
should be followed by an integer.
\n
"
);
goto
usage
;
}
nFrames
=
atoi
(
argv
[
globalUtilOptind
]);
globalUtilOptind
++
;
if
(
nFrames
<
0
)
goto
usage
;
break
;
case
'd'
:
fDec
^=
1
;
break
;
case
'v'
:
fVerbose
^=
1
;
break
;
case
'h'
:
goto
usage
;
default:
goto
usage
;
}
}
if
(
pAbc
->
pGia
==
NULL
)
{
Abc_Print
(
-
1
,
"Abc_CommandAbc9SatFx(): There is no AIG.
\n
"
);
return
0
;
}
if
(
fDec
)
Bmc_FxComputeOne
(
pAbc
->
pGia
);
else
Bmc_FxCompute
(
pAbc
->
pGia
);
return
0
;
usage:
Abc_Print
(
-
2
,
"usage: &satfx [-F num] [-dvh]
\n
"
);
Abc_Print
(
-
2
,
"
\t
performs SAT based shared logic extraction
\n
"
);
Abc_Print
(
-
2
,
"
\t
-F num : the number of timeframes [default = %d]
\n
"
,
nFrames
);
Abc_Print
(
-
2
,
"
\t
-d : toggles decomposing the first output [default = %s]
\n
"
,
fDec
?
"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_CommandAbc9Inse
(
Abc_Frame_t
*
pAbc
,
int
argc
,
char
**
argv
)
{
extern
Vec_Int_t
*
Gia_ManInseTest
(
Gia_Man_t
*
p
,
Vec_Int_t
*
vInit
,
int
nFrames
,
int
nWords
,
int
nTimeOut
,
int
fSim
,
int
fVerbose
);
src/map/if/ifSat.c
View file @
6da21b8b
...
...
@@ -54,10 +54,11 @@ void * If_ManSatBuildXY( int nLutSize )
sat_solver_setnvars
(
p
,
nVars
);
for
(
m
=
0
;
m
<
nMintsF
;
m
++
)
sat_solver_add_mux
(
p
,
iVarM
+
m
,
iVarP0
+
m
%
nMintsL
,
iVarP1
+
2
*
(
m
/
nMintsL
)
+
1
,
iVarP1
+
2
*
(
m
/
nMintsL
),
iVarM
+
m
);
0
,
0
,
0
,
0
);
return
p
;
}
void
*
If_ManSatBuildXYZ
(
int
nLutSize
)
...
...
@@ -73,13 +74,13 @@ void * If_ManSatBuildXYZ( int nLutSize )
sat_solver_setnvars
(
p
,
nVars
);
for
(
m
=
0
;
m
<
nMintsF
;
m
++
)
sat_solver_add_mux41
(
p
,
iVarM
+
m
,
iVarP0
+
m
%
nMintsL
,
iVarP1
+
(
m
>>
nLutSize
)
%
nMintsL
,
iVarP2
+
4
*
(
m
>>
(
2
*
nLutSize
))
+
0
,
iVarP2
+
4
*
(
m
>>
(
2
*
nLutSize
))
+
1
,
iVarP2
+
4
*
(
m
>>
(
2
*
nLutSize
))
+
2
,
iVarP2
+
4
*
(
m
>>
(
2
*
nLutSize
))
+
3
,
iVarM
+
m
);
iVarP2
+
4
*
(
m
>>
(
2
*
nLutSize
))
+
3
);
return
p
;
}
void
If_ManSatUnbuild
(
void
*
p
)
...
...
src/sat/bmc/bmcEco.c
View file @
6da21b8b
...
...
@@ -138,7 +138,6 @@ static inline Cnf_Dat_t * Cnf_DeriveGiaRemapped( Gia_Man_t * p )
int
Bmc_EcoSolve
(
sat_solver
*
pSat
,
int
Root
,
Vec_Int_t
*
vVars
)
{
int
nBTLimit
=
1000000
;
Vec_Int_t
*
vValues
=
Vec_IntAlloc
(
Vec_IntSize
(
vVars
)
);
Vec_Int_t
*
vLits
=
Vec_IntAlloc
(
Vec_IntSize
(
vVars
)
);
int
status
,
i
,
Div
,
iVar
,
nFinal
,
*
pFinal
,
nIter
=
0
,
RetValue
=
0
;
int
pLits
[
2
],
nVars
=
sat_solver_nvars
(
pSat
);
...
...
@@ -154,10 +153,6 @@ int Bmc_EcoSolve( sat_solver * pSat, int Root, Vec_Int_t * vVars )
if
(
status
==
l_False
)
{
RetValue
=
1
;
break
;
}
assert
(
status
==
l_True
);
// remember variable values
Vec_IntClear
(
vValues
);
Vec_IntForEachEntry
(
vVars
,
iVar
,
i
)
Vec_IntPush
(
vValues
,
sat_solver_var_value
(
pSat
,
iVar
)
);
// collect divisor literals
Vec_IntClear
(
vLits
);
Vec_IntPush
(
vLits
,
Abc_LitNot
(
pLits
[
0
])
);
// F = 0
...
...
@@ -189,7 +184,6 @@ int Bmc_EcoSolve( sat_solver * pSat, int Root, Vec_Int_t * vVars )
nIter
++
;
}
// assert( status == l_True );
Vec_IntFree
(
vValues
);
Vec_IntFree
(
vLits
);
return
RetValue
;
}
...
...
src/sat/bmc/bmcFx.c
0 → 100644
View file @
6da21b8b
This diff is collapsed.
Click to expand it.
src/sat/bsat/satSolver.h
View file @
6da21b8b
...
...
@@ -374,53 +374,53 @@ static inline int sat_solver_add_xor( sat_solver * pSat, int iVarA, int iVarB, i
assert
(
Cid
);
return
4
;
}
static
inline
int
sat_solver_add_mux
(
sat_solver
*
pSat
,
int
iVar
C
,
int
iVarT
,
int
iVarE
,
int
iVar
Z
)
static
inline
int
sat_solver_add_mux
(
sat_solver
*
pSat
,
int
iVar
Z
,
int
iVarC
,
int
iVarT
,
int
iVarE
,
int
iComplC
,
int
iComplT
,
int
iComplE
,
int
iCompl
Z
)
{
lit
Lits
[
3
];
int
Cid
;
assert
(
iVarC
>=
0
&&
iVarT
>=
0
&&
iVarE
>=
0
&&
iVarZ
>=
0
);
Lits
[
0
]
=
toLitCond
(
iVarC
,
1
);
Lits
[
1
]
=
toLitCond
(
iVarT
,
1
);
Lits
[
0
]
=
toLitCond
(
iVarC
,
1
^
iComplC
);
Lits
[
1
]
=
toLitCond
(
iVarT
,
1
^
iComplT
);
Lits
[
2
]
=
toLitCond
(
iVarZ
,
0
);
Cid
=
sat_solver_addclause
(
pSat
,
Lits
,
Lits
+
3
);
assert
(
Cid
);
Lits
[
0
]
=
toLitCond
(
iVarC
,
1
);
Lits
[
1
]
=
toLitCond
(
iVarT
,
0
);
Lits
[
2
]
=
toLitCond
(
iVarZ
,
1
);
Lits
[
0
]
=
toLitCond
(
iVarC
,
1
^
iComplC
);
Lits
[
1
]
=
toLitCond
(
iVarT
,
0
^
iComplT
);
Lits
[
2
]
=
toLitCond
(
iVarZ
,
1
^
iComplZ
);
Cid
=
sat_solver_addclause
(
pSat
,
Lits
,
Lits
+
3
);
assert
(
Cid
);
Lits
[
0
]
=
toLitCond
(
iVarC
,
0
);
Lits
[
1
]
=
toLitCond
(
iVarE
,
1
);
Lits
[
2
]
=
toLitCond
(
iVarZ
,
0
);
Lits
[
0
]
=
toLitCond
(
iVarC
,
0
^
iComplC
);
Lits
[
1
]
=
toLitCond
(
iVarE
,
1
^
iComplE
);
Lits
[
2
]
=
toLitCond
(
iVarZ
,
0
^
iComplZ
);
Cid
=
sat_solver_addclause
(
pSat
,
Lits
,
Lits
+
3
);
assert
(
Cid
);
Lits
[
0
]
=
toLitCond
(
iVarC
,
0
);
Lits
[
1
]
=
toLitCond
(
iVarE
,
0
);
Lits
[
2
]
=
toLitCond
(
iVarZ
,
1
);
Lits
[
0
]
=
toLitCond
(
iVarC
,
0
^
iComplC
);
Lits
[
1
]
=
toLitCond
(
iVarE
,
0
^
iComplE
);
Lits
[
2
]
=
toLitCond
(
iVarZ
,
1
^
iComplZ
);
Cid
=
sat_solver_addclause
(
pSat
,
Lits
,
Lits
+
3
);
assert
(
Cid
);
if
(
iVarT
==
iVarE
)
return
4
;
Lits
[
0
]
=
toLitCond
(
iVarT
,
0
);
Lits
[
1
]
=
toLitCond
(
iVarE
,
0
);
Lits
[
2
]
=
toLitCond
(
iVarZ
,
1
);
Lits
[
0
]
=
toLitCond
(
iVarT
,
0
^
iComplT
);
Lits
[
1
]
=
toLitCond
(
iVarE
,
0
^
iComplE
);
Lits
[
2
]
=
toLitCond
(
iVarZ
,
1
^
iComplZ
);
Cid
=
sat_solver_addclause
(
pSat
,
Lits
,
Lits
+
3
);
assert
(
Cid
);
Lits
[
0
]
=
toLitCond
(
iVarT
,
1
);
Lits
[
1
]
=
toLitCond
(
iVarE
,
1
);
Lits
[
2
]
=
toLitCond
(
iVarZ
,
0
);
Lits
[
0
]
=
toLitCond
(
iVarT
,
1
^
iComplT
);
Lits
[
1
]
=
toLitCond
(
iVarE
,
1
^
iComplE
);
Lits
[
2
]
=
toLitCond
(
iVarZ
,
0
^
iComplZ
);
Cid
=
sat_solver_addclause
(
pSat
,
Lits
,
Lits
+
3
);
assert
(
Cid
);
return
6
;
}
static
inline
int
sat_solver_add_mux41
(
sat_solver
*
pSat
,
int
iVar
C0
,
int
iVarC1
,
int
iVarD0
,
int
iVarD1
,
int
iVarD2
,
int
iVarD3
,
int
iVarZ
)
static
inline
int
sat_solver_add_mux41
(
sat_solver
*
pSat
,
int
iVar
Z
,
int
iVarC0
,
int
iVarC1
,
int
iVarD0
,
int
iVarD1
,
int
iVarD2
,
int
iVarD3
)
{
lit
Lits
[
4
];
int
Cid
;
...
...
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