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
5bf0f864
Commit
5bf0f864
authored
Aug 24, 2015
by
Alan Mishchenko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
New switch in 'read_lib' to replace gate/pin names by short strings.
parent
73bfe00f
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
105 additions
and
2 deletions
+105
-2
src/map/scl/scl.c
+10
-2
src/map/scl/sclLib.h
+1
-0
src/map/scl/sclLibUtil.c
+94
-0
No files found.
src/map/scl/scl.c
View file @
5bf0f864
...
@@ -139,11 +139,12 @@ int Scl_CommandReadLib( Abc_Frame_t * pAbc, int argc, char ** argv )
...
@@ -139,11 +139,12 @@ int Scl_CommandReadLib( Abc_Frame_t * pAbc, int argc, char ** argv )
float
Slew
=
0
;
float
Slew
=
0
;
float
Gain
=
0
;
float
Gain
=
0
;
int
nGatesMin
=
0
;
int
nGatesMin
=
0
;
int
fShortNames
=
0
;
int
fVerbose
=
1
;
int
fVerbose
=
1
;
int
fVeryVerbose
=
0
;
int
fVeryVerbose
=
0
;
Extra_UtilGetoptReset
();
Extra_UtilGetoptReset
();
while
(
(
c
=
Extra_UtilGetopt
(
argc
,
argv
,
"SGMdvwh"
)
)
!=
EOF
)
while
(
(
c
=
Extra_UtilGetopt
(
argc
,
argv
,
"SGMd
n
vwh"
)
)
!=
EOF
)
{
{
switch
(
c
)
switch
(
c
)
{
{
...
@@ -183,6 +184,9 @@ int Scl_CommandReadLib( Abc_Frame_t * pAbc, int argc, char ** argv )
...
@@ -183,6 +184,9 @@ int Scl_CommandReadLib( Abc_Frame_t * pAbc, int argc, char ** argv )
case
'd'
:
case
'd'
:
fDump
^=
1
;
fDump
^=
1
;
break
;
break
;
case
'n'
:
fShortNames
^=
1
;
break
;
case
'v'
:
case
'v'
:
fVerbose
^=
1
;
fVerbose
^=
1
;
break
;
break
;
...
@@ -219,6 +223,9 @@ int Scl_CommandReadLib( Abc_Frame_t * pAbc, int argc, char ** argv )
...
@@ -219,6 +223,9 @@ int Scl_CommandReadLib( Abc_Frame_t * pAbc, int argc, char ** argv )
return
0
;
return
0
;
}
}
Abc_SclLoad
(
pLib
,
(
SC_Lib
**
)
&
pAbc
->
pLibScl
);
Abc_SclLoad
(
pLib
,
(
SC_Lib
**
)
&
pAbc
->
pLibScl
);
// convert the library if needed
if
(
fShortNames
)
Abc_SclShortNames
(
pLib
);
// dump the resulting library
// dump the resulting library
if
(
fDump
&&
pAbc
->
pLibScl
)
if
(
fDump
&&
pAbc
->
pLibScl
)
Abc_SclWriteLiberty
(
Extra_FileNameGenericAppend
(
pFileName
,
"_temp.lib"
),
(
SC_Lib
*
)
pAbc
->
pLibScl
);
Abc_SclWriteLiberty
(
Extra_FileNameGenericAppend
(
pFileName
,
"_temp.lib"
),
(
SC_Lib
*
)
pAbc
->
pLibScl
);
...
@@ -228,12 +235,13 @@ int Scl_CommandReadLib( Abc_Frame_t * pAbc, int argc, char ** argv )
...
@@ -228,12 +235,13 @@ int Scl_CommandReadLib( Abc_Frame_t * pAbc, int argc, char ** argv )
return
0
;
return
0
;
usage:
usage:
fprintf
(
pAbc
->
Err
,
"usage: read_lib [-SG float] [-M num] [-dvwh] <file>
\n
"
);
fprintf
(
pAbc
->
Err
,
"usage: read_lib [-SG float] [-M num] [-d
n
vwh] <file>
\n
"
);
fprintf
(
pAbc
->
Err
,
"
\t
reads Liberty library from file
\n
"
);
fprintf
(
pAbc
->
Err
,
"
\t
reads Liberty library from file
\n
"
);
fprintf
(
pAbc
->
Err
,
"
\t
-S float : the slew parameter used to generate the library [default = %.2f]
\n
"
,
Slew
);
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
-G float : the gain parameter used to generate the library [default = %.2f]
\n
"
,
Gain
);
fprintf
(
pAbc
->
Err
,
"
\t
-M num : skip gate classes whose size is less than this [default = %d]
\n
"
,
nGatesMin
);
fprintf
(
pAbc
->
Err
,
"
\t
-M num : skip gate classes whose size is less than this [default = %d]
\n
"
,
nGatesMin
);
fprintf
(
pAbc
->
Err
,
"
\t
-d : toggle dumping the parsed library into file
\"
*_temp.lib
\"
[default = %s]
\n
"
,
fDump
?
"yes"
:
"no"
);
fprintf
(
pAbc
->
Err
,
"
\t
-d : toggle dumping the parsed library into file
\"
*_temp.lib
\"
[default = %s]
\n
"
,
fDump
?
"yes"
:
"no"
);
fprintf
(
pAbc
->
Err
,
"
\t
-n : toggle replacing gate/pin names by short strings [default = %s]
\n
"
,
fShortNames
?
"yes"
:
"no"
);
fprintf
(
pAbc
->
Err
,
"
\t
-v : toggle writing verbose information [default = %s]
\n
"
,
fVerbose
?
"yes"
:
"no"
);
fprintf
(
pAbc
->
Err
,
"
\t
-v : toggle writing verbose information [default = %s]
\n
"
,
fVerbose
?
"yes"
:
"no"
);
fprintf
(
pAbc
->
Err
,
"
\t
-v : toggle writing information about skipped gates [default = %s]
\n
"
,
fVeryVerbose
?
"yes"
:
"no"
);
fprintf
(
pAbc
->
Err
,
"
\t
-v : toggle writing information about skipped gates [default = %s]
\n
"
,
fVeryVerbose
?
"yes"
:
"no"
);
fprintf
(
pAbc
->
Err
,
"
\t
-h : prints the command summary
\n
"
);
fprintf
(
pAbc
->
Err
,
"
\t
-h : prints the command summary
\n
"
);
...
...
src/map/scl/sclLib.h
View file @
5bf0f864
...
@@ -615,6 +615,7 @@ extern void Abc_SclWriteLiberty( char * pFileName, SC_Lib * p );
...
@@ -615,6 +615,7 @@ extern void Abc_SclWriteLiberty( char * pFileName, SC_Lib * p );
extern
void
Abc_SclHashCells
(
SC_Lib
*
p
);
extern
void
Abc_SclHashCells
(
SC_Lib
*
p
);
extern
int
Abc_SclCellFind
(
SC_Lib
*
p
,
char
*
pName
);
extern
int
Abc_SclCellFind
(
SC_Lib
*
p
,
char
*
pName
);
extern
int
Abc_SclClassCellNum
(
SC_Cell
*
pClass
);
extern
int
Abc_SclClassCellNum
(
SC_Cell
*
pClass
);
extern
void
Abc_SclShortNames
(
SC_Lib
*
p
);
extern
int
Abc_SclLibClassNum
(
SC_Lib
*
pLib
);
extern
int
Abc_SclLibClassNum
(
SC_Lib
*
pLib
);
extern
void
Abc_SclLinkCells
(
SC_Lib
*
p
);
extern
void
Abc_SclLinkCells
(
SC_Lib
*
p
);
extern
void
Abc_SclPrintCells
(
SC_Lib
*
p
,
float
Slew
,
float
Gain
,
int
fInvOnly
,
int
fShort
);
extern
void
Abc_SclPrintCells
(
SC_Lib
*
p
,
float
Slew
,
float
Gain
,
int
fInvOnly
,
int
fShort
);
...
...
src/map/scl/sclLibUtil.c
View file @
5bf0f864
...
@@ -101,6 +101,100 @@ int Abc_SclLibClassNum( SC_Lib * pLib )
...
@@ -101,6 +101,100 @@ int Abc_SclLibClassNum( SC_Lib * pLib )
/**Function*************************************************************
/**Function*************************************************************
Synopsis [Change cell names and pin names.]
Description []
SideEffects []
SeeAlso []
***********************************************************************/
static
inline
int
Abc_SclIsChar
(
char
c
)
{
return
(
c
>=
'a'
&&
c
<=
'z'
)
||
(
c
>=
'A'
&&
c
<=
'Z'
)
||
c
==
'_'
;
}
static
inline
int
Abc_SclIsName
(
char
c
)
{
return
Abc_SclIsChar
(
c
)
||
(
c
>=
'0'
&&
c
<=
'9'
);
}
static
inline
char
*
Abc_SclFindLimit
(
char
*
pName
)
{
assert
(
Abc_SclIsChar
(
*
pName
)
);
while
(
Abc_SclIsName
(
*
pName
)
)
pName
++
;
return
pName
;
}
static
inline
int
Abc_SclAreEqual
(
char
*
pBase
,
char
*
pName
,
char
*
pLimit
)
{
return
!
strncmp
(
pBase
,
pName
,
pLimit
-
pName
);
}
void
Abc_SclShortFormula
(
SC_Cell
*
pCell
,
char
*
pForm
,
char
*
pBuffer
)
{
SC_Pin
*
pPin
;
int
i
;
char
*
pTemp
,
*
pLimit
;
for
(
pTemp
=
pForm
;
*
pTemp
;
)
{
if
(
!
Abc_SclIsChar
(
*
pTemp
)
)
{
*
pBuffer
++
=
*
pTemp
++
;
continue
;
}
pLimit
=
Abc_SclFindLimit
(
pTemp
);
SC_CellForEachPinIn
(
pCell
,
pPin
,
i
)
if
(
Abc_SclAreEqual
(
pPin
->
pName
,
pTemp
,
pLimit
)
)
{
*
pBuffer
++
=
'a'
+
i
;
break
;
}
assert
(
i
<
pCell
->
n_inputs
);
pTemp
=
pLimit
;
}
*
pBuffer
++
=
0
;
}
void
Abc_SclShortNames
(
SC_Lib
*
p
)
{
char
Buffer
[
10000
];
SC_Cell
*
pClass
,
*
pCell
;
SC_Pin
*
pPin
;
int
i
,
k
,
n
,
nClasses
=
Abc_SclLibClassNum
(
p
);
int
nDigits
=
Abc_Base10Log
(
nClasses
);
// itereate through classes
SC_LibForEachCellClass
(
p
,
pClass
,
i
)
{
int
nDigits2
=
Abc_Base10Log
(
Abc_SclClassCellNum
(
pClass
)
);
SC_RingForEachCell
(
pClass
,
pCell
,
k
)
{
ABC_FREE
(
pCell
->
pName
);
sprintf
(
Buffer
,
"g%0*d_%0*d"
,
nDigits
,
i
,
nDigits2
,
k
);
pCell
->
pName
=
Abc_UtilStrsav
(
Buffer
);
// formula
SC_CellForEachPinOut
(
pCell
,
pPin
,
n
)
{
Abc_SclShortFormula
(
pCell
,
pPin
->
func_text
,
Buffer
);
ABC_FREE
(
pPin
->
func_text
);
pPin
->
func_text
=
Abc_UtilStrsav
(
Buffer
);
}
// pin names
SC_CellForEachPinIn
(
pCell
,
pPin
,
n
)
{
ABC_FREE
(
pPin
->
pName
);
sprintf
(
Buffer
,
"%c"
,
'a'
+
n
);
pPin
->
pName
=
Abc_UtilStrsav
(
Buffer
);
}
SC_CellForEachPinOut
(
pCell
,
pPin
,
n
)
{
ABC_FREE
(
pPin
->
pName
);
sprintf
(
Buffer
,
"%c"
,
'z'
-
n
+
pCell
->
n_inputs
);
pPin
->
pName
=
Abc_UtilStrsav
(
Buffer
);
}
}
}
p
->
nBins
=
0
;
ABC_FREE
(
p
->
pBins
);
Abc_SclHashCells
(
p
);
}
/**Function*************************************************************
Synopsis [Links equal gates into rings while sorting them by area.]
Synopsis [Links equal gates into rings while sorting them by area.]
Description []
Description []
...
...
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