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
f392645d
Commit
f392645d
authored
Jul 22, 2013
by
Alan Mishchenko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Generating GENLIB library from SCL.
parent
fd28deef
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
470 additions
and
185 deletions
+470
-185
src/map/scl/scl.c
+88
-11
src/map/scl/sclLib.c
+246
-52
src/map/scl/sclLib.h
+101
-1
src/map/scl/sclSize.c
+8
-61
src/map/scl/sclSize.h
+1
-0
src/map/scl/sclTime.h
+5
-59
src/map/scl/sclUpsize.c
+1
-1
src/map/scl/sclUtil.c
+20
-0
No files found.
src/map/scl/scl.c
View file @
f392645d
...
...
@@ -39,6 +39,7 @@ static int Scl_CommandUpsize ( Abc_Frame_t * pAbc, int argc, char **argv );
static
int
Scl_CommandDnsize
(
Abc_Frame_t
*
pAbc
,
int
argc
,
char
**
argv
);
static
int
Scl_CommandMinsize
(
Abc_Frame_t
*
pAbc
,
int
argc
,
char
**
argv
);
static
int
Scl_CommandPrintBuf
(
Abc_Frame_t
*
pAbc
,
int
argc
,
char
**
argv
);
static
int
Scl_CommandDumpGen
(
Abc_Frame_t
*
pAbc
,
int
argc
,
char
**
argv
);
////////////////////////////////////////////////////////////////////////
/// FUNCTION DEFINITIONS ///
...
...
@@ -57,17 +58,18 @@ static int Scl_CommandPrintBuf( Abc_Frame_t * pAbc, int argc, char **argv );
***********************************************************************/
void
Scl_Init
(
Abc_Frame_t
*
pAbc
)
{
Cmd_CommandAdd
(
pAbc
,
"SCL mapping"
,
"read_scl"
,
Scl_CommandRead
,
0
);
Cmd_CommandAdd
(
pAbc
,
"SCL mapping"
,
"write_scl"
,
Scl_CommandWrite
,
0
);
Cmd_CommandAdd
(
pAbc
,
"SCL mapping"
,
"print_scl"
,
Scl_CommandPrint
,
0
);
Cmd_CommandAdd
(
pAbc
,
"SCL mapping"
,
"print_gs"
,
Scl_CommandPrintGS
,
0
);
Cmd_CommandAdd
(
pAbc
,
"SCL mapping"
,
"stime"
,
Scl_CommandStime
,
0
);
Cmd_CommandAdd
(
pAbc
,
"SCL mapping"
,
"topo"
,
Scl_CommandTopo
,
1
);
Cmd_CommandAdd
(
pAbc
,
"SCL mapping"
,
"buffer"
,
Scl_CommandBuffer
,
1
);
Cmd_CommandAdd
(
pAbc
,
"SCL mapping"
,
"minsize"
,
Scl_CommandMinsize
,
1
);
Cmd_CommandAdd
(
pAbc
,
"SCL mapping"
,
"upsize"
,
Scl_CommandUpsize
,
1
);
Cmd_CommandAdd
(
pAbc
,
"SCL mapping"
,
"dnsize"
,
Scl_CommandDnsize
,
1
);
Cmd_CommandAdd
(
pAbc
,
"SCL mapping"
,
"print_buf"
,
Scl_CommandPrintBuf
,
1
);
Cmd_CommandAdd
(
pAbc
,
"SCL mapping"
,
"read_scl"
,
Scl_CommandRead
,
0
);
Cmd_CommandAdd
(
pAbc
,
"SCL mapping"
,
"write_scl"
,
Scl_CommandWrite
,
0
);
Cmd_CommandAdd
(
pAbc
,
"SCL mapping"
,
"print_scl"
,
Scl_CommandPrint
,
0
);
Cmd_CommandAdd
(
pAbc
,
"SCL mapping"
,
"print_gs"
,
Scl_CommandPrintGS
,
0
);
Cmd_CommandAdd
(
pAbc
,
"SCL mapping"
,
"stime"
,
Scl_CommandStime
,
0
);
Cmd_CommandAdd
(
pAbc
,
"SCL mapping"
,
"topo"
,
Scl_CommandTopo
,
1
);
Cmd_CommandAdd
(
pAbc
,
"SCL mapping"
,
"buffer"
,
Scl_CommandBuffer
,
1
);
Cmd_CommandAdd
(
pAbc
,
"SCL mapping"
,
"minsize"
,
Scl_CommandMinsize
,
1
);
Cmd_CommandAdd
(
pAbc
,
"SCL mapping"
,
"upsize"
,
Scl_CommandUpsize
,
1
);
Cmd_CommandAdd
(
pAbc
,
"SCL mapping"
,
"dnsize"
,
Scl_CommandDnsize
,
1
);
Cmd_CommandAdd
(
pAbc
,
"SCL mapping"
,
"print_buf"
,
Scl_CommandPrintBuf
,
0
);
Cmd_CommandAdd
(
pAbc
,
"SCL mapping"
,
"dump_genlib"
,
Scl_CommandDumpGen
,
0
);
}
void
Scl_End
(
Abc_Frame_t
*
pAbc
)
{
...
...
@@ -977,6 +979,81 @@ usage:
return
1
;
}
/**Function*************************************************************
Synopsis []
Description []
SideEffects []
SeeAlso []
***********************************************************************/
int
Scl_CommandDumpGen
(
Abc_Frame_t
*
pAbc
,
int
argc
,
char
**
argv
)
{
Abc_Ntk_t
*
pNtk
=
Abc_FrameReadNtk
(
pAbc
);
char
*
pFileName
;
float
Slew
=
100
;
float
Gain
=
2
;
int
c
,
fVerbose
=
0
;
Extra_UtilGetoptReset
();
while
(
(
c
=
Extra_UtilGetopt
(
argc
,
argv
,
"SGvh"
)
)
!=
EOF
)
{
switch
(
c
)
{
case
'S'
:
if
(
globalUtilOptind
>=
argc
)
{
Abc_Print
(
-
1
,
"Command line switch
\"
-S
\"
should be followed by a floating point number.
\n
"
);
goto
usage
;
}
Slew
=
(
float
)
atof
(
argv
[
globalUtilOptind
]);
globalUtilOptind
++
;
if
(
Slew
<=
0
.
0
)
goto
usage
;
break
;
case
'G'
:
if
(
globalUtilOptind
>=
argc
)
{
Abc_Print
(
-
1
,
"Command line switch
\"
-G
\"
should be followed by a floating point number.
\n
"
);
goto
usage
;
}
Gain
=
(
float
)
atof
(
argv
[
globalUtilOptind
]);
globalUtilOptind
++
;
if
(
Gain
<=
0
.
0
)
goto
usage
;
break
;
case
'v'
:
fVerbose
^=
1
;
break
;
case
'h'
:
goto
usage
;
default:
goto
usage
;
}
}
if
(
pAbc
->
pLibScl
==
NULL
)
{
fprintf
(
pAbc
->
Err
,
"There is no Liberty library available.
\n
"
);
goto
usage
;
}
if
(
argc
!=
globalUtilOptind
+
1
)
goto
usage
;
pFileName
=
argv
[
globalUtilOptind
];
Abc_SclDumpGenlib
(
pFileName
,
(
SC_Lib
*
)
pAbc
->
pLibScl
,
Slew
,
Gain
);
return
0
;
usage:
fprintf
(
pAbc
->
Err
,
"usage: dump_genlib [-SG float] [-vh]
\n
"
);
fprintf
(
pAbc
->
Err
,
"
\t
writes GENLIB file for SCL library
\n
"
);
fprintf
(
pAbc
->
Err
,
"
\t
-S float : the slew parameter used to generate the library [default = %.2f]
\n
"
,
Slew
);
fprintf
(
pAbc
->
Err
,
"
\t
-G float : the gain parameter used to generate the library [default = %.2f]
\n
"
,
Gain
);
fprintf
(
pAbc
->
Err
,
"
\t
-v : toggle printing verbose information [default = %s]
\n
"
,
fVerbose
?
"yes"
:
"no"
);
fprintf
(
pAbc
->
Err
,
"
\t
-h : print the command usage
\n
"
);
return
1
;
}
////////////////////////////////////////////////////////////////////////
/// END OF FILE ///
////////////////////////////////////////////////////////////////////////
...
...
src/map/scl/sclLib.c
View file @
f392645d
...
...
@@ -785,58 +785,6 @@ void Abc_SclLinkCells( SC_Lib * p )
Vec_PtrFree
(
vList
);
}
}
void
Abc_SclPrintCells
(
SC_Lib
*
p
)
{
SC_Cell
*
pCell
,
*
pRepr
;
int
i
,
k
,
j
,
nLength
=
0
;
assert
(
Vec_PtrSize
(
p
->
vCellClasses
)
>
0
);
printf
(
"Library
\"
%s
\"
"
,
p
->
pName
);
printf
(
"containing %d cells in %d classes.
\n
"
,
Vec_PtrSize
(
p
->
vCells
),
Vec_PtrSize
(
p
->
vCellClasses
)
);
// find the longest name
SC_LibForEachCellClass
(
p
,
pRepr
,
k
)
SC_RingForEachCell
(
pRepr
,
pCell
,
i
)
nLength
=
Abc_MaxInt
(
nLength
,
strlen
(
pRepr
->
pName
)
);
// print cells
SC_LibForEachCellClass
(
p
,
pRepr
,
k
)
{
printf
(
"Class%3d : "
,
k
);
printf
(
"Ins = %d "
,
pRepr
->
n_inputs
);
printf
(
"Outs = %d"
,
pRepr
->
n_outputs
);
for
(
i
=
0
;
i
<
pRepr
->
n_outputs
;
i
++
)
{
printf
(
" "
);
Kit_DsdPrintFromTruth
(
(
unsigned
*
)
Vec_WrdArray
(
SC_CellPin
(
pRepr
,
pRepr
->
n_inputs
+
i
)
->
vFunc
),
pRepr
->
n_inputs
);
}
printf
(
"
\n
"
);
SC_RingForEachCell
(
pRepr
,
pCell
,
i
)
{
printf
(
" %3d : "
,
i
+
1
);
printf
(
"%-*s "
,
nLength
,
pCell
->
pName
);
printf
(
"%2d "
,
pCell
->
drive_strength
);
printf
(
"A =%8.2f D ="
,
pCell
->
area
);
// print linear approximation
for
(
j
=
0
;
j
<
3
;
j
++
)
{
SC_Pin
*
pPin
=
SC_CellPin
(
pCell
,
pCell
->
n_inputs
);
if
(
Vec_PtrSize
(
pPin
->
vRTimings
)
>
0
)
{
SC_Timings
*
pRTime
=
(
SC_Timings
*
)
Vec_PtrEntry
(
pPin
->
vRTimings
,
0
);
SC_Timing
*
pTime
=
(
SC_Timing
*
)
Vec_PtrEntry
(
pRTime
->
vTimings
,
0
);
printf
(
" %6.2f"
,
j
?
pTime
->
pCellRise
->
approx
[
0
][
j
]
:
SC_LibTimePs
(
p
,
pTime
->
pCellRise
->
approx
[
0
][
j
])
);
}
}
// print input capacitance
printf
(
" Cap ="
);
for
(
j
=
0
;
j
<
pCell
->
n_inputs
;
j
++
)
{
SC_Pin
*
pPin
=
SC_CellPin
(
pCell
,
j
);
printf
(
" %6.2f"
,
SC_LibCapFf
(
p
,
pPin
->
rise_cap
)
);
}
printf
(
"
\n
"
);
}
}
}
/**Function*************************************************************
...
...
@@ -895,6 +843,252 @@ SC_WireLoad * Abc_SclFindWireLoadModel( SC_Lib * p, float Area )
return
pWL
;
}
/**Function*************************************************************
Synopsis [Compute delay parameters of pin/cell/class.]
Description []
SideEffects []
SeeAlso []
***********************************************************************/
void
Abc_SclComputeParametersPin
(
SC_Lib
*
p
,
SC_Cell
*
pCell
,
int
iPin
,
float
Slew
,
float
*
pLD
,
float
*
pPD
)
{
SC_Timings
*
pRTime
;
SC_Timing
*
pTime
=
NULL
;
SC_Pin
*
pPin
;
SC_Pair
ArrIn
=
{
0
.
0
,
0
.
0
};
SC_Pair
SlewIn
=
{
Slew
,
Slew
};
SC_Pair
Load0
,
Load1
,
Load2
;
SC_Pair
ArrOut0
=
{
0
.
0
,
0
.
0
};
SC_Pair
ArrOut1
=
{
0
.
0
,
0
.
0
};
SC_Pair
ArrOut2
=
{
0
.
0
,
0
.
0
};
SC_Pair
SlewOut
=
{
0
.
0
,
0
.
0
};
Vec_Flt_t
*
vIndex
;
assert
(
iPin
>=
0
&&
iPin
<
pCell
->
n_inputs
);
pPin
=
SC_CellPin
(
pCell
,
pCell
->
n_inputs
);
// find timing info for this pin
assert
(
Vec_PtrSize
(
pPin
->
vRTimings
)
==
pCell
->
n_inputs
);
pRTime
=
(
SC_Timings
*
)
Vec_PtrEntry
(
pPin
->
vRTimings
,
iPin
);
assert
(
Vec_PtrSize
(
pRTime
->
vTimings
)
==
1
);
pTime
=
(
SC_Timing
*
)
Vec_PtrEntry
(
pRTime
->
vTimings
,
0
);
// get load points
vIndex
=
pTime
->
pCellRise
->
vIndex1
;
// capacitance
Load0
.
rise
=
Load0
.
fall
=
0
.
0
;
Load1
.
rise
=
Load1
.
fall
=
Vec_FltEntry
(
vIndex
,
0
);
Load2
.
rise
=
Load2
.
fall
=
Vec_FltEntry
(
vIndex
,
Vec_FltSize
(
vIndex
)
-
2
);
// compute delay
Scl_LibPinArrival
(
pTime
,
&
ArrIn
,
&
SlewIn
,
&
Load0
,
&
ArrOut0
,
&
SlewOut
);
Scl_LibPinArrival
(
pTime
,
&
ArrIn
,
&
SlewIn
,
&
Load1
,
&
ArrOut1
,
&
SlewOut
);
Scl_LibPinArrival
(
pTime
,
&
ArrIn
,
&
SlewIn
,
&
Load2
,
&
ArrOut2
,
&
SlewOut
);
ArrOut0
.
rise
=
0
.
5
*
(
ArrOut0
.
rise
+
ArrOut0
.
fall
);
ArrOut1
.
rise
=
0
.
5
*
(
ArrOut1
.
rise
+
ArrOut1
.
fall
);
ArrOut2
.
rise
=
0
.
5
*
(
ArrOut2
.
rise
+
ArrOut2
.
fall
);
// get tangent
*
pLD
=
(
ArrOut2
.
rise
-
ArrOut1
.
rise
)
/
((
Load2
.
rise
-
Load1
.
rise
)
/
SC_CellPinCap
(
pCell
,
iPin
));
// get constant
*
pPD
=
ArrOut0
.
rise
;
}
void
Abc_SclComputeParametersCell
(
SC_Lib
*
p
,
SC_Cell
*
pCell
,
float
Slew
,
float
*
pLD
,
float
*
pPD
)
{
SC_Pin
*
pPin
;
float
LD
,
PD
,
ld
,
pd
;
int
i
;
LD
=
PD
=
ld
=
pd
=
0
;
SC_CellForEachPinIn
(
pCell
,
pPin
,
i
)
{
Abc_SclComputeParametersPin
(
p
,
pCell
,
i
,
Slew
,
&
ld
,
&
pd
);
LD
+=
ld
;
PD
+=
pd
;
}
*
pLD
=
LD
/
pCell
->
n_inputs
;
*
pPD
=
PD
/
pCell
->
n_inputs
;
}
void
Abc_SclComputeParametersClass
(
SC_Lib
*
p
,
SC_Cell
*
pRepr
,
float
Slew
,
float
*
pLD
,
float
*
pPD
)
{
SC_Cell
*
pCell
;
float
LD
,
PD
,
ld
,
pd
;
int
i
,
Count
=
0
;
LD
=
PD
=
ld
=
pd
=
0
;
SC_RingForEachCell
(
pRepr
,
pCell
,
i
)
{
Abc_SclComputeParametersCell
(
p
,
pCell
,
Slew
,
&
ld
,
&
pd
);
LD
+=
ld
;
PD
+=
pd
;
Count
++
;
}
*
pLD
=
LD
/
Count
;
*
pPD
=
PD
/
Count
;
}
void
Abc_SclComputeParametersClassPin
(
SC_Lib
*
p
,
SC_Cell
*
pRepr
,
int
iPin
,
float
Slew
,
float
*
pLD
,
float
*
pPD
)
{
SC_Cell
*
pCell
;
float
LD
,
PD
,
ld
,
pd
;
int
i
,
Count
=
0
;
LD
=
PD
=
ld
=
pd
=
0
;
SC_RingForEachCell
(
pRepr
,
pCell
,
i
)
{
Abc_SclComputeParametersPin
(
p
,
pCell
,
Slew
,
iPin
,
&
ld
,
&
pd
);
LD
+=
ld
;
PD
+=
pd
;
Count
++
;
}
*
pLD
=
LD
/
Count
;
*
pPD
=
PD
/
Count
;
}
float
Abc_SclComputeDelayCellPin
(
SC_Lib
*
p
,
SC_Cell
*
pCell
,
int
iPin
,
float
Slew
,
float
Gain
)
{
float
LD
=
0
,
PD
=
0
;
Abc_SclComputeParametersPin
(
p
,
pCell
,
iPin
,
Slew
,
&
LD
,
&
PD
);
return
LD
*
Gain
+
PD
;
}
float
Abc_SclComputeDelayClassPin
(
SC_Lib
*
p
,
SC_Cell
*
pRepr
,
int
iPin
,
float
Slew
,
float
Gain
)
{
SC_Cell
*
pCell
;
float
Delay
=
0
;
int
i
,
Count
=
0
;
SC_RingForEachCell
(
pRepr
,
pCell
,
i
)
{
Delay
+=
Abc_SclComputeDelayCellPin
(
p
,
pCell
,
iPin
,
Slew
,
Gain
);
Count
++
;
}
return
Delay
/
Count
;
}
float
Abc_SclComputeAreaClass
(
SC_Cell
*
pRepr
)
{
SC_Cell
*
pCell
;
float
Area
=
0
;
int
i
,
Count
=
0
;
SC_RingForEachCell
(
pRepr
,
pCell
,
i
)
{
Area
+=
pCell
->
area
;
Count
++
;
}
return
Area
/
Count
;
}
/**Function*************************************************************
Synopsis [Print cells]
Description []
SideEffects []
SeeAlso []
***********************************************************************/
void
Abc_SclPrintCells
(
SC_Lib
*
p
)
{
SC_Cell
*
pCell
,
*
pRepr
;
int
i
,
k
,
nLength
=
0
;
float
LD
=
0
,
PD
=
0
;
float
SlewDef
=
100
;
assert
(
Vec_PtrSize
(
p
->
vCellClasses
)
>
0
);
printf
(
"Library
\"
%s
\"
"
,
p
->
pName
);
printf
(
"containing %d cells in %d classes.
\n
"
,
Vec_PtrSize
(
p
->
vCells
),
Vec_PtrSize
(
p
->
vCellClasses
)
);
// find the longest name
SC_LibForEachCellClass
(
p
,
pRepr
,
k
)
SC_RingForEachCell
(
pRepr
,
pCell
,
i
)
nLength
=
Abc_MaxInt
(
nLength
,
strlen
(
pRepr
->
pName
)
);
// print cells
SC_LibForEachCellClass
(
p
,
pRepr
,
k
)
{
printf
(
"Class%3d : "
,
k
);
printf
(
"Ins = %d "
,
pRepr
->
n_inputs
);
printf
(
"Outs = %d"
,
pRepr
->
n_outputs
);
for
(
i
=
0
;
i
<
pRepr
->
n_outputs
;
i
++
)
{
printf
(
" "
);
Kit_DsdPrintFromTruth
(
(
unsigned
*
)
Vec_WrdArray
(
SC_CellPin
(
pRepr
,
pRepr
->
n_inputs
+
i
)
->
vFunc
),
pRepr
->
n_inputs
);
}
printf
(
"
\n
"
);
SC_RingForEachCell
(
pRepr
,
pCell
,
i
)
{
Abc_SclComputeParametersCell
(
p
,
pCell
,
SlewDef
,
&
LD
,
&
PD
);
printf
(
" %3d : "
,
i
+
1
);
printf
(
"%-*s "
,
nLength
,
pCell
->
pName
);
printf
(
"%2d "
,
pCell
->
drive_strength
);
printf
(
"A =%8.2f "
,
pCell
->
area
);
printf
(
"C =%6.2f ff "
,
Abc_SclGatePinCapAve
(
p
,
pCell
)
);
printf
(
"LD =%8.2f ps "
,
LD
);
printf
(
"PD =%8.2f ps"
,
PD
);
printf
(
"
\n
"
);
}
}
}
/**Function*************************************************************
Synopsis [Derive GENLIB library.]
Description []
SideEffects []
SeeAlso []
***********************************************************************/
Vec_Str_t
*
Abc_SclDeriveGenlib
(
SC_Lib
*
p
,
float
Slew
,
float
Gain
)
{
extern
char
*
Abc_SclFindGateFormula
(
char
*
pGateName
,
char
*
pOutName
);
char
Buffer
[
200
];
Vec_Str_t
*
vStr
;
SC_Cell
*
pRepr
;
SC_Pin
*
pPin
;
int
i
,
k
,
Count
=
0
;
vStr
=
Vec_StrAlloc
(
1000
);
Vec_StrPrintStr
(
vStr
,
"GATE _const0_ 0.000000 z=CONST0;
\n
"
);
Vec_StrPrintStr
(
vStr
,
"GATE _const1_ 0.000000 z=CONST1;
\n
"
);
SC_LibForEachCellClass
(
p
,
pRepr
,
i
)
{
if
(
pRepr
->
n_outputs
>
1
)
continue
;
assert
(
strlen
(
pRepr
->
pName
)
<
200
);
Vec_StrPrintStr
(
vStr
,
"GATE "
);
sprintf
(
Buffer
,
"%-16s"
,
pRepr
->
pName
);
Vec_StrPrintStr
(
vStr
,
Buffer
);
Vec_StrPrintStr
(
vStr
,
" "
);
sprintf
(
Buffer
,
"%7.2f"
,
Abc_SclComputeAreaClass
(
pRepr
)
);
Vec_StrPrintStr
(
vStr
,
Buffer
);
Vec_StrPrintStr
(
vStr
,
" "
);
Vec_StrPrintStr
(
vStr
,
SC_CellPinName
(
pRepr
,
pRepr
->
n_inputs
)
);
Vec_StrPrintStr
(
vStr
,
"="
);
// Vec_StrPrintStr( vStr, SC_CellPinOutFunc(pRepr, 0) );
Vec_StrPrintStr
(
vStr
,
Abc_SclFindGateFormula
(
pRepr
->
pName
,
SC_CellPinName
(
pRepr
,
pRepr
->
n_inputs
))
);
Vec_StrPrintStr
(
vStr
,
";
\n
"
);
SC_CellForEachPinIn
(
pRepr
,
pPin
,
k
)
{
float
Delay
=
Abc_SclComputeDelayClassPin
(
p
,
pRepr
,
k
,
Slew
,
Gain
);
Vec_StrPrintStr
(
vStr
,
" PIN "
);
sprintf
(
Buffer
,
"%-4s"
,
pPin
->
pName
);
Vec_StrPrintStr
(
vStr
,
Buffer
);
sprintf
(
Buffer
,
" UNKNOWN 1 999 %7.2f 0.00 %7.2f 0.00
\n
"
,
Delay
,
Delay
);
Vec_StrPrintStr
(
vStr
,
Buffer
);
}
Count
++
;
}
Vec_StrPrintStr
(
vStr
,
"
\n
.end
\n
"
);
Vec_StrPush
(
vStr
,
'\0'
);
// printf( "%s", Vec_StrArray(vStr) );
printf
(
"GENLIB library with %d gates is produced.
\n
"
,
Count
);
return
vStr
;
}
void
Abc_SclDumpGenlib
(
char
*
pFileName
,
SC_Lib
*
p
,
float
Slew
,
float
Gain
)
{
Vec_Str_t
*
vStr
;
FILE
*
pFile
=
fopen
(
pFileName
,
"wb"
);
if
(
pFile
==
NULL
)
{
printf
(
"Cannot open file
\"
%s
\"
for writing.
\n
"
,
pFileName
);
return
;
}
vStr
=
Abc_SclDeriveGenlib
(
p
,
Slew
,
Gain
);
fprintf
(
pFile
,
"%s"
,
Vec_StrArray
(
vStr
)
);
Vec_StrFree
(
vStr
);
fclose
(
pFile
);
}
////////////////////////////////////////////////////////////////////////
/// END OF FILE ///
////////////////////////////////////////////////////////////////////////
...
...
src/map/scl/sclLib.h
View file @
f392645d
...
...
@@ -207,12 +207,17 @@ struct SC_Lib_
static
inline
SC_Cell
*
SC_LibCell
(
SC_Lib
*
p
,
int
i
)
{
return
(
SC_Cell
*
)
Vec_PtrEntry
(
p
->
vCells
,
i
);
}
static
inline
SC_Pin
*
SC_CellPin
(
SC_Cell
*
p
,
int
i
)
{
return
(
SC_Pin
*
)
Vec_PtrEntry
(
p
->
vPins
,
i
);
}
static
inline
Vec_Wrd_t
*
SC_CellFunc
(
SC_Cell
*
p
)
{
return
SC_CellPin
(
p
,
p
->
n_inputs
)
->
vFunc
;
}
static
inline
float
SC_CellPinCap
(
SC_Cell
*
p
,
int
i
)
{
return
0
.
5
*
(
SC_CellPin
(
p
,
i
)
->
rise_cap
+
SC_CellPin
(
p
,
i
)
->
fall_cap
);
}
static
inline
char
*
SC_CellPinOutFunc
(
SC_Cell
*
p
,
int
i
)
{
return
SC_CellPin
(
p
,
p
->
n_inputs
+
i
)
->
func_text
;
}
static
inline
char
*
SC_CellPinName
(
SC_Cell
*
p
,
int
i
)
{
return
SC_CellPin
(
p
,
i
)
->
pName
;
}
static
inline
double
SC_LibCapFf
(
SC_Lib
*
p
,
double
cap
)
{
return
cap
*
p
->
unit_cap_fst
*
pow
(
10
.
0
,
15
-
p
->
unit_cap_snd
);
}
static
inline
double
SC_LibCapFromFf
(
SC_Lib
*
p
,
double
cap
)
{
return
cap
/
p
->
unit_cap_fst
/
pow
(
10
.
0
,
15
-
p
->
unit_cap_snd
);
}
static
inline
double
SC_LibTimePs
(
SC_Lib
*
p
,
double
time
)
{
return
time
*
pow
(
10
.
0
,
12
-
p
->
unit_time
);
}
static
inline
double
SC_LibTimeFromPs
(
SC_Lib
*
p
,
double
ps
)
{
return
ps
/
pow
(
10
.
0
,
12
-
p
->
unit_time
);
}
#define SC_LibForEachCell( p, pCell, i ) Vec_PtrForEachEntry( SC_Cell *, p->vCells, pCell, i )
#define SC_LibForEachCellClass( p, pCell, i ) Vec_PtrForEachEntry( SC_Cell *, p->vCellClasses, pCell, i )
#define SC_LibForEachWireLoad( p, pWL, i ) Vec_PtrForEachEntry( SC_WireLoad *, p->vWireLoads, pWL, i )
...
...
@@ -436,6 +441,101 @@ static inline void Abc_SclLibFree( SC_Lib * p )
}
/**Function*************************************************************
Synopsis [Lookup table delay computation.]
Description []
SideEffects []
SeeAlso []
***********************************************************************/
static
inline
float
Scl_LibLookup
(
SC_Surface
*
p
,
float
slew
,
float
load
)
{
float
*
pIndex0
,
*
pIndex1
,
*
pDataS
,
*
pDataS1
;
float
sfrac
,
lfrac
,
p0
,
p1
;
int
s
,
l
;
// Find closest sample points in surface:
pIndex0
=
Vec_FltArray
(
p
->
vIndex0
);
for
(
s
=
1
;
s
<
Vec_FltSize
(
p
->
vIndex0
)
-
1
;
s
++
)
if
(
pIndex0
[
s
]
>
slew
)
break
;
s
--
;
pIndex1
=
Vec_FltArray
(
p
->
vIndex1
);
for
(
l
=
1
;
l
<
Vec_FltSize
(
p
->
vIndex1
)
-
1
;
l
++
)
if
(
pIndex1
[
l
]
>
load
)
break
;
l
--
;
// Interpolate (or extrapolate) function value from sample points:
sfrac
=
(
slew
-
pIndex0
[
s
])
/
(
pIndex0
[
s
+
1
]
-
pIndex0
[
s
]);
lfrac
=
(
load
-
pIndex1
[
l
])
/
(
pIndex1
[
l
+
1
]
-
pIndex1
[
l
]);
pDataS
=
Vec_FltArray
(
(
Vec_Flt_t
*
)
Vec_PtrEntry
(
p
->
vData
,
s
)
);
pDataS1
=
Vec_FltArray
(
(
Vec_Flt_t
*
)
Vec_PtrEntry
(
p
->
vData
,
s
+
1
)
);
p0
=
pDataS
[
l
]
+
lfrac
*
(
pDataS
[
l
+
1
]
-
pDataS
[
l
]);
p1
=
pDataS1
[
l
]
+
lfrac
*
(
pDataS1
[
l
+
1
]
-
pDataS1
[
l
]);
return
p0
+
sfrac
*
(
p1
-
p0
);
// <<== multiply result with K factor here
}
static
inline
void
Scl_LibPinArrival
(
SC_Timing
*
pTime
,
SC_Pair
*
pArrIn
,
SC_Pair
*
pSlewIn
,
SC_Pair
*
pLoad
,
SC_Pair
*
pArrOut
,
SC_Pair
*
pSlewOut
)
{
if
(
pTime
->
tsense
==
sc_ts_Pos
||
pTime
->
tsense
==
sc_ts_Non
)
{
pArrOut
->
rise
=
Abc_MaxFloat
(
pArrOut
->
rise
,
pArrIn
->
rise
+
Scl_LibLookup
(
pTime
->
pCellRise
,
pSlewIn
->
rise
,
pLoad
->
rise
)
);
pArrOut
->
fall
=
Abc_MaxFloat
(
pArrOut
->
fall
,
pArrIn
->
fall
+
Scl_LibLookup
(
pTime
->
pCellFall
,
pSlewIn
->
fall
,
pLoad
->
fall
)
);
pSlewOut
->
rise
=
Abc_MaxFloat
(
pSlewOut
->
rise
,
Scl_LibLookup
(
pTime
->
pRiseTrans
,
pSlewIn
->
rise
,
pLoad
->
rise
)
);
pSlewOut
->
fall
=
Abc_MaxFloat
(
pSlewOut
->
fall
,
Scl_LibLookup
(
pTime
->
pFallTrans
,
pSlewIn
->
fall
,
pLoad
->
fall
)
);
}
if
(
pTime
->
tsense
==
sc_ts_Neg
||
pTime
->
tsense
==
sc_ts_Non
)
{
pArrOut
->
rise
=
Abc_MaxFloat
(
pArrOut
->
rise
,
pArrIn
->
fall
+
Scl_LibLookup
(
pTime
->
pCellRise
,
pSlewIn
->
fall
,
pLoad
->
rise
)
);
pArrOut
->
fall
=
Abc_MaxFloat
(
pArrOut
->
fall
,
pArrIn
->
rise
+
Scl_LibLookup
(
pTime
->
pCellFall
,
pSlewIn
->
rise
,
pLoad
->
fall
)
);
pSlewOut
->
rise
=
Abc_MaxFloat
(
pSlewOut
->
rise
,
Scl_LibLookup
(
pTime
->
pRiseTrans
,
pSlewIn
->
fall
,
pLoad
->
rise
)
);
pSlewOut
->
fall
=
Abc_MaxFloat
(
pSlewOut
->
fall
,
Scl_LibLookup
(
pTime
->
pFallTrans
,
pSlewIn
->
rise
,
pLoad
->
fall
)
);
}
}
static
inline
void
Scl_LibPinDeparture
(
SC_Timing
*
pTime
,
SC_Pair
*
pDepIn
,
SC_Pair
*
pSlewIn
,
SC_Pair
*
pLoad
,
SC_Pair
*
pDepOut
)
{
if
(
pTime
->
tsense
==
sc_ts_Pos
||
pTime
->
tsense
==
sc_ts_Non
)
{
pDepIn
->
rise
=
Abc_MaxFloat
(
pDepIn
->
rise
,
pDepOut
->
rise
+
Scl_LibLookup
(
pTime
->
pCellRise
,
pSlewIn
->
rise
,
pLoad
->
rise
)
);
pDepIn
->
fall
=
Abc_MaxFloat
(
pDepIn
->
fall
,
pDepOut
->
fall
+
Scl_LibLookup
(
pTime
->
pCellFall
,
pSlewIn
->
fall
,
pLoad
->
fall
)
);
}
if
(
pTime
->
tsense
==
sc_ts_Neg
||
pTime
->
tsense
==
sc_ts_Non
)
{
pDepIn
->
fall
=
Abc_MaxFloat
(
pDepIn
->
fall
,
pDepOut
->
rise
+
Scl_LibLookup
(
pTime
->
pCellRise
,
pSlewIn
->
fall
,
pLoad
->
rise
)
);
pDepIn
->
rise
=
Abc_MaxFloat
(
pDepIn
->
rise
,
pDepOut
->
fall
+
Scl_LibLookup
(
pTime
->
pCellFall
,
pSlewIn
->
rise
,
pLoad
->
fall
)
);
}
}
/**Function*************************************************************
Synopsis [Computes input capacitance.]
Description []
SideEffects []
SeeAlso []
***********************************************************************/
static
inline
float
Abc_SclGatePinCapAve
(
SC_Lib
*
p
,
SC_Cell
*
pCell
)
{
SC_Pin
*
pPin
;
int
k
;
float
Cap
=
0
.
0
;
SC_CellForEachPinIn
(
pCell
,
pPin
,
k
)
Cap
+=
0
.
5
*
(
pPin
->
rise_cap
+
pPin
->
fall_cap
);
return
Cap
/
pCell
->
n_inputs
;
}
/*=== sclLib.c ===============================================================*/
extern
SC_Lib
*
Abc_SclRead
(
char
*
pFileName
);
extern
void
Abc_SclWrite
(
char
*
pFileName
,
SC_Lib
*
p
);
...
...
@@ -447,7 +547,7 @@ extern int Abc_SclCellFind( SC_Lib * p, char * pName );
extern
void
Abc_SclLinkCells
(
SC_Lib
*
p
);
extern
void
Abc_SclPrintCells
(
SC_Lib
*
p
);
extern
SC_WireLoad
*
Abc_SclFindWireLoadModel
(
SC_Lib
*
p
,
float
Area
);
extern
void
Abc_SclDumpGenlib
(
char
*
pFileName
,
SC_Lib
*
p
,
float
Slew
,
float
Gain
);
ABC_NAMESPACE_HEADER_END
...
...
src/map/scl/sclSize.c
View file @
f392645d
...
...
@@ -107,17 +107,19 @@ 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
(
p
,
pObj
)
:
NULL
;
printf
(
"%6d : "
,
Abc_ObjId
(
pObj
)
);
printf
(
"%d "
,
Abc_ObjFaninNum
(
pObj
)
);
printf
(
"%2d "
,
Abc_ObjFanoutNum
(
pObj
)
);
printf
(
"%-*s "
,
Length
,
Abc_ObjIsNode
(
pObj
)
?
Abc_SclObjCell
(
p
,
pObj
)
->
pName
:
"pi"
);
printf
(
"%-*s "
,
Length
,
pCell
?
pCell
->
pName
:
"pi"
);
if
(
fRise
>=
0
)
printf
(
"(%s) "
,
fRise
?
"rise"
:
"fall"
);
printf
(
"A =%7.2f "
,
Abc_ObjIsNode
(
pObj
)
?
Abc_SclObjCell
(
p
,
pObj
)
->
area
:
0
.
0
);
printf
(
"A =%7.2f "
,
pCell
?
pCell
->
area
:
0
.
0
);
printf
(
"D = ("
);
printf
(
"%8.2f ps"
,
Abc_SclObjTimePs
(
p
,
pObj
,
1
)
);
printf
(
"%8.2f ps ) "
,
Abc_SclObjTimePs
(
p
,
pObj
,
0
)
);
printf
(
"L =%7.2f ff "
,
Abc_SclObjLoadFf
(
p
,
pObj
,
fRise
>=
0
?
fRise
:
0
)
);
printf
(
"G =%5.2f "
,
pCell
?
Abc_SclObjLoadAve
(
p
,
pObj
)
/
SC_CellPinCap
(
pCell
,
0
)
:
0
.
0
);
printf
(
"S =%7.2f ps "
,
Abc_SclObjSlewPs
(
p
,
pObj
,
fRise
>=
0
?
fRise
:
0
)
);
printf
(
"SL =%6.2f ps"
,
Abc_SclObjSlack
(
p
,
pObj
)
);
printf
(
"
\n
"
);
...
...
@@ -181,77 +183,22 @@ void Abc_SclTimeNtkPrint( SC_Man * p, int fShowAll, int fShort )
SeeAlso []
***********************************************************************/
static
inline
float
Abc_SclLookup
(
SC_Surface
*
p
,
float
slew
,
float
load
)
{
float
*
pIndex0
,
*
pIndex1
,
*
pDataS
,
*
pDataS1
;
float
sfrac
,
lfrac
,
p0
,
p1
;
int
s
,
l
;
// Find closest sample points in surface:
pIndex0
=
Vec_FltArray
(
p
->
vIndex0
);
for
(
s
=
1
;
s
<
Vec_FltSize
(
p
->
vIndex0
)
-
1
;
s
++
)
if
(
pIndex0
[
s
]
>
slew
)
break
;
s
--
;
pIndex1
=
Vec_FltArray
(
p
->
vIndex1
);
for
(
l
=
1
;
l
<
Vec_FltSize
(
p
->
vIndex1
)
-
1
;
l
++
)
if
(
pIndex1
[
l
]
>
load
)
break
;
l
--
;
// Interpolate (or extrapolate) function value from sample points:
sfrac
=
(
slew
-
pIndex0
[
s
])
/
(
pIndex0
[
s
+
1
]
-
pIndex0
[
s
]);
lfrac
=
(
load
-
pIndex1
[
l
])
/
(
pIndex1
[
l
+
1
]
-
pIndex1
[
l
]);
pDataS
=
Vec_FltArray
(
(
Vec_Flt_t
*
)
Vec_PtrEntry
(
p
->
vData
,
s
)
);
pDataS1
=
Vec_FltArray
(
(
Vec_Flt_t
*
)
Vec_PtrEntry
(
p
->
vData
,
s
+
1
)
);
p0
=
pDataS
[
l
]
+
lfrac
*
(
pDataS
[
l
+
1
]
-
pDataS
[
l
]);
p1
=
pDataS1
[
l
]
+
lfrac
*
(
pDataS1
[
l
+
1
]
-
pDataS1
[
l
]);
return
p0
+
sfrac
*
(
p1
-
p0
);
// <<== multiply result with K factor here
}
void
Abc_SclTimeFanin
(
SC_Man
*
p
,
SC_Timing
*
pTime
,
Abc_Obj_t
*
pObj
,
Abc_Obj_t
*
pFanin
)
static
inline
void
Abc_SclTimeFanin
(
SC_Man
*
p
,
SC_Timing
*
pTime
,
Abc_Obj_t
*
pObj
,
Abc_Obj_t
*
pFanin
)
{
SC_Pair
*
pArrIn
=
Abc_SclObjTime
(
p
,
pFanin
);
SC_Pair
*
pSlewIn
=
Abc_SclObjSlew
(
p
,
pFanin
);
SC_Pair
*
pLoad
=
Abc_SclObjLoad
(
p
,
pObj
);
SC_Pair
*
pArrOut
=
Abc_SclObjTime
(
p
,
pObj
);
// modified
SC_Pair
*
pSlewOut
=
Abc_SclObjSlew
(
p
,
pObj
);
// modified
if
(
pTime
->
tsense
==
sc_ts_Pos
||
pTime
->
tsense
==
sc_ts_Non
)
{
pArrOut
->
rise
=
Abc_MaxFloat
(
pArrOut
->
rise
,
pArrIn
->
rise
+
Abc_SclLookup
(
pTime
->
pCellRise
,
pSlewIn
->
rise
,
pLoad
->
rise
)
);
pArrOut
->
fall
=
Abc_MaxFloat
(
pArrOut
->
fall
,
pArrIn
->
fall
+
Abc_SclLookup
(
pTime
->
pCellFall
,
pSlewIn
->
fall
,
pLoad
->
fall
)
);
pSlewOut
->
rise
=
Abc_MaxFloat
(
pSlewOut
->
rise
,
Abc_SclLookup
(
pTime
->
pRiseTrans
,
pSlewIn
->
rise
,
pLoad
->
rise
)
);
pSlewOut
->
fall
=
Abc_MaxFloat
(
pSlewOut
->
fall
,
Abc_SclLookup
(
pTime
->
pFallTrans
,
pSlewIn
->
fall
,
pLoad
->
fall
)
);
}
if
(
pTime
->
tsense
==
sc_ts_Neg
||
pTime
->
tsense
==
sc_ts_Non
)
{
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
)
);
}
Scl_LibPinArrival
(
pTime
,
pArrIn
,
pSlewIn
,
pLoad
,
pArrOut
,
pSlewOut
);
}
void
Abc_SclDeptFanin
(
SC_Man
*
p
,
SC_Timing
*
pTime
,
Abc_Obj_t
*
pObj
,
Abc_Obj_t
*
pFanin
)
static
inline
void
Abc_SclDeptFanin
(
SC_Man
*
p
,
SC_Timing
*
pTime
,
Abc_Obj_t
*
pObj
,
Abc_Obj_t
*
pFanin
)
{
SC_Pair
*
pDepIn
=
Abc_SclObjDept
(
p
,
pFanin
);
// modified
SC_Pair
*
pSlewIn
=
Abc_SclObjSlew
(
p
,
pFanin
);
SC_Pair
*
pLoad
=
Abc_SclObjLoad
(
p
,
pObj
);
SC_Pair
*
pDepOut
=
Abc_SclObjDept
(
p
,
pObj
);
if
(
pTime
->
tsense
==
sc_ts_Pos
||
pTime
->
tsense
==
sc_ts_Non
)
{
pDepIn
->
rise
=
Abc_MaxFloat
(
pDepIn
->
rise
,
pDepOut
->
rise
+
Abc_SclLookup
(
pTime
->
pCellRise
,
pSlewIn
->
rise
,
pLoad
->
rise
)
);
pDepIn
->
fall
=
Abc_MaxFloat
(
pDepIn
->
fall
,
pDepOut
->
fall
+
Abc_SclLookup
(
pTime
->
pCellFall
,
pSlewIn
->
fall
,
pLoad
->
fall
)
);
}
if
(
pTime
->
tsense
==
sc_ts_Neg
||
pTime
->
tsense
==
sc_ts_Non
)
{
pDepIn
->
fall
=
Abc_MaxFloat
(
pDepIn
->
fall
,
pDepOut
->
rise
+
Abc_SclLookup
(
pTime
->
pCellRise
,
pSlewIn
->
fall
,
pLoad
->
rise
)
);
pDepIn
->
rise
=
Abc_MaxFloat
(
pDepIn
->
rise
,
pDepOut
->
fall
+
Abc_SclLookup
(
pTime
->
pCellFall
,
pSlewIn
->
rise
,
pLoad
->
fall
)
);
}
Scl_LibPinDeparture
(
pTime
,
pDepIn
,
pSlewIn
,
pLoad
,
pDepOut
);
}
void
Abc_SclTimeNode
(
SC_Man
*
p
,
Abc_Obj_t
*
pObj
,
int
fDept
)
{
...
...
src/map/scl/sclSize.h
View file @
f392645d
...
...
@@ -106,6 +106,7 @@ static inline float Abc_SclObjGetSlack( SC_Man * p, Abc_Obj_t * pObj, float
static
inline
float
Abc_SclObjGetSlackR
(
SC_Man
*
p
,
Abc_Obj_t
*
pObj
,
float
D
){
return
D
-
(
Abc_SclObjTime
(
p
,
pObj
)
->
rise
+
Abc_SclObjDept
(
p
,
pObj
)
->
rise
);
}
static
inline
float
Abc_SclObjGetSlackF
(
SC_Man
*
p
,
Abc_Obj_t
*
pObj
,
float
D
){
return
D
-
(
Abc_SclObjTime
(
p
,
pObj
)
->
fall
+
Abc_SclObjDept
(
p
,
pObj
)
->
fall
);
}
static
inline
float
Abc_SclObjSlack
(
SC_Man
*
p
,
Abc_Obj_t
*
pObj
)
{
return
p
->
pSlack
[
Abc_ObjId
(
pObj
)];
}
static
inline
float
Abc_SclObjLoadAve
(
SC_Man
*
p
,
Abc_Obj_t
*
pObj
)
{
return
0
.
5
*
(
Abc_SclObjLoad
(
p
,
pObj
)
->
rise
+
Abc_SclObjLoad
(
p
,
pObj
)
->
fall
);
}
static
inline
void
Abc_SclObjDupFanin
(
SC_Man
*
p
,
Abc_Obj_t
*
pObj
)
{
assert
(
Abc_ObjIsCo
(
pObj
)
);
*
Abc_SclObjTime
(
p
,
pObj
)
=
*
Abc_SclObjTime
(
p
,
Abc_ObjFanin0
(
pObj
));
}
static
inline
float
Abc_SclObjGain
(
SC_Man
*
p
,
Abc_Obj_t
*
pObj
)
{
return
0
.
5
*
((
Abc_SclObjTime2
(
p
,
pObj
)
->
rise
-
Abc_SclObjTime
(
p
,
pObj
)
->
rise
)
+
(
Abc_SclObjTime2
(
p
,
pObj
)
->
fall
-
Abc_SclObjTime
(
p
,
pObj
)
->
fall
));
}
...
...
src/map/scl/sclTime.h
View file @
f392645d
...
...
@@ -205,80 +205,26 @@ static inline void Scl_ConeClear( SC_Time * p, Vec_Int_t * vCone )
SeeAlso []
***********************************************************************/
static
inline
float
Scl_Lookup
(
SC_Surface
*
p
,
float
slew
,
float
load
)
{
float
*
pIndex0
,
*
pIndex1
,
*
pDataS
,
*
pDataS1
;
float
sfrac
,
lfrac
,
p0
,
p1
;
int
s
,
l
;
// Find closest sample points in surface:
pIndex0
=
Vec_FltArray
(
p
->
vIndex0
);
for
(
s
=
1
;
s
<
Vec_FltSize
(
p
->
vIndex0
)
-
1
;
s
++
)
if
(
pIndex0
[
s
]
>
slew
)
break
;
s
--
;
pIndex1
=
Vec_FltArray
(
p
->
vIndex1
);
for
(
l
=
1
;
l
<
Vec_FltSize
(
p
->
vIndex1
)
-
1
;
l
++
)
if
(
pIndex1
[
l
]
>
load
)
break
;
l
--
;
// Interpolate (or extrapolate) function value from sample points:
sfrac
=
(
slew
-
pIndex0
[
s
])
/
(
pIndex0
[
s
+
1
]
-
pIndex0
[
s
]);
lfrac
=
(
load
-
pIndex1
[
l
])
/
(
pIndex1
[
l
+
1
]
-
pIndex1
[
l
]);
pDataS
=
Vec_FltArray
(
(
Vec_Flt_t
*
)
Vec_PtrEntry
(
p
->
vData
,
s
)
);
pDataS1
=
Vec_FltArray
(
(
Vec_Flt_t
*
)
Vec_PtrEntry
(
p
->
vData
,
s
+
1
)
);
p0
=
pDataS
[
l
]
+
lfrac
*
(
pDataS
[
l
+
1
]
-
pDataS
[
l
]);
p1
=
pDataS1
[
l
]
+
lfrac
*
(
pDataS1
[
l
+
1
]
-
pDataS1
[
l
]);
return
p0
+
sfrac
*
(
p1
-
p0
);
// <<== multiply result with K factor here
}
static
inline
void
Scl_TimeFanin
(
SC_Time
*
p
,
SC_Timing
*
pTime
,
int
iObj
,
int
iFanin
)
static
inline
void
Scl_PinTimeArrival
(
SC_Time
*
p
,
SC_Timing
*
pTime
,
int
iObj
,
int
iFanin
)
{
SC_Pair
*
pArrIn
=
Scl_ObjTime
(
p
,
iFanin
);
SC_Pair
*
pSlewIn
=
Scl_ObjSlew
(
p
,
iFanin
);
SC_Pair
*
pLoad
=
Scl_ObjLoad
(
p
,
iObj
);
SC_Pair
*
pArrOut
=
Scl_ObjTime
(
p
,
iObj
);
// modified
SC_Pair
*
pSlewOut
=
Scl_ObjSlew
(
p
,
iObj
);
// modified
if
(
pTime
->
tsense
==
sc_ts_Pos
||
pTime
->
tsense
==
sc_ts_Non
)
{
pArrOut
->
rise
=
Abc_MaxFloat
(
pArrOut
->
rise
,
pArrIn
->
rise
+
Scl_Lookup
(
pTime
->
pCellRise
,
pSlewIn
->
rise
,
pLoad
->
rise
)
);
pArrOut
->
fall
=
Abc_MaxFloat
(
pArrOut
->
fall
,
pArrIn
->
fall
+
Scl_Lookup
(
pTime
->
pCellFall
,
pSlewIn
->
fall
,
pLoad
->
fall
)
);
pSlewOut
->
rise
=
Abc_MaxFloat
(
pSlewOut
->
rise
,
Scl_Lookup
(
pTime
->
pRiseTrans
,
pSlewIn
->
rise
,
pLoad
->
rise
)
);
pSlewOut
->
fall
=
Abc_MaxFloat
(
pSlewOut
->
fall
,
Scl_Lookup
(
pTime
->
pFallTrans
,
pSlewIn
->
fall
,
pLoad
->
fall
)
);
}
if
(
pTime
->
tsense
==
sc_ts_Neg
||
pTime
->
tsense
==
sc_ts_Non
)
{
pArrOut
->
rise
=
Abc_MaxFloat
(
pArrOut
->
rise
,
pArrIn
->
fall
+
Scl_Lookup
(
pTime
->
pCellRise
,
pSlewIn
->
fall
,
pLoad
->
rise
)
);
pArrOut
->
fall
=
Abc_MaxFloat
(
pArrOut
->
fall
,
pArrIn
->
rise
+
Scl_Lookup
(
pTime
->
pCellFall
,
pSlewIn
->
rise
,
pLoad
->
fall
)
);
pSlewOut
->
rise
=
Abc_MaxFloat
(
pSlewOut
->
rise
,
Scl_Lookup
(
pTime
->
pRiseTrans
,
pSlewIn
->
fall
,
pLoad
->
rise
)
);
pSlewOut
->
fall
=
Abc_MaxFloat
(
pSlewOut
->
fall
,
Scl_Lookup
(
pTime
->
pFallTrans
,
pSlewIn
->
rise
,
pLoad
->
fall
)
);
}
Scl_LibPinArrival
(
pTime
,
pArrIn
,
pSlewIn
,
pLoad
,
pArrOut
,
pSlewOut
);
}
static
inline
void
Scl_
DeptFanin
(
SC_Time
*
p
,
SC_Timing
*
pTime
,
int
iObj
,
int
iFanin
)
static
inline
void
Scl_
PinTimeDeparture
(
SC_Time
*
p
,
SC_Timing
*
pTime
,
int
iObj
,
int
iFanin
)
{
SC_Pair
*
pDepIn
=
Scl_ObjDept
(
p
,
iFanin
);
// modified
SC_Pair
*
pSlewIn
=
Scl_ObjSlew
(
p
,
iFanin
);
SC_Pair
*
pLoad
=
Scl_ObjLoad
(
p
,
iObj
);
SC_Pair
*
pDepOut
=
Scl_ObjDept
(
p
,
iObj
);
if
(
pTime
->
tsense
==
sc_ts_Pos
||
pTime
->
tsense
==
sc_ts_Non
)
{
pDepIn
->
rise
=
Abc_MaxFloat
(
pDepIn
->
rise
,
pDepOut
->
rise
+
Scl_Lookup
(
pTime
->
pCellRise
,
pSlewIn
->
rise
,
pLoad
->
rise
)
);
pDepIn
->
fall
=
Abc_MaxFloat
(
pDepIn
->
fall
,
pDepOut
->
fall
+
Scl_Lookup
(
pTime
->
pCellFall
,
pSlewIn
->
fall
,
pLoad
->
fall
)
);
}
if
(
pTime
->
tsense
==
sc_ts_Neg
||
pTime
->
tsense
==
sc_ts_Non
)
{
pDepIn
->
fall
=
Abc_MaxFloat
(
pDepIn
->
fall
,
pDepOut
->
rise
+
Scl_Lookup
(
pTime
->
pCellRise
,
pSlewIn
->
fall
,
pLoad
->
rise
)
);
pDepIn
->
rise
=
Abc_MaxFloat
(
pDepIn
->
rise
,
pDepOut
->
fall
+
Scl_Lookup
(
pTime
->
pCellFall
,
pSlewIn
->
rise
,
pLoad
->
fall
)
);
}
Scl_LibPinDeparture
(
pTime
,
pDepIn
,
pSlewIn
,
pLoad
,
pDepOut
);
}
ABC_NAMESPACE_HEADER_END
#endif
...
...
src/map/scl/sclUpsize.c
View file @
f392645d
...
...
@@ -468,7 +468,7 @@ void Abc_SclUpsizePerform( SC_Lib * pLib, Abc_Ntk_t * pNtk, SC_SizePars * pPars
Vec_Int_t
*
vPathNodes
=
NULL
;
// critical nodes and PIs
Vec_Int_t
*
vTFO
;
abctime
clk
,
nRuntimeLimit
=
pPars
->
TimeOut
?
pPars
->
TimeOut
*
CLOCKS_PER_SEC
+
Abc_Clock
()
:
0
;
int
i
,
win
,
nUpsizes
=
-
1
,
nFramesNoChange
=
0
;
int
i
=
0
,
win
,
nUpsizes
=
-
1
,
nFramesNoChange
=
0
;
int
nAllPos
,
nAllNodes
,
nAllTfos
,
nAllUpsizes
;
if
(
pPars
->
fVerbose
)
...
...
src/map/scl/sclUtil.c
View file @
f392645d
...
...
@@ -20,6 +20,7 @@
#include "sclSize.h"
#include "map/mio/mio.h"
#include "base/main/main.h"
ABC_NAMESPACE_IMPL_START
...
...
@@ -175,6 +176,25 @@ void Abc_SclMinsizePerform( SC_Lib * pLib, Abc_Ntk_t * p, int fUseMax, int fVerb
Vec_IntFree
(
vGates
);
}
/**Function*************************************************************
Synopsis [Returns gate formula by name.]
Description []
SideEffects []
SeeAlso []
***********************************************************************/
char
*
Abc_SclFindGateFormula
(
char
*
pGateName
,
char
*
pOutName
)
{
Mio_Library_t
*
pLib
=
(
Mio_Library_t
*
)
Abc_FrameReadLibGen
();
Mio_Gate_t
*
pGate
=
Mio_LibraryReadGateByName
(
pLib
,
pGateName
,
pOutName
);
return
Mio_GateReadForm
(
pGate
);
}
////////////////////////////////////////////////////////////////////////
/// END OF FILE ///
////////////////////////////////////////////////////////////////////////
...
...
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