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
7d3976a7
Commit
7d3976a7
authored
Sep 17, 2013
by
Alan Mishchenko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Unifying standard cell library representations.
parent
5df166fc
Show whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
316 additions
and
105 deletions
+316
-105
src/base/abci/abcMap.c
+12
-3
src/base/abci/abcPrint.c
+1
-0
src/base/io/io.c
+1
-1
src/base/ver/verCore.c
+3
-0
src/map/mapper/mapperLib.c
+5
-3
src/map/mio/mio.c
+1
-1
src/map/mio/mio.h
+5
-3
src/map/mio/mioUtils.c
+33
-1
src/map/scl/scl.c
+136
-78
src/map/scl/sclLib.h
+2
-2
src/map/scl/sclLibScl.c
+3
-3
src/map/scl/sclLibUtil.c
+112
-10
src/map/scl/sclLiberty.c
+2
-0
No files found.
src/base/abci/abcMap.c
View file @
7d3976a7
...
...
@@ -66,13 +66,18 @@ Abc_Ntk_t * Abc_NtkMap( Abc_Ntk_t * pNtk, double DelayTarget, double AreaMulti,
Vec_Int_t
*
vSwitching
=
NULL
;
float
*
pSwitching
=
NULL
;
abctime
clk
,
clkTotal
=
Abc_Clock
();
Mio_Library_t
*
pLib
;
Mio_Library_t
*
pLib
=
(
Mio_Library_t
*
)
Abc_FrameReadLibGen
();
assert
(
Abc_NtkIsStrash
(
pNtk
)
);
// derive library from SCL
// if the library is created here, it will be deleted when pSuperLib is deleted in Map_SuperLibFree()
if
(
Abc_FrameReadLibScl
()
)
Abc_SclDeriveGenlib
(
Abc_FrameReadLibScl
(),
Slew
,
Gain
,
nGatesMin
);
{
pLib
=
Abc_SclDeriveGenlib
(
Abc_FrameReadLibScl
(),
Slew
,
Gain
,
nGatesMin
);
if
(
Abc_FrameReadLibGen
()
)
Mio_LibraryTransferDelays
(
(
Mio_Library_t
*
)
Abc_FrameReadLibGen
(),
pLib
);
}
// quit if there is no library
pLib
=
(
Mio_Library_t
*
)
Abc_FrameReadLibGen
();
if
(
pLib
==
NULL
)
{
printf
(
"The current library is not available.
\n
"
);
...
...
@@ -423,6 +428,7 @@ Abc_Obj_t * Abc_NodeFromMapPhase_rec( Abc_Ntk_t * pNtkNew, Map_Node_t * pNodeMap
***********************************************************************/
Abc_Obj_t
*
Abc_NodeFromMapSuper_rec
(
Abc_Ntk_t
*
pNtkNew
,
Map_Node_t
*
pNodeMap
,
Map_Super_t
*
pSuper
,
Abc_Obj_t
*
pNodePis
[],
int
nNodePis
)
{
Mio_Library_t
*
pLib
=
(
Mio_Library_t
*
)
Abc_FrameReadLibGen
();
Mio_Gate_t
*
pRoot
;
Map_Super_t
**
ppFanins
;
Abc_Obj_t
*
pNodeNew
,
*
pNodeFanin
;
...
...
@@ -449,6 +455,7 @@ Abc_Obj_t * Abc_NodeFromMapSuper_rec( Abc_Ntk_t * pNtkNew, Map_Node_t * pNodeMap
return
Abc_NtkCreateNodeConst0
(
pNtkNew
);
}
}
pRoot
=
Mio_LibraryReadGateByName
(
pLib
,
Mio_GateReadName
(
pRoot
),
NULL
);
// get information about the fanins of the supergate
nFanins
=
Map_SuperReadFaninNum
(
pSuper
);
...
...
@@ -685,6 +692,7 @@ void Abc_NodeFromMapCutPhase( Abc_Ntk_t * pNtkNew, Map_Cut_t * pCut, int fPhase
***********************************************************************/
Abc_Obj_t
*
Abc_NodeFromMapSuperChoice_rec
(
Abc_Ntk_t
*
pNtkNew
,
Map_Super_t
*
pSuper
,
Abc_Obj_t
*
pNodePis
[],
int
nNodePis
)
{
Mio_Library_t
*
pLib
=
(
Mio_Library_t
*
)
Abc_FrameReadLibGen
();
Mio_Gate_t
*
pRoot
;
Map_Super_t
**
ppFanins
;
Abc_Obj_t
*
pNodeNew
,
*
pNodeFanin
;
...
...
@@ -711,6 +719,7 @@ Abc_Obj_t * Abc_NodeFromMapSuperChoice_rec( Abc_Ntk_t * pNtkNew, Map_Super_t * p
return
Abc_NtkCreateNodeConst0
(
pNtkNew
);
}
}
pRoot
=
Mio_LibraryReadGateByName
(
pLib
,
Mio_GateReadName
(
pRoot
),
NULL
);
// get information about the fanins of the supergate
nFanins
=
Map_SuperReadFaninNum
(
pSuper
);
...
...
src/base/abci/abcPrint.c
View file @
7d3976a7
...
...
@@ -265,6 +265,7 @@ void Abc_NtkPrintStats( Abc_Ntk_t * pNtk, int fFactored, int fSaveBest, int fDum
Abc_Print
(
1
,
" bdd =%6d"
,
Abc_NtkGetBddNodeNum
(
pNtk
)
-
nSingles
);
else
if
(
Abc_NtkHasMapping
(
pNtk
)
)
{
assert
(
pNtk
->
pManFunc
==
Abc_FrameReadLibGen
()
);
Abc_Print
(
1
,
" area =%5.2f"
,
Abc_NtkGetMappedArea
(
pNtk
)
);
Abc_Print
(
1
,
" delay =%5.2f"
,
Abc_NtkDelayTrace
(
pNtk
,
NULL
,
NULL
,
0
)
);
}
...
...
src/base/io/io.c
View file @
7d3976a7
...
...
@@ -205,7 +205,7 @@ int IoCommandRead( Abc_Frame_t * pAbc, int argc, char ** argv )
if
(
!
strcmp
(
Extra_FileNameExtension
(
pFileName
),
"genlib"
)
)
sprintf
(
Command
,
"read_genlib %s"
,
pFileName
);
else
if
(
!
strcmp
(
Extra_FileNameExtension
(
pFileName
),
"lib"
)
)
sprintf
(
Command
,
"read_lib
erty
%s"
,
pFileName
);
sprintf
(
Command
,
"read_lib %s"
,
pFileName
);
else
if
(
!
strcmp
(
Extra_FileNameExtension
(
pFileName
),
"scl"
)
)
sprintf
(
Command
,
"read_scl %s"
,
pFileName
);
else
if
(
!
strcmp
(
Extra_FileNameExtension
(
pFileName
),
"super"
)
)
...
...
src/base/ver/verCore.c
View file @
7d3976a7
...
...
@@ -121,6 +121,9 @@ Ver_Man_t * Ver_ParseStart( char * pFileName, Abc_Lib_t * pGateLib )
// create the design library and assign the technology library
p
->
pDesign
=
Abc_LibCreate
(
pFileName
);
p
->
pDesign
->
pLibrary
=
pGateLib
;
// derive library from SCL
// if ( Abc_FrameReadLibScl() )
// Abc_SclInstallGenlib( Abc_FrameReadLibScl(), 0, 0, 0 );
p
->
pDesign
->
pGenlib
=
Abc_FrameReadLibGen
();
return
p
;
}
...
...
src/map/mapper/mapperLib.c
View file @
7d3976a7
...
...
@@ -169,9 +169,8 @@ void Map_SuperLibFree( Map_SuperLib_t * p )
if
(
p
==
NULL
)
return
;
if
(
p
->
pGenlib
)
{
// assert( p->pGenlib == Abc_FrameReadLibGen() );
// Mio_LibraryDelete( p->pGenlib );
// Abc_FrameSetLibGen( NULL );
if
(
p
->
pGenlib
!=
Abc_FrameReadLibGen
()
)
Mio_LibraryDelete
(
p
->
pGenlib
);
p
->
pGenlib
=
NULL
;
}
if
(
p
->
tTableC
)
...
...
@@ -204,14 +203,17 @@ int Map_SuperLibDeriveFromGenlib( Mio_Library_t * pLib, int fVerbose )
char
*
pFileName
;
if
(
pLib
==
NULL
)
return
0
;
// compute supergates
vStr
=
Super_PrecomputeStr
(
pLib
,
5
,
1
,
100000000
,
10000000
,
10000000
,
100
,
1
,
0
);
if
(
vStr
==
NULL
)
return
0
;
// create supergate library
pFileName
=
Extra_FileNameGenericAppend
(
Mio_LibraryReadName
(
pLib
),
".super"
);
pLibSuper
=
Map_SuperLibCreate
(
pLib
,
vStr
,
pFileName
,
NULL
,
1
,
0
);
Vec_StrFree
(
vStr
);
// replace the library
Map_SuperLibFree
(
(
Map_SuperLib_t
*
)
Abc_FrameReadLibSuper
()
);
Abc_FrameSetLibSuper
(
pLibSuper
);
...
...
src/map/mio/mio.c
View file @
7d3976a7
...
...
@@ -82,7 +82,7 @@ static char * pMcncGenlib[25] = {
***********************************************************************/
void
Mio_Init
(
Abc_Frame_t
*
pAbc
)
{
Cmd_CommandAdd
(
pAbc
,
"SC mapping"
,
"read_liberty"
,
Mio_CommandReadLiberty
,
0
);
//
Cmd_CommandAdd( pAbc, "SC mapping", "read_liberty", Mio_CommandReadLiberty, 0 );
Cmd_CommandAdd
(
pAbc
,
"SC mapping"
,
"read_genlib"
,
Mio_CommandReadGenlib
,
0
);
Cmd_CommandAdd
(
pAbc
,
"SC mapping"
,
"write_genlib"
,
Mio_CommandWriteGenlib
,
0
);
...
...
src/map/mio/mio.h
View file @
7d3976a7
...
...
@@ -82,7 +82,6 @@ static inline char * Mio_UtilStrsav( char * s ) { return s ? strcpy(ABC_A
/*=== mio.c =============================================================*/
extern
void
Mio_UpdateGenlib
(
Mio_Library_t
*
pLib
);
extern
int
Mio_UpdateGenlib2
(
Vec_Str_t
*
vStr
,
Vec_Str_t
*
vStr2
,
char
*
pFileName
,
int
fVerbose
);
extern
void
Abc_SclDeriveGenlib
(
void
*
pScl
,
float
Slew
,
float
Gain
,
int
nGatesMin
);
/*=== mioApi.c =============================================================*/
extern
char
*
Mio_LibraryReadName
(
Mio_Library_t
*
pLib
);
extern
int
Mio_LibraryReadGateNum
(
Mio_Library_t
*
pLib
);
...
...
@@ -161,10 +160,13 @@ extern Mio_Gate_t * Mio_GateCreatePseudo( int nInputs );
extern
void
Mio_LibraryShiftDelay
(
Mio_Library_t
*
pLib
,
double
Shift
);
extern
void
Mio_LibraryMultiArea
(
Mio_Library_t
*
pLib
,
double
Multi
);
extern
void
Mio_LibraryMultiDelay
(
Mio_Library_t
*
pLib
,
double
Multi
);
extern
void
Mio_LibraryTransferDelays
(
Mio_Library_t
*
pLibD
,
Mio_Library_t
*
pLibS
);
ABC_NAMESPACE_HEADER_END
/*=== sclUtil.c =========================================================*/
extern
Mio_Library_t
*
Abc_SclDeriveGenlibSimple
(
void
*
pScl
);
extern
Mio_Library_t
*
Abc_SclDeriveGenlib
(
void
*
pScl
,
float
Slew
,
float
Gain
,
int
nGatesMin
);
ABC_NAMESPACE_HEADER_END
#endif
...
...
src/map/mio/mioUtils.c
View file @
7d3976a7
...
...
@@ -260,7 +260,7 @@ void Mio_WriteLibrary( FILE * pFile, Mio_Library_t * pLib, int fPrintSops )
Mio_GateForEachPin
(
pGate
,
pPin
)
NameLen
=
Abc_MaxInt
(
NameLen
,
strlen
(
pPin
->
pName
)
);
}
fprintf
(
pFile
,
"# The genlib library
\"
%s
\"
.
\n
"
,
pLib
->
pName
);
fprintf
(
pFile
,
"# The genlib library
\"
%s
\"
written by ABC on %s
\n\n
"
,
pLib
->
pName
,
Extra_TimeStamp
()
);
for
(
i
=
0
;
i
<
pLib
->
nGates
;
i
++
)
Mio_WriteGate
(
pFile
,
pLib
->
ppGates0
[
i
],
GateLen
,
NameLen
,
FormLen
,
fPrintSops
,
fAllPins
);
}
...
...
@@ -705,6 +705,38 @@ void Mio_LibraryMultiDelay( Mio_Library_t * pLib, double Multi )
}
}
/**Function*************************************************************
Synopsis [Transfers delays from the second to the first.]
Description []
SideEffects []
SeeAlso []
***********************************************************************/
void
Mio_LibraryTransferDelays
(
Mio_Library_t
*
pLibD
,
Mio_Library_t
*
pLibS
)
{
Mio_Gate_t
*
pGateD
,
*
pGateS
;
Mio_Pin_t
*
pPinD
,
*
pPinS
;
Mio_LibraryForEachGate
(
pLibS
,
pGateS
)
{
Mio_LibraryForEachGate
(
pLibD
,
pGateD
)
{
if
(
pGateD
->
uTruth
!=
pGateS
->
uTruth
)
continue
;
pPinS
=
Mio_GateReadPins
(
pGateS
);
Mio_GateForEachPin
(
pGateD
,
pPinD
)
{
pPinD
->
dDelayBlockRise
=
pPinS
->
dDelayBlockRise
;
pPinD
->
dDelayBlockFall
=
pPinS
->
dDelayBlockFall
;
pPinD
->
dDelayBlockMax
=
pPinS
->
dDelayBlockMax
;
pPinS
=
Mio_PinReadNext
(
pPinS
);
}
}
}
}
////////////////////////////////////////////////////////////////////////
/// END OF FILE ///
...
...
src/map/scl/scl.c
View file @
7d3976a7
...
...
@@ -29,8 +29,9 @@ ABC_NAMESPACE_IMPL_START
////////////////////////////////////////////////////////////////////////
static
int
Scl_CommandReadLib
(
Abc_Frame_t
*
pAbc
,
int
argc
,
char
**
argv
);
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_CommandWriteLib
(
Abc_Frame_t
*
pAbc
,
int
argc
,
char
**
argv
);
static
int
Scl_CommandReadScl
(
Abc_Frame_t
*
pAbc
,
int
argc
,
char
**
argv
);
static
int
Scl_CommandWriteScl
(
Abc_Frame_t
*
pAbc
,
int
argc
,
char
**
argv
);
static
int
Scl_CommandPrintLib
(
Abc_Frame_t
*
pAbc
,
int
argc
,
char
**
argv
);
static
int
Scl_CommandDumpGen
(
Abc_Frame_t
*
pAbc
,
int
argc
,
char
**
argv
);
static
int
Scl_CommandPrintGS
(
Abc_Frame_t
*
pAbc
,
int
argc
,
char
**
argv
);
...
...
@@ -87,9 +88,10 @@ void Abc_SclLoad( SC_Lib * pLib, SC_Lib ** ppScl )
void
Scl_Init
(
Abc_Frame_t
*
pAbc
)
{
Cmd_CommandAdd
(
pAbc
,
"SCL mapping"
,
"read_lib"
,
Scl_CommandReadLib
,
0
);
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"
,
"write_lib"
,
Scl_CommandWriteLib
,
0
);
Cmd_CommandAdd
(
pAbc
,
"SCL mapping"
,
"print_lib"
,
Scl_CommandPrintLib
,
0
);
Cmd_CommandAdd
(
pAbc
,
"SCL mapping"
,
"read_scl"
,
Scl_CommandReadScl
,
0
);
Cmd_CommandAdd
(
pAbc
,
"SCL mapping"
,
"write_scl"
,
Scl_CommandWriteScl
,
0
);
Cmd_CommandAdd
(
pAbc
,
"SCL mapping"
,
"dump_genlib"
,
Scl_CommandDumpGen
,
0
);
Cmd_CommandAdd
(
pAbc
,
"SCL mapping"
,
"print_gs"
,
Scl_CommandPrintGS
,
0
);
Cmd_CommandAdd
(
pAbc
,
"SCL mapping"
,
"stime"
,
Scl_CommandStime
,
0
);
...
...
@@ -128,9 +130,9 @@ int Scl_CommandReadLib( Abc_Frame_t * pAbc, int argc, char ** argv )
FILE
*
pFile
;
SC_Lib
*
pLib
;
int
c
,
fDump
=
0
;
float
Slew
=
20
0
;
float
Gain
=
10
0
;
int
nGatesMin
=
4
;
float
Slew
=
0
;
float
Gain
=
0
;
int
nGatesMin
=
0
;
int
fVerbose
=
1
;
int
fVeryVerbose
=
0
;
...
...
@@ -210,7 +212,7 @@ int Scl_CommandReadLib( Abc_Frame_t * pAbc, int argc, char ** argv )
Abc_SclWriteLiberty
(
Extra_FileNameGenericAppend
(
pFileName
,
"_temp.lib"
),
(
SC_Lib
*
)
pAbc
->
pLibScl
);
// extract genlib library
if
(
pAbc
->
pLibScl
)
Abc_Scl
Derive
Genlib
(
pAbc
->
pLibScl
,
Slew
,
Gain
,
nGatesMin
);
Abc_Scl
Install
Genlib
(
pAbc
->
pLibScl
,
Slew
,
Gain
,
nGatesMin
);
return
0
;
usage:
...
...
@@ -227,72 +229,6 @@ usage:
return
1
;
}
/**Function*************************************************************
Synopsis []
Description []
SideEffects []
SeeAlso []
***********************************************************************/
int
Scl_CommandRead
(
Abc_Frame_t
*
pAbc
,
int
argc
,
char
**
argv
)
{
FILE
*
pFile
;
SC_Lib
*
pLib
;
char
*
pFileName
;
int
c
,
fDump
=
0
;
Extra_UtilGetoptReset
();
while
(
(
c
=
Extra_UtilGetopt
(
argc
,
argv
,
"dh"
)
)
!=
EOF
)
{
switch
(
c
)
{
case
'd'
:
fDump
^=
1
;
break
;
case
'h'
:
goto
usage
;
default:
goto
usage
;
}
}
if
(
argc
!=
globalUtilOptind
+
1
)
goto
usage
;
// get the input file name
pFileName
=
argv
[
globalUtilOptind
];
if
(
(
pFile
=
fopen
(
pFileName
,
"rb"
))
==
NULL
)
{
fprintf
(
pAbc
->
Err
,
"Cannot open input file
\"
%s
\"
.
\n
"
,
pFileName
);
return
1
;
}
fclose
(
pFile
);
// read new library
pLib
=
Abc_SclReadFromFile
(
pFileName
);
if
(
pLib
==
NULL
)
{
fprintf
(
pAbc
->
Err
,
"Reading SCL library from file
\"
%s
\"
has failed.
\n
"
,
pFileName
);
return
1
;
}
Abc_SclLoad
(
pLib
,
(
SC_Lib
**
)
&
pAbc
->
pLibScl
);
if
(
fDump
)
Abc_SclWriteLiberty
(
Extra_FileNameGenericAppend
(
pFileName
,
"_temp.lib"
),
(
SC_Lib
*
)
pAbc
->
pLibScl
);
return
0
;
usage:
fprintf
(
pAbc
->
Err
,
"usage: read_scl [-dh] <file>
\n
"
);
fprintf
(
pAbc
->
Err
,
"
\t
reads extracted Liberty library from file
\n
"
);
fprintf
(
pAbc
->
Err
,
"
\t
-d : toggle dumping the parsed library into file
\"
*_temp.lib
\"
[default = %s]
\n
"
,
fDump
?
"yes"
:
"no"
);
fprintf
(
pAbc
->
Err
,
"
\t
-h : prints the command summary
\n
"
);
fprintf
(
pAbc
->
Err
,
"
\t
<file> : the name of a file to read
\n
"
);
return
1
;
}
/**Function*************************************************************
Synopsis []
...
...
@@ -304,7 +240,7 @@ usage:
SeeAlso []
***********************************************************************/
int
Scl_CommandWrite
(
Abc_Frame_t
*
pAbc
,
int
argc
,
char
**
argv
)
int
Scl_CommandWrite
Lib
(
Abc_Frame_t
*
pAbc
,
int
argc
,
char
**
argv
)
{
FILE
*
pFile
;
char
*
pFileName
;
...
...
@@ -338,12 +274,12 @@ int Scl_CommandWrite( Abc_Frame_t * pAbc, int argc, char **argv )
fclose
(
pFile
);
// save current library
Abc_SclWrite
Scl
(
pFileName
,
(
SC_Lib
*
)
pAbc
->
pLibScl
);
Abc_SclWrite
Liberty
(
pFileName
,
(
SC_Lib
*
)
pAbc
->
pLibScl
);
return
0
;
usage:
fprintf
(
pAbc
->
Err
,
"usage: write_
scl
[-h] <file>
\n
"
);
fprintf
(
pAbc
->
Err
,
"
\t
write
extracted
Liberty library into file
\n
"
);
fprintf
(
pAbc
->
Err
,
"usage: write_
lib
[-h] <file>
\n
"
);
fprintf
(
pAbc
->
Err
,
"
\t
write
current
Liberty library into file
\n
"
);
fprintf
(
pAbc
->
Err
,
"
\t
-h : print the help massage
\n
"
);
fprintf
(
pAbc
->
Err
,
"
\t
<file> : the name of the file to write
\n
"
);
return
1
;
...
...
@@ -427,6 +363,128 @@ usage:
return
1
;
}
/**Function*************************************************************
Synopsis []
Description []
SideEffects []
SeeAlso []
***********************************************************************/
int
Scl_CommandReadScl
(
Abc_Frame_t
*
pAbc
,
int
argc
,
char
**
argv
)
{
FILE
*
pFile
;
SC_Lib
*
pLib
;
char
*
pFileName
;
int
c
,
fDump
=
0
;
Extra_UtilGetoptReset
();
while
(
(
c
=
Extra_UtilGetopt
(
argc
,
argv
,
"dh"
)
)
!=
EOF
)
{
switch
(
c
)
{
case
'd'
:
fDump
^=
1
;
break
;
case
'h'
:
goto
usage
;
default:
goto
usage
;
}
}
if
(
argc
!=
globalUtilOptind
+
1
)
goto
usage
;
// get the input file name
pFileName
=
argv
[
globalUtilOptind
];
if
(
(
pFile
=
fopen
(
pFileName
,
"rb"
))
==
NULL
)
{
fprintf
(
pAbc
->
Err
,
"Cannot open input file
\"
%s
\"
.
\n
"
,
pFileName
);
return
1
;
}
fclose
(
pFile
);
// read new library
pLib
=
Abc_SclReadFromFile
(
pFileName
);
if
(
pLib
==
NULL
)
{
fprintf
(
pAbc
->
Err
,
"Reading SCL library from file
\"
%s
\"
has failed.
\n
"
,
pFileName
);
return
1
;
}
Abc_SclLoad
(
pLib
,
(
SC_Lib
**
)
&
pAbc
->
pLibScl
);
if
(
fDump
)
Abc_SclWriteLiberty
(
Extra_FileNameGenericAppend
(
pFileName
,
"_temp.lib"
),
(
SC_Lib
*
)
pAbc
->
pLibScl
);
return
0
;
usage:
fprintf
(
pAbc
->
Err
,
"usage: read_scl [-dh] <file>
\n
"
);
fprintf
(
pAbc
->
Err
,
"
\t
reads extracted Liberty library from file
\n
"
);
fprintf
(
pAbc
->
Err
,
"
\t
-d : toggle dumping the parsed library into file
\"
*_temp.lib
\"
[default = %s]
\n
"
,
fDump
?
"yes"
:
"no"
);
fprintf
(
pAbc
->
Err
,
"
\t
-h : prints the command summary
\n
"
);
fprintf
(
pAbc
->
Err
,
"
\t
<file> : the name of a file to read
\n
"
);
return
1
;
}
/**Function*************************************************************
Synopsis []
Description []
SideEffects []
SeeAlso []
***********************************************************************/
int
Scl_CommandWriteScl
(
Abc_Frame_t
*
pAbc
,
int
argc
,
char
**
argv
)
{
FILE
*
pFile
;
char
*
pFileName
;
int
c
;
Extra_UtilGetoptReset
();
while
(
(
c
=
Extra_UtilGetopt
(
argc
,
argv
,
"h"
)
)
!=
EOF
)
{
switch
(
c
)
{
case
'h'
:
goto
usage
;
default:
goto
usage
;
}
}
if
(
argc
!=
globalUtilOptind
+
1
)
goto
usage
;
if
(
pAbc
->
pLibScl
==
NULL
)
{
fprintf
(
pAbc
->
Err
,
"There is no Liberty library available.
\n
"
);
return
1
;
}
// get the input file name
pFileName
=
argv
[
globalUtilOptind
];
if
(
(
pFile
=
fopen
(
pFileName
,
"wb"
))
==
NULL
)
{
fprintf
(
pAbc
->
Err
,
"Cannot open output file
\"
%s
\"
.
\n
"
,
pFileName
);
return
1
;
}
fclose
(
pFile
);
// save current library
Abc_SclWriteScl
(
pFileName
,
(
SC_Lib
*
)
pAbc
->
pLibScl
);
return
0
;
usage:
fprintf
(
pAbc
->
Err
,
"usage: write_scl [-h] <file>
\n
"
);
fprintf
(
pAbc
->
Err
,
"
\t
write extracted Liberty library into file
\n
"
);
fprintf
(
pAbc
->
Err
,
"
\t
-h : print the help massage
\n
"
);
fprintf
(
pAbc
->
Err
,
"
\t
<file> : the name of the file to write
\n
"
);
return
1
;
}
/**Function*************************************************************
Synopsis []
...
...
src/map/scl/sclLib.h
View file @
7d3976a7
...
...
@@ -234,6 +234,7 @@ static inline void SC_PairMove( SC_Pair * d, SC_Pair * s ) { *d = *s; s
static
inline
int
SC_PairEqual
(
SC_Pair
*
d
,
SC_Pair
*
s
)
{
return
d
->
rise
==
s
->
rise
&&
d
->
fall
==
s
->
fall
;
}
static
inline
int
SC_PairEqualE
(
SC_Pair
*
d
,
SC_Pair
*
s
,
float
E
)
{
return
d
->
rise
-
s
->
rise
<
E
&&
s
->
rise
-
d
->
rise
<
E
&&
d
->
fall
-
s
->
fall
<
E
&&
s
->
fall
-
d
->
fall
<
E
;
}
static
inline
int
SC_LibCellNum
(
SC_Lib
*
p
)
{
return
Vec_PtrSize
(
p
->
vCells
);
}
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
;
}
...
...
@@ -598,8 +599,7 @@ extern SC_Cell * Abc_SclFindSmallestGate( SC_Cell * p, float CinMin );
extern
SC_WireLoad
*
Abc_SclFindWireLoadModel
(
SC_Lib
*
p
,
float
Area
);
extern
SC_WireLoad
*
Abc_SclFetchWireLoadModel
(
SC_Lib
*
p
,
char
*
pName
);
extern
void
Abc_SclDumpGenlib
(
char
*
pFileName
,
SC_Lib
*
p
,
float
Slew
,
float
Gain
,
int
nGatesMin
);
extern
void
Abc_SclDeriveGenlib
(
void
*
pScl
,
float
Slew
,
float
Gain
,
int
nGatesMin
);
extern
void
Abc_SclInstallGenlib
(
void
*
pScl
,
float
Slew
,
float
Gain
,
int
nGatesMin
);
ABC_NAMESPACE_HEADER_END
...
...
src/map/scl/sclLibScl.c
View file @
7d3976a7
...
...
@@ -122,7 +122,7 @@ static void Abc_SclReadLibrary( Vec_Str_t * vOut, int * pPos, SC_Lib * p )
for
(
i
=
Vec_StrGetI
(
vOut
,
pPos
);
i
!=
0
;
i
--
)
{
SC_Cell
*
pCell
=
Abc_SclCellAlloc
();
pCell
->
Id
=
Vec_PtrSize
(
p
->
vCells
);
pCell
->
Id
=
SC_LibCellNum
(
p
);
Vec_PtrPush
(
p
->
vCells
,
pCell
);
pCell
->
pName
=
Vec_StrGetS
(
vOut
,
pPos
);
...
...
@@ -530,7 +530,7 @@ static void Abc_SclWriteLibraryText( FILE * s, SC_Lib * p )
SC_Pin
*
pPin
;
int
n_valid_cells
;
int
i
,
j
,
k
;
fprintf
(
s
,
"/* This Liberty file was generated by ABC on %s
.
*/
\n
"
,
Extra_TimeStamp
()
);
fprintf
(
s
,
"/* This Liberty file was generated by ABC on %s */
\n
"
,
Extra_TimeStamp
()
);
fprintf
(
s
,
"/* The original unabridged library came from file
\"
%s
\"
.*/
\n\n
"
,
p
->
pFileName
);
// fprintf( s, "%d", ABC_SCL_CUR_VERSION );
...
...
@@ -569,7 +569,7 @@ static void Abc_SclWriteLibraryText( FILE * s, SC_Lib * p )
{
fprintf
(
s
,
" wire_load_selection(
\"
%s
\"
) {
\n
"
,
pWLS
->
pName
);
for
(
j
=
0
;
j
<
Vec_FltSize
(
pWLS
->
vAreaFrom
);
j
++
)
fprintf
(
s
,
" wire_load_from_area( %f, %f,
\"
%s
\"
);
\n
"
,
fprintf
(
s
,
" wire_load_from_area( %f, %f,
%s
);
\n
"
,
Vec_FltEntry
(
pWLS
->
vAreaFrom
,
j
),
Vec_FltEntry
(
pWLS
->
vAreaTo
,
j
),
(
char
*
)
Vec_PtrEntry
(
pWLS
->
vWireLoadModel
,
j
)
);
...
...
src/map/scl/sclLibUtil.c
View file @
7d3976a7
...
...
@@ -67,7 +67,7 @@ void Abc_SclHashCells( SC_Lib * p )
SC_Cell
*
pCell
;
int
i
,
*
pPlace
;
assert
(
p
->
nBins
==
0
);
p
->
nBins
=
Abc_PrimeCudd
(
5
*
Vec_PtrSize
(
p
->
vCells
)
);
p
->
nBins
=
Abc_PrimeCudd
(
5
*
SC_LibCellNum
(
p
)
);
p
->
pBins
=
ABC_FALLOC
(
int
,
p
->
nBins
);
SC_LibForEachCell
(
p
,
pCell
,
i
)
{
...
...
@@ -494,6 +494,78 @@ void Abc_SclPrintCells( SC_Lib * p, float Slew, float Gain, int fInvOnly, int fS
/**Function*************************************************************
Synopsis [Derives simple GENLIB library.]
Description []
SideEffects []
SeeAlso []
***********************************************************************/
Vec_Str_t
*
Abc_SclProduceGenlibStrSimple
(
SC_Lib
*
p
)
{
char
Buffer
[
200
];
Vec_Str_t
*
vStr
;
SC_Cell
*
pCell
;
SC_Pin
*
pPin
,
*
pPinOut
;
int
i
,
j
,
k
,
Count
=
2
;
// mark skipped cells
// Abc_SclMarkSkippedCells( p );
vStr
=
Vec_StrAlloc
(
1000
);
Vec_StrPrintStr
(
vStr
,
"GATE _const0_ 0.00 z=CONST0;
\n
"
);
Vec_StrPrintStr
(
vStr
,
"GATE _const1_ 0.00 z=CONST1;
\n
"
);
SC_LibForEachCell
(
p
,
pCell
,
i
)
{
if
(
pCell
->
n_inputs
==
0
)
continue
;
assert
(
strlen
(
pCell
->
pName
)
<
200
);
SC_CellForEachPinOut
(
pCell
,
pPinOut
,
j
)
{
Vec_StrPrintStr
(
vStr
,
"GATE "
);
sprintf
(
Buffer
,
"%-16s"
,
pCell
->
pName
);
Vec_StrPrintStr
(
vStr
,
Buffer
);
Vec_StrPrintStr
(
vStr
,
" "
);
sprintf
(
Buffer
,
"%7.2f"
,
pCell
->
area
);
Vec_StrPrintStr
(
vStr
,
Buffer
);
Vec_StrPrintStr
(
vStr
,
" "
);
Vec_StrPrintStr
(
vStr
,
pPinOut
->
pName
);
Vec_StrPrintStr
(
vStr
,
"="
);
Vec_StrPrintStr
(
vStr
,
pPinOut
->
func_text
?
pPinOut
->
func_text
:
"?"
);
Vec_StrPrintStr
(
vStr
,
";
\n
"
);
SC_CellForEachPinIn
(
pCell
,
pPin
,
k
)
{
Vec_StrPrintStr
(
vStr
,
" PIN "
);
sprintf
(
Buffer
,
"%-4s"
,
pPin
->
pName
);
Vec_StrPrintStr
(
vStr
,
Buffer
);
sprintf
(
Buffer
,
" UNKNOWN 1 999 1.00 0.00 1.00 0.00
\n
"
);
Vec_StrPrintStr
(
vStr
,
Buffer
);
}
Count
++
;
}
}
Vec_StrPrintStr
(
vStr
,
"
\n
.end
\n
"
);
Vec_StrPush
(
vStr
,
'\0'
);
// printf( "GENLIB library with %d gates is produced:\n", Count );
// printf( "%s", Vec_StrArray(vStr) );
return
vStr
;
}
Mio_Library_t
*
Abc_SclDeriveGenlibSimple
(
void
*
pScl
)
{
SC_Lib
*
p
=
(
SC_Lib
*
)
pScl
;
Vec_Str_t
*
vStr
=
Abc_SclProduceGenlibStrSimple
(
p
);
Mio_Library_t
*
pLib
=
Mio_LibraryRead
(
p
->
pFileName
,
Vec_StrArray
(
vStr
),
NULL
,
0
);
Vec_StrFree
(
vStr
);
if
(
pLib
)
printf
(
"Internally derived GENLIB library
\"
%s
\"
with %d gates.
\n
"
,
p
->
pName
,
SC_LibCellNum
(
p
)
);
else
printf
(
"Reading library has filed.
\n
"
);
return
pLib
;
}
/**Function*************************************************************
Synopsis [Derive GENLIB library.]
Description []
...
...
@@ -503,7 +575,7 @@ void Abc_SclPrintCells( SC_Lib * p, float Slew, float Gain, int fInvOnly, int fS
SeeAlso []
***********************************************************************/
Vec_Str_t
*
Abc_Scl
Deriv
eGenlibStr
(
SC_Lib
*
p
,
float
Slew
,
float
Gain
,
int
nGatesMin
,
int
*
pnCellCount
)
Vec_Str_t
*
Abc_Scl
Produc
eGenlibStr
(
SC_Lib
*
p
,
float
Slew
,
float
Gain
,
int
nGatesMin
,
int
*
pnCellCount
)
{
char
Buffer
[
200
];
Vec_Str_t
*
vStr
;
...
...
@@ -565,8 +637,8 @@ Vec_Str_t * Abc_SclDeriveGenlibStr( SC_Lib * p, float Slew, float Gain, int nGat
}
void
Abc_SclDumpGenlib
(
char
*
pFileName
,
SC_Lib
*
p
,
float
Slew
,
float
Gain
,
int
nGatesMin
)
{
char
FileName
[
1000
];
int
nCellCount
=
0
;
char
FileName
[
1000
];
Vec_Str_t
*
vStr
;
FILE
*
pFile
;
if
(
pFileName
==
NULL
)
...
...
@@ -579,22 +651,52 @@ void Abc_SclDumpGenlib( char * pFileName, SC_Lib * p, float Slew, float Gain, in
printf
(
"Cannot open file
\"
%s
\"
for writing.
\n
"
,
FileName
);
return
;
}
vStr
=
Abc_Scl
Deriv
eGenlibStr
(
p
,
Slew
,
Gain
,
nGatesMin
,
&
nCellCount
);
vStr
=
Abc_Scl
Produc
eGenlibStr
(
p
,
Slew
,
Gain
,
nGatesMin
,
&
nCellCount
);
fprintf
(
pFile
,
"%s"
,
Vec_StrArray
(
vStr
)
);
Vec_StrFree
(
vStr
);
fclose
(
pFile
);
printf
(
"Written GENLIB library with %d gates into file
\"
%s
\"
.
\n
"
,
nCellCount
,
FileName
);
}
void
Abc_SclDeriveGenlib
(
void
*
pScl
,
float
Slew
,
float
Gain
,
int
nGatesMin
)
Mio_Library_t
*
Abc_SclDeriveGenlib
(
void
*
pScl
,
float
Slew
,
float
Gain
,
int
nGatesMin
)
{
int
nGateCount
=
0
;
Vec_Str_t
*
vStr
=
Abc_SclDeriveGenlibStr
(
(
SC_Lib
*
)
pScl
,
Slew
,
Gain
,
nGatesMin
,
&
nGateCount
);
Vec_Str_t
*
vStr2
=
Vec_StrDup
(
vStr
);
int
RetValue
=
Mio_UpdateGenlib2
(
vStr
,
vStr2
,
((
SC_Lib
*
)
pScl
)
->
pName
,
0
);
int
nCellCount
=
0
;
SC_Lib
*
p
=
(
SC_Lib
*
)
pScl
;
Vec_Str_t
*
vStr
=
Abc_SclProduceGenlibStr
(
p
,
Slew
,
Gain
,
nGatesMin
,
&
nCellCount
);
Mio_Library_t
*
pLib
=
Mio_LibraryRead
(
p
->
pFileName
,
Vec_StrArray
(
vStr
),
NULL
,
0
);
Vec_StrFree
(
vStr
);
if
(
pLib
)
printf
(
"Internally derived GENLIB library
\"
%s
\"
with %d gates.
\n
"
,
p
->
pName
,
nCellCount
);
else
printf
(
"Reading library has filed.
\n
"
);
return
pLib
;
}
/**Function*************************************************************
Synopsis [Install library.]
Description []
SideEffects []
SeeAlso []
***********************************************************************/
void
Abc_SclInstallGenlib
(
void
*
pScl
,
float
Slew
,
float
Gain
,
int
nGatesMin
)
{
SC_Lib
*
p
=
(
SC_Lib
*
)
pScl
;
Vec_Str_t
*
vStr
,
*
vStr2
;
int
RetValue
,
nGateCount
=
SC_LibCellNum
(
p
);
if
(
Gain
==
0
)
vStr
=
Abc_SclProduceGenlibStrSimple
(
p
);
else
vStr
=
Abc_SclProduceGenlibStr
(
p
,
Slew
,
Gain
,
nGatesMin
,
&
nGateCount
);
vStr2
=
Vec_StrDup
(
vStr
);
RetValue
=
Mio_UpdateGenlib2
(
vStr
,
vStr2
,
p
->
pName
,
0
);
Vec_StrFree
(
vStr
);
Vec_StrFree
(
vStr2
);
if
(
RetValue
)
printf
(
"Internally derived GENLIB library
\"
%s
\"
with %d gates.
\n
"
,
((
SC_Lib
*
)
pScl
)
->
pName
,
nGateCount
);
printf
(
"Internally derived GENLIB library
\"
%s
\"
with %d gates.
\n
"
,
p
->
pName
,
nGateCount
);
else
printf
(
"Reading library has filed.
\n
"
);
}
...
...
src/map/scl/sclLiberty.c
View file @
7d3976a7
...
...
@@ -848,6 +848,8 @@ void Scl_LibertyReadWireLoadSelect( Scl_Tree_t * p, Vec_Str_t * vOut )
float
First
=
atof
(
strtok
(
pHead
,
" ,"
)
);
float
Second
=
atof
(
strtok
(
NULL
,
" ,"
)
);
char
*
pThird
=
strtok
(
NULL
,
" "
);
if
(
pThird
[
0
]
==
'\"'
)
assert
(
pThird
[
strlen
(
pThird
)
-
1
]
==
'\"'
),
pThird
[
strlen
(
pThird
)
-
1
]
=
0
,
pThird
++
;
Vec_StrPutF_
(
vOut
,
First
);
Vec_StrPutF_
(
vOut
,
Second
);
Vec_StrPutS_
(
vOut
,
pThird
);
...
...
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