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
00d02371
Commit
00d02371
authored
Jul 24, 2013
by
Alan Mishchenko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Tuning standard-cell mapping flow.
parent
fadcef9e
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
165 additions
and
82 deletions
+165
-82
src/base/abci/abc.c
+44
-9
src/base/abci/abcMap.c
+7
-8
src/base/main/main.h
+1
-0
src/base/main/mainFrame.c
+1
-0
src/map/mapper/mapper.c
+7
-1
src/map/mapper/mapperInt.h
+3
-3
src/map/mapper/mapperLib.c
+5
-5
src/map/mapper/mapperTree.c
+7
-4
src/map/mio/mio.c
+65
-47
src/map/mio/mio.h
+4
-0
src/map/scl/sclLib.c
+17
-3
src/map/scl/sclSize.c
+1
-0
src/map/scl/sclSize.h
+3
-2
No files found.
src/base/abci/abc.c
View file @
00d02371
...
...
@@ -14391,13 +14391,16 @@ int Abc_CommandMap( Abc_Frame_t * pAbc, int argc, char ** argv )
double
DelayTarget
;
double
AreaMulti
;
double
DelayMulti
;
float
Slew
=
200
;
float
Gain
=
100
;
int
nGatesMin
=
4
;
int
fAreaOnly
;
int
fRecovery
;
int
fSweep
;
int
fSwitching
;
int
fVerbose
;
int
c
;
extern
Abc_Ntk_t
*
Abc_NtkMap
(
Abc_Ntk_t
*
pNtk
,
double
DelayTarget
,
double
AreaMulti
,
double
DelayMulti
,
int
fRecovery
,
int
fSwitching
,
int
fVerbose
);
extern
Abc_Ntk_t
*
Abc_NtkMap
(
Abc_Ntk_t
*
pNtk
,
double
DelayTarget
,
double
AreaMulti
,
double
DelayMulti
,
float
Slew
,
float
Gain
,
int
nGatesMin
,
int
fRecovery
,
int
fSwitching
,
int
fVerbose
);
extern
int
Abc_NtkFraigSweep
(
Abc_Ntk_t
*
pNtk
,
int
fUseInv
,
int
fExdc
,
int
fVerbose
,
int
fVeryVerbose
);
pNtk
=
Abc_FrameReadNtk
(
pAbc
);
...
...
@@ -14411,7 +14414,7 @@ int Abc_CommandMap( Abc_Frame_t * pAbc, int argc, char ** argv )
fSwitching
=
0
;
fVerbose
=
0
;
Extra_UtilGetoptReset
();
while
(
(
c
=
Extra_UtilGetopt
(
argc
,
argv
,
"DABarspvh"
)
)
!=
EOF
)
while
(
(
c
=
Extra_UtilGetopt
(
argc
,
argv
,
"DAB
SGM
arspvh"
)
)
!=
EOF
)
{
switch
(
c
)
{
...
...
@@ -14434,8 +14437,6 @@ int Abc_CommandMap( Abc_Frame_t * pAbc, int argc, char ** argv )
}
AreaMulti
=
(
float
)
atof
(
argv
[
globalUtilOptind
]);
globalUtilOptind
++
;
// if ( AreaMulti < 0.0 )
// goto usage;
break
;
case
'B'
:
if
(
globalUtilOptind
>=
argc
)
...
...
@@ -14445,8 +14446,39 @@ int Abc_CommandMap( Abc_Frame_t * pAbc, int argc, char ** argv )
}
DelayMulti
=
(
float
)
atof
(
argv
[
globalUtilOptind
]);
globalUtilOptind
++
;
// if ( DelayMulti < 0.0 )
// goto usage;
break
;
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
'M'
:
if
(
globalUtilOptind
>=
argc
)
{
Abc_Print
(
-
1
,
"Command line switch
\"
-M
\"
should be followed by a positive integer.
\n
"
);
goto
usage
;
}
nGatesMin
=
atoi
(
argv
[
globalUtilOptind
]);
globalUtilOptind
++
;
if
(
nGatesMin
<
0
)
goto
usage
;
break
;
case
'a'
:
fAreaOnly
^=
1
;
...
...
@@ -14496,7 +14528,7 @@ int Abc_CommandMap( Abc_Frame_t * pAbc, int argc, char ** argv )
}
Abc_Print
(
0
,
"The network was strashed and balanced before mapping.
\n
"
);
// get the new network
pNtkRes
=
Abc_NtkMap
(
pNtk
,
DelayTarget
,
AreaMulti
,
DelayMulti
,
fRecovery
,
fSwitching
,
fVerbose
);
pNtkRes
=
Abc_NtkMap
(
pNtk
,
DelayTarget
,
AreaMulti
,
DelayMulti
,
Slew
,
Gain
,
nGatesMin
,
fRecovery
,
fSwitching
,
fVerbose
);
if
(
pNtkRes
==
NULL
)
{
Abc_NtkDelete
(
pNtk
);
...
...
@@ -14508,7 +14540,7 @@ int Abc_CommandMap( Abc_Frame_t * pAbc, int argc, char ** argv )
else
{
// get the new network
pNtkRes
=
Abc_NtkMap
(
pNtk
,
DelayTarget
,
AreaMulti
,
DelayMulti
,
fRecovery
,
fSwitching
,
fVerbose
);
pNtkRes
=
Abc_NtkMap
(
pNtk
,
DelayTarget
,
AreaMulti
,
DelayMulti
,
Slew
,
Gain
,
nGatesMin
,
fRecovery
,
fSwitching
,
fVerbose
);
if
(
pNtkRes
==
NULL
)
{
Abc_Print
(
-
1
,
"Mapping has failed.
\n
"
);
...
...
@@ -14535,11 +14567,14 @@ usage:
sprintf
(
Buffer
,
"not used"
);
else
sprintf
(
Buffer
,
"%.3f"
,
DelayTarget
);
Abc_Print
(
-
2
,
"usage: map [-DAB
float
] [-arspvh]
\n
"
);
Abc_Print
(
-
2
,
"usage: map [-DAB
SG float] [-M num
] [-arspvh]
\n
"
);
Abc_Print
(
-
2
,
"
\t
performs standard cell mapping of the current network
\n
"
);
Abc_Print
(
-
2
,
"
\t
-D float : sets the global required times [default = %s]
\n
"
,
Buffer
);
Abc_Print
(
-
2
,
"
\t
-A float :
\"
area multiplier
\"
to bias gate selection [default = %.2f]
\n
"
,
AreaMulti
);
Abc_Print
(
-
2
,
"
\t
-B float :
\"
delay multiplier
\"
to bias gate selection [default = %.2f]
\n
"
,
DelayMulti
);
Abc_Print
(
-
2
,
"
\t
-S float : the slew parameter used to generate the library [default = %.2f]
\n
"
,
Slew
);
Abc_Print
(
-
2
,
"
\t
-G float : the gain parameter used to generate the library [default = %.2f]
\n
"
,
Gain
);
Abc_Print
(
-
2
,
"
\t
-M num : skip gate classes whose size is less than this [default = %d]
\n
"
,
nGatesMin
);
Abc_Print
(
-
2
,
"
\t
-a : toggles area-only mapping [default = %s]
\n
"
,
fAreaOnly
?
"yes"
:
"no"
);
Abc_Print
(
-
2
,
"
\t
-r : toggles area recovery [default = %s]
\n
"
,
fRecovery
?
"yes"
:
"no"
);
Abc_Print
(
-
2
,
"
\t
-s : toggles sweep after mapping [default = %s]
\n
"
,
fSweep
?
"yes"
:
"no"
);
src/base/abci/abcMap.c
View file @
00d02371
...
...
@@ -57,7 +57,7 @@ static Abc_Obj_t * Abc_NodeFromMapSuperChoice_rec( Abc_Ntk_t * pNtkNew, Map_Sup
SeeAlso []
***********************************************************************/
Abc_Ntk_t
*
Abc_NtkMap
(
Abc_Ntk_t
*
pNtk
,
double
DelayTarget
,
double
AreaMulti
,
double
DelayMulti
,
int
fRecovery
,
int
fSwitching
,
int
fVerbose
)
Abc_Ntk_t
*
Abc_NtkMap
(
Abc_Ntk_t
*
pNtk
,
double
DelayTarget
,
double
AreaMulti
,
double
DelayMulti
,
float
Slew
,
float
Gain
,
int
nGatesMin
,
int
fRecovery
,
int
fSwitching
,
int
fVerbose
)
{
static
int
fUseMulti
=
0
;
int
fShowSwitching
=
1
;
...
...
@@ -66,17 +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
*
)
Abc_FrameReadLibGen
();
Mio_Library_t
*
pLib
;
assert
(
Abc_NtkIsStrash
(
pNtk
)
);
// check that the library is available
// derive library from SCL
if
(
Abc_FrameReadLibScl
()
)
Mio_SclDeriveGenlib
(
Abc_FrameReadLibScl
(),
Slew
,
Gain
,
nGatesMin
);
// quit if there is no library
pLib
=
Abc_FrameReadLibGen
();
if
(
pLib
==
NULL
)
{
printf
(
"The current library is not available.
\n
"
);
return
0
;
}
if
(
AreaMulti
!=
0
.
0
)
fUseMulti
=
1
,
printf
(
"The cell areas are multiplied by the factor: <num_fanins> ^ (%.2f).
\n
"
,
AreaMulti
);
if
(
DelayMulti
!=
0
.
0
)
...
...
@@ -91,8 +92,6 @@ Abc_Ntk_t * Abc_NtkMap( Abc_Ntk_t * pNtk, double DelayTarget, double AreaMulti,
// derive the supergate library
if
(
fUseMulti
||
Abc_FrameReadLibSuper
()
==
NULL
)
{
// printf( "A simple supergate library is derived from gate library \"%s\".\n",
// Mio_LibraryReadName((Mio_Library_t *)Abc_FrameReadLibGen()) );
if
(
fVerbose
)
printf
(
"Converting
\"
%s
\"
into supergate library
\"
%s
\"
.
\n
"
,
Mio_LibraryReadName
(
pLib
),
Extra_FileNameGenericAppend
(
Mio_LibraryReadName
(
pLib
),
".super"
)
);
...
...
src/base/main/main.h
View file @
00d02371
...
...
@@ -103,6 +103,7 @@ extern ABC_DLL void * Abc_FrameReadLibGen();
extern
ABC_DLL
void
*
Abc_FrameReadLibGen2
();
extern
ABC_DLL
void
*
Abc_FrameReadLibSuper
();
extern
ABC_DLL
void
*
Abc_FrameReadLibVer
();
extern
ABC_DLL
void
*
Abc_FrameReadLibScl
();
extern
ABC_DLL
void
*
Abc_FrameReadManDd
();
extern
ABC_DLL
void
*
Abc_FrameReadManDec
();
extern
ABC_DLL
char
*
Abc_FrameReadFlag
(
char
*
pFlag
);
...
...
src/base/main/mainFrame.c
View file @
00d02371
...
...
@@ -56,6 +56,7 @@ void * Abc_FrameReadLibGen() { return s_GlobalFr
void
*
Abc_FrameReadLibGen2
()
{
return
s_GlobalFrame
->
pLibGen2
;
}
void
*
Abc_FrameReadLibSuper
()
{
return
s_GlobalFrame
->
pLibSuper
;
}
void
*
Abc_FrameReadLibVer
()
{
return
s_GlobalFrame
->
pLibVer
;
}
void
*
Abc_FrameReadLibScl
()
{
return
s_GlobalFrame
->
pLibScl
;
}
void
*
Abc_FrameReadManDd
()
{
if
(
s_GlobalFrame
->
dd
==
NULL
)
s_GlobalFrame
->
dd
=
Cudd_Init
(
0
,
0
,
CUDD_UNIQUE_SLOTS
,
CUDD_CACHE_SLOTS
,
0
);
return
s_GlobalFrame
->
dd
;
}
void
*
Abc_FrameReadManDec
()
{
if
(
s_GlobalFrame
->
pManDec
==
NULL
)
s_GlobalFrame
->
pManDec
=
Dec_ManStart
();
return
s_GlobalFrame
->
pManDec
;
}
char
*
Abc_FrameReadFlag
(
char
*
pFlag
)
{
return
Cmd_FlagReadByName
(
s_GlobalFrame
,
pFlag
);
}
...
...
src/map/mapper/mapper.c
View file @
00d02371
...
...
@@ -142,8 +142,14 @@ int Map_CommandReadLibrary( Abc_Frame_t * pAbc, int argc, char **argv )
}
fclose
(
pFile
);
if
(
Abc_FrameReadLibGen
()
==
NULL
)
{
fprintf
(
pErr
,
"Genlib library should be read in first..
\n
"
);
return
1
;
}
// set the new network
pLib
=
Map_SuperLibCreate
(
NULL
,
FileName
,
ExcludeFile
,
fAlgorithm
,
fVerbose
);
pLib
=
Map_SuperLibCreate
(
(
Mio_Library_t
*
)
Abc_FrameReadLibGen
(),
NULL
,
FileName
,
ExcludeFile
,
fAlgorithm
,
fVerbose
);
if
(
pLib
==
NULL
)
{
fprintf
(
pErr
,
"Reading supergate library has failed.
\n
"
);
...
...
src/map/mapper/mapperInt.h
View file @
00d02371
...
...
@@ -378,7 +378,7 @@ extern void Map_NodeAddFaninFanout( Map_Node_t * pFanin, Map_Node_t
extern
void
Map_NodeRemoveFaninFanout
(
Map_Node_t
*
pFanin
,
Map_Node_t
*
pFanoutToRemove
);
extern
int
Map_NodeGetFanoutNum
(
Map_Node_t
*
pNode
);
/*=== mapperLib.c ============================================================*/
extern
Map_SuperLib_t
*
Map_SuperLibCreate
(
Vec_Str_t
*
vStr
,
char
*
pFileName
,
char
*
pExcludeFile
,
int
fAlgorithm
,
int
fVerbose
);
extern
Map_SuperLib_t
*
Map_SuperLibCreate
(
Mio_Library_t
*
pGenlib
,
Vec_Str_t
*
vStr
,
char
*
pFileName
,
char
*
pExcludeFile
,
int
fAlgorithm
,
int
fVerbose
);
extern
void
Map_SuperLibFree
(
Map_SuperLib_t
*
p
);
/*=== mapperMatch.c ===============================================================*/
extern
int
Map_MappingMatches
(
Map_Man_t
*
p
);
...
...
@@ -406,8 +406,8 @@ extern float Map_MappingGetArea( Map_Man_t * pMan, Map_NodeVec_t * v
extern
void
Map_MappingShow
(
Map_Man_t
*
pMan
,
char
*
pFileName
);
/*=== mapperTree.c ===============================================================*/
extern
int
Map_LibraryDeriveGateInfo
(
Map_SuperLib_t
*
pLib
,
st__table
*
tExcludeGate
);
extern
int
Map_LibraryReadFileTreeStr
(
Map_SuperLib_t
*
pLib
,
Vec_Str_t
*
vStr
,
char
*
pFileName
);
extern
int
Map_LibraryReadTree
(
Map_SuperLib_t
*
pLib
,
char
*
pFileName
,
char
*
pExcludeFile
);
extern
int
Map_LibraryReadFileTreeStr
(
Map_SuperLib_t
*
pLib
,
Mio_Library_t
*
pGenlib
,
Vec_Str_t
*
vStr
,
char
*
pFileName
);
extern
int
Map_LibraryReadTree
(
Map_SuperLib_t
*
pLib
,
Mio_Library_t
*
pGenlib
,
char
*
pFileName
,
char
*
pExcludeFile
);
extern
void
Map_LibraryPrintTree
(
Map_SuperLib_t
*
pLib
);
/*=== mapperSuper.c ===============================================================*/
extern
int
Map_LibraryRead
(
Map_SuperLib_t
*
p
,
char
*
pFileName
);
...
...
src/map/mapper/mapperLib.c
View file @
00d02371
...
...
@@ -55,7 +55,7 @@ ABC_NAMESPACE_IMPL_START
SeeAlso []
***********************************************************************/
Map_SuperLib_t
*
Map_SuperLibCreate
(
Vec_Str_t
*
vStr
,
char
*
pFileName
,
char
*
pExcludeFile
,
int
fAlgorithm
,
int
fVerbose
)
Map_SuperLib_t
*
Map_SuperLibCreate
(
Mio_Library_t
*
pGenlib
,
Vec_Str_t
*
vStr
,
char
*
pFileName
,
char
*
pExcludeFile
,
int
fAlgorithm
,
int
fVerbose
)
{
Map_SuperLib_t
*
p
;
abctime
clk
;
...
...
@@ -79,7 +79,7 @@ clk = Abc_Clock();
if
(
vStr
!=
NULL
)
{
// read the supergate library from file
int
Status
=
Map_LibraryReadFileTreeStr
(
p
,
vStr
,
pFileName
);
int
Status
=
Map_LibraryReadFileTreeStr
(
p
,
pGenlib
,
vStr
,
pFileName
);
if
(
Status
==
0
)
{
Map_SuperLibFree
(
p
);
...
...
@@ -96,7 +96,7 @@ clk = Abc_Clock();
}
else
if
(
fAlgorithm
)
{
if
(
!
Map_LibraryReadTree
(
p
,
pFileName
,
pExcludeFile
)
)
if
(
!
Map_LibraryReadTree
(
p
,
p
Genlib
,
p
FileName
,
pExcludeFile
)
)
{
Map_SuperLibFree
(
p
);
return
NULL
;
...
...
@@ -169,7 +169,7 @@ void Map_SuperLibFree( Map_SuperLib_t * p )
if
(
p
==
NULL
)
return
;
if
(
p
->
pGenlib
)
{
assert
(
p
->
pGenlib
==
Abc_FrameReadLibGen
()
);
//
assert( p->pGenlib == Abc_FrameReadLibGen() );
// Mio_LibraryDelete( p->pGenlib );
// Abc_FrameSetLibGen( NULL );
p
->
pGenlib
=
NULL
;
...
...
@@ -210,7 +210,7 @@ int Map_SuperLibDeriveFromGenlib( Mio_Library_t * pLib, int fVerbose )
return
0
;
// create supergate library
pFileName
=
Extra_FileNameGenericAppend
(
Mio_LibraryReadName
(
pLib
),
".super"
);
pLibSuper
=
Map_SuperLibCreate
(
vStr
,
pFileName
,
NULL
,
1
,
0
);
pLibSuper
=
Map_SuperLibCreate
(
pLib
,
vStr
,
pFileName
,
NULL
,
1
,
0
);
Vec_StrFree
(
vStr
);
// replace the library
Map_SuperLibFree
(
(
Map_SuperLib_t
*
)
Abc_FrameReadLibSuper
()
);
...
...
src/map/mapper/mapperTree.c
View file @
00d02371
...
...
@@ -142,6 +142,7 @@ Map_Super_t * Map_LibraryReadGateTree( Map_SuperLib_t * pLib, char * pBuffer, in
SeeAlso []
***********************************************************************/
/*
int Map_LibraryReadFileTree( Map_SuperLib_t * pLib, FILE * pFile, char *pFileName )
{
ProgressBar * pProgress;
...
...
@@ -299,6 +300,7 @@ int Map_LibraryReadTree2( Map_SuperLib_t * pLib, char * pFileName, char * pExclu
// prepare the info about the library
return Map_LibraryDeriveGateInfo( pLib, tExcludeGate );
}
*/
/**Function*************************************************************
...
...
@@ -386,7 +388,7 @@ int Map_LibraryCompareLibNames( char * pName1, char * pName2 )
SeeAlso []
***********************************************************************/
int
Map_LibraryReadFileTreeStr
(
Map_SuperLib_t
*
pLib
,
Vec_Str_t
*
vStr
,
char
*
pFileName
)
int
Map_LibraryReadFileTreeStr
(
Map_SuperLib_t
*
pLib
,
Mio_Library_t
*
pGenlib
,
Vec_Str_t
*
vStr
,
char
*
pFileName
)
{
ProgressBar
*
pProgress
;
char
pBuffer
[
5000
];
...
...
@@ -410,7 +412,8 @@ int Map_LibraryReadFileTreeStr( Map_SuperLib_t * pLib, Vec_Str_t * vStr, char *
}
pLibName
=
strtok
(
pTemp
,
"
\t\r\n
"
);
pLib
->
pGenlib
=
(
Mio_Library_t
*
)
Abc_FrameReadLibGen
();
// pLib->pGenlib = (Mio_Library_t *)Abc_FrameReadLibGen();
pLib
->
pGenlib
=
pGenlib
;
// if ( pLib->pGenlib == NULL || strcmp( , pLibName ) )
if
(
pLib
->
pGenlib
==
NULL
||
Map_LibraryCompareLibNames
(
Mio_LibraryReadName
(
pLib
->
pGenlib
),
pLibName
)
)
{
...
...
@@ -519,7 +522,7 @@ int Map_LibraryReadFileTreeStr( Map_SuperLib_t * pLib, Vec_Str_t * vStr, char *
pLib
->
nSupersReal
=
nCounter
;
return
1
;
}
int
Map_LibraryReadTree
(
Map_SuperLib_t
*
pLib
,
char
*
pFileName
,
char
*
pExcludeFile
)
int
Map_LibraryReadTree
(
Map_SuperLib_t
*
pLib
,
Mio_Library_t
*
pGenlib
,
char
*
pFileName
,
char
*
pExcludeFile
)
{
char
*
pBuffer
;
Vec_Str_t
*
vStr
;
...
...
@@ -554,7 +557,7 @@ int Map_LibraryReadTree( Map_SuperLib_t * pLib, char * pFileName, char * pExclud
fprintf
(
Abc_FrameReadOut
(
pAbc
),
"Read %d gates from exclude file
\n
"
,
num
);
}
Status
=
Map_LibraryReadFileTreeStr
(
pLib
,
vStr
,
pFileName
);
Status
=
Map_LibraryReadFileTreeStr
(
pLib
,
pGenlib
,
vStr
,
pFileName
);
Vec_StrFree
(
vStr
);
if
(
Status
==
0
)
return
0
;
...
...
src/map/mio/mio.c
View file @
00d02371
...
...
@@ -110,6 +110,63 @@ void Mio_End( Abc_Frame_t * pAbc )
Amap_LibFree
(
(
Amap_Lib_t
*
)
Abc_FrameReadLibGen2
()
);
}
/**Function*************************************************************
Synopsis []
Description []
SideEffects []
SeeAlso []
***********************************************************************/
void
Mio_UpdateGenlib
(
Mio_Library_t
*
pLib
)
{
// free the current superlib because it depends on the old Mio library
if
(
Abc_FrameReadLibSuper
()
)
{
Map_SuperLibFree
(
(
Map_SuperLib_t
*
)
Abc_FrameReadLibSuper
()
);
Abc_FrameSetLibSuper
(
NULL
);
}
// replace the current library
Mio_LibraryDelete
(
(
Mio_Library_t
*
)
Abc_FrameReadLibGen
()
);
Abc_FrameSetLibGen
(
pLib
);
// replace the current library
Amap_LibFree
(
(
Amap_Lib_t
*
)
Abc_FrameReadLibGen2
()
);
Abc_FrameSetLibGen2
(
NULL
);
}
int
Mio_UpdateGenlib2
(
Vec_Str_t
*
vStr
,
Vec_Str_t
*
vStr2
,
char
*
pFileName
,
int
fVerbose
)
{
Mio_Library_t
*
pLib
;
// set the new network
pLib
=
Mio_LibraryRead
(
pFileName
,
Vec_StrArray
(
vStr
),
NULL
,
fVerbose
);
if
(
pLib
==
NULL
)
return
0
;
// free the current superlib because it depends on the old Mio library
if
(
Abc_FrameReadLibSuper
()
)
{
Map_SuperLibFree
(
(
Map_SuperLib_t
*
)
Abc_FrameReadLibSuper
()
);
Abc_FrameSetLibSuper
(
NULL
);
}
// replace the current library
Mio_LibraryDelete
(
(
Mio_Library_t
*
)
Abc_FrameReadLibGen
()
);
Abc_FrameSetLibGen
(
pLib
);
// set the new network
pLib
=
(
Mio_Library_t
*
)
Amap_LibReadAndPrepare
(
pFileName
,
Vec_StrArray
(
vStr2
),
0
,
0
);
if
(
pLib
==
NULL
)
return
0
;
// replace the current library
Amap_LibFree
(
(
Amap_Lib_t
*
)
Abc_FrameReadLibGen2
()
);
Abc_FrameSetLibGen2
(
pLib
);
return
1
;
}
/**Function*************************************************************
...
...
@@ -155,11 +212,8 @@ int Mio_CommandReadLiberty( Abc_Frame_t * pAbc, int argc, char **argv )
}
}
if
(
argc
!=
globalUtilOptind
+
1
)
{
goto
usage
;
}
// get the input file name
pFileName
=
argv
[
globalUtilOptind
];
...
...
@@ -183,43 +237,17 @@ int Mio_CommandReadLiberty( Abc_Frame_t * pAbc, int argc, char **argv )
}
else
{
Mio_Library_t
*
pLib
;
Vec_Str_t
*
vStr
,
*
vStr2
;
int
RetValue
;
vStr
=
Amap_LibertyParseStr
(
pFileName
,
fVerbose
);
if
(
vStr
==
NULL
)
return
0
;
vStr2
=
Vec_StrDup
(
vStr
);
// set the new network
pLib
=
Mio_LibraryRead
(
pFileName
,
Vec_StrArray
(
vStr
),
NULL
,
fVerbose
);
vStr2
=
Vec_StrDup
(
vStr
);
RetValue
=
Mio_UpdateGenlib2
(
vStr
,
vStr2
,
pFileName
,
fVerbose
);
Vec_StrFree
(
vStr
);
if
(
pLib
==
NULL
)
{
Vec_StrFree
(
vStr2
);
return
0
;
}
// free the current superlib because it depends on the old Mio library
if
(
Abc_FrameReadLibSuper
()
)
{
Map_SuperLibFree
(
(
Map_SuperLib_t
*
)
Abc_FrameReadLibSuper
()
);
Abc_FrameSetLibSuper
(
NULL
);
}
// replace the current library
Mio_LibraryDelete
(
(
Mio_Library_t
*
)
Abc_FrameReadLibGen
()
);
Abc_FrameSetLibGen
(
pLib
);
// set the new network
pLib
=
(
Mio_Library_t
*
)
Amap_LibReadAndPrepare
(
pFileName
,
Vec_StrArray
(
vStr2
),
0
,
0
);
Vec_StrFree
(
vStr2
);
if
(
pLib
==
NULL
)
return
0
;
// replace the current library
Amap_LibFree
(
(
Amap_Lib_t
*
)
Abc_FrameReadLibGen2
()
);
Abc_FrameSetLibGen2
(
pLib
);
if
(
!
RetValue
)
printf
(
"Reading library has filed.
\n
"
);
}
return
0
;
...
...
@@ -331,26 +359,16 @@ int Mio_CommandReadGenlib( Abc_Frame_t * pAbc, int argc, char **argv )
if
(
WireDelay
!=
0
.
0
)
Mio_LibraryShiftDelay
(
pLib
,
WireDelay
);
// free the current superlib because it depends on the old Mio library
if
(
Abc_FrameReadLibSuper
()
)
{
Map_SuperLibFree
(
(
Map_SuperLib_t
*
)
Abc_FrameReadLibSuper
()
);
Abc_FrameSetLibSuper
(
NULL
);
}
// prepare libraries
Mio_UpdateGenlib
(
pLib
);
// replace the current library
Mio_LibraryDelete
(
(
Mio_Library_t
*
)
Abc_FrameReadLibGen
()
);
Abc_FrameSetLibGen
(
pLib
);
// set the new network
pLib2
=
Amap_LibReadAndPrepare
(
pFileName
,
NULL
,
0
,
0
);
if
(
pLib2
==
NULL
)
{
fprintf
(
pErr
,
"Reading genlib library has failed.
\n
"
);
fprintf
(
pErr
,
"Reading
second
genlib library has failed.
\n
"
);
return
1
;
}
// replace the current library
Amap_LibFree
(
(
Amap_Lib_t
*
)
Abc_FrameReadLibGen2
()
);
Abc_FrameSetLibGen2
(
pLib2
);
return
0
;
...
...
src/map/mio/mio.h
View file @
00d02371
...
...
@@ -79,6 +79,10 @@ static inline char * Mio_UtilStrsav( char * s ) { return s ? strcpy(ABC_A
/// FUNCTION DEFINITIONS ///
////////////////////////////////////////////////////////////////////////
/*=== 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
Mio_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
);
...
...
src/map/scl/sclLib.c
View file @
00d02371
...
...
@@ -1044,7 +1044,7 @@ void Abc_SclPrintCells( SC_Lib * p, float Slew, float Gain )
SeeAlso []
***********************************************************************/
Vec_Str_t
*
Abc_SclDeriveGenlib
(
SC_Lib
*
p
,
float
Slew
,
float
Gain
,
int
nGatesMin
,
int
*
pnCellCount
)
Vec_Str_t
*
Abc_SclDeriveGenlib
Str
(
SC_Lib
*
p
,
float
Slew
,
float
Gain
,
int
nGatesMin
,
int
*
pnCellCount
)
{
extern
char
*
Abc_SclFindGateFormula
(
char
*
pGateName
,
char
*
pOutName
);
char
Buffer
[
200
];
...
...
@@ -1090,7 +1090,8 @@ Vec_Str_t * Abc_SclDeriveGenlib( SC_Lib * p, float Slew, float Gain, int nGatesM
Vec_StrPush
(
vStr
,
'\0'
);
// printf( "%s", Vec_StrArray(vStr) );
// printf( "GENLIB library with %d gates is produced.\n", Count );
*
pnCellCount
=
Count
;
if
(
pnCellCount
)
*
pnCellCount
=
Count
;
return
vStr
;
}
void
Abc_SclDumpGenlib
(
char
*
pFileName
,
SC_Lib
*
p
,
float
Slew
,
float
Gain
,
int
nGatesMin
)
...
...
@@ -1109,12 +1110,25 @@ 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_SclDeriveGenlib
(
p
,
Slew
,
Gain
,
nGatesMin
,
&
nCellCount
);
vStr
=
Abc_SclDeriveGenlib
Str
(
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
Mio_SclDeriveGenlib
(
void
*
pScl
,
float
Slew
,
float
Gain
,
int
nGatesMin
)
{
int
nGateCount
=
0
;
Vec_Str_t
*
vStr
=
Abc_SclDeriveGenlibStr
(
pScl
,
Slew
,
Gain
,
nGatesMin
,
&
nGateCount
);
Vec_Str_t
*
vStr2
=
Vec_StrDup
(
vStr
);
int
RetValue
=
Mio_UpdateGenlib2
(
vStr
,
vStr2
,
((
SC_Lib
*
)
pScl
)
->
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
);
else
printf
(
"Reading library has filed.
\n
"
);
}
////////////////////////////////////////////////////////////////////////
/// END OF FILE ///
...
...
src/map/scl/sclSize.c
View file @
00d02371
...
...
@@ -129,6 +129,7 @@ void Abc_SclTimeNtkPrint( SC_Man * p, int fShowAll, int fPrintPath )
int
i
,
nLength
=
0
,
fRise
=
0
;
Abc_Obj_t
*
pObj
,
*
pPivot
=
Abc_SclFindCriticalCo
(
p
,
&
fRise
);
float
maxDelay
=
Abc_SclObjTimePs
(
p
,
pPivot
,
fRise
);
p
->
ReportDelay
=
maxDelay
;
printf
(
"WireLoad model =
\"
%s
\"
. "
,
p
->
pWLoadUsed
?
p
->
pWLoadUsed
->
pName
:
"none"
);
printf
(
"Gates = %6d. "
,
Abc_NtkNodeNum
(
p
->
pNtk
)
);
...
...
src/map/scl/sclSize.h
View file @
00d02371
...
...
@@ -73,6 +73,7 @@ struct SC_Man_
float
SumArea0
;
// total area at the begining
float
MaxDelay0
;
// max delay at the begining
float
BestDelay
;
// best delay in the middle
float
ReportDelay
;
// delay to report
// runtime statistics
abctime
timeTotal
;
// starting/total time
abctime
timeCone
;
// critical path selection
...
...
@@ -364,8 +365,8 @@ static inline void Abc_SclDumpStats( SC_Man * p, char * pFileName, abctime Time
fprintf
(
pTable
,
"%d "
,
Abc_NtkPoNum
(
p
->
pNtk
)
);
fprintf
(
pTable
,
"%d "
,
Abc_NtkNodeNum
(
p
->
pNtk
)
);
fprintf
(
pTable
,
"%d "
,
(
int
)
p
->
SumArea
);
fprintf
(
pTable
,
"%d "
,
(
int
)
SC_LibTimePs
(
p
->
pLib
,
p
->
MaxDelay
)
);
fprintf
(
pTable
,
"%.2f "
,
1
.
0
*
Time
/
CLOCKS_PER_SEC
);
fprintf
(
pTable
,
"%d "
,
(
int
)
p
->
ReportDelay
);
//
fprintf( pTable, "%.2f ", 1.0*Time/CLOCKS_PER_SEC );
fprintf
(
pTable
,
"
\n
"
);
fclose
(
pTable
);
}
...
...
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