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
48996f7a
Commit
48996f7a
authored
Sep 18, 2012
by
Alan Mishchenko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Changes to command 'upsize'.
parent
e0eb2703
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
135 additions
and
63 deletions
+135
-63
src/map/scl/scl.c
+3
-3
src/map/scl/sclMan.h
+1
-0
src/map/scl/sclUpsize.c
+131
-60
No files found.
src/map/scl/scl.c
View file @
48996f7a
...
@@ -642,9 +642,9 @@ usage:
...
@@ -642,9 +642,9 @@ usage:
int
Scl_CommandUpsize
(
Abc_Frame_t
*
pAbc
,
int
argc
,
char
**
argv
)
int
Scl_CommandUpsize
(
Abc_Frame_t
*
pAbc
,
int
argc
,
char
**
argv
)
{
{
Abc_Ntk_t
*
pNtk
=
Abc_FrameReadNtk
(
pAbc
);
Abc_Ntk_t
*
pNtk
=
Abc_FrameReadNtk
(
pAbc
);
int
Window
=
5
;
int
Window
=
2
;
int
Ratio
=
5
;
int
Ratio
=
10
;
int
nIters
=
2
0
;
int
nIters
=
10
0
;
int
c
,
fVerbose
=
0
;
int
c
,
fVerbose
=
0
;
Extra_UtilGetoptReset
();
Extra_UtilGetoptReset
();
while
(
(
c
=
Extra_UtilGetopt
(
argc
,
argv
,
"WRIvh"
)
)
!=
EOF
)
while
(
(
c
=
Extra_UtilGetopt
(
argc
,
argv
,
"WRIvh"
)
)
!=
EOF
)
...
...
src/map/scl/sclMan.h
View file @
48996f7a
...
@@ -74,6 +74,7 @@ struct SC_Man_
...
@@ -74,6 +74,7 @@ struct SC_Man_
////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////
static
inline
SC_Cell
*
Abc_SclObjCell
(
SC_Man
*
p
,
Abc_Obj_t
*
pObj
)
{
return
SC_LibCell
(
p
->
pLib
,
Vec_IntEntry
(
p
->
vGates
,
Abc_ObjId
(
pObj
))
);
}
static
inline
SC_Cell
*
Abc_SclObjCell
(
SC_Man
*
p
,
Abc_Obj_t
*
pObj
)
{
return
SC_LibCell
(
p
->
pLib
,
Vec_IntEntry
(
p
->
vGates
,
Abc_ObjId
(
pObj
))
);
}
static
inline
void
Abc_SclObjSetCell
(
SC_Man
*
p
,
Abc_Obj_t
*
pObj
,
SC_Cell
*
pCell
)
{
Vec_IntWriteEntry
(
p
->
vGates
,
Abc_ObjId
(
pObj
),
pCell
->
Id
);
}
static
inline
SC_Pair
*
Abc_SclObjLoad
(
SC_Man
*
p
,
Abc_Obj_t
*
pObj
)
{
return
p
->
pLoads
+
Abc_ObjId
(
pObj
);
}
static
inline
SC_Pair
*
Abc_SclObjLoad
(
SC_Man
*
p
,
Abc_Obj_t
*
pObj
)
{
return
p
->
pLoads
+
Abc_ObjId
(
pObj
);
}
static
inline
SC_Pair
*
Abc_SclObjTime
(
SC_Man
*
p
,
Abc_Obj_t
*
pObj
)
{
return
p
->
pTimes
+
Abc_ObjId
(
pObj
);
}
static
inline
SC_Pair
*
Abc_SclObjTime
(
SC_Man
*
p
,
Abc_Obj_t
*
pObj
)
{
return
p
->
pTimes
+
Abc_ObjId
(
pObj
);
}
...
...
src/map/scl/sclUpsize.c
View file @
48996f7a
...
@@ -36,6 +36,48 @@ extern Vec_Int_t * Abc_SclFindCriticalCoWindow( SC_Man * p, int Window );
...
@@ -36,6 +36,48 @@ extern Vec_Int_t * Abc_SclFindCriticalCoWindow( SC_Man * p, int Window );
/**Function*************************************************************
/**Function*************************************************************
Synopsis [Collect TFO of nodes.]
Description []
SideEffects []
SeeAlso []
***********************************************************************/
void
Abc_SclFindTFO_rec
(
Abc_Obj_t
*
pObj
,
Vec_Int_t
*
vVisited
)
{
Abc_Obj_t
*
pNext
;
int
i
;
// if ( Abc_ObjIsCo(pObj) )
// return;
if
(
Abc_NodeIsTravIdCurrent
(
pObj
)
)
return
;
Abc_NodeSetTravIdCurrent
(
pObj
);
Abc_ObjForEachFanout
(
pObj
,
pNext
,
i
)
Abc_SclFindTFO_rec
(
pNext
,
vVisited
);
Vec_IntPush
(
vVisited
,
Abc_ObjId
(
pObj
)
);
}
Vec_Int_t
*
Abc_SclFindTFO
(
Abc_Ntk_t
*
p
,
Vec_Int_t
*
vPath
)
{
Vec_Int_t
*
vVisited
;
Abc_Obj_t
*
pObj
,
*
pFanin
;
int
i
,
k
;
assert
(
Vec_IntSize
(
vPath
)
>
0
);
vVisited
=
Vec_IntAlloc
(
100
);
// collect nodes in the TFO
Abc_NtkIncrementTravId
(
p
);
Abc_NtkForEachObjVec
(
vPath
,
p
,
pObj
,
i
)
Abc_ObjForEachFanin
(
pObj
,
pFanin
,
k
)
if
(
Abc_ObjIsNode
(
pFanin
)
)
Abc_SclFindTFO_rec
(
pFanin
,
vVisited
);
// reverse order
Vec_IntReverseOrder
(
vVisited
);
return
vVisited
;
}
/**Function*************************************************************
Synopsis [Collect near-critical COs.]
Synopsis [Collect near-critical COs.]
Description []
Description []
...
@@ -103,6 +145,8 @@ Vec_Int_t * Abc_SclFindCriticalNodeWindow( SC_Man * p, Vec_Int_t * vPathCos, int
...
@@ -103,6 +145,8 @@ Vec_Int_t * Abc_SclFindCriticalNodeWindow( SC_Man * p, Vec_Int_t * vPathCos, int
Abc_NtkForEachObjVec
(
vPathCos
,
p
->
pNtk
,
pObj
,
i
)
Abc_NtkForEachObjVec
(
vPathCos
,
p
->
pNtk
,
pObj
,
i
)
Abc_SclFindCriticalNodeWindow_rec
(
p
,
Abc_ObjFanin0
(
pObj
),
vPath
,
fSlack
-
(
fMaxArr
-
Abc_SclObjTimeMax
(
p
,
pObj
))
);
Abc_SclFindCriticalNodeWindow_rec
(
p
,
Abc_ObjFanin0
(
pObj
),
vPath
,
fSlack
-
(
fMaxArr
-
Abc_SclObjTimeMax
(
p
,
pObj
))
);
// label critical nodes
// label critical nodes
Abc_NtkForEachObjVec
(
vPathCos
,
p
->
pNtk
,
pObj
,
i
)
pObj
->
fMarkA
=
1
;
Abc_NtkForEachObjVec
(
vPath
,
p
->
pNtk
,
pObj
,
i
)
Abc_NtkForEachObjVec
(
vPath
,
p
->
pNtk
,
pObj
,
i
)
pObj
->
fMarkA
=
1
;
pObj
->
fMarkA
=
1
;
return
vPath
;
return
vPath
;
...
@@ -126,35 +170,48 @@ void Abc_SclUnmarkCriticalNodeWindow( SC_Man * p, Vec_Int_t * vPath )
...
@@ -126,35 +170,48 @@ void Abc_SclUnmarkCriticalNodeWindow( SC_Man * p, Vec_Int_t * vPath )
SeeAlso []
SeeAlso []
***********************************************************************/
***********************************************************************/
Vec_Int_t
*
Abc_SclFindNodesToUpdate
(
Abc_Obj_t
*
p
Obj
)
Vec_Int_t
*
Abc_SclFindNodesToUpdate
(
Abc_Obj_t
*
p
Pivot
,
Vec_Int_t
**
pvEvals
)
{
{
Abc_Ntk_t
*
p
=
Abc_ObjNtk
(
pPivot
);
Abc_Obj_t
*
pObj
,
*
pNext
,
*
pNext2
;
Vec_Int_t
*
vNodes
;
Vec_Int_t
*
vNodes
;
Abc_Obj_t
*
pNext
,
*
pNext2
;
int
i
,
k
;
int
i
,
k
,
Start
;
assert
(
Abc_ObjIsNode
(
pPivot
)
);
assert
(
Abc_ObjIsNode
(
pObj
)
);
assert
(
pPivot
->
fMarkA
);
assert
(
pObj
->
fMarkA
);
vNodes
=
Vec_IntAlloc
(
16
);
// collect fanins, node, and fanouts
// collect fanins, node, and fanouts
Abc_ObjForEachFanin
(
pObj
,
pNext
,
i
)
vNodes
=
Vec_IntAlloc
(
16
);
Abc_ObjForEachFanin
(
pPivot
,
pNext
,
i
)
if
(
Abc_ObjIsNode
(
pNext
)
)
if
(
Abc_ObjIsNode
(
pNext
)
)
Vec_IntPush
(
vNodes
,
Abc_ObjId
(
pNext
)
);
Vec_IntPush
(
vNodes
,
Abc_ObjId
(
pNext
)
);
Vec_IntPush
(
vNodes
,
Abc_ObjId
(
pObj
)
);
Vec_IntPush
(
vNodes
,
Abc_ObjId
(
pPivot
)
);
Abc_ObjForEachFanout
(
pObj
,
pNext
,
i
)
Abc_ObjForEachFanout
(
pPivot
,
pNext
,
i
)
if
(
Abc_ObjIsNode
(
pNext
)
&&
pNext
->
fMarkA
)
Vec_IntPush
(
vNodes
,
Abc_ObjId
(
pNext
)
),
pNext
->
fMarkB
=
1
;
// remember this position
Start
=
Vec_IntSize
(
vNodes
);
// label collected nodes
Abc_ObjForEachFanout
(
pObj
,
pNext
,
i
)
if
(
Abc_ObjIsNode
(
pNext
)
&&
pNext
->
fMarkA
)
if
(
Abc_ObjIsNode
(
pNext
)
&&
pNext
->
fMarkA
)
{
Vec_IntPush
(
vNodes
,
Abc_ObjId
(
pNext
)
);
Abc_ObjForEachFanout
(
pNext
,
pNext2
,
k
)
Abc_ObjForEachFanout
(
pNext
,
pNext2
,
k
)
if
(
Abc_ObjIsNode
(
pNext2
)
&&
pNext2
->
fMarkA
&&
!
pNext2
->
fMarkB
)
if
(
Abc_ObjIsNode
(
pNext2
)
&&
pNext2
->
fMarkA
)
Vec_IntPush
(
vNodes
,
Abc_ObjId
(
pNext2
)
),
pNext2
->
fMarkB
=
1
;
Vec_IntPush
(
vNodes
,
Abc_ObjId
(
pNext2
)
);
// clean the fanouts
}
Abc_NtkForEachObjVec
(
vNodes
,
pObj
->
pNtk
,
pNext
,
i
)
Vec_IntUniqify
(
vNodes
);
pNext
->
fMarkB
=
0
;
// label nodes
// save position at the last entry
Abc_NtkForEachObjVec
(
vNodes
,
p
,
pObj
,
i
)
Vec_IntPush
(
vNodes
,
Start
);
{
assert
(
pObj
->
fMarkB
==
0
);
pObj
->
fMarkB
=
1
;
}
// collect nodes pointed to by non-labeled nodes
*
pvEvals
=
Vec_IntAlloc
(
10
);
Abc_NtkForEachObjVec
(
vNodes
,
p
,
pObj
,
i
)
Abc_ObjForEachFanout
(
pObj
,
pNext
,
k
)
if
(
pNext
->
fMarkA
&&
!
pNext
->
fMarkB
)
{
Vec_IntPush
(
*
pvEvals
,
Abc_ObjId
(
pObj
)
);
break
;
}
assert
(
Vec_IntSize
(
*
pvEvals
)
>
0
);
// label nodes
Abc_NtkForEachObjVec
(
vNodes
,
p
,
pObj
,
i
)
pObj
->
fMarkB
=
0
;
return
vNodes
;
return
vNodes
;
}
}
...
@@ -170,22 +227,17 @@ Vec_Int_t * Abc_SclFindNodesToUpdate( Abc_Obj_t * pObj )
...
@@ -170,22 +227,17 @@ Vec_Int_t * Abc_SclFindNodesToUpdate( Abc_Obj_t * pObj )
SeeAlso []
SeeAlso []
***********************************************************************/
***********************************************************************/
float
Abc_SclFindGain
(
SC_Man
*
p
,
Vec_Int_t
*
vCone
)
float
Abc_SclFindGain
(
SC_Man
*
p
,
Vec_Int_t
*
vCone
,
Vec_Int_t
*
vEvals
)
{
{
double
dGain
=
0
;
double
dGain
=
0
;
Abc_Obj_t
*
pObj
;
Abc_Obj_t
*
pObj
;
int
i
,
Start
;
int
i
;
Start
=
Vec_IntEntryLast
(
vCone
);
vCone
->
nSize
--
;
Abc_SclConeStore
(
p
,
vCone
);
Abc_SclConeStore
(
p
,
vCone
);
Abc_SclTimeCone
(
p
,
vCone
);
Abc_SclTimeCone
(
p
,
vCone
);
Abc_NtkForEachObjVec
Start
(
vCone
,
p
->
pNtk
,
pObj
,
i
,
Start
)
Abc_NtkForEachObjVec
(
vEvals
,
p
->
pNtk
,
pObj
,
i
)
dGain
+=
Abc_SclObjGain
(
p
,
pObj
);
dGain
+=
Abc_SclObjGain
(
p
,
pObj
);
Abc_SclConeRestore
(
p
,
vCone
);
Abc_SclConeRestore
(
p
,
vCone
);
dGain
/=
(
Vec_IntSize
(
vCone
)
-
Start
);
dGain
/=
Vec_IntSize
(
vEvals
);
vCone
->
nSize
++
;
return
(
float
)
dGain
;
return
(
float
)
dGain
;
}
}
...
@@ -203,30 +255,32 @@ float Abc_SclFindGain( SC_Man * p, Vec_Int_t * vCone )
...
@@ -203,30 +255,32 @@ float Abc_SclFindGain( SC_Man * p, Vec_Int_t * vCone )
int
Abc_SclFindUpsizes
(
SC_Man
*
p
,
Vec_Int_t
*
vPathNodes
,
int
Ratio
)
int
Abc_SclFindUpsizes
(
SC_Man
*
p
,
Vec_Int_t
*
vPathNodes
,
int
Ratio
)
{
{
SC_Cell
*
pCellOld
,
*
pCellNew
;
SC_Cell
*
pCellOld
,
*
pCellNew
;
Vec_Flt_t
*
vSavings
;
Vec_Flt_t
*
vSavings
;
// best gain for each node
Vec_Int_t
*
vBests
;
Vec_Int_t
*
vBests
;
// best gate for each node
Vec_Int_t
*
vCone
;
Vec_Int_t
*
vCone
,
*
vEvals
,
*
vUpdates
;
Vec_Int_t
*
vUpdates
;
Abc_Obj_t
*
pObj
;
Abc_Obj_t
*
pObj
;
float
dGain
,
dGainBest
=
0
;
float
dGain
,
dGainBest
=
0
;
int
i
,
k
,
Entry
,
gateBest
=
-
1
;
int
i
,
k
,
Entry
,
gateBest
=
-
1
;
int
nUpsizes
=
0
;
int
nUpsizes
=
0
;
// return nUpsizes;
vSavings
=
Vec_FltAlloc
(
Vec_IntSize
(
vPathNodes
)
);
vSavings
=
Vec_FltAlloc
(
Vec_IntSize
(
vPathNodes
)
);
vBests
=
Vec_IntAlloc
(
Vec_IntSize
(
vPathNodes
)
);
vBests
=
Vec_IntAlloc
(
Vec_IntSize
(
vPathNodes
)
);
Abc_NtkForEachObjVec
(
vPathNodes
,
p
->
pNtk
,
pObj
,
i
)
Abc_NtkForEachObjVec
(
vPathNodes
,
p
->
pNtk
,
pObj
,
i
)
{
{
dGainBest
=
0
;
dGainBest
=
0
;
pCellOld
=
Abc_SclObjCell
(
p
,
pObj
);
pCellOld
=
Abc_SclObjCell
(
p
,
pObj
);
assert
(
pCellOld
->
Id
==
Vec_IntEntry
(
p
->
vGates
,
Abc_ObjId
(
pObj
))
);
// try different gate sizes for this node
// try different gate sizes for this node
vCone
=
Abc_SclFindNodesToUpdate
(
pObj
);
vCone
=
Abc_SclFindNodesToUpdate
(
pObj
,
&
vEvals
);
SC_RingForEachCell
(
pCellOld
,
pCellNew
,
k
)
SC_RingForEachCell
(
pCellOld
,
pCellNew
,
k
)
{
{
Vec_IntWriteEntry
(
p
->
vGates
,
Abc_ObjId
(
pObj
),
pCellNew
->
Id
);
if
(
pCellNew
==
pCellOld
)
continue
;
Abc_SclObjSetCell
(
p
,
pObj
,
pCellNew
);
//printf( "changing %s for %s at node %d ", pCellOld->pName, pCellNew->pName, Abc_ObjId(pObj) );
//printf( "changing %s for %s at node %d ", pCellOld->pName, pCellNew->pName, Abc_ObjId(pObj) );
Abc_SclUpdateLoad
(
p
,
pObj
,
pCellOld
,
pCellNew
);
Abc_SclUpdateLoad
(
p
,
pObj
,
pCellOld
,
pCellNew
);
dGain
=
Abc_SclFindGain
(
p
,
vCone
);
dGain
=
Abc_SclFindGain
(
p
,
vCone
,
vEvals
);
Abc_SclUpdateLoad
(
p
,
pObj
,
pCellNew
,
pCellOld
);
Abc_SclUpdateLoad
(
p
,
pObj
,
pCellNew
,
pCellOld
);
//printf( "gain is %f\n", dGain );
//printf( "gain is %f\n", dGain );
if
(
dGainBest
<
dGain
)
if
(
dGainBest
<
dGain
)
...
@@ -235,8 +289,10 @@ int Abc_SclFindUpsizes( SC_Man * p, Vec_Int_t * vPathNodes, int Ratio )
...
@@ -235,8 +289,10 @@ int Abc_SclFindUpsizes( SC_Man * p, Vec_Int_t * vPathNodes, int Ratio )
gateBest
=
pCellNew
->
Id
;
gateBest
=
pCellNew
->
Id
;
}
}
}
}
assert
(
dGainBest
>=
0
.
0
);
Vec_IntFree
(
vCone
);
Vec_IntFree
(
vCone
);
Vec_IntWriteEntry
(
p
->
vGates
,
Abc_ObjId
(
pObj
),
pCellOld
->
Id
);
Vec_IntFree
(
vEvals
);
Abc_SclObjSetCell
(
p
,
pObj
,
pCellOld
);
Vec_FltPush
(
vSavings
,
dGainBest
);
Vec_FltPush
(
vSavings
,
dGainBest
);
Vec_IntPush
(
vBests
,
gateBest
);
Vec_IntPush
(
vBests
,
gateBest
);
}
}
...
@@ -245,11 +301,9 @@ int Abc_SclFindUpsizes( SC_Man * p, Vec_Int_t * vPathNodes, int Ratio )
...
@@ -245,11 +301,9 @@ int Abc_SclFindUpsizes( SC_Man * p, Vec_Int_t * vPathNodes, int Ratio )
// we have computed the gains - find the best ones
// we have computed the gains - find the best ones
{
{
Vec_Int_t
*
vCosts
;
Vec_Int_t
*
vCosts
;
int
*
pPerm
;
float
Max
=
Vec_FltFindMax
(
vSavings
);
float
Max
=
Vec_FltFindMax
(
vSavings
);
float
Factor
=
1
.
0
*
(
1
<<
28
)
/
Max
;
float
Factor
=
1
.
0
*
(
1
<<
28
)
/
Max
,
This
;
float
This
;
int
i
,
Limit
,
*
pPerm
;
int
i
,
Limit
;
// find a good factor
// find a good factor
vCosts
=
Vec_IntAlloc
(
Vec_FltSize
(
vSavings
)
);
vCosts
=
Vec_IntAlloc
(
Vec_FltSize
(
vSavings
)
);
Vec_FltForEachEntry
(
vSavings
,
This
,
i
)
Vec_FltForEachEntry
(
vSavings
,
This
,
i
)
...
@@ -260,28 +314,31 @@ int Abc_SclFindUpsizes( SC_Man * p, Vec_Int_t * vPathNodes, int Ratio )
...
@@ -260,28 +314,31 @@ int Abc_SclFindUpsizes( SC_Man * p, Vec_Int_t * vPathNodes, int Ratio )
pPerm
=
Abc_QuickSortCost
(
Vec_IntArray
(
vCosts
),
Vec_IntSize
(
vCosts
),
1
);
pPerm
=
Abc_QuickSortCost
(
Vec_IntArray
(
vCosts
),
Vec_IntSize
(
vCosts
),
1
);
assert
(
Vec_FltEntry
(
vSavings
,
pPerm
[
0
])
>=
Vec_FltEntry
(
vSavings
,
pPerm
[
Vec_FltSize
(
vSavings
)
-
1
])
);
assert
(
Vec_FltEntry
(
vSavings
,
pPerm
[
0
])
>=
Vec_FltEntry
(
vSavings
,
pPerm
[
Vec_FltSize
(
vSavings
)
-
1
])
);
// find those that are good to update
// find those that are good to update
Limit
=
Abc_M
in
Int
(
1
,
(
int
)(
0
.
01
*
Ratio
*
Vec_IntSize
(
vBests
))
);
Limit
=
Abc_M
ax
Int
(
1
,
(
int
)(
0
.
01
*
Ratio
*
Vec_IntSize
(
vBests
))
);
vUpdates
=
Vec_IntAlloc
(
Limit
);
vUpdates
=
Vec_IntAlloc
(
Limit
);
for
(
i
=
0
;
i
<
Limit
;
i
++
)
for
(
i
=
0
;
i
<
Limit
;
i
++
)
if
(
Vec_FltEntry
(
vSavings
,
pPerm
[
i
])
>
0
)
if
(
Vec_FltEntry
(
vSavings
,
pPerm
[
i
])
>
0
)
Vec_IntPush
(
vUpdates
,
pPerm
[
i
]
);
Vec_IntPush
(
vUpdates
,
pPerm
[
i
]
);
Vec_IntFree
(
vCosts
);
ABC_FREE
(
pPerm
);
}
}
// update the network
// update the network
Vec_IntForEachEntry
(
vUpdates
,
Entry
,
i
)
Vec_IntForEachEntry
(
vUpdates
,
Entry
,
i
)
{
{
// get the object
pObj
=
Abc_NtkObj
(
p
->
pNtk
,
Vec_IntEntry
(
vPathNodes
,
Entry
)
);
pObj
=
Abc_NtkObj
(
p
->
pNtk
,
Vec_IntEntry
(
vPathNodes
,
Entry
)
);
// find new gate
// find new gate
pCellOld
=
Abc_SclObjCell
(
p
,
pObj
);
pCellOld
=
Abc_SclObjCell
(
p
,
pObj
);
pCellNew
=
SC_LibCell
(
p
->
pLib
,
Vec_IntEntry
(
vBests
,
Abc_ObjId
(
pObj
)
)
);
pCellNew
=
SC_LibCell
(
p
->
pLib
,
Vec_IntEntry
(
vBests
,
Entry
)
);
assert
(
pCellNew
!=
NULL
);
assert
(
pCellNew
!=
NULL
);
// update gate
// update gate
Abc_SclUpdateLoad
(
p
,
pObj
,
pCellOld
,
pCellNew
);
Abc_SclUpdateLoad
(
p
,
pObj
,
pCellOld
,
pCellNew
);
p
->
SumArea
+=
pCellNew
->
area
-
pCellOld
->
area
;
p
->
SumArea
+=
pCellNew
->
area
-
pCellOld
->
area
;
Vec_IntWriteEntry
(
p
->
vGates
,
Abc_ObjId
(
pObj
),
pCellNew
->
Id
);
Abc_SclObjSetCell
(
p
,
pObj
,
pCellNew
);
nUpsizes
++
;
}
}
Vec_IntFree
(
vUpdates
);
Vec_IntFree
(
vUpdates
);
Vec_IntFree
(
vBests
);
Vec_IntFree
(
vBests
);
Vec_FltFree
(
vSavings
);
Vec_FltFree
(
vSavings
);
...
@@ -300,18 +357,19 @@ int Abc_SclFindUpsizes( SC_Man * p, Vec_Int_t * vPathNodes, int Ratio )
...
@@ -300,18 +357,19 @@ int Abc_SclFindUpsizes( SC_Man * p, Vec_Int_t * vPathNodes, int Ratio )
SeeAlso []
SeeAlso []
***********************************************************************/
***********************************************************************/
void
Abc_SclUpsizePrint
(
SC_Man
*
p
,
int
Iter
,
Vec_Int_t
*
vPathPos
,
Vec_Int_t
*
vPathNodes
,
int
nUpsizes
)
void
Abc_SclUpsizePrint
(
SC_Man
*
p
,
int
Iter
,
Vec_Int_t
*
vPathPos
,
Vec_Int_t
*
vPathNodes
,
Vec_Int_t
*
vTFO
,
int
nUpsizes
)
{
{
printf
(
"Iter %3d "
,
Iter
);
printf
(
"Iter %3d "
,
Iter
);
printf
(
"PathPOs:%5d. "
,
Vec_IntSize
(
vPathPos
)
);
printf
(
"PO:%5d. "
,
Vec_IntSize
(
vPathPos
)
);
printf
(
"PathNodes:%6d. "
,
Vec_IntSize
(
vPathNodes
)
);
printf
(
"Node:%6d. "
,
Vec_IntSize
(
vPathNodes
)
);
printf
(
"Resized:%5d. "
,
nUpsizes
);
printf
(
"TFO:%6d. "
,
Vec_IntSize
(
vTFO
)
);
printf
(
"Size:%5d. "
,
nUpsizes
);
printf
(
"D: "
);
printf
(
"D: "
);
printf
(
"%.2f
-> %.2f ps "
,
SC_LibTimePs
(
p
->
pLib
,
p
->
MaxDelay0
),
SC_LibTimePs
(
p
->
pLib
,
p
->
MaxDelay
)
);
printf
(
"%.2f
ps "
,
SC_LibTimePs
(
p
->
pLib
,
p
->
MaxDelay
)
);
printf
(
"(%+
.1f %%). "
,
100
.
0
*
(
p
->
MaxDelay
-
p
->
MaxDelay0
)
/
p
->
MaxDelay0
);
printf
(
"(%+
5.1f %%) "
,
100
.
0
*
(
p
->
MaxDelay
-
p
->
MaxDelay0
)
/
p
->
MaxDelay0
);
printf
(
"A: "
);
printf
(
"A: "
);
printf
(
"%.2f
-> %.2f "
,
p
->
SumArea0
,
p
->
SumArea
);
printf
(
"%.2f
"
,
p
->
SumArea
);
printf
(
"(%+
.1f %%). "
,
100
.
0
*
(
p
->
SumArea
-
p
->
SumArea0
)
/
p
->
SumArea0
);
printf
(
"(%+
5.1f %%) "
,
100
.
0
*
(
p
->
SumArea
-
p
->
SumArea0
)
/
p
->
SumArea0
);
Abc_PrintTime
(
1
,
"Time"
,
clock
()
-
p
->
clkStart
);
Abc_PrintTime
(
1
,
"Time"
,
clock
()
-
p
->
clkStart
);
}
}
...
@@ -331,22 +389,35 @@ void Abc_SclUpsizePerform( SC_Lib * pLib, Abc_Ntk_t * pNtk, int Window, int Rati
...
@@ -331,22 +389,35 @@ void Abc_SclUpsizePerform( SC_Lib * pLib, Abc_Ntk_t * pNtk, int Window, int Rati
SC_Man
*
p
;
SC_Man
*
p
;
Vec_Int_t
*
vPathPos
;
// critical POs
Vec_Int_t
*
vPathPos
;
// critical POs
Vec_Int_t
*
vPathNodes
;
// critical nodes and PIs
Vec_Int_t
*
vPathNodes
;
// critical nodes and PIs
int
i
,
nUpsizes
;
Vec_Int_t
*
vTFO
;
int
i
,
nUpsizes
=
-
1
;
// prepare the manager; collect init stats
// prepare the manager; collect init stats
p
=
Abc_SclManStart
(
pLib
,
pNtk
,
1
);
p
=
Abc_SclManStart
(
pLib
,
pNtk
,
1
);
// perform upsizing
// perform upsizing
for
(
i
=
0
;
i
<
nIters
;
i
++
)
for
(
i
=
0
;
nUpsizes
&&
i
<
nIters
;
i
++
)
{
{
vPathPos
=
Abc_SclFindCriticalCoWindow
(
p
,
Window
);
vPathPos
=
Abc_SclFindCriticalCoWindow
(
p
,
Window
);
vPathNodes
=
Abc_SclFindCriticalNodeWindow
(
p
,
vPathPos
,
Window
);
vPathNodes
=
Abc_SclFindCriticalNodeWindow
(
p
,
vPathPos
,
Window
);
nUpsizes
=
Abc_SclFindUpsizes
(
p
,
vPathNodes
,
Ratio
);
nUpsizes
=
Abc_SclFindUpsizes
(
p
,
vPathNodes
,
Ratio
);
Abc_SclUnmarkCriticalNodeWindow
(
p
,
vPathNodes
);
Abc_SclUnmarkCriticalNodeWindow
(
p
,
vPathNodes
);
Abc_SclTimeNtkRecompute
(
p
,
&
p
->
SumArea
,
&
p
->
MaxDelay
);
Abc_SclUnmarkCriticalNodeWindow
(
p
,
vPathPos
);
Abc_SclUpsizePrint
(
p
,
i
,
vPathPos
,
vPathNodes
,
nUpsizes
);
// update info
vTFO
=
Abc_SclFindTFO
(
p
->
pNtk
,
vPathNodes
);
// Abc_SclTimeNtkRecompute( p, &p->SumArea, &p->MaxDelay );
Abc_SclConeStore
(
p
,
vTFO
);
Abc_SclTimeCone
(
p
,
vTFO
);
p
->
MaxDelay
=
Abc_SclGetMaxDelay
(
p
);
Abc_SclUpsizePrint
(
p
,
i
,
vPathPos
,
vPathNodes
,
vTFO
,
nUpsizes
);
Vec_IntFree
(
vPathPos
);
Vec_IntFree
(
vPathPos
);
Vec_IntFree
(
vPathNodes
);
Vec_IntFree
(
vPathNodes
);
Vec_IntFree
(
vTFO
);
if
(
i
&&
i
%
50
==
0
)
Abc_SclComputeLoad
(
p
);
}
}
// Abc_NtkCleanMarkAB( pNtk );
// Abc_NtkCleanMarkAB( pNtk );
...
...
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