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
aa1a50fe
Commit
aa1a50fe
authored
Sep 08, 2013
by
Alan Mishchenko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixing corner-case bug in command 'ind'.
parent
00bc4398
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
40 additions
and
23 deletions
+40
-23
src/aig/saig/saigInd.c
+40
-23
No files found.
src/aig/saig/saigInd.c
View file @
aa1a50fe
...
@@ -88,7 +88,7 @@ int Saig_ManStatesAreEqual( sat_solver * pSat, Vec_Int_t * vState, int nRegs, in
...
@@ -88,7 +88,7 @@ int Saig_ManStatesAreEqual( sat_solver * pSat, Vec_Int_t * vState, int nRegs, in
SeeAlso []
SeeAlso []
***********************************************************************/
***********************************************************************/
void
Saig_ManAddUniqueness
(
sat_solver
*
pSat
,
Vec_Int_t
*
vState
,
int
nRegs
,
int
i
,
int
k
,
int
*
pnSatVarNum
,
int
*
pnClauses
)
int
Saig_ManAddUniqueness
(
sat_solver
*
pSat
,
Vec_Int_t
*
vState
,
int
nRegs
,
int
i
,
int
k
,
int
*
pnSatVarNum
,
int
*
pnClauses
,
int
fVerbose
)
{
{
int
*
pStateI
=
(
int
*
)
Vec_IntArray
(
vState
)
+
nRegs
*
i
;
int
*
pStateI
=
(
int
*
)
Vec_IntArray
(
vState
)
+
nRegs
*
i
;
int
*
pStateK
=
(
int
*
)
Vec_IntArray
(
vState
)
+
nRegs
*
k
;
int
*
pStateK
=
(
int
*
)
Vec_IntArray
(
vState
)
+
nRegs
*
k
;
...
@@ -99,8 +99,9 @@ void Saig_ManAddUniqueness( sat_solver * pSat, Vec_Int_t * vState, int nRegs, in
...
@@ -99,8 +99,9 @@ void Saig_ManAddUniqueness( sat_solver * pSat, Vec_Int_t * vState, int nRegs, in
for
(
v
=
0
;
v
<
nRegs
;
v
++
)
for
(
v
=
0
;
v
<
nRegs
;
v
++
)
if
(
pStateI
[
v
]
>=
0
&&
pStateK
[
v
]
==
-
1
)
if
(
pStateI
[
v
]
>=
0
&&
pStateK
[
v
]
==
-
1
)
{
{
// printf( "Cannot constrain an incomplete state.\n" );
if
(
fVerbose
)
return
;
printf
(
"Cannot constrain an incomplete state.
\n
"
);
return
0
;
}
}
// add XORs
// add XORs
nSatVarsOld
=
*
pnSatVarNum
;
nSatVarsOld
=
*
pnSatVarNum
;
...
@@ -111,8 +112,9 @@ void Saig_ManAddUniqueness( sat_solver * pSat, Vec_Int_t * vState, int nRegs, in
...
@@ -111,8 +112,9 @@ void Saig_ManAddUniqueness( sat_solver * pSat, Vec_Int_t * vState, int nRegs, in
RetValue
=
Cnf_DataAddXorClause
(
pSat
,
pStateI
[
v
],
pStateK
[
v
],
(
*
pnSatVarNum
)
++
);
RetValue
=
Cnf_DataAddXorClause
(
pSat
,
pStateI
[
v
],
pStateK
[
v
],
(
*
pnSatVarNum
)
++
);
if
(
RetValue
==
0
)
if
(
RetValue
==
0
)
{
{
printf
(
"SAT solver became UNSAT.
\n
"
);
if
(
fVerbose
)
return
;
printf
(
"SAT solver became UNSAT after adding a uniqueness constraint.
\n
"
);
return
1
;
}
}
}
}
// add OR clause
// add OR clause
...
@@ -126,9 +128,11 @@ void Saig_ManAddUniqueness( sat_solver * pSat, Vec_Int_t * vState, int nRegs, in
...
@@ -126,9 +128,11 @@ void Saig_ManAddUniqueness( sat_solver * pSat, Vec_Int_t * vState, int nRegs, in
ABC_FREE
(
pClause
);
ABC_FREE
(
pClause
);
if
(
RetValue
==
0
)
if
(
RetValue
==
0
)
{
{
printf
(
"SAT solver became UNSAT.
\n
"
);
if
(
fVerbose
)
return
;
printf
(
"SAT solver became UNSAT after adding a uniqueness constraint.
\n
"
);
return
1
;
}
}
return
0
;
}
}
/**Function*************************************************************
/**Function*************************************************************
...
@@ -271,15 +275,22 @@ int Saig_ManInduction( Aig_Man_t * p, int nTimeOut, int nFramesMax, int nConfMax
...
@@ -271,15 +275,22 @@ int Saig_ManInduction( Aig_Man_t * p, int nTimeOut, int nFramesMax, int nConfMax
Vec_IntWriteEntry
(
vState
,
nOldSize
+
iReg
,
pCnfPart
->
pVarNums
[
pObjPiCopy
->
Id
]
);
Vec_IntWriteEntry
(
vState
,
nOldSize
+
iReg
,
pCnfPart
->
pVarNums
[
pObjPiCopy
->
Id
]
);
}
}
}
}
assert
(
Vec_IntSize
(
vState
)
%
Aig_ManRegNum
(
p
)
==
0
);
iLast
=
Vec_IntSize
(
vState
)
/
Aig_ManRegNum
(
p
);
iLast
=
Vec_IntSize
(
vState
)
/
Aig_ManRegNum
(
p
);
if
(
fUniqueAll
)
if
(
fUniqueAll
)
{
{
for
(
i
=
1
;
i
<
iLast
-
1
;
i
++
)
for
(
i
=
1
;
i
<
iLast
-
1
;
i
++
)
{
{
nConstrs
++
;
nConstrs
++
;
Saig_ManAddUniqueness
(
pSat
,
vState
,
Aig_ManRegNum
(
p
),
i
,
iLast
-
1
,
&
nSatVarNum
,
&
nClauses
);
if
(
fVeryVerbose
)
if
(
fVeryVerbose
)
printf
(
"added constaint for %3d and %3d
\n
"
,
i
,
iLast
-
1
);
printf
(
"Adding constaint for state %2d and state %2d.
\n
"
,
i
,
iLast
-
1
);
if
(
Saig_ManAddUniqueness
(
pSat
,
vState
,
Aig_ManRegNum
(
p
),
i
,
iLast
-
1
,
&
nSatVarNum
,
&
nClauses
,
fVerbose
)
)
break
;
}
if
(
i
<
iLast
-
1
)
{
RetValue
=
1
;
break
;
}
}
}
}
...
@@ -290,7 +301,7 @@ nextrun:
...
@@ -290,7 +301,7 @@ nextrun:
status
=
sat_solver_solve
(
pSat
,
NULL
,
NULL
,
(
ABC_INT64_T
)
nConfMax
,
0
,
0
,
0
);
status
=
sat_solver_solve
(
pSat
,
NULL
,
NULL
,
(
ABC_INT64_T
)
nConfMax
,
0
,
0
,
0
);
if
(
fVerbose
)
if
(
fVerbose
)
{
{
printf
(
"%4d : PI =%5d. PO =%5d. AIG =%5d. Var =%7d. Clau =%7d. Conf =%7d. "
,
printf
(
"
Frame
%4d : PI =%5d. PO =%5d. AIG =%5d. Var =%7d. Clau =%7d. Conf =%7d. "
,
f
,
Aig_ManCiNum
(
pAigPart
),
Aig_ManCoNum
(
pAigPart
),
Aig_ManNodeNum
(
pAigPart
),
f
,
Aig_ManCiNum
(
pAigPart
),
Aig_ManCoNum
(
pAigPart
),
Aig_ManNodeNum
(
pAigPart
),
nSatVarNum
,
nClauses
,
(
int
)
pSat
->
stats
.
conflicts
-
nConfPrev
);
nSatVarNum
,
nClauses
,
(
int
)
pSat
->
stats
.
conflicts
-
nConfPrev
);
ABC_PRT
(
"Time"
,
Abc_Clock
()
-
clk
);
ABC_PRT
(
"Time"
,
Abc_Clock
()
-
clk
);
...
@@ -311,7 +322,7 @@ nextrun:
...
@@ -311,7 +322,7 @@ nextrun:
if
(
i
&&
(
i
%
Aig_ManRegNum
(
p
))
==
0
)
if
(
i
&&
(
i
%
Aig_ManRegNum
(
p
))
==
0
)
printf
(
"
\n
"
);
printf
(
"
\n
"
);
if
(
(
i
%
Aig_ManRegNum
(
p
))
==
0
)
if
(
(
i
%
Aig_ManRegNum
(
p
))
==
0
)
printf
(
"%3d : "
,
i
/
Aig_ManRegNum
(
p
)
);
printf
(
"
State
%3d : "
,
i
/
Aig_ManRegNum
(
p
)
);
printf
(
"%c"
,
(
iReg
>=
0
)
?
(
'0'
+
sat_solver_var_value
(
pSat
,
iReg
))
:
'x'
);
printf
(
"%c"
,
(
iReg
>=
0
)
?
(
'0'
+
sat_solver_var_value
(
pSat
,
iReg
))
:
'x'
);
}
}
printf
(
"
\n
"
);
printf
(
"
\n
"
);
...
@@ -341,23 +352,29 @@ nextrun:
...
@@ -341,23 +352,29 @@ nextrun:
if
(
fUnique
)
if
(
fUnique
)
{
{
for
(
i
=
1
;
i
<
iLast
;
i
++
)
for
(
i
=
1
;
i
<
iLast
;
i
++
)
for
(
k
=
i
+
1
;
k
<
iLast
;
k
++
)
{
{
if
(
!
Saig_ManStatesAreEqual
(
pSat
,
vState
,
Aig_ManRegNum
(
p
),
i
,
k
)
)
for
(
k
=
i
+
1
;
k
<
iLast
;
k
++
)
continue
;
{
nConstrs
++
;
if
(
!
Saig_ManStatesAreEqual
(
pSat
,
vState
,
Aig_ManRegNum
(
p
),
i
,
k
)
)
fAdded
=
1
;
continue
;
Saig_ManAddUniqueness
(
pSat
,
vState
,
Aig_ManRegNum
(
p
),
i
,
k
,
&
nSatVarNum
,
&
nClauses
);
nConstrs
++
;
if
(
fVeryVerbose
)
fAdded
=
1
;
printf
(
"added constaint for %3d and %3d
\n
"
,
i
,
k
);
if
(
fVeryVerbose
)
printf
(
"Adding constaint for state %2d and state %2d.
\n
"
,
i
,
k
);
if
(
Saig_ManAddUniqueness
(
pSat
,
vState
,
Aig_ManRegNum
(
p
),
i
,
k
,
&
nSatVarNum
,
&
nClauses
,
fVerbose
)
)
break
;
}
if
(
k
<
iLast
)
break
;
}
if
(
i
<
iLast
)
{
RetValue
=
1
;
break
;
}
}
}
}
if
(
fAdded
)
if
(
fAdded
)
{
// if ( fVeryVerbose )
// printf( "Trying a new run.\n" );
goto
nextrun
;
goto
nextrun
;
}
}
}
if
(
fVerbose
)
if
(
fVerbose
)
{
{
...
...
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