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
02081dba
Commit
02081dba
authored
Feb 27, 2011
by
Alan Mishchenko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added generation of counter-examples in &reachm.
parent
2f874d27
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
262 additions
and
59 deletions
+262
-59
src/aig/llb/llb1Core.c
+1
-0
src/aig/llb/llb1Man.c
+37
-8
src/aig/llb/llb1Reach.c
+220
-51
src/aig/llb/llbInt.h
+4
-0
No files found.
src/aig/llb/llb1Core.c
View file @
02081dba
...
@@ -208,6 +208,7 @@ int Llb_ManModelCheckGia( Gia_Man_t * pGia, Gia_ParLlb_t * pPars )
...
@@ -208,6 +208,7 @@ int Llb_ManModelCheckGia( Gia_Man_t * pGia, Gia_ParLlb_t * pPars )
RetValue
=
Llb_ManModelCheckAig
(
pAig
,
pPars
,
NULL
,
NULL
);
RetValue
=
Llb_ManModelCheckAig
(
pAig
,
pPars
,
NULL
,
NULL
);
else
else
RetValue
=
Llb_ManModelCheckAigWithHints
(
pAig
,
pPars
);
RetValue
=
Llb_ManModelCheckAigWithHints
(
pAig
,
pPars
);
pGia
->
pCexSeq
=
pAig
->
pSeqModel
;
pAig
->
pSeqModel
=
NULL
;
Aig_ManStop
(
pAig
);
Aig_ManStop
(
pAig
);
return
RetValue
;
return
RetValue
;
}
}
...
...
src/aig/llb/llb1Man.c
View file @
02081dba
...
@@ -47,9 +47,13 @@ void Llb_ManPrepareVarMap( Llb_Man_t * p )
...
@@ -47,9 +47,13 @@ void Llb_ManPrepareVarMap( Llb_Man_t * p )
Aig_Obj_t
*
pObjLi
,
*
pObjLo
;
Aig_Obj_t
*
pObjLi
,
*
pObjLo
;
int
i
,
iVarLi
,
iVarLo
;
int
i
,
iVarLi
,
iVarLo
;
assert
(
p
->
vNs2Glo
==
NULL
);
assert
(
p
->
vNs2Glo
==
NULL
);
assert
(
p
->
vCs2Glo
==
NULL
);
assert
(
p
->
vGlo2Cs
==
NULL
);
assert
(
p
->
vGlo2Cs
==
NULL
);
assert
(
p
->
vGlo2Ns
==
NULL
);
p
->
vNs2Glo
=
Vec_IntStartFull
(
Vec_IntSize
(
p
->
vVar2Obj
)
);
p
->
vNs2Glo
=
Vec_IntStartFull
(
Vec_IntSize
(
p
->
vVar2Obj
)
);
p
->
vCs2Glo
=
Vec_IntStartFull
(
Vec_IntSize
(
p
->
vVar2Obj
)
);
p
->
vGlo2Cs
=
Vec_IntStartFull
(
Aig_ManRegNum
(
p
->
pAig
)
);
p
->
vGlo2Cs
=
Vec_IntStartFull
(
Aig_ManRegNum
(
p
->
pAig
)
);
p
->
vGlo2Ns
=
Vec_IntStartFull
(
Aig_ManRegNum
(
p
->
pAig
)
);
Saig_ManForEachLiLo
(
p
->
pAig
,
pObjLi
,
pObjLo
,
i
)
Saig_ManForEachLiLo
(
p
->
pAig
,
pObjLi
,
pObjLo
,
i
)
{
{
iVarLi
=
Vec_IntEntry
(
p
->
vObj2Var
,
Aig_ObjId
(
pObjLi
));
iVarLi
=
Vec_IntEntry
(
p
->
vObj2Var
,
Aig_ObjId
(
pObjLi
));
...
@@ -57,7 +61,16 @@ void Llb_ManPrepareVarMap( Llb_Man_t * p )
...
@@ -57,7 +61,16 @@ void Llb_ManPrepareVarMap( Llb_Man_t * p )
assert
(
iVarLi
>=
0
&&
iVarLi
<
Vec_IntSize
(
p
->
vVar2Obj
)
);
assert
(
iVarLi
>=
0
&&
iVarLi
<
Vec_IntSize
(
p
->
vVar2Obj
)
);
assert
(
iVarLo
>=
0
&&
iVarLo
<
Vec_IntSize
(
p
->
vVar2Obj
)
);
assert
(
iVarLo
>=
0
&&
iVarLo
<
Vec_IntSize
(
p
->
vVar2Obj
)
);
Vec_IntWriteEntry
(
p
->
vNs2Glo
,
iVarLi
,
i
);
Vec_IntWriteEntry
(
p
->
vNs2Glo
,
iVarLi
,
i
);
Vec_IntWriteEntry
(
p
->
vCs2Glo
,
iVarLo
,
i
);
Vec_IntWriteEntry
(
p
->
vGlo2Cs
,
i
,
iVarLo
);
Vec_IntWriteEntry
(
p
->
vGlo2Cs
,
i
,
iVarLo
);
Vec_IntWriteEntry
(
p
->
vGlo2Ns
,
i
,
iVarLi
);
}
// add mapping of the PIs
Saig_ManForEachPi
(
p
->
pAig
,
pObjLo
,
i
)
{
iVarLo
=
Vec_IntEntry
(
p
->
vObj2Var
,
Aig_ObjId
(
pObjLo
));
Vec_IntWriteEntry
(
p
->
vCs2Glo
,
iVarLo
,
Aig_ManRegNum
(
p
->
pAig
)
+
i
);
Vec_IntWriteEntry
(
p
->
vNs2Glo
,
iVarLo
,
Aig_ManRegNum
(
p
->
pAig
)
+
i
);
}
}
}
}
...
@@ -117,6 +130,7 @@ void Llb_ManPrepareVarLimits( Llb_Man_t * p )
...
@@ -117,6 +130,7 @@ void Llb_ManPrepareVarLimits( Llb_Man_t * p )
void
Llb_ManStop
(
Llb_Man_t
*
p
)
void
Llb_ManStop
(
Llb_Man_t
*
p
)
{
{
Llb_Grp_t
*
pGrp
;
Llb_Grp_t
*
pGrp
;
DdNode
*
bTemp
;
int
i
;
int
i
;
// Vec_IntFreeP( &p->vMem );
// Vec_IntFreeP( &p->vMem );
...
@@ -128,25 +142,39 @@ void Llb_ManStop( Llb_Man_t * p )
...
@@ -128,25 +142,39 @@ void Llb_ManStop( Llb_Man_t * p )
Llb_MtrFree
(
p
->
pMatrix
);
Llb_MtrFree
(
p
->
pMatrix
);
Vec_PtrForEachEntry
(
Llb_Grp_t
*
,
p
->
vGroups
,
pGrp
,
i
)
Vec_PtrForEachEntry
(
Llb_Grp_t
*
,
p
->
vGroups
,
pGrp
,
i
)
Llb_ManGroupStop
(
pGrp
);
Llb_ManGroupStop
(
pGrp
);
Vec_PtrFreeP
(
&
p
->
vGroups
);
Vec_IntFreeP
(
&
p
->
vVar2Obj
);
Vec_IntFreeP
(
&
p
->
vObj2Var
);
Vec_IntFreeP
(
&
p
->
vVarBegs
);
Vec_IntFreeP
(
&
p
->
vVarEnds
);
Vec_IntFreeP
(
&
p
->
vNs2Glo
);
Vec_IntFreeP
(
&
p
->
vGlo2Cs
);
// Vec_IntFreeP( &p->vHints );
if
(
p
->
dd
)
if
(
p
->
dd
)
{
{
// printf( "Manager dd\n" );
Extra_StopManager
(
p
->
dd
);
Extra_StopManager
(
p
->
dd
);
}
}
if
(
p
->
ddG
)
if
(
p
->
ddG
)
{
{
// printf( "Manager ddG\n" );
if
(
p
->
ddG
->
bFunc
)
if
(
p
->
ddG
->
bFunc
)
Cudd_RecursiveDeref
(
p
->
ddG
,
p
->
ddG
->
bFunc
);
Cudd_RecursiveDeref
(
p
->
ddG
,
p
->
ddG
->
bFunc
);
Extra_StopManager
(
p
->
ddG
);
Extra_StopManager
(
p
->
ddG
);
}
}
if
(
p
->
ddR
)
{
// printf( "Manager ddR\n" );
if
(
p
->
ddR
->
bFunc
)
Cudd_RecursiveDeref
(
p
->
ddR
,
p
->
ddR
->
bFunc
);
Vec_PtrForEachEntry
(
DdNode
*
,
p
->
vRings
,
bTemp
,
i
)
Cudd_RecursiveDeref
(
p
->
ddR
,
bTemp
);
Extra_StopManager
(
p
->
ddR
);
}
Aig_ManStop
(
p
->
pAig
);
Aig_ManStop
(
p
->
pAig
);
Vec_PtrFreeP
(
&
p
->
vGroups
);
Vec_IntFreeP
(
&
p
->
vVar2Obj
);
Vec_IntFreeP
(
&
p
->
vObj2Var
);
Vec_IntFreeP
(
&
p
->
vVarBegs
);
Vec_IntFreeP
(
&
p
->
vVarEnds
);
Vec_PtrFreeP
(
&
p
->
vRings
);
Vec_IntFreeP
(
&
p
->
vNs2Glo
);
Vec_IntFreeP
(
&
p
->
vCs2Glo
);
Vec_IntFreeP
(
&
p
->
vGlo2Cs
);
Vec_IntFreeP
(
&
p
->
vGlo2Ns
);
// Vec_IntFreeP( &p->vHints );
ABC_FREE
(
p
);
ABC_FREE
(
p
);
}
}
...
@@ -172,6 +200,7 @@ Llb_Man_t * Llb_ManStart( Aig_Man_t * pAigGlo, Aig_Man_t * pAig, Gia_ParLlb_t *
...
@@ -172,6 +200,7 @@ Llb_Man_t * Llb_ManStart( Aig_Man_t * pAigGlo, Aig_Man_t * pAig, Gia_ParLlb_t *
p
->
pAig
=
pAig
;
p
->
pAig
=
pAig
;
p
->
vVar2Obj
=
Llb_ManMarkPivotNodes
(
p
->
pAig
,
pPars
->
fUsePivots
);
p
->
vVar2Obj
=
Llb_ManMarkPivotNodes
(
p
->
pAig
,
pPars
->
fUsePivots
);
p
->
vObj2Var
=
Vec_IntInvert
(
p
->
vVar2Obj
,
-
1
);
p
->
vObj2Var
=
Vec_IntInvert
(
p
->
vVar2Obj
,
-
1
);
p
->
vRings
=
Vec_PtrAlloc
(
100
);
Llb_ManPrepareVarMap
(
p
);
Llb_ManPrepareVarMap
(
p
);
Llb_ManPrepareGroups
(
p
);
Llb_ManPrepareGroups
(
p
);
Aig_ManCleanMarkA
(
pAig
);
Aig_ManCleanMarkA
(
pAig
);
...
...
src/aig/llb/llb1Reach.c
View file @
02081dba
...
@@ -152,7 +152,7 @@ DdNode * Llb_ManConstructGroupBdd( Llb_Man_t * p, Llb_Grp_t * pGroup )
...
@@ -152,7 +152,7 @@ DdNode * Llb_ManConstructGroupBdd( Llb_Man_t * p, Llb_Grp_t * pGroup )
SeeAlso []
SeeAlso []
***********************************************************************/
***********************************************************************/
DdNode
*
Llb_ManConstructQuantCubeIntern
(
Llb_Man_t
*
p
,
Llb_Grp_t
*
pGroup
,
int
iGrpPlace
)
DdNode
*
Llb_ManConstructQuantCubeIntern
(
Llb_Man_t
*
p
,
Llb_Grp_t
*
pGroup
,
int
iGrpPlace
,
int
fBackward
)
{
{
Aig_Obj_t
*
pObj
;
Aig_Obj_t
*
pObj
;
DdNode
*
bRes
,
*
bTemp
,
*
bVar
;
DdNode
*
bRes
,
*
bTemp
,
*
bVar
;
...
@@ -162,6 +162,8 @@ DdNode * Llb_ManConstructQuantCubeIntern( Llb_Man_t * p, Llb_Grp_t * pGroup, int
...
@@ -162,6 +162,8 @@ DdNode * Llb_ManConstructQuantCubeIntern( Llb_Man_t * p, Llb_Grp_t * pGroup, int
bRes
=
Cudd_ReadOne
(
p
->
dd
);
Cudd_Ref
(
bRes
);
bRes
=
Cudd_ReadOne
(
p
->
dd
);
Cudd_Ref
(
bRes
);
Vec_PtrForEachEntry
(
Aig_Obj_t
*
,
pGroup
->
vIns
,
pObj
,
i
)
Vec_PtrForEachEntry
(
Aig_Obj_t
*
,
pGroup
->
vIns
,
pObj
,
i
)
{
{
if
(
fBackward
&&
Saig_ObjIsPi
(
p
->
pAig
,
pObj
)
)
continue
;
iGroupFirst
=
Vec_IntEntry
(
p
->
vVarBegs
,
Aig_ObjId
(
pObj
));
iGroupFirst
=
Vec_IntEntry
(
p
->
vVarBegs
,
Aig_ObjId
(
pObj
));
iGroupLast
=
Vec_IntEntry
(
p
->
vVarEnds
,
Aig_ObjId
(
pObj
));
iGroupLast
=
Vec_IntEntry
(
p
->
vVarEnds
,
Aig_ObjId
(
pObj
));
assert
(
iGroupFirst
<=
iGroupLast
);
assert
(
iGroupFirst
<=
iGroupLast
);
...
@@ -173,6 +175,8 @@ DdNode * Llb_ManConstructQuantCubeIntern( Llb_Man_t * p, Llb_Grp_t * pGroup, int
...
@@ -173,6 +175,8 @@ DdNode * Llb_ManConstructQuantCubeIntern( Llb_Man_t * p, Llb_Grp_t * pGroup, int
}
}
Vec_PtrForEachEntry
(
Aig_Obj_t
*
,
pGroup
->
vOuts
,
pObj
,
i
)
Vec_PtrForEachEntry
(
Aig_Obj_t
*
,
pGroup
->
vOuts
,
pObj
,
i
)
{
{
if
(
fBackward
&&
Saig_ObjIsPi
(
p
->
pAig
,
pObj
)
)
continue
;
iGroupFirst
=
Vec_IntEntry
(
p
->
vVarBegs
,
Aig_ObjId
(
pObj
));
iGroupFirst
=
Vec_IntEntry
(
p
->
vVarBegs
,
Aig_ObjId
(
pObj
));
iGroupLast
=
Vec_IntEntry
(
p
->
vVarEnds
,
Aig_ObjId
(
pObj
));
iGroupLast
=
Vec_IntEntry
(
p
->
vVarEnds
,
Aig_ObjId
(
pObj
));
assert
(
iGroupFirst
<=
iGroupLast
);
assert
(
iGroupFirst
<=
iGroupLast
);
...
@@ -198,7 +202,7 @@ DdNode * Llb_ManConstructQuantCubeIntern( Llb_Man_t * p, Llb_Grp_t * pGroup, int
...
@@ -198,7 +202,7 @@ DdNode * Llb_ManConstructQuantCubeIntern( Llb_Man_t * p, Llb_Grp_t * pGroup, int
SeeAlso []
SeeAlso []
***********************************************************************/
***********************************************************************/
DdNode
*
Llb_ManConstructQuantCube
(
Llb_Man_t
*
p
,
Llb_Grp_t
*
pGroup
,
int
iGrpPlace
)
DdNode
*
Llb_ManConstructQuantCube
Fwd
(
Llb_Man_t
*
p
,
Llb_Grp_t
*
pGroup
,
int
iGrpPlace
)
{
{
Aig_Obj_t
*
pObj
;
Aig_Obj_t
*
pObj
;
DdNode
*
bRes
,
*
bTemp
,
*
bVar
;
DdNode
*
bRes
,
*
bTemp
,
*
bVar
;
...
@@ -232,6 +236,53 @@ DdNode * Llb_ManConstructQuantCube( Llb_Man_t * p, Llb_Grp_t * pGroup, int iGrpP
...
@@ -232,6 +236,53 @@ DdNode * Llb_ManConstructQuantCube( Llb_Man_t * p, Llb_Grp_t * pGroup, int iGrpP
/**Function*************************************************************
/**Function*************************************************************
Synopsis [Derives quantification cube.]
Description []
SideEffects []
SeeAlso []
***********************************************************************/
DdNode
*
Llb_ManConstructQuantCubeBwd
(
Llb_Man_t
*
p
,
Llb_Grp_t
*
pGroup
,
int
iGrpPlace
)
{
Aig_Obj_t
*
pObj
;
DdNode
*
bRes
,
*
bTemp
,
*
bVar
;
int
i
,
iGroupFirst
,
TimeStop
;
TimeStop
=
p
->
dd
->
TimeStop
;
p
->
dd
->
TimeStop
=
0
;
bRes
=
Cudd_ReadOne
(
p
->
dd
);
Cudd_Ref
(
bRes
);
Vec_PtrForEachEntry
(
Aig_Obj_t
*
,
pGroup
->
vIns
,
pObj
,
i
)
{
if
(
Saig_ObjIsPi
(
p
->
pAig
,
pObj
)
)
continue
;
iGroupFirst
=
Vec_IntEntry
(
p
->
vVarBegs
,
Aig_ObjId
(
pObj
));
assert
(
iGroupFirst
<=
iGrpPlace
);
if
(
iGroupFirst
<
iGrpPlace
)
continue
;
bVar
=
Cudd_bddIthVar
(
p
->
dd
,
Vec_IntEntry
(
p
->
vObj2Var
,
Aig_ObjId
(
pObj
))
);
bRes
=
Cudd_bddAnd
(
p
->
dd
,
bTemp
=
bRes
,
bVar
);
Cudd_Ref
(
bRes
);
Cudd_RecursiveDeref
(
p
->
dd
,
bTemp
);
}
Vec_PtrForEachEntry
(
Aig_Obj_t
*
,
pGroup
->
vOuts
,
pObj
,
i
)
{
if
(
Saig_ObjIsPi
(
p
->
pAig
,
pObj
)
)
continue
;
iGroupFirst
=
Vec_IntEntry
(
p
->
vVarBegs
,
Aig_ObjId
(
pObj
));
assert
(
iGroupFirst
<=
iGrpPlace
);
if
(
iGroupFirst
<
iGrpPlace
)
continue
;
bVar
=
Cudd_bddIthVar
(
p
->
dd
,
Vec_IntEntry
(
p
->
vObj2Var
,
Aig_ObjId
(
pObj
))
);
bRes
=
Cudd_bddAnd
(
p
->
dd
,
bTemp
=
bRes
,
bVar
);
Cudd_Ref
(
bRes
);
Cudd_RecursiveDeref
(
p
->
dd
,
bTemp
);
}
Cudd_Deref
(
bRes
);
p
->
dd
->
TimeStop
=
TimeStop
;
return
bRes
;
}
/**Function*************************************************************
Synopsis []
Synopsis []
Description []
Description []
...
@@ -271,17 +322,22 @@ DdNode * Llb_ManComputeInitState( Llb_Man_t * p, DdManager * dd )
...
@@ -271,17 +322,22 @@ DdNode * Llb_ManComputeInitState( Llb_Man_t * p, DdManager * dd )
SeeAlso []
SeeAlso []
***********************************************************************/
***********************************************************************/
DdNode
*
Llb_ManComputeImage
(
Llb_Man_t
*
p
,
DdNode
*
bInit
)
DdNode
*
Llb_ManComputeImage
(
Llb_Man_t
*
p
,
DdNode
*
bInit
,
int
fBackward
)
{
{
int
fCheckSupport
=
0
;
int
fCheckSupport
=
0
;
Llb_Grp_t
*
pGroup
;
Llb_Grp_t
*
pGroup
;
DdNode
*
bImage
,
*
bGroup
,
*
bCube
,
*
bTemp
;
DdNode
*
bImage
,
*
bGroup
,
*
bCube
,
*
bTemp
;
int
i
;
int
k
,
Index
;
bImage
=
bInit
;
Cudd_Ref
(
bImage
);
bImage
=
bInit
;
Cudd_Ref
(
bImage
);
for
(
i
=
1
;
i
<
p
->
pMatrix
->
nCols
-
1
;
i
++
)
for
(
k
=
1
;
k
<
p
->
pMatrix
->
nCols
-
1
;
k
++
)
{
{
if
(
fBackward
)
Index
=
p
->
pMatrix
->
nCols
-
1
-
k
;
else
Index
=
k
;
// compute group BDD
// compute group BDD
pGroup
=
p
->
pMatrix
->
pColGrps
[
i
];
pGroup
=
p
->
pMatrix
->
pColGrps
[
Index
];
bGroup
=
Llb_ManConstructGroupBdd
(
p
,
pGroup
);
bGroup
=
Llb_ManConstructGroupBdd
(
p
,
pGroup
);
if
(
bGroup
==
NULL
)
if
(
bGroup
==
NULL
)
{
{
...
@@ -290,7 +346,7 @@ DdNode * Llb_ManComputeImage( Llb_Man_t * p, DdNode * bInit )
...
@@ -290,7 +346,7 @@ DdNode * Llb_ManComputeImage( Llb_Man_t * p, DdNode * bInit )
}
}
Cudd_Ref
(
bGroup
);
Cudd_Ref
(
bGroup
);
// quantify variables appearing only in this group
// quantify variables appearing only in this group
bCube
=
Llb_ManConstructQuantCubeIntern
(
p
,
pGroup
,
i
);
Cudd_Ref
(
bCube
);
bCube
=
Llb_ManConstructQuantCubeIntern
(
p
,
pGroup
,
Index
,
fBackward
);
Cudd_Ref
(
bCube
);
bGroup
=
Cudd_bddExistAbstract
(
p
->
dd
,
bTemp
=
bGroup
,
bCube
);
bGroup
=
Cudd_bddExistAbstract
(
p
->
dd
,
bTemp
=
bGroup
,
bCube
);
if
(
bGroup
==
NULL
)
if
(
bGroup
==
NULL
)
{
{
...
@@ -302,7 +358,11 @@ DdNode * Llb_ManComputeImage( Llb_Man_t * p, DdNode * bInit )
...
@@ -302,7 +358,11 @@ DdNode * Llb_ManComputeImage( Llb_Man_t * p, DdNode * bInit )
Cudd_RecursiveDeref
(
p
->
dd
,
bTemp
);
Cudd_RecursiveDeref
(
p
->
dd
,
bTemp
);
Cudd_RecursiveDeref
(
p
->
dd
,
bCube
);
Cudd_RecursiveDeref
(
p
->
dd
,
bCube
);
// perform partial product
// perform partial product
bCube
=
Llb_ManConstructQuantCube
(
p
,
pGroup
,
i
);
Cudd_Ref
(
bCube
);
if
(
fBackward
)
bCube
=
Llb_ManConstructQuantCubeBwd
(
p
,
pGroup
,
Index
);
else
bCube
=
Llb_ManConstructQuantCubeFwd
(
p
,
pGroup
,
Index
);
Cudd_Ref
(
bCube
);
// bImage = Extra_bddAndAbstractTime( p->dd, bTemp = bImage, bGroup, bCube, p->pPars->TimeTarget );
// bImage = Extra_bddAndAbstractTime( p->dd, bTemp = bImage, bGroup, bCube, p->pPars->TimeTarget );
bImage
=
Cudd_bddAndAbstract
(
p
->
dd
,
bTemp
=
bImage
,
bGroup
,
bCube
);
bImage
=
Cudd_bddAndAbstract
(
p
->
dd
,
bTemp
=
bImage
,
bGroup
,
bCube
);
if
(
bImage
==
NULL
)
if
(
bImage
==
NULL
)
...
@@ -393,7 +453,7 @@ DdNode * Llb_ManCreateConstraints( Llb_Man_t * p, Vec_Int_t * vHints, int fUseNs
...
@@ -393,7 +453,7 @@ DdNode * Llb_ManCreateConstraints( Llb_Man_t * p, Vec_Int_t * vHints, int fUseNs
/**Function*************************************************************
/**Function*************************************************************
Synopsis []
Synopsis [
Perform reachability with hints and returns reached states in ppGlo.
]
Description []
Description []
...
@@ -402,9 +462,106 @@ DdNode * Llb_ManCreateConstraints( Llb_Man_t * p, Vec_Int_t * vHints, int fUseNs
...
@@ -402,9 +462,106 @@ DdNode * Llb_ManCreateConstraints( Llb_Man_t * p, Vec_Int_t * vHints, int fUseNs
SeeAlso []
SeeAlso []
***********************************************************************/
***********************************************************************/
Abc_Cex_t
*
Llb_Man
DeriveCex
(
Llb_Man_t
*
p
,
DdNode
*
bInter
,
int
iOutFail
,
int
iIter
)
Abc_Cex_t
*
Llb_Man
ReachDeriveCex
(
Llb_Man_t
*
p
)
{
{
return
NULL
;
Abc_Cex_t
*
pCex
;
Aig_Obj_t
*
pObj
;
DdNode
*
bState
,
*
bImage
,
*
bOneCube
,
*
bTemp
,
*
bRing
;
int
i
,
v
,
RetValue
,
nPiOffset
;
char
*
pValues
=
ABC_ALLOC
(
char
,
Cudd_ReadSize
(
p
->
ddR
)
);
assert
(
Vec_PtrSize
(
p
->
vRings
)
>
0
);
p
->
dd
->
TimeStop
=
0
;
p
->
ddR
->
TimeStop
=
0
;
/*
Saig_ManForEachLo( p->pAig, pObj, i )
printf( "%d ", pObj->Id );
printf( "\n" );
Saig_ManForEachLi( p->pAig, pObj, i )
printf( "%d(%d) ", pObj->Id, Aig_ObjFaninId0(pObj) );
printf( "\n" );
*/
// allocate room for the counter-example
pCex
=
Abc_CexAlloc
(
Saig_ManRegNum
(
p
->
pAig
),
Saig_ManPiNum
(
p
->
pAig
),
Vec_PtrSize
(
p
->
vRings
)
);
pCex
->
iFrame
=
Vec_PtrSize
(
p
->
vRings
)
-
1
;
pCex
->
iPo
=
-
1
;
// get the last cube
bOneCube
=
Cudd_bddIntersect
(
p
->
ddR
,
(
DdNode
*
)
Vec_PtrEntryLast
(
p
->
vRings
),
p
->
ddR
->
bFunc
);
Cudd_Ref
(
bOneCube
);
RetValue
=
Cudd_bddPickOneCube
(
p
->
ddR
,
bOneCube
,
pValues
);
Cudd_RecursiveDeref
(
p
->
ddR
,
bOneCube
);
assert
(
RetValue
);
// write PIs of counter-example
nPiOffset
=
Saig_ManRegNum
(
p
->
pAig
)
+
Saig_ManPiNum
(
p
->
pAig
)
*
(
Vec_PtrSize
(
p
->
vRings
)
-
1
);
Saig_ManForEachPi
(
p
->
pAig
,
pObj
,
i
)
if
(
pValues
[
Saig_ManRegNum
(
p
->
pAig
)
+
i
]
==
1
)
Aig_InfoSetBit
(
pCex
->
pData
,
nPiOffset
+
i
);
// write state in terms of NS variables
if
(
Vec_PtrSize
(
p
->
vRings
)
>
1
)
{
bState
=
Llb_CoreComputeCube
(
p
->
dd
,
p
->
vGlo2Ns
,
1
,
pValues
);
Cudd_Ref
(
bState
);
}
// perform backward analysis
Vec_PtrForEachEntryReverse
(
DdNode
*
,
p
->
vRings
,
bRing
,
v
)
{
if
(
v
==
Vec_PtrSize
(
p
->
vRings
)
-
1
)
continue
;
//Extra_bddPrintSupport( p->dd, bState ); printf( "\n" );
//Extra_bddPrintSupport( p->dd, bRing ); printf( "\n" );
// compute the next states
bImage
=
Llb_ManComputeImage
(
p
,
bState
,
1
);
assert
(
bImage
!=
NULL
);
Cudd_Ref
(
bImage
);
Cudd_RecursiveDeref
(
p
->
dd
,
bState
);
//Extra_bddPrintSupport( p->dd, bImage ); printf( "\n" );
// move reached states into ring manager
bImage
=
Extra_TransferPermute
(
p
->
dd
,
p
->
ddR
,
bTemp
=
bImage
,
Vec_IntArray
(
p
->
vCs2Glo
)
);
Cudd_Ref
(
bImage
);
Cudd_RecursiveDeref
(
p
->
dd
,
bTemp
);
//Extra_bddPrintSupport( p->ddR, bImage ); printf( "\n" );
// intersect with the previous set
bOneCube
=
Cudd_bddIntersect
(
p
->
ddR
,
bImage
,
bRing
);
Cudd_Ref
(
bOneCube
);
Cudd_RecursiveDeref
(
p
->
ddR
,
bImage
);
// find any assignment of the BDD
RetValue
=
Cudd_bddPickOneCube
(
p
->
ddR
,
bOneCube
,
pValues
);
Cudd_RecursiveDeref
(
p
->
ddR
,
bOneCube
);
assert
(
RetValue
);
/*
for ( i = 0; i < p->ddR->size; i++ )
printf( "%d ", pValues[i] );
printf( "\n" );
*/
// write PIs of counter-example
nPiOffset
-=
Saig_ManPiNum
(
p
->
pAig
);
Saig_ManForEachPi
(
p
->
pAig
,
pObj
,
i
)
if
(
pValues
[
Saig_ManRegNum
(
p
->
pAig
)
+
i
]
==
1
)
Aig_InfoSetBit
(
pCex
->
pData
,
nPiOffset
+
i
);
// check that we get the init state
if
(
v
==
0
)
{
Saig_ManForEachLo
(
p
->
pAig
,
pObj
,
i
)
assert
(
pValues
[
i
]
==
0
);
break
;
}
// write state in terms of NS variables
bState
=
Llb_CoreComputeCube
(
p
->
dd
,
p
->
vGlo2Ns
,
1
,
pValues
);
Cudd_Ref
(
bState
);
}
assert
(
nPiOffset
==
Saig_ManRegNum
(
p
->
pAig
)
);
// update the output number
//Abc_CexPrint( pCex );
RetValue
=
Saig_ManFindFailedPoCex
(
p
->
pAigGlo
,
pCex
);
assert
(
RetValue
>=
0
&&
RetValue
<
Saig_ManPoNum
(
p
->
pAigGlo
)
);
// invalid CEX!!!
pCex
->
iPo
=
RetValue
;
// cleanup
ABC_FREE
(
pValues
);
return
pCex
;
}
}
/**Function*************************************************************
/**Function*************************************************************
...
@@ -420,12 +577,12 @@ Abc_Cex_t * Llb_ManDeriveCex( Llb_Man_t * p, DdNode * bInter, int iOutFail, int
...
@@ -420,12 +577,12 @@ Abc_Cex_t * Llb_ManDeriveCex( Llb_Man_t * p, DdNode * bInter, int iOutFail, int
***********************************************************************/
***********************************************************************/
int
Llb_ManReachability
(
Llb_Man_t
*
p
,
Vec_Int_t
*
vHints
,
DdManager
**
pddGlo
)
int
Llb_ManReachability
(
Llb_Man_t
*
p
,
Vec_Int_t
*
vHints
,
DdManager
**
pddGlo
)
{
{
int
fCheckOutputs
=
!
p
->
pPars
->
fSkipOutCheck
;
int
*
pNs2Glo
=
Vec_IntArray
(
p
->
vNs2Glo
);
int
*
pNs2Glo
=
Vec_IntArray
(
p
->
vNs2Glo
);
int
*
pCs2Glo
=
Vec_IntArray
(
p
->
vCs2Glo
);
int
*
pGlo2Cs
=
Vec_IntArray
(
p
->
vGlo2Cs
);
int
*
pGlo2Cs
=
Vec_IntArray
(
p
->
vGlo2Cs
);
DdNode
*
bCurrent
,
*
bReached
,
*
bNext
,
*
bTemp
,
*
bCube
;
DdNode
*
bCurrent
,
*
bReached
,
*
bNext
,
*
bTemp
,
*
bCube
;
DdNode
*
bConstrCs
,
*
bConstrNs
;
DdNode
*
bConstrCs
,
*
bConstrNs
;
int
clk2
,
clk
=
clock
(),
nIters
,
nBddSize
=
0
,
iOutFail
=
-
1
;
int
clk2
,
clk
=
clock
(),
nIters
,
nBddSize
=
0
;
int
nThreshold
=
10000
;
int
nThreshold
=
10000
;
// compute time to stop
// compute time to stop
...
@@ -440,7 +597,9 @@ int Llb_ManReachability( Llb_Man_t * p, Vec_Int_t * vHints, DdManager ** pddGlo
...
@@ -440,7 +597,9 @@ int Llb_ManReachability( Llb_Man_t * p, Vec_Int_t * vHints, DdManager ** pddGlo
// start the managers
// start the managers
assert
(
p
->
dd
==
NULL
);
assert
(
p
->
dd
==
NULL
);
assert
(
p
->
ddG
==
NULL
);
assert
(
p
->
ddG
==
NULL
);
assert
(
p
->
ddR
==
NULL
);
p
->
dd
=
Cudd_Init
(
Vec_IntSize
(
p
->
vVar2Obj
),
0
,
CUDD_UNIQUE_SLOTS
,
CUDD_CACHE_SLOTS
,
0
);
p
->
dd
=
Cudd_Init
(
Vec_IntSize
(
p
->
vVar2Obj
),
0
,
CUDD_UNIQUE_SLOTS
,
CUDD_CACHE_SLOTS
,
0
);
p
->
ddR
=
Cudd_Init
(
Aig_ManPiNum
(
p
->
pAig
),
0
,
CUDD_UNIQUE_SLOTS
,
CUDD_CACHE_SLOTS
,
0
);
if
(
pddGlo
&&
*
pddGlo
)
if
(
pddGlo
&&
*
pddGlo
)
p
->
ddG
=
*
pddGlo
,
*
pddGlo
=
NULL
;
p
->
ddG
=
*
pddGlo
,
*
pddGlo
=
NULL
;
else
else
...
@@ -450,16 +609,29 @@ int Llb_ManReachability( Llb_Man_t * p, Vec_Int_t * vHints, DdManager ** pddGlo
...
@@ -450,16 +609,29 @@ int Llb_ManReachability( Llb_Man_t * p, Vec_Int_t * vHints, DdManager ** pddGlo
{
{
Cudd_AutodynEnable
(
p
->
dd
,
CUDD_REORDER_SYMM_SIFT
);
Cudd_AutodynEnable
(
p
->
dd
,
CUDD_REORDER_SYMM_SIFT
);
Cudd_AutodynEnable
(
p
->
ddG
,
CUDD_REORDER_SYMM_SIFT
);
Cudd_AutodynEnable
(
p
->
ddG
,
CUDD_REORDER_SYMM_SIFT
);
Cudd_AutodynEnable
(
p
->
ddR
,
CUDD_REORDER_SYMM_SIFT
);
}
}
else
else
{
{
Cudd_AutodynDisable
(
p
->
dd
);
Cudd_AutodynDisable
(
p
->
dd
);
Cudd_AutodynDisable
(
p
->
ddG
);
Cudd_AutodynDisable
(
p
->
ddG
);
Cudd_AutodynDisable
(
p
->
ddR
);
}
}
// set the stop time parameter
// set the stop time parameter
p
->
dd
->
TimeStop
=
p
->
pPars
->
TimeTarget
;
p
->
dd
->
TimeStop
=
p
->
pPars
->
TimeTarget
;
p
->
ddG
->
TimeStop
=
p
->
pPars
->
TimeTarget
;
p
->
ddG
->
TimeStop
=
p
->
pPars
->
TimeTarget
;
p
->
ddR
->
TimeStop
=
p
->
pPars
->
TimeTarget
;
// create bad state in the ring manager
p
->
ddR
->
bFunc
=
Llb_BddComputeBad
(
p
->
pAigGlo
,
p
->
ddR
,
p
->
pPars
->
TimeTarget
);
if
(
p
->
ddR
->
bFunc
==
NULL
)
{
if
(
!
p
->
pPars
->
fSilent
)
printf
(
"Reached timeout (%d seconds) during constructing the bad states.
\n
"
,
p
->
pPars
->
TimeLimit
);
return
-
1
;
}
Cudd_Ref
(
p
->
ddR
->
bFunc
);
// derive constraints
// derive constraints
bConstrCs
=
Llb_ManCreateConstraints
(
p
,
vHints
,
0
);
Cudd_Ref
(
bConstrCs
);
bConstrCs
=
Llb_ManCreateConstraints
(
p
,
vHints
,
0
);
Cudd_Ref
(
bConstrCs
);
...
@@ -499,61 +671,58 @@ int Llb_ManReachability( Llb_Man_t * p, Vec_Int_t * vHints, DdManager ** pddGlo
...
@@ -499,61 +671,58 @@ int Llb_ManReachability( Llb_Man_t * p, Vec_Int_t * vHints, DdManager ** pddGlo
return
-
1
;
return
-
1
;
}
}
// check outputs
// save the onion ring
if
(
fCheckOutputs
)
bTemp
=
Extra_TransferPermute
(
p
->
dd
,
p
->
ddR
,
bCurrent
,
pCs2Glo
);
if
(
bTemp
==
NULL
)
{
{
Aig_Obj_t
*
pObj
;
if
(
!
p
->
pPars
->
fSilent
)
int
i
;
printf
(
"Reached timeout (%d seconds) during ring transfer.
\n
"
,
p
->
pPars
->
TimeLimit
);
Aig_ManConst1
(
p
->
pAigGlo
)
->
pData
=
Cudd_ReadOne
(
p
->
dd
);
p
->
pPars
->
iFrame
=
nIters
-
1
;
Aig_ManForEachPi
(
p
->
pAig
,
pObj
,
i
)
Cudd_RecursiveDeref
(
p
->
dd
,
bCurrent
);
bCurrent
=
NULL
;
pObj
->
pData
=
Cudd_bddIthVar
(
p
->
dd
,
Vec_IntEntry
(
p
->
vObj2Var
,
Aig_ObjId
(
pObj
))
);
Cudd_RecursiveDeref
(
p
->
dd
,
bConstrCs
);
bConstrCs
=
NULL
;
Aig_ManForEachPi
(
p
->
pAigGlo
,
pObj
,
i
)
Cudd_RecursiveDeref
(
p
->
dd
,
bConstrNs
);
bConstrNs
=
NULL
;
pObj
->
pData
=
Aig_ManPi
(
p
->
pAig
,
i
)
->
pData
;
Cudd_RecursiveDeref
(
p
->
ddG
,
bReached
);
bReached
=
NULL
;
return
-
1
;
}
Cudd_Ref
(
bTemp
);
Vec_PtrPush
(
p
->
vRings
,
bTemp
);
//Extra_bddPrintSupport( p->dd, bCurrent ); printf( "\n" );
// check it for bad states
for
(
iOutFail
=
0
;
iOutFail
<
Saig_ManPoNum
(
p
->
pAig
);
iOutFail
++
)
if
(
!
p
->
pPars
->
fSkipOutCheck
&&
!
Cudd_bddLeq
(
p
->
ddR
,
bTemp
,
Cudd_Not
(
p
->
ddR
->
bFunc
)
)
)
{
{
DdNode
*
bFunc
,
*
bInter
;
assert
(
p
->
pAigGlo
->
pSeqModel
==
NULL
);
bFunc
=
Llb_ManConstructOutBdd
(
p
->
pAigGlo
,
Aig_ManPo
(
p
->
pAigGlo
,
iOutFail
),
p
->
dd
);
Cudd_Ref
(
bFunc
);
if
(
!
p
->
pPars
->
fBackward
)
//Extra_bddPrint( p->dd, bFunc ); printf( "\n" );
p
->
pAigGlo
->
pSeqModel
=
Llb_ManReachDeriveCex
(
p
);
if
(
Cudd_bddLeq
(
p
->
dd
,
bCurrent
,
Cudd_Not
(
bFunc
)
)
)
// no cex
if
(
!
p
->
pPars
->
fSilent
)
{
Cudd_RecursiveDeref
(
p
->
dd
,
bFunc
);
continue
;
}
bInter
=
Cudd_bddIntersect
(
p
->
dd
,
bCurrent
,
bFunc
);
Cudd_Ref
(
bInter
);
assert
(
p
->
pAig
->
pSeqModel
==
NULL
);
p
->
pAig
->
pSeqModel
=
Llb_ManDeriveCex
(
p
,
bInter
,
iOutFail
,
nIters
);
Cudd_RecursiveDeref
(
p
->
dd
,
bInter
);
Cudd_RecursiveDeref
(
p
->
dd
,
bFunc
);
break
;
}
if
(
iOutFail
<
Saig_ManPoNum
(
p
->
pAig
)
)
{
{
if
(
!
p
->
pPars
->
fSilent
)
if
(
!
p
->
pPars
->
fBackward
)
printf
(
"Output %d was asserted in frame %d (use
\"
write_counter
\"
to dump a witness). "
,
iOutFail
,
nIters
);
printf
(
"Output %d was asserted in frame %d (use
\"
write_counter
\"
to dump a witness). "
,
p
->
pAigGlo
->
pSeqModel
->
iPo
,
nIters
);
Cudd_RecursiveDeref
(
p
->
ddG
,
bReached
);
bReached
=
NULL
;
else
Cudd_RecursiveDeref
(
p
->
dd
,
bCurrent
);
bCurrent
=
NULL
;
printf
(
"Output ??? was asserted in frame %d (counter-example is not produced). "
,
nIters
);
p
->
pPars
->
iFrame
=
nIters
;
Abc_PrintTime
(
1
,
"Time"
,
clock
()
-
clk
);
break
;
}
}
Cudd_RecursiveDeref
(
p
->
dd
,
bCurrent
);
bCurrent
=
NULL
;
Cudd_RecursiveDeref
(
p
->
dd
,
bConstrCs
);
bConstrCs
=
NULL
;
Cudd_RecursiveDeref
(
p
->
dd
,
bConstrNs
);
bConstrNs
=
NULL
;
Cudd_RecursiveDeref
(
p
->
ddG
,
bReached
);
bReached
=
NULL
;
return
0
;
}
}
// restrict reachable states using constraints
// restrict reachable states using constraints
if
(
vHints
)
if
(
vHints
)
{
{
bCurrent
=
Cudd_bddAnd
(
p
->
dd
,
bTemp
=
bCurrent
,
bConstrCs
);
Cudd_Ref
(
bCurrent
);
bCurrent
=
Cudd_bddAnd
(
p
->
dd
,
bTemp
=
bCurrent
,
bConstrCs
);
Cudd_Ref
(
bCurrent
);
Cudd_RecursiveDeref
(
p
->
dd
,
bTemp
);
Cudd_RecursiveDeref
(
p
->
dd
,
bTemp
);
}
}
// quantify variables appearing only in the init state
// quantify variables appearing only in the init state
bCube
=
Llb_ManConstructQuantCubeIntern
(
p
,
(
Llb_Grp_t
*
)
Vec_PtrEntry
(
p
->
vGroups
,
0
),
0
);
Cudd_Ref
(
bCube
);
bCube
=
Llb_ManConstructQuantCubeIntern
(
p
,
(
Llb_Grp_t
*
)
Vec_PtrEntry
(
p
->
vGroups
,
0
),
0
,
0
);
Cudd_Ref
(
bCube
);
bCurrent
=
Cudd_bddExistAbstract
(
p
->
dd
,
bTemp
=
bCurrent
,
bCube
);
Cudd_Ref
(
bCurrent
);
bCurrent
=
Cudd_bddExistAbstract
(
p
->
dd
,
bTemp
=
bCurrent
,
bCube
);
Cudd_Ref
(
bCurrent
);
Cudd_RecursiveDeref
(
p
->
dd
,
bTemp
);
Cudd_RecursiveDeref
(
p
->
dd
,
bTemp
);
Cudd_RecursiveDeref
(
p
->
dd
,
bCube
);
Cudd_RecursiveDeref
(
p
->
dd
,
bCube
);
// compute the next states
// compute the next states
bNext
=
Llb_ManComputeImage
(
p
,
bCurrent
);
bNext
=
Llb_ManComputeImage
(
p
,
bCurrent
,
0
);
if
(
bNext
==
NULL
)
if
(
bNext
==
NULL
)
{
{
if
(
!
p
->
pPars
->
fSilent
)
if
(
!
p
->
pPars
->
fSilent
)
...
...
src/aig/llb/llbInt.h
View file @
02081dba
...
@@ -55,16 +55,20 @@ struct Llb_Man_t_
...
@@ -55,16 +55,20 @@ struct Llb_Man_t_
Aig_Man_t
*
pAig
;
// derived AIG manager (created in this package)
Aig_Man_t
*
pAig
;
// derived AIG manager (created in this package)
DdManager
*
dd
;
// BDD manager
DdManager
*
dd
;
// BDD manager
DdManager
*
ddG
;
// BDD manager
DdManager
*
ddG
;
// BDD manager
DdManager
*
ddR
;
// BDD manager
Vec_Int_t
*
vObj2Var
;
// mapping AIG ObjId into BDD var index
Vec_Int_t
*
vObj2Var
;
// mapping AIG ObjId into BDD var index
Vec_Int_t
*
vVar2Obj
;
// mapping BDD var index into AIG ObjId
Vec_Int_t
*
vVar2Obj
;
// mapping BDD var index into AIG ObjId
Vec_Ptr_t
*
vGroups
;
// group Id into group pointer
Vec_Ptr_t
*
vGroups
;
// group Id into group pointer
Llb_Mtr_t
*
pMatrix
;
// dependency matrix
Llb_Mtr_t
*
pMatrix
;
// dependency matrix
// image computation
// image computation
Vec_Ptr_t
*
vRings
;
// onion rings
Vec_Int_t
*
vVarBegs
;
// the first group where the var appears
Vec_Int_t
*
vVarBegs
;
// the first group where the var appears
Vec_Int_t
*
vVarEnds
;
// the last group where the var appears
Vec_Int_t
*
vVarEnds
;
// the last group where the var appears
// variable mapping
// variable mapping
Vec_Int_t
*
vNs2Glo
;
// next state variables into global variables
Vec_Int_t
*
vNs2Glo
;
// next state variables into global variables
Vec_Int_t
*
vCs2Glo
;
// next state variables into global variables
Vec_Int_t
*
vGlo2Cs
;
// global variables into current state variables
Vec_Int_t
*
vGlo2Cs
;
// global variables into current state variables
Vec_Int_t
*
vGlo2Ns
;
// global variables into current state variables
// flow computation
// flow computation
// Vec_Int_t * vMem;
// Vec_Int_t * vMem;
// Vec_Ptr_t * vTops;
// Vec_Ptr_t * vTops;
...
...
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