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
fdfb083c
Commit
fdfb083c
authored
Sep 20, 2012
by
Alan Mishchenko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added command 'minsize' to reduce all gates to their minimum size in the library.
parent
f59de3de
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
121 additions
and
19 deletions
+121
-19
src/map/scl/scl.c
+82
-18
src/map/scl/sclInt.h
+1
-1
src/map/scl/sclUtil.c
+38
-0
No files found.
src/map/scl/scl.c
View file @
fdfb083c
...
...
@@ -28,15 +28,16 @@ ABC_NAMESPACE_IMPL_START
/// DECLARATIONS ///
////////////////////////////////////////////////////////////////////////
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_CommandPrint
(
Abc_Frame_t
*
pAbc
,
int
argc
,
char
**
argv
);
static
int
Scl_CommandPrintGS
(
Abc_Frame_t
*
pAbc
,
int
argc
,
char
**
argv
);
static
int
Scl_CommandStime
(
Abc_Frame_t
*
pAbc
,
int
argc
,
char
**
argv
);
static
int
Scl_CommandTopo
(
Abc_Frame_t
*
pAbc
,
int
argc
,
char
**
argv
);
static
int
Scl_CommandBuffer
(
Abc_Frame_t
*
pAbc
,
int
argc
,
char
**
argv
);
static
int
Scl_CommandGsize
(
Abc_Frame_t
*
pAbc
,
int
argc
,
char
**
argv
);
static
int
Scl_CommandUpsize
(
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_CommandPrint
(
Abc_Frame_t
*
pAbc
,
int
argc
,
char
**
argv
);
static
int
Scl_CommandPrintGS
(
Abc_Frame_t
*
pAbc
,
int
argc
,
char
**
argv
);
static
int
Scl_CommandStime
(
Abc_Frame_t
*
pAbc
,
int
argc
,
char
**
argv
);
static
int
Scl_CommandTopo
(
Abc_Frame_t
*
pAbc
,
int
argc
,
char
**
argv
);
static
int
Scl_CommandBuffer
(
Abc_Frame_t
*
pAbc
,
int
argc
,
char
**
argv
);
static
int
Scl_CommandGsize
(
Abc_Frame_t
*
pAbc
,
int
argc
,
char
**
argv
);
static
int
Scl_CommandUpsize
(
Abc_Frame_t
*
pAbc
,
int
argc
,
char
**
argv
);
static
int
Scl_CommandMinsize
(
Abc_Frame_t
*
pAbc
,
int
argc
,
char
**
argv
);
////////////////////////////////////////////////////////////////////////
/// FUNCTION DEFINITIONS ///
...
...
@@ -55,15 +56,16 @@ static int Scl_CommandUpsize ( 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"
,
"gsize"
,
Scl_CommandGsize
,
1
);
Cmd_CommandAdd
(
pAbc
,
"SCL mapping"
,
"upsize"
,
Scl_CommandUpsize
,
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"
,
"gsize"
,
Scl_CommandGsize
,
1
);
Cmd_CommandAdd
(
pAbc
,
"SCL mapping"
,
"upsize"
,
Scl_CommandUpsize
,
1
);
Cmd_CommandAdd
(
pAbc
,
"SCL mapping"
,
"minsize"
,
Scl_CommandMinsize
,
1
);
}
void
Scl_End
(
Abc_Frame_t
*
pAbc
)
{
...
...
@@ -729,6 +731,68 @@ usage:
return
1
;
}
/**Function*************************************************************
Synopsis []
Description []
SideEffects []
SeeAlso []
***********************************************************************/
int
Scl_CommandMinsize
(
Abc_Frame_t
*
pAbc
,
int
argc
,
char
**
argv
)
{
Abc_Ntk_t
*
pNtk
=
Abc_FrameReadNtk
(
pAbc
);
int
c
,
fVerbose
=
0
;
Extra_UtilGetoptReset
();
while
(
(
c
=
Extra_UtilGetopt
(
argc
,
argv
,
"vh"
)
)
!=
EOF
)
{
switch
(
c
)
{
case
'v'
:
fVerbose
^=
1
;
break
;
case
'h'
:
goto
usage
;
default:
goto
usage
;
}
}
if
(
Abc_FrameReadNtk
(
pAbc
)
==
NULL
)
{
fprintf
(
pAbc
->
Err
,
"There is no current network.
\n
"
);
return
1
;
}
if
(
!
Abc_NtkHasMapping
(
Abc_FrameReadNtk
(
pAbc
))
)
{
fprintf
(
pAbc
->
Err
,
"The current network is not mapped.
\n
"
);
return
1
;
}
if
(
!
Abc_SclCheckNtk
(
Abc_FrameReadNtk
(
pAbc
),
0
)
)
{
fprintf
(
pAbc
->
Err
,
"The current networks is not in a topo order (run
\"
topo
\"
).
\n
"
);
return
1
;
}
if
(
pAbc
->
pLibScl
==
NULL
)
{
fprintf
(
pAbc
->
Err
,
"There is no Liberty library available.
\n
"
);
return
1
;
}
Abc_SclMinsizePerform
(
pAbc
->
pLibScl
,
pNtk
,
fVerbose
);
return
0
;
usage:
fprintf
(
pAbc
->
Err
,
"usage: minsize [-vh]
\n
"
);
fprintf
(
pAbc
->
Err
,
"
\t
downsized all gates to their minimum size
\n
"
);
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/sclInt.h
View file @
fdfb083c
...
...
@@ -446,7 +446,7 @@ extern void Abc_SclPrintCells( SC_Lib * p );
extern
Vec_Int_t
*
Abc_SclManFindGates
(
SC_Lib
*
pLib
,
Abc_Ntk_t
*
p
);
extern
void
Abc_SclManSetGates
(
SC_Lib
*
pLib
,
Abc_Ntk_t
*
p
,
Vec_Int_t
*
vGates
);
extern
void
Abc_SclPrintGateSizes
(
SC_Lib
*
pLib
,
Abc_Ntk_t
*
p
);
extern
void
Abc_SclMinsizePerform
(
SC_Lib
*
pLib
,
Abc_Ntk_t
*
p
,
int
fVerbose
);
ABC_NAMESPACE_HEADER_END
...
...
src/map/scl/sclUtil.c
View file @
fdfb083c
...
...
@@ -284,6 +284,44 @@ void Abc_SclPrintGateSizes( SC_Lib * pLib, Abc_Ntk_t * p )
Vec_IntFree
(
vGates
);
}
/**Function*************************************************************
Synopsis [Downsizes each gate to its minimium size.]
Description []
SideEffects []
SeeAlso []
***********************************************************************/
void
Abc_SclMinsizePerform
(
SC_Lib
*
pLib
,
Abc_Ntk_t
*
p
,
int
fVerbose
)
{
Vec_Int_t
*
vMinCells
,
*
vGates
;
SC_Cell
*
pCell
,
*
pRepr
=
NULL
;
Abc_Obj_t
*
pObj
;
int
i
,
k
,
gateId
;
// map each gate in the library into its min-size prototype
vMinCells
=
Vec_IntStartFull
(
Vec_PtrSize
(
pLib
->
vCells
)
);
SC_LibForEachCellClass
(
pLib
,
pRepr
,
i
)
SC_RingForEachCell
(
pRepr
,
pCell
,
k
)
Vec_IntWriteEntry
(
vMinCells
,
pCell
->
Id
,
pRepr
->
Id
);
// update each cell
vGates
=
Abc_SclManFindGates
(
pLib
,
p
);
Abc_NtkForEachNode1
(
p
,
pObj
,
i
)
{
gateId
=
Vec_IntEntry
(
vGates
,
i
);
assert
(
gateId
>=
0
&&
gateId
<
Vec_PtrSize
(
pLib
->
vCells
)
);
gateId
=
Vec_IntEntry
(
vMinCells
,
gateId
);
assert
(
gateId
>=
0
&&
gateId
<
Vec_PtrSize
(
pLib
->
vCells
)
);
Vec_IntWriteEntry
(
vGates
,
i
,
gateId
);
}
Abc_SclManSetGates
(
pLib
,
p
,
vGates
);
Vec_IntFree
(
vMinCells
);
Vec_IntFree
(
vGates
);
}
////////////////////////////////////////////////////////////////////////
/// 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