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
fbdaf207
Commit
fbdaf207
authored
Aug 09, 2013
by
Alan Mishchenko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Integrated buffering and sizing.
parent
d4ad3b41
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
67 additions
and
30 deletions
+67
-30
src/map/scl/scl.c
+11
-6
src/map/scl/sclBufSize.c
+45
-21
src/map/scl/sclSize.c
+2
-2
src/map/scl/sclSize.h
+9
-1
No files found.
src/map/scl/scl.c
View file @
fbdaf207
...
...
@@ -707,14 +707,15 @@ int Scl_CommandBufSize( Abc_Frame_t * pAbc, int argc, char ** argv )
{
Abc_Ntk_t
*
pNtk
=
Abc_FrameReadNtk
(
pAbc
);
Abc_Ntk_t
*
pNtkRes
;
int
c
,
GainRatio
,
nDegree
,
fBufPis
,
fAddBufs
,
fVerbose
;
GainRatio
=
20
0
;
int
c
,
GainRatio
,
nDegree
,
f
SizeOnly
,
f
BufPis
,
fAddBufs
,
fVerbose
;
GainRatio
=
15
0
;
nDegree
=
4
;
fSizeOnly
=
0
;
fAddBufs
=
0
;
fBufPis
=
0
;
fVerbose
=
0
;
Extra_UtilGetoptReset
();
while
(
(
c
=
Extra_UtilGetopt
(
argc
,
argv
,
"GNbpvh"
)
)
!=
EOF
)
while
(
(
c
=
Extra_UtilGetopt
(
argc
,
argv
,
"GN
s
bpvh"
)
)
!=
EOF
)
{
switch
(
c
)
{
...
...
@@ -740,6 +741,9 @@ int Scl_CommandBufSize( Abc_Frame_t * pAbc, int argc, char ** argv )
if
(
nDegree
<
0
)
goto
usage
;
break
;
case
's'
:
fSizeOnly
^=
1
;
break
;
case
'b'
:
fAddBufs
^=
1
;
break
;
...
...
@@ -766,13 +770,13 @@ int Scl_CommandBufSize( Abc_Frame_t * pAbc, int argc, char ** argv )
Abc_Print
(
-
1
,
"This command can only be applied to a logic network.
\n
"
);
return
1
;
}
if
(
!
fAddBufs
&&
pNtk
->
vPhases
==
NULL
)
if
(
!
f
SizeOnly
&&
!
f
AddBufs
&&
pNtk
->
vPhases
==
NULL
)
{
Abc_Print
(
-
1
,
"Fanin phase information is not avaiable.
\n
"
);
return
1
;
}
// modify the current network
pNtkRes
=
Abc_SclBufSizePerform
(
pNtk
,
(
SC_Lib
*
)
pAbc
->
pLibScl
,
GainRatio
,
nDegree
,
fAddBufs
,
fBufPis
,
fVerbose
);
pNtkRes
=
Abc_SclBufSizePerform
(
pNtk
,
(
SC_Lib
*
)
pAbc
->
pLibScl
,
GainRatio
,
nDegree
,
f
SizeOnly
,
f
AddBufs
,
fBufPis
,
fVerbose
);
if
(
pNtkRes
==
NULL
)
{
Abc_Print
(
-
1
,
"The command has failed.
\n
"
);
...
...
@@ -783,10 +787,11 @@ int Scl_CommandBufSize( Abc_Frame_t * pAbc, int argc, char ** argv )
return
0
;
usage:
fprintf
(
pAbc
->
Err
,
"usage: bufsize [-GM num] [-bpvh]
\n
"
);
fprintf
(
pAbc
->
Err
,
"usage: bufsize [-GM num] [-
s
bpvh]
\n
"
);
fprintf
(
pAbc
->
Err
,
"
\t
performs buffering and sizing and mapped network
\n
"
);
fprintf
(
pAbc
->
Err
,
"
\t
-G <num> : target gain percentage [default = %d]
\n
"
,
GainRatio
);
fprintf
(
pAbc
->
Err
,
"
\t
-M <num> : the maximum fanout degree [default = %d]
\n
"
,
nDegree
);
fprintf
(
pAbc
->
Err
,
"
\t
-s : toggle performing only sizing [default = %s]
\n
"
,
fSizeOnly
?
"yes"
:
"no"
);
fprintf
(
pAbc
->
Err
,
"
\t
-b : toggle using buffers instead of inverters [default = %s]
\n
"
,
fAddBufs
?
"yes"
:
"no"
);
fprintf
(
pAbc
->
Err
,
"
\t
-p : toggle buffering primary inputs [default = %s]
\n
"
,
fBufPis
?
"yes"
:
"no"
);
fprintf
(
pAbc
->
Err
,
"
\t
-v : toggle printing verbose information [default = %s]
\n
"
,
fVerbose
?
"yes"
:
"no"
);
...
...
src/map/scl/sclBufSize.c
View file @
fbdaf207
...
...
@@ -34,6 +34,7 @@ struct Bus_Man_t_
// parameters
float
Gain
;
// target gain
int
nDegree
;
// max branching factor
int
fSizeOnly
;
// perform only sizing
int
fAddBufs
;
// add buffers
int
fBufPis
;
// use CI buffering
int
fVerbose
;
// verbose
...
...
@@ -72,21 +73,22 @@ static inline void Bus_SclObjUpdateDept( Abc_Obj_t * p, float time ) { f
SeeAlso []
***********************************************************************/
Bus_Man_t
*
Bus_ManStart
(
Abc_Ntk_t
*
pNtk
,
SC_Lib
*
pLib
,
int
GainRatio
,
int
nDegree
,
int
fAddBufs
,
int
fBufPis
,
int
fVerbose
)
Bus_Man_t
*
Bus_ManStart
(
Abc_Ntk_t
*
pNtk
,
SC_Lib
*
pLib
,
int
GainRatio
,
int
nDegree
,
int
f
SizeOnly
,
int
f
AddBufs
,
int
fBufPis
,
int
fVerbose
)
{
Bus_Man_t
*
p
;
p
=
ABC_CALLOC
(
Bus_Man_t
,
1
);
p
->
Gain
=
0
.
01
*
GainRatio
;
p
->
nDegree
=
nDegree
;
p
->
fAddBufs
=
fAddBufs
;
p
->
fBufPis
=
fBufPis
;
p
->
fVerbose
=
fVerbose
;
p
->
pNtk
=
pNtk
;
p
->
pLib
=
pLib
;
p
->
pInv
=
Abc_SclFindInvertor
(
pLib
,
fAddBufs
)
->
pAve
;
p
->
vCins
=
Vec_FltStart
(
2
*
Abc_NtkObjNumMax
(
pNtk
)
);
p
->
vLoads
=
Vec_FltStart
(
2
*
Abc_NtkObjNumMax
(
pNtk
)
);
p
->
vDepts
=
Vec_FltStart
(
2
*
Abc_NtkObjNumMax
(
pNtk
)
);
p
->
Gain
=
0
.
01
*
GainRatio
;
p
->
nDegree
=
nDegree
;
p
->
fSizeOnly
=
fSizeOnly
;
p
->
fAddBufs
=
fAddBufs
;
p
->
fBufPis
=
fBufPis
;
p
->
fVerbose
=
fVerbose
;
p
->
pNtk
=
pNtk
;
p
->
pLib
=
pLib
;
p
->
pInv
=
Abc_SclFindInvertor
(
pLib
,
fAddBufs
)
->
pAve
;
p
->
vCins
=
Vec_FltStart
(
2
*
Abc_NtkObjNumMax
(
pNtk
)
);
p
->
vLoads
=
Vec_FltStart
(
2
*
Abc_NtkObjNumMax
(
pNtk
)
);
p
->
vDepts
=
Vec_FltStart
(
2
*
Abc_NtkObjNumMax
(
pNtk
)
);
pNtk
->
pBSMan
=
p
;
return
p
;
}
...
...
@@ -168,7 +170,11 @@ void Abc_NtkComputeFanoutCins( Abc_Obj_t * pObj )
int
i
;
Abc_ObjForEachFanout
(
pObj
,
pFanout
,
i
)
if
(
Abc_ObjIsNode
(
pFanout
)
)
Bus_SclObjSetCin
(
pFanout
,
SC_CellPinCap
(
Abc_SclObjCell
(
pFanout
),
Abc_NodeFindFanin
(
pFanout
,
pObj
)
)
);
{
float
cap
=
SC_CellPinCap
(
Abc_SclObjCell
(
pFanout
),
Abc_NodeFindFanin
(
pFanout
,
pObj
)
);
assert
(
cap
>
0
);
Bus_SclObjSetCin
(
pFanout
,
cap
);
}
}
float
Abc_NtkComputeNodeLoad
(
Abc_Obj_t
*
pObj
)
{
...
...
@@ -196,7 +202,7 @@ float Abc_NtkComputeNodeDept( Abc_Obj_t * pObj )
Edge
=
Scl_LibPinArrivalEstimate
(
Abc_SclObjCell
(
pFanout
),
Abc_NodeFindFanin
(
pFanout
,
pObj
),
Load
);
Bus_SclObjUpdateDept
(
pObj
,
Dept
+
Edge
);
assert
(
Edge
>
0
);
assert
(
Load
>
0
);
//
assert( Load > 0 );
}
return
Bus_SclObjDept
(
pObj
);
}
...
...
@@ -318,11 +324,13 @@ void Abc_SclBufSize( Bus_Man_t * p )
SC_Cell
*
pCell
,
*
pCellNew
;
Vec_Ptr_t
*
vFanouts
;
Abc_Obj_t
*
pObj
,
*
pInv
;
abctime
clk
=
Abc_Clock
();
float
Dept
,
DeptMax
=
0
;
float
Load
,
Cin
;
int
i
;
vFanouts
=
Vec_PtrAlloc
(
100
);
Abc_SclMioGates2SclGates
(
p
->
pLib
,
p
->
pNtk
);
Abc_NtkForEachNodeReverse
(
p
->
pNtk
,
pObj
,
i
)
Abc_NtkForEachNodeReverse
1
(
p
->
pNtk
,
pObj
,
i
)
{
// compute load
Abc_NtkComputeFanoutCins
(
pObj
);
...
...
@@ -331,7 +339,7 @@ void Abc_SclBufSize( Bus_Man_t * p )
pCell
=
Abc_SclObjCell
(
pObj
);
Cin
=
SC_CellPinCapAve
(
pCell
->
pAve
);
// consider upsizing the gate
if
(
Load
>
p
->
Gain
*
Cin
)
if
(
!
p
->
fSizeOnly
&&
Load
>
p
->
Gain
*
Cin
)
{
// add one or more inverters
Abc_NodeCollectFanouts
(
pObj
,
vFanouts
);
...
...
@@ -347,27 +355,43 @@ void Abc_SclBufSize( Bus_Man_t * p )
assert
(
Abc_ObjFanin0
(
pInv
)
==
NULL
);
Abc_ObjAddFanin
(
pInv
,
pObj
);
Bus_SclObjSetLoad
(
pObj
,
Load
);
}
}
// create cell
pCellNew
=
Abc_SclFindSmallestGate
(
pCell
,
Load
/
p
->
Gain
);
Abc_SclObjSetCell
(
pObj
,
pCellNew
);
Abc_NtkComputeNodeDept
(
pObj
);
Dept
=
Abc_NtkComputeNodeDept
(
pObj
);
DeptMax
=
Abc_MaxFloat
(
DeptMax
,
Dept
);
if
(
p
->
fVerbose
)
{
printf
(
"Node %7d : "
,
i
);
printf
(
"%12s "
,
pCellNew
->
pName
);
printf
(
"(%2d/%2d) "
,
pCellNew
->
Order
,
pCellNew
->
nGates
);
printf
(
"gain =%5.2f "
,
Load
/
SC_CellPinCapAve
(
pCellNew
)
);
printf
(
"dept =%7.0f ps "
,
SC_LibTimePs
(
p
->
pLib
,
Dept
)
);
printf
(
"
\n
"
);
}
}
Abc_SclSclGates2MioGates
(
p
->
pLib
,
p
->
pNtk
);
Vec_PtrFree
(
vFanouts
);
if
(
p
->
fVerbose
)
{
printf
(
"Largest departure time = %7.0f ps "
,
SC_LibTimePs
(
p
->
pLib
,
DeptMax
)
);
Abc_PrintTime
(
1
,
"Time"
,
Abc_Clock
()
-
clk
);
}
}
Abc_Ntk_t
*
Abc_SclBufSizePerform
(
Abc_Ntk_t
*
pNtk
,
SC_Lib
*
pLib
,
int
GainRatio
,
int
nDegree
,
int
fAddBufs
,
int
fBufPis
,
int
fVerbose
)
Abc_Ntk_t
*
Abc_SclBufSizePerform
(
Abc_Ntk_t
*
pNtk
,
SC_Lib
*
pLib
,
int
GainRatio
,
int
nDegree
,
int
f
SizeOnly
,
int
f
AddBufs
,
int
fBufPis
,
int
fVerbose
)
{
Abc_Ntk_t
*
pNtkNew
;
Bus_Man_t
*
p
;
if
(
!
Abc_SclCheckNtk
(
pNtk
,
0
)
)
return
NULL
;
Abc_SclReportDupFanins
(
pNtk
);
p
=
Bus_ManStart
(
pNtk
,
pLib
,
GainRatio
,
nDegree
,
fAddBufs
,
fBufPis
,
fVerbose
);
p
=
Bus_ManStart
(
pNtk
,
pLib
,
GainRatio
,
nDegree
,
f
SizeOnly
,
f
AddBufs
,
fBufPis
,
fVerbose
);
Bus_ManReadInOutLoads
(
p
);
Abc_SclBufSize
(
p
);
Bus_ManStop
(
p
);
Vec_IntFillExtra
(
pNtk
->
vPhases
,
Abc_NtkObjNumMax
(
pNtk
),
0
);
if
(
pNtk
->
vPhases
)
Vec_IntFillExtra
(
pNtk
->
vPhases
,
Abc_NtkObjNumMax
(
pNtk
),
0
);
pNtkNew
=
Abc_NtkDupDfs
(
pNtk
);
return
pNtkNew
;
}
...
...
src/map/scl/sclSize.c
View file @
fbdaf207
...
...
@@ -109,7 +109,7 @@ Abc_Obj_t * Abc_SclFindMostCriticalFanin( SC_Man * p, int * pfRise, Abc_Obj_t *
static
inline
void
Abc_SclTimeNodePrint
(
SC_Man
*
p
,
Abc_Obj_t
*
pObj
,
int
fRise
,
int
Length
,
float
maxDelay
)
{
SC_Cell
*
pCell
=
Abc_ObjIsNode
(
pObj
)
?
Abc_SclObjCell
(
pObj
)
:
NULL
;
printf
(
"%
6
d : "
,
Abc_ObjId
(
pObj
)
);
printf
(
"%
8
d : "
,
Abc_ObjId
(
pObj
)
);
printf
(
"%d "
,
Abc_ObjFaninNum
(
pObj
)
);
printf
(
"%4d "
,
Abc_ObjFanoutNum
(
pObj
)
);
printf
(
"%-*s "
,
Length
,
pCell
?
pCell
->
pName
:
"pi"
);
...
...
@@ -170,7 +170,7 @@ void Abc_SclTimeNtkPrint( SC_Man * p, int fShowAll, int fPrintPath )
pObj
=
Abc_ObjFanin0
(
pPivot
);
while
(
pObj
)
//&& Abc_ObjIsNode(pObj) )
{
printf
(
"Path%3d --
"
,
i
--
);
printf
(
"Path%3d --"
,
i
--
);
Abc_SclTimeNodePrint
(
p
,
pObj
,
fRise
,
nLength
,
maxDelay
);
pObj
=
Abc_SclFindMostCriticalFanin
(
p
,
&
fRise
,
pObj
);
}
...
...
src/map/scl/sclSize.h
View file @
fbdaf207
...
...
@@ -188,6 +188,14 @@ static inline SC_Man * Abc_SclManAlloc( SC_Lib * pLib, Abc_Ntk_t * pNtk )
}
static
inline
void
Abc_SclManFree
(
SC_Man
*
p
)
{
Abc_Obj_t
*
pObj
;
int
i
;
// set CI/CO ids
Abc_NtkForEachCi
(
p
->
pNtk
,
pObj
,
i
)
pObj
->
iData
=
0
;
Abc_NtkForEachCo
(
p
->
pNtk
,
pObj
,
i
)
pObj
->
iData
=
0
;
// other
p
->
pNtk
->
pSCLib
=
NULL
;
Vec_IntFreeP
(
&
p
->
pNtk
->
vGates
);
Vec_IntFreeP
(
&
p
->
vNodeIter
);
...
...
@@ -485,7 +493,7 @@ static inline void Abc_SclDumpStats( SC_Man * p, char * pFileName, abctime Time
}
/*=== sclBufSize.c ===============================================================*/
extern
Abc_Ntk_t
*
Abc_SclBufSizePerform
(
Abc_Ntk_t
*
pNtk
,
SC_Lib
*
pLib
,
int
GainRatio
,
int
nDegree
,
int
fAddBufs
,
int
fBufPis
,
int
fVerbose
);
extern
Abc_Ntk_t
*
Abc_SclBufSizePerform
(
Abc_Ntk_t
*
pNtk
,
SC_Lib
*
pLib
,
int
GainRatio
,
int
nDegree
,
int
f
SizeOnly
,
int
f
AddBufs
,
int
fBufPis
,
int
fVerbose
);
/*=== sclBuffer.c ===============================================================*/
extern
int
Abc_SclIsInv
(
Abc_Obj_t
*
pObj
);
extern
void
Abc_NodeInvUpdateFanPolarity
(
Abc_Obj_t
*
pObj
);
...
...
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