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
1ba1e657
Commit
1ba1e657
authored
Aug 26, 2012
by
Alan Mishchenko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
New package to read/write a subset of Liberty for STA.
parent
95e14cd7
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
176 additions
and
63 deletions
+176
-63
src/map/scl/scl.c
+57
-2
src/map/scl/scl.h
+2
-1
src/map/scl/sclFile.c
+0
-0
src/map/scl/sclSize.c
+4
-0
src/map/scl/sclTime.c
+113
-60
No files found.
src/map/scl/scl.c
View file @
1ba1e657
...
...
@@ -30,6 +30,7 @@ ABC_NAMESPACE_IMPL_START
static
int
Scl_CommandRead
(
Abc_Frame_t
*
pAbc
,
int
argc
,
char
**
argv
);
static
int
Scl_CommandWrite
(
Abc_Frame_t
*
pAbc
,
int
argc
,
char
**
argv
);
static
int
Scl_CommandStime
(
Abc_Frame_t
*
pAbc
,
int
argc
,
char
**
argv
);
static
int
Scl_CommandGsize
(
Abc_Frame_t
*
pAbc
,
int
argc
,
char
**
argv
);
////////////////////////////////////////////////////////////////////////
/// FUNCTION DEFINITIONS ///
...
...
@@ -51,6 +52,7 @@ void Scl_Init( Abc_Frame_t * pAbc )
Cmd_CommandAdd
(
pAbc
,
"SC mapping"
,
"read_scl"
,
Scl_CommandRead
,
0
);
Cmd_CommandAdd
(
pAbc
,
"SC mapping"
,
"write_scl"
,
Scl_CommandWrite
,
0
);
Cmd_CommandAdd
(
pAbc
,
"SC mapping"
,
"stime"
,
Scl_CommandStime
,
0
);
Cmd_CommandAdd
(
pAbc
,
"SC mapping"
,
"gsize"
,
Scl_CommandGsize
,
1
);
}
void
Scl_End
(
Abc_Frame_t
*
pAbc
)
{
...
...
@@ -144,7 +146,7 @@ int Scl_CommandWrite( Abc_Frame_t * pAbc, int argc, char **argv )
goto
usage
;
if
(
pAbc
->
pLibScl
==
NULL
)
{
fprintf
(
pAbc
->
Err
,
"There is no Liberty
L
ibrary available.
\n
"
);
fprintf
(
pAbc
->
Err
,
"There is no Liberty
l
ibrary available.
\n
"
);
return
1
;
}
// get the input file name
...
...
@@ -207,7 +209,7 @@ int Scl_CommandStime( Abc_Frame_t * pAbc, int argc, char **argv )
}
if
(
pAbc
->
pLibScl
==
NULL
)
{
fprintf
(
pAbc
->
Err
,
"There is no Liberty
L
ibrary available.
\n
"
);
fprintf
(
pAbc
->
Err
,
"There is no Liberty
l
ibrary available.
\n
"
);
return
1
;
}
...
...
@@ -221,6 +223,59 @@ usage:
return
1
;
}
/**Function*************************************************************
Synopsis []
Description []
SideEffects []
SeeAlso []
***********************************************************************/
int
Scl_CommandGsize
(
Abc_Frame_t
*
pAbc
,
int
argc
,
char
**
argv
)
{
int
c
;
Extra_UtilGetoptReset
();
while
(
(
c
=
Extra_UtilGetopt
(
argc
,
argv
,
"h"
)
)
!=
EOF
)
{
switch
(
c
)
{
case
'h'
:
goto
usage
;
default:
goto
usage
;
}
}
if
(
Abc_FrameReadNtk
(
pAbc
)
==
NULL
)
{
fprintf
(
pAbc
->
Err
,
"There is no current network.
\n
"
);
return
1
;
}
if
(
!
Abc_NtkHasMapping
(
Abc_FrameReadNtk
(
pAbc
))
)
{
fprintf
(
pAbc
->
Err
,
"The current network is not mapped.
\n
"
);
return
1
;
}
if
(
pAbc
->
pLibScl
==
NULL
)
{
fprintf
(
pAbc
->
Err
,
"There is no Liberty library available.
\n
"
);
return
1
;
}
Abc_SclSizingPerform
(
pAbc
->
pLibScl
,
Abc_FrameReadNtk
(
pAbc
)
);
return
0
;
usage:
fprintf
(
pAbc
->
Err
,
"usage: gsize [-h]
\n
"
);
fprintf
(
pAbc
->
Err
,
"
\t
performs gate sizing using Liberty library
\n
"
);
fprintf
(
pAbc
->
Err
,
"
\t
-h : print the help massage
\n
"
);
return
1
;
}
////////////////////////////////////////////////////////////////////////
/// END OF FILE ///
...
...
src/map/scl/scl.h
View file @
1ba1e657
...
...
@@ -51,7 +51,8 @@ extern void Abc_SclLoad( char * pFileName, void ** ppScl );
extern
void
Abc_SclSave
(
char
*
pFileName
,
void
*
pScl
);
/*=== sclTime.c =============================================================*/
extern
void
Abc_SclTimePerform
(
SC_Lib
*
pLib
,
void
*
pNtk
);
/*=== sclSize.c =============================================================*/
extern
void
Abc_SclSizingPerform
(
SC_Lib
*
pLib
,
void
*
pNtk
);
ABC_NAMESPACE_HEADER_END
...
...
src/map/scl/sclFile.c
View file @
1ba1e657
This diff is collapsed.
Click to expand it.
src/map/scl/sclSize.c
View file @
1ba1e657
...
...
@@ -29,6 +29,7 @@ ABC_NAMESPACE_IMPL_START
/// FUNCTION DEFINITIONS ///
////////////////////////////////////////////////////////////////////////
/**Function*************************************************************
Synopsis []
...
...
@@ -40,6 +41,9 @@ ABC_NAMESPACE_IMPL_START
SeeAlso []
***********************************************************************/
void
Abc_SclSizingPerform
(
SC_Lib
*
pLib
,
void
*
pNtk
)
{
}
////////////////////////////////////////////////////////////////////////
...
...
src/map/scl/sclTime.c
View file @
1ba1e657
...
...
@@ -82,6 +82,7 @@ void Abc_SclManFindGates( SC_Man * p )
gateId
=
Abc_SclCellFind
(
p
->
pLib
,
pName
);
assert
(
gateId
>=
0
);
Vec_IntWriteEntry
(
p
->
vGates
,
i
,
gateId
);
//printf( "Found gate %s\n", pName );
}
}
SC_Man
*
Abc_SclManAlloc
(
SC_Lib
*
pLib
,
Abc_Ntk_t
*
pNtk
)
...
...
@@ -133,9 +134,10 @@ Vec_Flt_t * Abc_SclFindWireCaps( SC_Man * p, Vec_Ptr_t * vNodes )
{
Vec_Flt_t
*
vCaps
=
NULL
;
SC_WireLoad
*
pWL
=
NULL
;
int
i
,
Entry
,
EntryPrev
,
EntryMax
;
int
i
,
Entry
,
EntryMax
;
float
EntryPrev
,
EntryCur
;
p
->
pWireLoadUsed
=
NULL
;
if
(
p
->
pLib
->
default_wire_load_sel
)
if
(
p
->
pLib
->
default_wire_load_sel
&&
strlen
(
p
->
pLib
->
default_wire_load_sel
)
)
{
float
Area
;
SC_WireLoadSel
*
pWLS
=
NULL
;
...
...
@@ -157,7 +159,7 @@ Vec_Flt_t * Abc_SclFindWireCaps( SC_Man * p, Vec_Ptr_t * vNodes )
if
(
i
==
Vec_FltSize
(
pWLS
->
vAreaFrom
)
)
p
->
pWireLoadUsed
=
(
char
*
)
Vec_PtrEntryLast
(
pWLS
->
vWireLoadModel
);
}
else
if
(
p
->
pLib
->
default_wire_load
)
else
if
(
p
->
pLib
->
default_wire_load
&&
strlen
(
p
->
pLib
->
default_wire_load
)
)
p
->
pWireLoadUsed
=
p
->
pLib
->
default_wire_load
;
else
{
...
...
@@ -184,10 +186,10 @@ Vec_Flt_t * Abc_SclFindWireCaps( SC_Man * p, Vec_Ptr_t * vNodes )
Vec_FltWriteEntry
(
vCaps
,
Entry
,
Vec_FltEntry
(
pWL
->
vLen
,
i
)
*
pWL
->
cap
);
// reformat
EntryPrev
=
0
;
Vec_FltForEachEntry
(
vCaps
,
Entry
,
i
)
Vec_FltForEachEntry
(
vCaps
,
Entry
Cur
,
i
)
{
if
(
Entry
)
EntryPrev
=
Entry
;
if
(
Entry
Cur
)
EntryPrev
=
Entry
Cur
;
else
Vec_FltWriteEntry
(
vCaps
,
i
,
EntryPrev
);
}
...
...
@@ -205,6 +207,97 @@ Vec_Flt_t * Abc_SclFindWireCaps( SC_Man * p, Vec_Ptr_t * vNodes )
SeeAlso []
***********************************************************************/
void
Abc_SclComputeLoad
(
SC_Man
*
p
,
Vec_Ptr_t
*
vNodes
,
Vec_Flt_t
*
vWireCaps
)
{
Abc_Obj_t
*
pObj
,
*
pFanin
;
int
i
,
k
;
Vec_PtrForEachEntry
(
Abc_Obj_t
*
,
vNodes
,
pObj
,
i
)
{
SC_Cell
*
pCell
=
Abc_SclObjCell
(
p
,
pObj
);
Abc_ObjForEachFanin
(
pObj
,
pFanin
,
k
)
{
SC_Pin
*
pPin
=
SC_CellPin
(
pCell
,
k
);
SC_Pair
*
pLoad
=
Abc_SclObjLoad
(
p
,
pFanin
);
pLoad
->
rise
+=
pPin
->
rise_cap
;
pLoad
->
fall
+=
pPin
->
fall_cap
;
}
}
if
(
vWireCaps
)
{
Vec_PtrForEachEntry
(
Abc_Obj_t
*
,
vNodes
,
pObj
,
i
)
{
SC_Pair
*
pLoad
=
Abc_SclObjLoad
(
p
,
pObj
);
k
=
Abc_MinInt
(
Vec_FltSize
(
vWireCaps
)
-
1
,
Abc_ObjFanoutNum
(
pObj
)
);
pLoad
->
rise
+=
Vec_FltEntry
(
vWireCaps
,
k
);
pLoad
->
fall
+=
Vec_FltEntry
(
vWireCaps
,
k
);
}
}
}
/**Function*************************************************************
Synopsis []
Description []
SideEffects []
SeeAlso []
***********************************************************************/
Abc_Obj_t
*
Abc_SclFindMostCritical
(
SC_Man
*
p
,
int
*
pfRise
,
Vec_Ptr_t
*
vNodes
)
{
Abc_Obj_t
*
pObj
,
*
pPivot
=
NULL
;
float
fMaxArr
=
0
;
int
i
;
Vec_PtrForEachEntry
(
Abc_Obj_t
*
,
vNodes
,
pObj
,
i
)
{
SC_Pair
*
pArr
=
Abc_SclObjArr
(
p
,
pObj
);
if
(
fMaxArr
<
pArr
->
rise
)
fMaxArr
=
pArr
->
rise
,
*
pfRise
=
1
,
pPivot
=
pObj
;
if
(
fMaxArr
<
pArr
->
fall
)
fMaxArr
=
pArr
->
fall
,
*
pfRise
=
0
,
pPivot
=
pObj
;
}
assert
(
pPivot
!=
NULL
);
return
pPivot
;
}
void
Abc_SclTimeNtkPrint
(
SC_Man
*
p
,
Vec_Ptr_t
*
vNodes
)
{
/*
int fRise = 0;
Abc_Obj_t * pPivot = Abc_SclFindMostCritical( p, &fRise, vNodes );
printf( "Critical delay: ObjId = %d. ", Abc_ObjId(pPivot) );
printf( "Rise = %f. ", Abc_SclObjArr(p, pPivot)->rise );
printf( "Fall = %f. ", Abc_SclObjArr(p, pPivot)->fall );
printf( "\n" );
*/
Abc_Obj_t
*
pObj
;
int
i
;
printf
(
"WireLoad model =
\"
%s
\"
.
\n
"
,
p
->
pWireLoadUsed
);
printf
(
"Area = %f.
\n
"
,
Abc_SclTotalArea
(
p
,
vNodes
)
);
Vec_PtrForEachEntry
(
Abc_Obj_t
*
,
vNodes
,
pObj
,
i
)
{
printf
(
"Node %6d : "
,
Abc_ObjId
(
pObj
)
);
printf
(
"TimeR = %f. "
,
Abc_SclObjArr
(
p
,
pObj
)
->
rise
);
printf
(
"RimeF = %f. "
,
Abc_SclObjArr
(
p
,
pObj
)
->
fall
);
printf
(
"SlewR = %f. "
,
Abc_SclObjSlew
(
p
,
pObj
)
->
rise
);
printf
(
"SlewF = %f. "
,
Abc_SclObjSlew
(
p
,
pObj
)
->
fall
);
printf
(
"LoadR = %f. "
,
Abc_SclObjLoad
(
p
,
pObj
)
->
rise
);
printf
(
"LoadF = %f. "
,
Abc_SclObjLoad
(
p
,
pObj
)
->
fall
);
printf
(
"
\n
"
);
}
}
/**Function*************************************************************
Synopsis []
Description []
SideEffects []
SeeAlso []
***********************************************************************/
static
inline
float
Abc_SclLookup
(
SC_Surface
*
p
,
float
slew
,
float
load
)
{
float
*
pIndex0
,
*
pIndex1
,
*
pDataS
,
*
pDataS1
;
...
...
@@ -238,51 +331,25 @@ static inline float Abc_SclLookup( SC_Surface * p, float slew, float load )
}
void
Abc_SclTimeGate
(
SC_Man
*
p
,
SC_Timing
*
pTime
,
Abc_Obj_t
*
pObj
,
Abc_Obj_t
*
pFanin
)
{
SC_Pair
*
pArrIn
=
Abc_SclObj
Load
(
p
,
pFanin
);
SC_Pair
*
pSlewIn
=
Abc_SclObj
Load
(
p
,
pFanin
);
SC_Pair
*
pArrIn
=
Abc_SclObj
Arr
(
p
,
pFanin
);
SC_Pair
*
pSlewIn
=
Abc_SclObj
Slew
(
p
,
pFanin
);
SC_Pair
*
pLoad
=
Abc_SclObjLoad
(
p
,
pObj
);
SC_Pair
*
pArrOut
=
Abc_SclObj
Load
(
p
,
pObj
);
// modified
SC_Pair
*
pSlewOut
=
Abc_SclObj
Load
(
p
,
pObj
);
// modified
SC_Pair
*
pArrOut
=
Abc_SclObj
Arr
(
p
,
pObj
);
// modified
SC_Pair
*
pSlewOut
=
Abc_SclObj
Slew
(
p
,
pObj
);
// modified
if
(
pTime
->
tsense
==
sc_ts_Pos
||
pTime
->
tsense
==
sc_ts_Non
)
{
pArrOut
->
rise
=
Abc_Max
In
t
(
pArrOut
->
rise
,
pArrIn
->
rise
+
Abc_SclLookup
(
pTime
->
pCellRise
,
pSlewIn
->
rise
,
pLoad
->
rise
)
);
pArrOut
->
fall
=
Abc_Max
In
t
(
pArrOut
->
fall
,
pArrIn
->
fall
+
Abc_SclLookup
(
pTime
->
pCellFall
,
pSlewIn
->
fall
,
pLoad
->
fall
)
);
pSlewOut
->
rise
=
Abc_Max
In
t
(
pSlewOut
->
rise
,
Abc_SclLookup
(
pTime
->
pRiseTrans
,
pSlewIn
->
rise
,
pLoad
->
rise
)
);
pSlewOut
->
fall
=
Abc_Max
In
t
(
pSlewOut
->
fall
,
Abc_SclLookup
(
pTime
->
pFallTrans
,
pSlewIn
->
fall
,
pLoad
->
fall
)
);
pArrOut
->
rise
=
Abc_Max
Floa
t
(
pArrOut
->
rise
,
pArrIn
->
rise
+
Abc_SclLookup
(
pTime
->
pCellRise
,
pSlewIn
->
rise
,
pLoad
->
rise
)
);
pArrOut
->
fall
=
Abc_Max
Floa
t
(
pArrOut
->
fall
,
pArrIn
->
fall
+
Abc_SclLookup
(
pTime
->
pCellFall
,
pSlewIn
->
fall
,
pLoad
->
fall
)
);
pSlewOut
->
rise
=
Abc_Max
Floa
t
(
pSlewOut
->
rise
,
Abc_SclLookup
(
pTime
->
pRiseTrans
,
pSlewIn
->
rise
,
pLoad
->
rise
)
);
pSlewOut
->
fall
=
Abc_Max
Floa
t
(
pSlewOut
->
fall
,
Abc_SclLookup
(
pTime
->
pFallTrans
,
pSlewIn
->
fall
,
pLoad
->
fall
)
);
}
if
(
pTime
->
tsense
==
sc_ts_Neg
||
pTime
->
tsense
==
sc_ts_Non
)
{
pArrOut
->
rise
=
Abc_MaxInt
(
pArrOut
->
rise
,
pArrIn
->
fall
+
Abc_SclLookup
(
pTime
->
pCellRise
,
pSlewIn
->
fall
,
pLoad
->
rise
)
);
pArrOut
->
fall
=
Abc_MaxInt
(
pArrOut
->
fall
,
pArrIn
->
rise
+
Abc_SclLookup
(
pTime
->
pCellFall
,
pSlewIn
->
rise
,
pLoad
->
fall
)
);
pSlewOut
->
rise
=
Abc_MaxInt
(
pSlewOut
->
rise
,
Abc_SclLookup
(
pTime
->
pRiseTrans
,
pSlewIn
->
fall
,
pLoad
->
rise
)
);
pSlewOut
->
fall
=
Abc_MaxInt
(
pSlewOut
->
fall
,
Abc_SclLookup
(
pTime
->
pFallTrans
,
pSlewIn
->
rise
,
pLoad
->
fall
)
);
}
}
void
Abc_SclComputeLoad
(
SC_Man
*
p
,
Vec_Ptr_t
*
vNodes
,
Vec_Flt_t
*
vWireCaps
)
{
Abc_Obj_t
*
pObj
,
*
pFanin
;
int
i
,
k
;
Vec_PtrForEachEntry
(
Abc_Obj_t
*
,
vNodes
,
pObj
,
i
)
{
SC_Cell
*
pCell
=
Abc_SclObjCell
(
p
,
pObj
);
Abc_ObjForEachFanin
(
pObj
,
pFanin
,
k
)
{
SC_Pin
*
pPin
=
SC_CellPin
(
pCell
,
k
);
SC_Pair
*
pLoad
=
Abc_SclObjLoad
(
p
,
pFanin
);
pLoad
->
rise
+=
pPin
->
rise_cap
;
pLoad
->
fall
+=
pPin
->
fall_cap
;
}
}
if
(
vWireCaps
)
{
Vec_PtrForEachEntry
(
Abc_Obj_t
*
,
vNodes
,
pObj
,
i
)
{
SC_Pair
*
pLoad
=
Abc_SclObjLoad
(
p
,
pObj
);
k
=
Abc_MinInt
(
Vec_FltSize
(
vWireCaps
)
-
1
,
Abc_ObjFanoutNum
(
pObj
)
);
pLoad
->
rise
+=
Vec_FltEntry
(
vWireCaps
,
k
);
pLoad
->
fall
+=
Vec_FltEntry
(
vWireCaps
,
k
);
}
pArrOut
->
rise
=
Abc_MaxFloat
(
pArrOut
->
rise
,
pArrIn
->
fall
+
Abc_SclLookup
(
pTime
->
pCellRise
,
pSlewIn
->
fall
,
pLoad
->
rise
)
);
pArrOut
->
fall
=
Abc_MaxFloat
(
pArrOut
->
fall
,
pArrIn
->
rise
+
Abc_SclLookup
(
pTime
->
pCellFall
,
pSlewIn
->
rise
,
pLoad
->
fall
)
);
pSlewOut
->
rise
=
Abc_MaxFloat
(
pSlewOut
->
rise
,
Abc_SclLookup
(
pTime
->
pRiseTrans
,
pSlewIn
->
fall
,
pLoad
->
rise
)
);
pSlewOut
->
fall
=
Abc_MaxFloat
(
pSlewOut
->
fall
,
Abc_SclLookup
(
pTime
->
pFallTrans
,
pSlewIn
->
rise
,
pLoad
->
fall
)
);
}
}
void
Abc_SclTimeNtk
(
SC_Man
*
p
)
...
...
@@ -313,6 +380,8 @@ void Abc_SclTimeNtk( SC_Man * p )
Abc_SclTimeGate
(
p
,
pTime
,
pObj
,
Abc_ObjFanin
(
pObj
,
k
)
);
}
}
Abc_SclTimeNtkPrint
(
p
,
vNodes
);
Vec_FltFree
(
vWireCaps
);
Vec_PtrFree
(
vNodes
);
}
...
...
@@ -327,27 +396,11 @@ void Abc_SclTimeNtk( SC_Man * p )
SeeAlso []
***********************************************************************/
void
Abc_SclTimeNtkPrint
(
SC_Man
*
p
)
{
}
/**Function*************************************************************
Synopsis []
Description []
SideEffects []
SeeAlso []
***********************************************************************/
void
Abc_SclTimePerform
(
SC_Lib
*
pLib
,
void
*
pNtk
)
{
SC_Man
*
p
;
p
=
Abc_SclManAlloc
(
pLib
,
(
Abc_Ntk_t
*
)
pNtk
);
Abc_SclTimeNtk
(
p
);
Abc_SclTimeNtkPrint
(
p
);
Abc_SclManFree
(
p
);
}
...
...
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