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
3368b2dd
Commit
3368b2dd
authored
Nov 24, 2014
by
Alan Mishchenko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improvements to handling boxes and flops.
parent
df83fb5e
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
319 additions
and
73 deletions
+319
-73
src/aig/gia/gia.h
+5
-3
src/aig/gia/giaIf.c
+4
-3
src/aig/gia/giaSweep.c
+202
-32
src/aig/gia/giaTim.c
+43
-17
src/base/abci/abc.c
+65
-18
No files found.
src/aig/gia/gia.h
View file @
3368b2dd
...
...
@@ -1317,7 +1317,8 @@ extern Gia_Man_t * Gia_ManSpeedup( Gia_Man_t * p, int Percentage, int De
extern
void
Gia_ManStgPrint
(
FILE
*
pFile
,
Vec_Int_t
*
vLines
,
int
nIns
,
int
nOuts
,
int
nStates
);
extern
Gia_Man_t
*
Gia_ManStgRead
(
char
*
pFileName
,
int
kHot
,
int
fVerbose
);
/*=== giaSweep.c ============================================================*/
extern
Gia_Man_t
*
Gia_ManFraigSweep
(
Gia_Man_t
*
p
,
void
*
pPars
);
extern
Gia_Man_t
*
Gia_ManFraigSweepSimple
(
Gia_Man_t
*
p
,
void
*
pPars
);
extern
Gia_Man_t
*
Gia_ManSweepWithBoxes
(
Gia_Man_t
*
p
,
void
*
pParsC
,
void
*
pParsS
,
int
fConst
,
int
fEquiv
,
int
fVerbose
);
/*=== giaSweeper.c ============================================================*/
extern
Gia_Man_t
*
Gia_SweeperStart
(
Gia_Man_t
*
p
);
extern
void
Gia_SweeperStop
(
Gia_Man_t
*
p
);
...
...
@@ -1349,6 +1350,7 @@ extern Vec_Int_t * Gia_ManComputeSwitchProbs( Gia_Man_t * pGia, int nFra
extern
Vec_Flt_t
*
Gia_ManPrintOutputProb
(
Gia_Man_t
*
p
);
/*=== giaTim.c ===========================================================*/
extern
int
Gia_ManBoxNum
(
Gia_Man_t
*
p
);
extern
int
Gia_ManRegBoxNum
(
Gia_Man_t
*
p
);
extern
int
Gia_ManIsSeqWithBoxes
(
Gia_Man_t
*
p
);
extern
int
Gia_ManIsNormalized
(
Gia_Man_t
*
p
);
extern
Gia_Man_t
*
Gia_ManDupNormalize
(
Gia_Man_t
*
p
);
...
...
@@ -1360,8 +1362,8 @@ extern void * Gia_ManUpdateTimMan( Gia_Man_t * p, Vec_Int_t * vBoxP
extern
void
*
Gia_ManUpdateTimMan2
(
Gia_Man_t
*
p
,
Vec_Int_t
*
vBoxesLeft
);
extern
Gia_Man_t
*
Gia_ManUpdateExtraAig
(
void
*
pTime
,
Gia_Man_t
*
pAig
,
Vec_Int_t
*
vBoxPres
);
extern
Gia_Man_t
*
Gia_ManUpdateExtraAig2
(
void
*
pTime
,
Gia_Man_t
*
pAig
,
Vec_Int_t
*
vBoxesLeft
);
extern
Gia_Man_t
*
Gia_ManDupCollapse
(
Gia_Man_t
*
p
,
Gia_Man_t
*
pBoxes
,
Vec_Int_t
*
vBoxPres
);
extern
int
Gia_ManVerifyWithBoxes
(
Gia_Man_t
*
pGia
,
void
*
pParsInit
,
char
*
pFileSpec
);
extern
Gia_Man_t
*
Gia_ManDupCollapse
(
Gia_Man_t
*
p
,
Gia_Man_t
*
pBoxes
,
Vec_Int_t
*
vBoxPres
,
int
fSeq
);
extern
int
Gia_ManVerifyWithBoxes
(
Gia_Man_t
*
pGia
,
int
nBTLimit
,
int
nTimeLim
,
int
fSeq
,
int
fVerbose
,
char
*
pFileSpec
);
/*=== giaTruth.c ===========================================================*/
extern
word
Gia_ObjComputeTruthTable6Lut
(
Gia_Man_t
*
p
,
int
iObj
,
Vec_Wrd_t
*
vTemp
);
extern
word
Gia_ObjComputeTruthTable6
(
Gia_Man_t
*
p
,
Gia_Obj_t
*
pObj
,
Vec_Int_t
*
vSupp
,
Vec_Wrd_t
*
vTruths
);
...
...
src/aig/gia/giaIf.c
View file @
3368b2dd
...
...
@@ -1885,9 +1885,10 @@ void Gia_ManTransferTiming( Gia_Man_t * p, Gia_Man_t * pGia )
{
if
(
pGia
->
pManTime
==
NULL
||
p
==
pGia
)
return
;
p
->
pManTime
=
pGia
->
pManTime
;
pGia
->
pManTime
=
NULL
;
p
->
pAigExtra
=
pGia
->
pAigExtra
;
pGia
->
pAigExtra
=
NULL
;
p
->
nAnd2Delay
=
pGia
->
nAnd2Delay
;
pGia
->
nAnd2Delay
=
0
;
p
->
pManTime
=
pGia
->
pManTime
;
pGia
->
pManTime
=
NULL
;
p
->
pAigExtra
=
pGia
->
pAigExtra
;
pGia
->
pAigExtra
=
NULL
;
p
->
vRegClasses
=
pGia
->
vRegClasses
;
pGia
->
vRegClasses
=
NULL
;
p
->
nAnd2Delay
=
pGia
->
nAnd2Delay
;
pGia
->
nAnd2Delay
=
0
;
}
/**Function*************************************************************
...
...
src/aig/gia/giaSweep.c
View file @
3368b2dd
...
...
@@ -21,6 +21,8 @@
#include "gia.h"
#include "giaAig.h"
#include "proof/dch/dch.h"
#include "misc/tim/tim.h"
#include "proof/cec/cec.h"
ABC_NAMESPACE_IMPL_START
...
...
@@ -36,6 +38,160 @@ ABC_NAMESPACE_IMPL_START
Synopsis [Mark GIA nodes that feed into POs.]
Description [Returns the array of classes of remaining registers.]
SideEffects []
SeeAlso []
***********************************************************************/
void
Gia_ManMarkSeqGiaWithBoxes_rec
(
Gia_Man_t
*
p
,
Gia_Obj_t
*
pObj
,
Vec_Int_t
*
vRoots
)
{
Tim_Man_t
*
pManTime
=
(
Tim_Man_t
*
)
p
->
pManTime
;
int
i
,
iBox
,
nBoxIns
,
nBoxOuts
,
iShift
,
nRealCis
;
if
(
Gia_ObjIsTravIdCurrent
(
p
,
pObj
)
)
return
;
Gia_ObjSetTravIdCurrent
(
p
,
pObj
);
if
(
Gia_ObjIsAnd
(
pObj
)
)
{
Gia_ManMarkSeqGiaWithBoxes_rec
(
p
,
Gia_ObjFanin0
(
pObj
),
vRoots
);
Gia_ManMarkSeqGiaWithBoxes_rec
(
p
,
Gia_ObjFanin1
(
pObj
),
vRoots
);
return
;
}
assert
(
Gia_ObjIsCi
(
pObj
)
);
nRealCis
=
Tim_ManPiNum
(
pManTime
);
if
(
Gia_ObjCioId
(
pObj
)
<
nRealCis
)
{
int
nRegs
=
Gia_ManRegBoxNum
(
p
);
int
iFlop
=
Gia_ObjCioId
(
pObj
)
-
(
nRealCis
-
nRegs
);
assert
(
iFlop
>=
0
&&
iFlop
<
nRegs
);
pObj
=
Gia_ManCo
(
p
,
Tim_ManPoNum
(
pManTime
)
-
nRegs
+
iFlop
);
Vec_IntPush
(
vRoots
,
Gia_ObjId
(
p
,
pObj
)
);
return
;
}
// get the box
iBox
=
Tim_ManBoxForCi
(
pManTime
,
Gia_ObjCioId
(
pObj
)
);
nBoxIns
=
Tim_ManBoxInputNum
(
pManTime
,
iBox
);
nBoxOuts
=
Tim_ManBoxOutputNum
(
pManTime
,
iBox
);
// mark all outputs
iShift
=
Tim_ManBoxOutputFirst
(
pManTime
,
iBox
);
for
(
i
=
0
;
i
<
nBoxOuts
;
i
++
)
Gia_ObjSetTravIdCurrent
(
p
,
Gia_ManCi
(
p
,
iShift
+
i
));
// traverse from inputs
iShift
=
Tim_ManBoxInputFirst
(
pManTime
,
iBox
);
for
(
i
=
0
;
i
<
nBoxIns
;
i
++
)
Gia_ObjSetTravIdCurrent
(
p
,
Gia_ManCo
(
p
,
iShift
+
i
));
for
(
i
=
0
;
i
<
nBoxIns
;
i
++
)
Gia_ManMarkSeqGiaWithBoxes_rec
(
p
,
Gia_ObjFanin0
(
Gia_ManCo
(
p
,
iShift
+
i
)),
vRoots
);
}
void
Gia_ManMarkSeqGiaWithBoxes
(
Gia_Man_t
*
p
,
int
fSeq
)
{
// CI order: real PIs + flop outputs + box outputs
// CO order: box inputs + real POs + flop inputs
Tim_Man_t
*
pManTime
=
(
Tim_Man_t
*
)
p
->
pManTime
;
Vec_Int_t
*
vRoots
;
Gia_Obj_t
*
pObj
;
int
nRealCis
=
Tim_ManPiNum
(
pManTime
);
int
nRealCos
=
Tim_ManPoNum
(
pManTime
);
int
i
,
nRegs
=
fSeq
?
Gia_ManRegBoxNum
(
p
)
:
0
;
assert
(
Gia_ManRegNum
(
p
)
==
0
);
assert
(
Gia_ManBoxNum
(
p
)
>
0
);
// mark the terminals
Gia_ManIncrementTravId
(
p
);
Gia_ObjSetTravIdCurrent
(
p
,
Gia_ManConst0
(
p
)
);
for
(
i
=
0
;
i
<
nRealCis
-
nRegs
;
i
++
)
Gia_ObjSetTravIdCurrent
(
p
,
Gia_ManPi
(
p
,
i
)
);
// collect flops reachable from the POs
vRoots
=
Vec_IntAlloc
(
Gia_ManRegBoxNum
(
p
)
);
for
(
i
=
Gia_ManPoNum
(
p
)
-
nRealCos
;
i
<
Gia_ManPoNum
(
p
)
-
nRegs
;
i
++
)
Gia_ManMarkSeqGiaWithBoxes_rec
(
p
,
Gia_ObjFanin0
(
Gia_ManPo
(
p
,
i
)),
vRoots
);
// collect flops reachable from roots
if
(
fSeq
)
Gia_ManForEachObjVec
(
vRoots
,
p
,
pObj
,
i
)
{
assert
(
Gia_ObjIsCo
(
pObj
)
);
Gia_ManMarkSeqGiaWithBoxes_rec
(
p
,
Gia_ObjFanin0
(
pObj
),
vRoots
);
}
Vec_IntFree
(
vRoots
);
}
Gia_Man_t
*
Gia_ManDupWithBoxes
(
Gia_Man_t
*
p
,
int
fSeq
)
{
Tim_Man_t
*
pManTime
=
(
Tim_Man_t
*
)
p
->
pManTime
;
Gia_Man_t
*
pNew
;
Gia_Obj_t
*
pObj
;
Vec_Int_t
*
vBoxesLeft
;
int
curCi
,
curCo
,
nBoxIns
,
nBoxOuts
;
int
i
,
k
,
iShift
,
nMarked
;
assert
(
Gia_ManBoxNum
(
p
)
>
0
);
assert
(
Gia_ManRegBoxNum
(
p
)
>
0
);
// mark useful boxes
Gia_ManMarkSeqGiaWithBoxes
(
p
,
fSeq
);
// duplicate marked entries
pNew
=
Gia_ManStart
(
Gia_ManObjNum
(
p
)
);
pNew
->
pName
=
Abc_UtilStrsav
(
p
->
pName
);
pNew
->
pSpec
=
Abc_UtilStrsav
(
p
->
pSpec
);
Gia_ManConst0
(
p
)
->
Value
=
0
;
Gia_ManForEachObj1
(
p
,
pObj
,
i
)
{
if
(
!
Gia_ObjIsTravIdCurrent
(
p
,
pObj
)
)
continue
;
if
(
Gia_ObjIsCi
(
pObj
)
)
pObj
->
Value
=
Gia_ManAppendCi
(
pNew
);
else
if
(
Gia_ObjIsAnd
(
pObj
)
)
pObj
->
Value
=
Gia_ManAppendAnd
(
pNew
,
Gia_ObjFanin0Copy
(
pObj
),
Gia_ObjFanin1Copy
(
pObj
)
);
else
if
(
Gia_ObjIsCo
(
pObj
)
)
pObj
->
Value
=
Gia_ManAppendCo
(
pNew
,
Gia_ObjFanin0Copy
(
pObj
)
);
else
assert
(
0
);
}
assert
(
!
Gia_ManHasDangling
(
p
)
);
// collect remaining flops
if
(
fSeq
)
{
pNew
->
vRegClasses
=
Vec_IntAlloc
(
Gia_ManRegBoxNum
(
p
)
);
iShift
=
Gia_ManPoNum
(
p
)
-
Gia_ManRegBoxNum
(
p
);
for
(
i
=
0
;
i
<
Gia_ManRegBoxNum
(
p
);
i
++
)
if
(
Gia_ObjIsTravIdCurrent
(
p
,
Gia_ManCo
(
p
,
iShift
+
i
))
)
Vec_IntPush
(
pNew
->
vRegClasses
,
Vec_IntEntry
(
p
->
vRegClasses
,
i
)
);
}
else
if
(
p
->
vRegClasses
)
pNew
->
vRegClasses
=
Vec_IntDup
(
p
->
vRegClasses
);
// collect remaining boxes
vBoxesLeft
=
Vec_IntAlloc
(
Gia_ManBoxNum
(
p
)
);
curCi
=
Tim_ManPiNum
(
pManTime
);
curCo
=
0
;
for
(
i
=
0
;
i
<
Gia_ManBoxNum
(
p
);
i
++
)
{
nBoxIns
=
Tim_ManBoxInputNum
(
pManTime
,
i
);
nBoxOuts
=
Tim_ManBoxOutputNum
(
pManTime
,
i
);
nMarked
=
0
;
for
(
k
=
0
;
k
<
nBoxIns
;
k
++
)
nMarked
+=
Gia_ObjIsTravIdCurrent
(
p
,
Gia_ManCo
(
p
,
curCo
+
k
)
);
for
(
k
=
0
;
k
<
nBoxOuts
;
k
++
)
nMarked
+=
Gia_ObjIsTravIdCurrent
(
p
,
Gia_ManCi
(
p
,
curCi
+
k
)
);
curCo
+=
nBoxIns
;
curCi
+=
nBoxOuts
;
// check presence
assert
(
nMarked
==
0
||
nMarked
==
nBoxIns
+
nBoxOuts
);
if
(
nMarked
)
Vec_IntPush
(
vBoxesLeft
,
i
);
}
curCo
+=
Tim_ManPoNum
(
pManTime
);
assert
(
curCi
==
Gia_ManCiNum
(
p
)
);
assert
(
curCo
==
Gia_ManCoNum
(
p
)
);
// update timing manager
pNew
->
pManTime
=
Gia_ManUpdateTimMan2
(
p
,
vBoxesLeft
);
// update extra STG
assert
(
p
->
pAigExtra
!=
NULL
);
assert
(
pNew
->
pAigExtra
==
NULL
);
pNew
->
pAigExtra
=
Gia_ManUpdateExtraAig2
(
p
->
pManTime
,
p
->
pAigExtra
,
vBoxesLeft
);
Vec_IntFree
(
vBoxesLeft
);
return
pNew
;
}
/**Function*************************************************************
Synopsis [Mark GIA nodes that feed into POs.]
Description []
SideEffects []
...
...
@@ -215,11 +371,17 @@ int * Gia_ManFraigSelectReprs( Gia_Man_t * p, Gia_Man_t * pGia, int fVerbose )
int
i
,
iLitGia
,
iLitGia2
,
iReprGia
,
fCompl
;
int
nConsts
=
0
,
nReprs
=
0
;
pGia2Abc
[
0
]
=
0
;
Gia_ManCleanMark0
(
p
);
Gia_ManForEachCo
(
p
,
pObj
,
i
)
if
(
Gia_ObjIsCi
(
Gia_ObjFanin0
(
pObj
))
)
// this CI is pointed by CO
Gia_ObjFanin0
(
pObj
)
->
fMark0
=
1
;
Gia_ManSetPhase
(
pGia
);
Gia_ManForEachObj1
(
p
,
pObj
,
i
)
{
if
(
Gia_ObjIsCo
(
pObj
)
)
continue
;
if
(
Gia_ObjIsCi
(
pObj
)
&&
pObj
->
fMark0
)
// skip CI pointed by CO
continue
;
assert
(
Gia_ObjIsCi
(
pObj
)
||
Gia_ObjIsAnd
(
pObj
)
);
iLitGia
=
Gia_ObjValue
(
pObj
);
if
(
iLitGia
==
-
1
)
...
...
@@ -243,6 +405,8 @@ int * Gia_ManFraigSelectReprs( Gia_Man_t * p, Gia_Man_t * pGia, int fVerbose )
}
}
ABC_FREE
(
pGia2Abc
);
Gia_ManForEachCo
(
p
,
pObj
,
i
)
Gia_ObjFanin0
(
pObj
)
->
fMark0
=
0
;
if
(
fVerbose
)
printf
(
"Found %d const reprs and %d other reprs.
\n
"
,
nConsts
,
nReprs
);
return
pReprs
;
...
...
@@ -271,6 +435,29 @@ void Gia_ManFraigSweepPerform( Gia_Man_t * p, void * pPars )
/**Function*************************************************************
Synopsis []
Description []
SideEffects []
SeeAlso []
***********************************************************************/
Gia_Man_t
*
Gia_ManFraigSweepSimple
(
Gia_Man_t
*
p
,
void
*
pPars
)
{
Gia_Man_t
*
pNew
;
assert
(
p
->
pManTime
==
NULL
||
Gia_ManBoxNum
(
p
)
==
0
);
Gia_ManFraigSweepPerform
(
p
,
pPars
);
pNew
=
Gia_ManEquivReduce
(
p
,
1
,
0
,
0
,
0
);
if
(
pNew
==
NULL
)
pNew
=
Gia_ManDup
(
p
);
Gia_ManTransferTiming
(
pNew
,
p
);
return
pNew
;
}
/**Function*************************************************************
Synopsis [Reduces root model with scorr.]
Description []
...
...
@@ -280,59 +467,42 @@ void Gia_ManFraigSweepPerform( Gia_Man_t * p, void * pPars )
SeeAlso []
***********************************************************************/
Gia_Man_t
*
Gia_Man
FraigSweep
(
Gia_Man_t
*
p
,
void
*
pPars
)
Gia_Man_t
*
Gia_Man
SweepWithBoxes
(
Gia_Man_t
*
p
,
void
*
pParsC
,
void
*
pParsS
,
int
fConst
,
int
fEquiv
,
int
fVerbose
)
{
Gia_Man_t
*
pGia
,
*
pNew
,
*
pTemp
;
int
*
pReprs
;
assert
(
Gia_ManRegNum
(
p
)
==
0
);
if
(
p
->
pManTime
==
NULL
)
{
Gia_ManFraigSweepPerform
(
p
,
pPars
);
pNew
=
Gia_ManEquivReduce
(
p
,
1
,
0
,
0
,
0
);
if
(
pNew
==
NULL
)
return
Gia_ManDup
(
p
);
return
pNew
;
}
if
(
p
->
pAigExtra
==
NULL
)
{
printf
(
"Timing manager is given but there is no GIA of boxes.
\n
"
);
return
NULL
;
}
assert
(
p
->
pAigExtra
!=
NULL
);
// order AIG objects
pNew
=
Gia_ManDupUnnormalize
(
p
);
if
(
pNew
==
NULL
)
return
NULL
;
Gia_ManTransferTiming
(
pNew
,
p
);
// find global equivalences
pNew
->
pManTime
=
p
->
pManTime
;
pGia
=
Gia_ManDupCollapse
(
pNew
,
p
->
pAigExtra
,
NULL
);
pNew
->
pManTime
=
NULL
;
Gia_ManFraigSweepPerform
(
pGia
,
pPars
);
pGia
=
Gia_ManDupCollapse
(
pNew
,
p
->
pAigExtra
,
NULL
,
pParsC
?
0
:
1
);
Gia_ManTransferTiming
(
pGia
,
pNew
);
// compute equivalences
if
(
pParsC
)
Gia_ManFraigSweepPerform
(
pGia
,
pParsC
);
else
if
(
pParsS
)
Cec_ManLSCorrespondenceClasses
(
pGia
,
(
Cec_ParCor_t
*
)
pParsS
);
else
Gia_ManSeqCleanupClasses
(
pGia
,
fConst
,
fEquiv
,
fVerbose
);
// transfer equivalences
pReprs
=
Gia_ManFraigSelectReprs
(
pNew
,
pGia
,
((
Dch_Pars_t
*
)
pPars
)
->
fVerbose
);
pReprs
=
Gia_ManFraigSelectReprs
(
pNew
,
pGia
,
fVerbose
);
Gia_ManStop
(
pGia
);
// reduce AIG
pNew
=
Gia_ManFraigReduceGia
(
pTemp
=
pNew
,
pReprs
);
Gia_ManTransferTiming
(
pNew
,
pTemp
);
Gia_ManStop
(
pTemp
);
ABC_FREE
(
pReprs
);
// derive new AIG
assert
(
pNew
->
pManTime
==
NULL
);
assert
(
pNew
->
pAigExtra
==
NULL
);
pNew
->
pManTime
=
p
->
pManTime
;
pNew
->
pAigExtra
=
p
->
pAigExtra
;
pNew
->
nAnd2Delay
=
p
->
nAnd2Delay
;
pNew
=
Gia_ManFraigCreateGia
(
pTemp
=
pNew
);
assert
(
pTemp
->
pManTime
==
p
->
pManTime
);
assert
(
pTemp
->
pAigExtra
==
p
->
pAigExtra
);
pTemp
->
pManTime
=
NULL
;
pTemp
->
pAigExtra
=
NULL
;
pNew
=
Gia_ManDupWithBoxes
(
pTemp
=
pNew
,
pParsC
?
0
:
1
);
Gia_ManStop
(
pTemp
);
// normalize the result
pNew
=
Gia_ManDupNormalize
(
pTemp
=
pNew
);
Gia_ManTransferTiming
(
pNew
,
pTemp
);
Gia_ManStop
(
pTemp
);
// return the result
assert
(
pNew
->
pManTime
!=
NULL
);
assert
(
pNew
->
pAigExtra
!=
NULL
);
return
pNew
;
}
...
...
src/aig/gia/giaTim.c
View file @
3368b2dd
...
...
@@ -19,8 +19,10 @@
***********************************************************************/
#include "gia.h"
#include "giaAig.h"
#include "misc/tim/tim.h"
#include "proof/cec/cec.h"
#include "proof/fra/fra.h"
ABC_NAMESPACE_IMPL_START
...
...
@@ -48,6 +50,10 @@ int Gia_ManBoxNum( Gia_Man_t * p )
{
return
p
->
pManTime
?
Tim_ManBoxNum
((
Tim_Man_t
*
)
p
->
pManTime
)
:
0
;
}
int
Gia_ManRegBoxNum
(
Gia_Man_t
*
p
)
{
return
p
->
vRegClasses
?
Vec_IntSize
(
p
->
vRegClasses
)
:
0
;
}
/**Function*************************************************************
...
...
@@ -701,13 +707,14 @@ void Gia_ManDupCollapse_rec( Gia_Man_t * p, Gia_Obj_t * pObj, Gia_Man_t * pNew )
if
(
Gia_ObjSibl
(
p
,
Gia_ObjId
(
p
,
pObj
))
)
pNew
->
pSibls
[
Abc_Lit2Var
(
pObj
->
Value
)]
=
Abc_Lit2Var
(
Gia_ObjSiblObj
(
p
,
Gia_ObjId
(
p
,
pObj
))
->
Value
);
}
Gia_Man_t
*
Gia_ManDupCollapse
(
Gia_Man_t
*
p
,
Gia_Man_t
*
pBoxes
,
Vec_Int_t
*
vBoxPres
)
Gia_Man_t
*
Gia_ManDupCollapse
(
Gia_Man_t
*
p
,
Gia_Man_t
*
pBoxes
,
Vec_Int_t
*
vBoxPres
,
int
fSeq
)
{
// this procedure assumes that sequential AIG with boxes is unshuffled to have valid boxes
Tim_Man_t
*
pManTime
=
(
Tim_Man_t
*
)
p
->
pManTime
;
Gia_Man_t
*
pNew
,
*
pTemp
;
Gia_Obj_t
*
pObj
,
*
pObjBox
;
int
i
,
k
,
curCi
,
curCo
;
assert
(
!
fSeq
||
p
->
vRegClasses
);
//assert( Gia_ManRegNum(p) == 0 );
assert
(
Gia_ManCiNum
(
p
)
==
Tim_ManPiNum
(
pManTime
)
+
Gia_ManCoNum
(
pBoxes
)
);
pNew
=
Gia_ManStart
(
Gia_ManObjNum
(
p
)
);
...
...
@@ -790,7 +797,7 @@ Gia_Man_t * Gia_ManDupCollapse( Gia_Man_t * p, Gia_Man_t * pBoxes, Vec_Int_t * v
// verify counts
assert
(
curCi
==
Gia_ManCiNum
(
p
)
);
assert
(
curCo
==
Gia_ManCoNum
(
p
)
);
Gia_ManSetRegNum
(
pNew
,
Gia_ManRegNum
(
p
)
);
Gia_ManSetRegNum
(
pNew
,
(
fSeq
&&
p
->
vRegClasses
)
?
Vec_IntSize
(
p
->
vRegClasses
)
:
Gia_ManRegNum
(
p
)
);
Gia_ManHashStop
(
pNew
);
pNew
=
Gia_ManCleanup
(
pTemp
=
pNew
);
Gia_ManCleanupRemap
(
p
,
pTemp
);
...
...
@@ -811,9 +818,8 @@ Gia_Man_t * Gia_ManDupCollapse( Gia_Man_t * p, Gia_Man_t * pBoxes, Vec_Int_t * v
SeeAlso []
***********************************************************************/
int
Gia_ManVerifyWithBoxes
(
Gia_Man_t
*
pGia
,
void
*
pParsInit
,
char
*
pFileSpec
)
int
Gia_ManVerifyWithBoxes
(
Gia_Man_t
*
pGia
,
int
nBTLimit
,
int
nTimeLim
,
int
fSeq
,
int
fVerbose
,
char
*
pFileSpec
)
{
int
fVerbose
=
1
;
int
Status
=
-
1
;
Gia_Man_t
*
pSpec
,
*
pGia0
,
*
pGia1
,
*
pMiter
;
Vec_Int_t
*
vBoxPres
=
NULL
;
...
...
@@ -866,28 +872,48 @@ int Gia_ManVerifyWithBoxes( Gia_Man_t * pGia, void * pParsInit, char * pFileSpec
}
// collapse two designs
if
(
Gia_ManBoxNum
(
pSpec
)
>
0
)
pGia0
=
Gia_ManDupCollapse
(
pSpec
,
pSpec
->
pAigExtra
,
vBoxPres
);
pGia0
=
Gia_ManDupCollapse
(
pSpec
,
pSpec
->
pAigExtra
,
vBoxPres
,
fSeq
);
else
pGia0
=
Gia_ManDup
(
pSpec
);
if
(
Gia_ManBoxNum
(
pGia
)
>
0
)
pGia1
=
Gia_ManDupCollapse
(
pGia
,
pGia
->
pAigExtra
,
NULL
);
pGia1
=
Gia_ManDupCollapse
(
pGia
,
pGia
->
pAigExtra
,
NULL
,
fSeq
);
else
pGia1
=
Gia_ManDup
(
pGia
);
Vec_IntFreeP
(
&
vBoxPres
);
}
// compute the miter
pMiter
=
Gia_ManMiter
(
pGia0
,
pGia1
,
0
,
1
,
0
,
0
,
fVerbose
);
if
(
pMiter
)
if
(
fSeq
)
{
pMiter
=
Gia_ManMiter
(
pGia0
,
pGia1
,
0
,
0
,
1
,
0
,
fVerbose
);
if
(
pMiter
)
{
Aig_Man_t
*
pMan
;
Fra_Sec_t
SecPar
,
*
pSecPar
=
&
SecPar
;
Fra_SecSetDefaultParams
(
pSecPar
);
pSecPar
->
nBTLimit
=
nBTLimit
;
pSecPar
->
TimeLimit
=
nTimeLim
;
pSecPar
->
fVerbose
=
fVerbose
;
pMan
=
Gia_ManToAig
(
pMiter
,
0
);
Gia_ManStop
(
pMiter
);
Status
=
Fra_FraigSec
(
pMan
,
pSecPar
,
NULL
);
Aig_ManStop
(
pMan
);
}
}
else
{
Cec_ParCec_t
ParsCec
,
*
pPars
=
&
ParsCec
;
Cec_ManCecSetDefaultParams
(
pPars
);
pPars
->
fVerbose
=
fVerbose
;
if
(
pParsInit
)
memcpy
(
pPars
,
pParsInit
,
sizeof
(
Cec_ParCec_t
)
);
Status
=
Cec_ManVerify
(
pMiter
,
pPars
);
Gia_ManStop
(
pMiter
);
if
(
pPars
->
iOutFail
>=
0
)
Abc_Print
(
1
,
"Verification failed for at least one output (%d).
\n
"
,
pPars
->
iOutFail
);
pMiter
=
Gia_ManMiter
(
pGia0
,
pGia1
,
0
,
1
,
0
,
0
,
fVerbose
);
if
(
pMiter
)
{
Cec_ParCec_t
ParsCec
,
*
pPars
=
&
ParsCec
;
Cec_ManCecSetDefaultParams
(
pPars
);
pPars
->
nBTLimit
=
nBTLimit
;
pPars
->
TimeLimit
=
nTimeLim
;
pPars
->
fVerbose
=
fVerbose
;
Status
=
Cec_ManVerify
(
pMiter
,
pPars
);
if
(
pPars
->
iOutFail
>=
0
)
Abc_Print
(
1
,
"Verification failed for at least one output (%d).
\n
"
,
pPars
->
iOutFail
);
Gia_ManStop
(
pMiter
);
}
}
Gia_ManStop
(
pGia0
);
Gia_ManStop
(
pGia1
);
...
...
src/base/abci/abc.c
View file @
3368b2dd
...
...
@@ -20534,7 +20534,6 @@ int Abc_CommandDSec( Abc_Frame_t * pAbc, int argc, char ** argv )
int
c
;
int
fIgnoreNames
;
extern
void
Fra_SecSetDefaultParams
(
Fra_Sec_t
*
p
);
extern
int
Abc_NtkDarSec
(
Abc_Ntk_t
*
pNtk1
,
Abc_Ntk_t
*
pNtk2
,
Fra_Sec_t
*
p
);
pNtk
=
Abc_FrameReadNtk
(
pAbc
);
...
...
@@ -26544,12 +26543,12 @@ int Abc_CommandAbc9Strash( Abc_Frame_t * pAbc, int argc, char ** argv )
{
Gia_Man_t
*
pUnshuffled
=
Gia_ManDupUnshuffleInputs
(
pAbc
->
pGia
);
Gia_ManTransferTiming
(
pUnshuffled
,
pAbc
->
pGia
);
pTemp
=
Gia_ManDupCollapse
(
pUnshuffled
,
pUnshuffled
->
pAigExtra
,
NULL
);
pTemp
=
Gia_ManDupCollapse
(
pUnshuffled
,
pUnshuffled
->
pAigExtra
,
NULL
,
0
);
Gia_ManTransferTiming
(
pAbc
->
pGia
,
pUnshuffled
);
Gia_ManStop
(
pUnshuffled
);
}
else
pTemp
=
Gia_ManDupCollapse
(
pAbc
->
pGia
,
pAbc
->
pGia
->
pAigExtra
,
NULL
);
pTemp
=
Gia_ManDupCollapse
(
pAbc
->
pGia
,
pAbc
->
pGia
->
pAigExtra
,
NULL
,
0
);
if
(
!
Abc_FrameReadFlag
(
"silentmode"
)
)
printf
(
"Collapsed AIG with boxes and logic of the boxes.
\n
"
);
}
...
...
@@ -29424,6 +29423,22 @@ int Abc_CommandAbc9Scl( Abc_Frame_t * pAbc, int argc, char ** argv )
Abc_Print
(
-
1
,
"Abc_CommandAbc9Scl(): There is no AIG.
\n
"
);
return
1
;
}
if
(
Gia_ManBoxNum
(
pAbc
->
pGia
)
&&
Gia_ManRegBoxNum
(
pAbc
->
pGia
)
)
{
if
(
pAbc
->
pGia
->
pAigExtra
==
NULL
)
{
printf
(
"Timing manager is given but there is no GIA of boxes.
\n
"
);
return
0
;
}
pTemp
=
Gia_ManSweepWithBoxes
(
pAbc
->
pGia
,
NULL
,
NULL
,
fConst
,
fEquiv
,
fVerbose
);
Abc_FrameUpdateGia
(
pAbc
,
pTemp
);
return
0
;
}
if
(
Gia_ManRegNum
(
pAbc
->
pGia
)
==
0
)
{
Abc_Print
(
-
1
,
"The network is combinational.
\n
"
);
return
0
;
}
pTemp
=
Gia_ManSeqStructSweep
(
pAbc
->
pGia
,
fConst
,
fEquiv
,
fVerbose
);
Abc_FrameUpdateGia
(
pAbc
,
pTemp
);
return
0
;
...
...
@@ -29512,6 +29527,17 @@ int Abc_CommandAbc9Lcorr( Abc_Frame_t * pAbc, int argc, char ** argv )
Abc_Print
(
-
1
,
"Abc_CommandAbc9Lcorr(): There is no AIG.
\n
"
);
return
1
;
}
if
(
Gia_ManBoxNum
(
pAbc
->
pGia
)
&&
Gia_ManRegBoxNum
(
pAbc
->
pGia
)
)
{
if
(
pAbc
->
pGia
->
pAigExtra
==
NULL
)
{
printf
(
"Timing manager is given but there is no GIA of boxes.
\n
"
);
return
0
;
}
pTemp
=
Gia_ManSweepWithBoxes
(
pAbc
->
pGia
,
NULL
,
pPars
,
0
,
0
,
pPars
->
fVerbose
);
Abc_FrameUpdateGia
(
pAbc
,
pTemp
);
return
0
;
}
if
(
Gia_ManRegNum
(
pAbc
->
pGia
)
==
0
)
{
Abc_Print
(
-
1
,
"The network is combinational.
\n
"
);
...
...
@@ -29619,6 +29645,17 @@ int Abc_CommandAbc9Scorr( Abc_Frame_t * pAbc, int argc, char ** argv )
Abc_Print
(
-
1
,
"Abc_CommandAbc9Scorr(): There is no AIG.
\n
"
);
return
1
;
}
if
(
Gia_ManBoxNum
(
pAbc
->
pGia
)
&&
Gia_ManRegBoxNum
(
pAbc
->
pGia
)
)
{
if
(
pAbc
->
pGia
->
pAigExtra
==
NULL
)
{
printf
(
"Timing manager is given but there is no GIA of boxes.
\n
"
);
return
0
;
}
pTemp
=
Gia_ManSweepWithBoxes
(
pAbc
->
pGia
,
NULL
,
pPars
,
0
,
0
,
pPars
->
fVerbose
);
Abc_FrameUpdateGia
(
pAbc
,
pTemp
);
return
0
;
}
if
(
Gia_ManRegNum
(
pAbc
->
pGia
)
==
0
)
{
Abc_Print
(
-
1
,
"The network is combinational.
\n
"
);
...
...
@@ -30735,11 +30772,9 @@ usage:
int
Abc_CommandAbc9Verify
(
Abc_Frame_t
*
pAbc
,
int
argc
,
char
**
argv
)
{
char
*
pFileSpec
=
NULL
;
Cec_ParCec_t
ParsCec
,
*
pPars
=
&
ParsCec
;
int
c
;
Cec_ManCecSetDefaultParams
(
pPars
);
int
c
,
nBTLimit
=
1000
,
nTimeLim
=
0
,
fSeq
=
0
,
fVerbose
=
0
;
Extra_UtilGetoptReset
();
while
(
(
c
=
Extra_UtilGetopt
(
argc
,
argv
,
"CTvh"
)
)
!=
EOF
)
while
(
(
c
=
Extra_UtilGetopt
(
argc
,
argv
,
"CT
s
vh"
)
)
!=
EOF
)
{
switch
(
c
)
{
...
...
@@ -30749,9 +30784,9 @@ int Abc_CommandAbc9Verify( Abc_Frame_t * pAbc, int argc, char ** argv )
Abc_Print
(
-
1
,
"Command line switch
\"
-C
\"
should be followed by an integer.
\n
"
);
goto
usage
;
}
pPars
->
nBTLimit
=
atoi
(
argv
[
globalUtilOptind
]);
nBTLimit
=
atoi
(
argv
[
globalUtilOptind
]);
globalUtilOptind
++
;
if
(
pPars
->
nBTLimit
<
0
)
if
(
nBTLimit
<
0
)
goto
usage
;
break
;
case
'T'
:
...
...
@@ -30760,13 +30795,16 @@ int Abc_CommandAbc9Verify( Abc_Frame_t * pAbc, int argc, char ** argv )
Abc_Print
(
-
1
,
"Command line switch
\"
-T
\"
should be followed by an integer.
\n
"
);
goto
usage
;
}
pPars
->
TimeLimit
=
atoi
(
argv
[
globalUtilOptind
]);
nTimeLim
=
atoi
(
argv
[
globalUtilOptind
]);
globalUtilOptind
++
;
if
(
pPars
->
TimeLimit
<
0
)
if
(
nTimeLim
<
0
)
goto
usage
;
break
;
case
's'
:
fSeq
^=
1
;
break
;
case
'v'
:
pPars
->
fVerbose
^=
1
;
fVerbose
^=
1
;
break
;
case
'h'
:
goto
usage
;
...
...
@@ -30780,15 +30818,16 @@ int Abc_CommandAbc9Verify( Abc_Frame_t * pAbc, int argc, char ** argv )
Extra_FileNameCorrectPath
(
pFileSpec
);
printf
(
"Taking spec from file
\"
%s
\"
.
\n
"
,
pFileSpec
);
}
Gia_ManVerifyWithBoxes
(
pAbc
->
pGia
,
pPars
,
pFileSpec
);
Gia_ManVerifyWithBoxes
(
pAbc
->
pGia
,
nBTLimit
,
nTimeLim
,
fSeq
,
fVerbose
,
pFileSpec
);
return
0
;
usage:
Abc_Print
(
-
2
,
"usage: &verify [-CT num] [-vh] <file>
\n
"
);
Abc_Print
(
-
2
,
"usage: &verify [-CT num] [-
s
vh] <file>
\n
"
);
Abc_Print
(
-
2
,
"
\t
performs verification of combinational design
\n
"
);
Abc_Print
(
-
2
,
"
\t
-C num : the max number of conflicts at a node [default = %d]
\n
"
,
pPars
->
nBTLimit
);
Abc_Print
(
-
2
,
"
\t
-T num : approximate runtime limit in seconds [default = %d]
\n
"
,
pPars
->
TimeLimit
);
Abc_Print
(
-
2
,
"
\t
-v : toggle verbose output [default = %s]
\n
"
,
pPars
->
fVerbose
?
"yes"
:
"no"
);
Abc_Print
(
-
2
,
"
\t
-C num : the max number of conflicts at a node [default = %d]
\n
"
,
nBTLimit
);
Abc_Print
(
-
2
,
"
\t
-T num : approximate runtime limit in seconds [default = %d]
\n
"
,
nTimeLim
);
Abc_Print
(
-
2
,
"
\t
-s : toggle using sequential verification [default = %s]
\n
"
,
fSeq
?
"yes"
:
"no"
);
Abc_Print
(
-
2
,
"
\t
-v : toggle verbose output [default = %s]
\n
"
,
fVerbose
?
"yes"
:
"no"
);
Abc_Print
(
-
2
,
"
\t
-h : print the command usage
\n
"
);
Abc_Print
(
-
2
,
"
\t
<file> : optional file name with the spec [default = not used
\n
"
);
return
1
;
...
...
@@ -30876,7 +30915,15 @@ int Abc_CommandAbc9Sweep( Abc_Frame_t * pAbc, int argc, char ** argv )
Abc_Print
(
-
1
,
"Abc_CommandAbc9Sweep(): There is no AIG.
\n
"
);
return
1
;
}
pTemp
=
Gia_ManFraigSweep
(
pAbc
->
pGia
,
pPars
);
if
(
Gia_ManBoxNum
(
pAbc
->
pGia
)
&&
pAbc
->
pGia
->
pAigExtra
==
NULL
)
{
printf
(
"Timing manager is given but there is no GIA of boxes.
\n
"
);
return
0
;
}
if
(
Gia_ManBoxNum
(
pAbc
->
pGia
)
)
pTemp
=
Gia_ManSweepWithBoxes
(
pAbc
->
pGia
,
pPars
,
NULL
,
0
,
0
,
pPars
->
fVerbose
);
else
pTemp
=
Gia_ManFraigSweepSimple
(
pAbc
->
pGia
,
pPars
);
Abc_FrameUpdateGia
(
pAbc
,
pTemp
);
return
0
;
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