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
75ee395f
Commit
75ee395f
authored
Feb 21, 2011
by
Alan Mishchenko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Implemented additional filtering of equivalences (&srm -sf).
parent
ab75993d
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
108 additions
and
32 deletions
+108
-32
src/aig/cec/cecSeq.c
+1
-1
src/aig/gia/gia.h
+1
-1
src/aig/gia/giaEquiv.c
+93
-22
src/base/abci/abc.c
+13
-8
No files found.
src/aig/cec/cecSeq.c
View file @
75ee395f
...
...
@@ -393,7 +393,7 @@ int Cec_ManSeqSemiformal( Gia_Man_t * pAig, Cec_ParSmf_t * pPars )
// write equivalence classes
Gia_WriteAiger
(
pAig
,
"gore.aig"
,
0
,
0
);
// reduce the model
pReduce
=
Gia_ManSpecReduce
(
pAig
,
0
,
0
,
1
,
0
);
pReduce
=
Gia_ManSpecReduce
(
pAig
,
0
,
0
,
1
,
0
,
0
);
if
(
pReduce
)
{
pReduce
=
Gia_ManSeqStructSweep
(
pAux
=
pReduce
,
1
,
1
,
0
);
...
...
src/aig/gia/gia.h
View file @
75ee395f
...
...
@@ -659,7 +659,7 @@ extern void Gia_ManEquivPrintClasses( Gia_Man_t * p, int fVerbose
extern
Gia_Man_t
*
Gia_ManEquivReduce
(
Gia_Man_t
*
p
,
int
fUseAll
,
int
fDualOut
,
int
fVerbose
);
extern
Gia_Man_t
*
Gia_ManEquivReduceAndRemap
(
Gia_Man_t
*
p
,
int
fSeq
,
int
fMiterPairs
);
extern
int
Gia_ManEquivSetColors
(
Gia_Man_t
*
p
,
int
fVerbose
);
extern
Gia_Man_t
*
Gia_ManSpecReduce
(
Gia_Man_t
*
p
,
int
fDualOut
,
int
fSynthesis
,
int
fReduce
,
int
fVerbose
);
extern
Gia_Man_t
*
Gia_ManSpecReduce
(
Gia_Man_t
*
p
,
int
fDualOut
,
int
fSynthesis
,
int
fReduce
,
int
f
SkipSome
,
int
f
Verbose
);
extern
Gia_Man_t
*
Gia_ManSpecReduceInit
(
Gia_Man_t
*
p
,
Abc_Cex_t
*
pInit
,
int
nFrames
,
int
fDualOut
);
extern
Gia_Man_t
*
Gia_ManSpecReduceInitFrames
(
Gia_Man_t
*
p
,
Abc_Cex_t
*
pInit
,
int
nFramesMax
,
int
*
pnFrames
,
int
fDualOut
,
int
nMinOutputs
);
extern
void
Gia_ManEquivTransform
(
Gia_Man_t
*
p
,
int
fVerbose
);
...
...
src/aig/gia/giaEquiv.c
View file @
75ee395f
...
...
@@ -748,7 +748,7 @@ int Gia_ManEquivSetColors( Gia_Man_t * p, int fVerbose )
SeeAlso []
***********************************************************************/
static
inline
void
Gia_ManSpecBuild
(
Gia_Man_t
*
pNew
,
Gia_Man_t
*
p
,
Gia_Obj_t
*
pObj
,
Vec_Int_t
*
vXorLits
,
int
fDualOut
,
int
fSpeculate
)
static
inline
void
Gia_ManSpecBuild
(
Gia_Man_t
*
pNew
,
Gia_Man_t
*
p
,
Gia_Obj_t
*
pObj
,
Vec_Int_t
*
vXorLits
,
int
fDualOut
,
int
fSpeculate
,
Vec_Int_t
*
vTrace
)
{
Gia_Obj_t
*
pRepr
;
unsigned
iLitNew
;
...
...
@@ -760,7 +760,14 @@ static inline void Gia_ManSpecBuild( Gia_Man_t * pNew, Gia_Man_t * p, Gia_Obj_t
return
;
iLitNew
=
Gia_LitNotCond
(
pRepr
->
Value
,
Gia_ObjPhaseReal
(
pRepr
)
^
Gia_ObjPhaseReal
(
pObj
)
);
if
(
pObj
->
Value
!=
iLitNew
&&
!
Gia_ObjProved
(
p
,
Gia_ObjId
(
p
,
pObj
))
)
{
if
(
vTrace
)
Vec_IntPush
(
vTrace
,
1
);
Vec_IntPush
(
vXorLits
,
Gia_ManHashXor
(
pNew
,
pObj
->
Value
,
iLitNew
)
);
}
else
{
if
(
vTrace
)
Vec_IntPush
(
vTrace
,
0
);
}
if
(
fSpeculate
)
pObj
->
Value
=
iLitNew
;
}
...
...
@@ -799,15 +806,15 @@ int Gia_ManHasNoEquivs( Gia_Man_t * p )
SeeAlso []
***********************************************************************/
void
Gia_ManSpecReduce_rec
(
Gia_Man_t
*
pNew
,
Gia_Man_t
*
p
,
Gia_Obj_t
*
pObj
,
Vec_Int_t
*
vXorLits
,
int
fDualOut
,
int
fSpeculate
)
void
Gia_ManSpecReduce_rec
(
Gia_Man_t
*
pNew
,
Gia_Man_t
*
p
,
Gia_Obj_t
*
pObj
,
Vec_Int_t
*
vXorLits
,
int
fDualOut
,
int
fSpeculate
,
Vec_Int_t
*
vTrace
)
{
if
(
~
pObj
->
Value
)
return
;
assert
(
Gia_ObjIsAnd
(
pObj
)
);
Gia_ManSpecReduce_rec
(
pNew
,
p
,
Gia_ObjFanin0
(
pObj
),
vXorLits
,
fDualOut
,
fSpeculate
);
Gia_ManSpecReduce_rec
(
pNew
,
p
,
Gia_ObjFanin1
(
pObj
),
vXorLits
,
fDualOut
,
fSpeculate
);
Gia_ManSpecReduce_rec
(
pNew
,
p
,
Gia_ObjFanin0
(
pObj
),
vXorLits
,
fDualOut
,
fSpeculate
,
vTrace
);
Gia_ManSpecReduce_rec
(
pNew
,
p
,
Gia_ObjFanin1
(
pObj
),
vXorLits
,
fDualOut
,
fSpeculate
,
vTrace
);
pObj
->
Value
=
Gia_ManHashAnd
(
pNew
,
Gia_ObjFanin0Copy
(
pObj
),
Gia_ObjFanin1Copy
(
pObj
)
);
Gia_ManSpecBuild
(
pNew
,
p
,
pObj
,
vXorLits
,
fDualOut
,
fSpeculate
);
Gia_ManSpecBuild
(
pNew
,
p
,
pObj
,
vXorLits
,
fDualOut
,
fSpeculate
,
vTrace
);
}
/**Function*************************************************************
...
...
@@ -821,36 +828,77 @@ void Gia_ManSpecReduce_rec( Gia_Man_t * pNew, Gia_Man_t * p, Gia_Obj_t * pObj, V
SeeAlso []
***********************************************************************/
Gia_Man_t
*
Gia_ManSpecReduce
(
Gia_Man_t
*
p
,
int
fDualOut
,
int
fSynthesis
,
int
fSpeculate
,
int
fVerbos
e
)
Gia_Man_t
*
Gia_ManSpecReduce
Trace
(
Gia_Man_t
*
p
,
Vec_Int_t
*
vTrac
e
)
{
Vec_Int_t
*
vXorLits
;
Gia_Man_t
*
pNew
,
*
pTemp
;
Gia_Obj_t
*
pObj
;
Vec_Int_t
*
vXorLits
;
int
i
,
iLitNew
;
if
(
!
p
->
pReprs
)
{
printf
(
"Gia_ManSpecReduce(): Equivalence classes are not available.
\n
"
);
return
NULL
;
}
if
(
fDualOut
&&
(
Gia_ManPoNum
(
p
)
&
1
)
)
Vec_IntClear
(
vTrace
);
vXorLits
=
Vec_IntAlloc
(
1000
);
Gia_ManSetPhase
(
p
);
Gia_ManFillValue
(
p
);
pNew
=
Gia_ManStart
(
Gia_ManObjNum
(
p
)
);
pNew
->
pName
=
Gia_UtilStrsav
(
p
->
pName
);
Gia_ManHashAlloc
(
pNew
);
Gia_ManConst0
(
p
)
->
Value
=
0
;
Gia_ManForEachCi
(
p
,
pObj
,
i
)
pObj
->
Value
=
Gia_ManAppendCi
(
pNew
);
Gia_ManForEachRo
(
p
,
pObj
,
i
)
Gia_ManSpecBuild
(
pNew
,
p
,
pObj
,
vXorLits
,
0
,
1
,
vTrace
);
Gia_ManForEachCo
(
p
,
pObj
,
i
)
Gia_ManSpecReduce_rec
(
pNew
,
p
,
Gia_ObjFanin0
(
pObj
),
vXorLits
,
0
,
1
,
vTrace
);
Gia_ManForEachPo
(
p
,
pObj
,
i
)
Gia_ManAppendCo
(
pNew
,
Gia_ObjFanin0Copy
(
pObj
)
);
Vec_IntForEachEntry
(
vXorLits
,
iLitNew
,
i
)
Gia_ManAppendCo
(
pNew
,
iLitNew
);
if
(
Vec_IntSize
(
vXorLits
)
==
0
)
{
printf
(
"
Gia_ManSpecReduce(): Dual-output miter should have even number of PO
s.
\n
"
);
return
NULL
;
printf
(
"
Speculatively reduced model has no primary output
s.
\n
"
);
Gia_ManAppendCo
(
pNew
,
0
)
;
}
/*
if ( Gia_ManHasNoEquivs(p) )
Gia_ManForEachRi
(
p
,
pObj
,
i
)
Gia_ManAppendCo
(
pNew
,
Gia_ObjFanin0Copy
(
pObj
)
);
Gia_ManHashStop
(
pNew
);
Vec_IntFree
(
vXorLits
);
Gia_ManSetRegNum
(
pNew
,
Gia_ManRegNum
(
p
)
);
pNew
=
Gia_ManCleanup
(
pTemp
=
pNew
);
Gia_ManStop
(
pTemp
);
return
pNew
;
}
/**Function*************************************************************
Synopsis [Reduces AIG using equivalence classes.]
Description []
SideEffects []
SeeAlso []
***********************************************************************/
Gia_Man_t
*
Gia_ManSpecReduce
(
Gia_Man_t
*
p
,
int
fDualOut
,
int
fSynthesis
,
int
fSpeculate
,
int
fSkipSome
,
int
fVerbose
)
{
Gia_Man_t
*
pNew
,
*
pTemp
;
Gia_Obj_t
*
pObj
;
Vec_Int_t
*
vXorLits
;
int
i
,
iLitNew
;
if
(
!
p
->
pReprs
)
{
printf( "Gia_ManSpecReduce():
There are no equivalences to reduc
e.\n" );
printf
(
"Gia_ManSpecReduce():
Equivalence classes are not availabl
e.
\n
"
);
return
NULL
;
}
*/
/*
if ( !Gia_ManCheckTopoOrder( p ) )
if
(
fDualOut
&&
(
Gia_ManPoNum
(
p
)
&
1
)
)
{
printf( "Gia_ManSpecReduce():
AIG is not in a correct topological order
.\n" );
printf
(
"Gia_ManSpecReduce():
Dual-output miter should have even number of POs
.
\n
"
);
return
NULL
;
}
*/
vXorLits
=
Vec_IntAlloc
(
1000
);
Gia_ManSetPhase
(
p
);
Gia_ManFillValue
(
p
);
...
...
@@ -863,9 +911,9 @@ Gia_Man_t * Gia_ManSpecReduce( Gia_Man_t * p, int fDualOut, int fSynthesis, int
Gia_ManForEachCi
(
p
,
pObj
,
i
)
pObj
->
Value
=
Gia_ManAppendCi
(
pNew
);
Gia_ManForEachRo
(
p
,
pObj
,
i
)
Gia_ManSpecBuild
(
pNew
,
p
,
pObj
,
vXorLits
,
fDualOut
,
fSpeculate
);
Gia_ManSpecBuild
(
pNew
,
p
,
pObj
,
vXorLits
,
fDualOut
,
fSpeculate
,
NULL
);
Gia_ManForEachCo
(
p
,
pObj
,
i
)
Gia_ManSpecReduce_rec
(
pNew
,
p
,
Gia_ObjFanin0
(
pObj
),
vXorLits
,
fDualOut
,
fSpeculate
);
Gia_ManSpecReduce_rec
(
pNew
,
p
,
Gia_ObjFanin0
(
pObj
),
vXorLits
,
fDualOut
,
fSpeculate
,
NULL
);
if
(
!
fSynthesis
)
{
Gia_ManForEachPo
(
p
,
pObj
,
i
)
...
...
@@ -885,6 +933,29 @@ Gia_Man_t * Gia_ManSpecReduce( Gia_Man_t * p, int fDualOut, int fSynthesis, int
Gia_ManSetRegNum
(
pNew
,
Gia_ManRegNum
(
p
)
);
pNew
=
Gia_ManCleanup
(
pTemp
=
pNew
);
Gia_ManStop
(
pTemp
);
// update using trace
if
(
fSkipSome
)
{
Vec_Int_t
*
vTrace
=
Vec_IntAlloc
(
100
);
int
iLit
,
nLitNum
=
Gia_ManEquivCountLitsAll
(
p
);
pTemp
=
Gia_ManSpecReduceTrace
(
p
,
vTrace
);
Gia_ManStop
(
pTemp
);
assert
(
Vec_IntSize
(
vTrace
)
==
nLitNum
);
assert
(
Gia_ManPoNum
(
pNew
)
==
Gia_ManPoNum
(
p
)
+
nLitNum
);
iLit
=
Gia_ManPoNum
(
p
);
for
(
i
=
0
;
i
<
nLitNum
;
i
++
)
{
if
(
Vec_IntEntry
(
vTrace
,
i
)
==
0
)
continue
;
pObj
=
Gia_ManPo
(
pNew
,
Gia_ManPoNum
(
p
)
+
i
);
pObj
->
fCompl0
=
0
;
pObj
->
iDiff0
=
Gia_ObjId
(
pNew
,
pObj
);
}
Vec_IntFreeP
(
&
vTrace
);
pNew
=
Gia_ManCleanup
(
pTemp
=
pNew
);
Gia_ManStop
(
pTemp
);
}
return
pNew
;
}
...
...
@@ -1591,7 +1662,7 @@ int Gia_CommandSpecI( Gia_Man_t * pGia, int nFramesInit, int nBTLimitInit, int f
printf
(
"Gia_CommandSpecI: There are only trivial equiv candidates left (PO drivers). Quitting.
\n
"
);
break
;
}
pSrm
=
Gia_ManSpecReduce
(
pGia
,
0
,
0
,
1
,
0
);
pSrm
=
Gia_ManSpecReduce
(
pGia
,
0
,
0
,
1
,
0
,
0
);
// bmc2 -F 100 -C 25000
{
Abc_Cex_t
*
pCex
;
...
...
@@ -1628,7 +1699,7 @@ int Gia_CommandSpecI( Gia_Man_t * pGia, int nFramesInit, int nBTLimitInit, int f
// write equivalence classes
Gia_WriteAiger
(
pGia
,
"gore.aig"
,
0
,
0
);
// reduce the model
pReduce
=
Gia_ManSpecReduce
(
pGia
,
0
,
0
,
1
,
0
);
pReduce
=
Gia_ManSpecReduce
(
pGia
,
0
,
0
,
1
,
0
,
0
);
if
(
pReduce
)
{
pReduce
=
Gia_ManSeqStructSweep
(
pAux
=
pReduce
,
1
,
1
,
0
);
...
...
src/base/abci/abc.c
View file @
75ee395f
...
...
@@ -25941,22 +25941,26 @@ int Abc_CommandAbc9Srm( Abc_Frame_t * pAbc, int argc, char ** argv )
char
pFileName
[
10
],
pFileName2
[
10
];
Gia_Man_t
*
pTemp
,
*
pAux
;
int
c
,
fVerbose
=
0
;
int
fSpeculate
=
1
;
int
fSynthesis
=
0
;
int
fSpeculate
=
1
;
int
fSkipSome
=
0
;
int
fDualOut
=
0
;
Extra_UtilGetoptReset
();
while
(
(
c
=
Extra_UtilGetopt
(
argc
,
argv
,
"d
sr
vh"
)
)
!=
EOF
)
while
(
(
c
=
Extra_UtilGetopt
(
argc
,
argv
,
"d
rsf
vh"
)
)
!=
EOF
)
{
switch
(
c
)
{
case
'd'
:
fDualOut
^=
1
;
break
;
case
'r'
:
fSynthesis
^=
1
;
break
;
case
's'
:
fSpeculate
^=
1
;
break
;
case
'
r
'
:
fS
ynthesis
^=
1
;
case
'
f
'
:
fS
kipSome
^=
1
;
break
;
case
'v'
:
fVerbose
^=
1
;
...
...
@@ -25974,7 +25978,7 @@ int Abc_CommandAbc9Srm( Abc_Frame_t * pAbc, int argc, char ** argv )
}
sprintf
(
pFileName
,
"gsrm%s.aig"
,
fSpeculate
?
""
:
"s"
);
sprintf
(
pFileName2
,
"gsyn%s.aig"
,
fSpeculate
?
""
:
"s"
);
pTemp
=
Gia_ManSpecReduce
(
pAbc
->
pGia
,
fDualOut
,
fSynthesis
,
fSpeculate
,
fVerbose
);
pTemp
=
Gia_ManSpecReduce
(
pAbc
->
pGia
,
fDualOut
,
fSynthesis
,
fSpeculate
,
f
SkipSome
,
f
Verbose
);
if
(
pTemp
)
{
if
(
fSpeculate
)
...
...
@@ -26004,11 +26008,12 @@ int Abc_CommandAbc9Srm( Abc_Frame_t * pAbc, int argc, char ** argv )
return
0
;
usage:
Abc_Print
(
-
2
,
"usage: &srm [-d
sr
vh]
\n
"
);
Abc_Print
(
-
2
,
"usage: &srm [-d
rsf
vh]
\n
"
);
Abc_Print
(
-
2
,
"
\t
writes speculatively reduced model into file
\"
%s
\"\n
"
,
pFileName
);
Abc_Print
(
-
2
,
"
\t
-d : toggle creating dual output miter [default = %s]
\n
"
,
fDualOut
?
"yes"
:
"no"
);
Abc_Print
(
-
2
,
"
\t
-s : toggle using speculation at the internal nodes [default = %s]
\n
"
,
fSpeculate
?
"yes"
:
"no"
);
Abc_Print
(
-
2
,
"
\t
-r : toggle writing reduced network for synthesis [default = %s]
\n
"
,
fSynthesis
?
"yes"
:
"no"
);
Abc_Print
(
-
2
,
"
\t
-s : toggle using speculation at the internal nodes [default = %s]
\n
"
,
fSpeculate
?
"yes"
:
"no"
);
Abc_Print
(
-
2
,
"
\t
-f : toggle filtering to remove redundant equivalences [default = %s]
\n
"
,
fSkipSome
?
"yes"
:
"no"
);
Abc_Print
(
-
2
,
"
\t
-v : toggle printing verbose information [default = %s]
\n
"
,
fVerbose
?
"yes"
:
"no"
);
Abc_Print
(
-
2
,
"
\t
-h : print the command usage
\n
"
);
return
1
;
...
...
@@ -26127,7 +26132,7 @@ usage:
Abc_Print
(
-
2
,
"
\t
-h : print the command usage
\n
"
);
Abc_Print
(
-
2
,
"
\t
<miter.aig> : file with the external miter to read
\n
"
);
Abc_Print
(
-
2
,
"
\t
\n
"
);
Abc_Print
(
-
2
,
"
\t
The external miter should be generated by &srm -
m
\n
"
);
Abc_Print
(
-
2
,
"
\t
The external miter should be generated by &srm -
s
\n
"
);
Abc_Print
(
-
2
,
"
\t
and (partially) solved by any verification engine(s).
\n
"
);
Abc_Print
(
-
2
,
"
\t
The external miter should have as many POs as
\n
"
);
Abc_Print
(
-
2
,
"
\t
the number of POs in the current AIG plus
\n
"
);
...
...
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