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
f09a7042
Commit
f09a7042
authored
Jul 29, 2013
by
Alan Mishchenko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added commands 'maxsize' and 'unbuffer'.
parent
b93ead2a
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
198 additions
and
8 deletions
+198
-8
src/base/abc/abc.h
+6
-0
src/map/scl/scl.c
+127
-8
src/map/scl/sclBuffer.c
+64
-0
src/map/scl/sclSize.h
+1
-0
No files found.
src/base/abc/abc.h
View file @
f09a7042
...
...
@@ -468,6 +468,12 @@ static inline void Abc_ObjSetMvVar( Abc_Obj_t * pObj, void * pV) { Vec_At
#define Abc_AigForEachAnd( pNtk, pNode, i ) \
for ( i = 0; (i < Vec_PtrSize((pNtk)->vObjs)) && (((pNode) = Abc_NtkObj(pNtk, i)), 1); i++ ) \
if ( (pNode) == NULL || !Abc_AigNodeIsAnd(pNode) ) {} else
#define Abc_NtkForEachNodeCi( pNtk, pNode, i ) \
for ( i = 0; (i < Vec_PtrSize((pNtk)->vObjs)) && (((pNode) = Abc_NtkObj(pNtk, i)), 1); i++ ) \
if ( (pNode) == NULL || (!Abc_ObjIsNode(pNode) && !Abc_ObjIsCi(pNode)) ) {} else
#define Abc_NtkForEachNodeCo( pNtk, pNode, i ) \
for ( i = 0; (i < Vec_PtrSize((pNtk)->vObjs)) && (((pNode) = Abc_NtkObj(pNtk, i)), 1); i++ ) \
if ( (pNode) == NULL || (!Abc_ObjIsNode(pNode) && !Abc_ObjIsCo(pNode)) ) {} else
// various boxes
#define Abc_NtkForEachBox( pNtk, pObj, i ) \
for ( i = 0; (i < Vec_PtrSize((pNtk)->vBoxes)) && (((pObj) = Abc_NtkBox(pNtk, i)), 1); i++ )
...
...
src/map/scl/scl.c
View file @
f09a7042
...
...
@@ -36,9 +36,11 @@ 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_CommandUnBuffer
(
Abc_Frame_t
*
pAbc
,
int
argc
,
char
**
argv
);
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_CommandMaxsize
(
Abc_Frame_t
*
pAbc
,
int
argc
,
char
**
argv
);
static
int
Scl_CommandPrintBuf
(
Abc_Frame_t
*
pAbc
,
int
argc
,
char
**
argv
);
////////////////////////////////////////////////////////////////////////
...
...
@@ -66,7 +68,9 @@ void Scl_Init( Abc_Frame_t * pAbc )
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"
,
"unbuffer"
,
Scl_CommandUnBuffer
,
1
);
Cmd_CommandAdd
(
pAbc
,
"SCL mapping"
,
"minsize"
,
Scl_CommandMinsize
,
1
);
Cmd_CommandAdd
(
pAbc
,
"SCL mapping"
,
"maxsize"
,
Scl_CommandMaxsize
,
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
);
...
...
@@ -652,18 +656,134 @@ usage:
SeeAlso []
***********************************************************************/
int
Scl_CommandUnBuffer
(
Abc_Frame_t
*
pAbc
,
int
argc
,
char
**
argv
)
{
Abc_Ntk_t
*
pNtkRes
,
*
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
(
pNtk
==
NULL
)
{
fprintf
(
pAbc
->
Err
,
"There is no current network.
\n
"
);
return
1
;
}
if
(
!
Abc_NtkIsLogic
(
pNtk
)
)
{
fprintf
(
pAbc
->
Err
,
"The current network is not a logic network.
\n
"
);
return
1
;
}
pNtkRes
=
Abc_SclUnBufferPerform
(
pNtk
,
fVerbose
);
if
(
pNtkRes
==
NULL
)
{
Abc_Print
(
-
1
,
"The command has failed.
\n
"
);
return
1
;
}
Abc_FrameReplaceCurrentNetwork
(
pAbc
,
pNtkRes
);
return
0
;
usage:
fprintf
(
pAbc
->
Err
,
"usage: unbuffer [-vh]
\n
"
);
fprintf
(
pAbc
->
Err
,
"
\t
collapses buffer/inverter trees
\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
;
}
/**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
,
f
UseMax
=
0
,
f
Verbose
=
0
;
int
c
,
fVerbose
=
0
;
Extra_UtilGetoptReset
();
while
(
(
c
=
Extra_UtilGetopt
(
argc
,
argv
,
"
m
vh"
)
)
!=
EOF
)
while
(
(
c
=
Extra_UtilGetopt
(
argc
,
argv
,
"vh"
)
)
!=
EOF
)
{
switch
(
c
)
{
case
'
m
'
:
f
UseMax
^=
1
;
case
'
v
'
:
f
Verbose
^=
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 network 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
(
(
SC_Lib
*
)
pAbc
->
pLibScl
,
pNtk
,
0
,
fVerbose
);
return
0
;
usage:
fprintf
(
pAbc
->
Err
,
"usage: minsize [-vh]
\n
"
);
fprintf
(
pAbc
->
Err
,
"
\t
downsizes 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
;
}
/**Function*************************************************************
Synopsis []
Description []
SideEffects []
SeeAlso []
***********************************************************************/
int
Scl_CommandMaxsize
(
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
;
...
...
@@ -695,13 +815,12 @@ int Scl_CommandMinsize( Abc_Frame_t * pAbc, int argc, char **argv )
return
1
;
}
Abc_SclMinsizePerform
(
(
SC_Lib
*
)
pAbc
->
pLibScl
,
pNtk
,
fUseMax
,
fVerbose
);
Abc_SclMinsizePerform
(
(
SC_Lib
*
)
pAbc
->
pLibScl
,
pNtk
,
1
,
fVerbose
);
return
0
;
usage:
fprintf
(
pAbc
->
Err
,
"usage: minsize [-mvh]
\n
"
);
fprintf
(
pAbc
->
Err
,
"
\t
downsized all gates to their minimum size
\n
"
);
fprintf
(
pAbc
->
Err
,
"
\t
-m : toggle upsizing gates to their maximum size [default = %s]
\n
"
,
fUseMax
?
"yes"
:
"no"
);
fprintf
(
pAbc
->
Err
,
"usage: maxsize [-vh]
\n
"
);
fprintf
(
pAbc
->
Err
,
"
\t
upsizes all gates to their maximum 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
;
...
...
src/map/scl/sclBuffer.c
View file @
f09a7042
...
...
@@ -77,6 +77,70 @@ static inline int Abc_BufEdgeSlack( Buf_Man_t * p, Abc_Obj_t * pObj, Abc_Obj_t
/**Function*************************************************************
Synopsis [Removes buffers and inverters.]
Description []
SideEffects []
SeeAlso []
***********************************************************************/
static
inline
int
Abc_SclObjIsBufInv
(
Abc_Obj_t
*
pObj
)
{
return
Abc_ObjIsNode
(
pObj
)
&&
Abc_ObjFaninNum
(
pObj
)
==
1
;
}
int
Abc_SclGetRealFaninLit
(
Abc_Obj_t
*
pObj
)
{
int
iLit
;
if
(
!
Abc_SclObjIsBufInv
(
pObj
)
)
return
Abc_Var2Lit
(
Abc_ObjId
(
pObj
),
0
);
iLit
=
Abc_SclGetRealFaninLit
(
Abc_ObjFanin0
(
pObj
)
);
return
Abc_LitNotCond
(
iLit
,
Abc_NodeIsInv
(
pObj
)
);
}
Abc_Ntk_t
*
Abc_SclUnBufferPerform
(
Abc_Ntk_t
*
pNtk
,
int
fVerbose
)
{
Vec_Int_t
*
vLits
;
Abc_Obj_t
*
pObj
,
*
pFanin
,
*
pFaninNew
;
int
i
,
k
,
iLit
,
nNodesOld
=
Abc_NtkObjNumMax
(
pNtk
);
// assign inverters
vLits
=
Vec_IntStartFull
(
Abc_NtkObjNumMax
(
pNtk
)
);
Abc_NtkForEachNode
(
pNtk
,
pObj
,
i
)
if
(
Abc_NodeIsInv
(
pObj
)
&&
!
Abc_SclObjIsBufInv
(
Abc_ObjFanin0
(
pObj
))
)
Vec_IntWriteEntry
(
vLits
,
Abc_ObjFaninId0
(
pObj
),
Abc_ObjId
(
pObj
)
);
// transfer fanins
Abc_NtkForEachNodeCo
(
pNtk
,
pObj
,
i
)
{
if
(
i
>=
nNodesOld
)
break
;
Abc_ObjForEachFanin
(
pObj
,
pFanin
,
k
)
{
if
(
!
Abc_SclObjIsBufInv
(
pFanin
)
)
continue
;
iLit
=
Abc_SclGetRealFaninLit
(
pFanin
);
pFaninNew
=
Abc_NtkObj
(
pNtk
,
Abc_Lit2Var
(
iLit
)
);
if
(
Abc_LitIsCompl
(
iLit
)
)
{
if
(
Vec_IntEntry
(
vLits
,
Abc_Lit2Var
(
iLit
)
)
==
-
1
)
{
pFaninNew
=
Abc_NtkCreateNodeInv
(
pNtk
,
pFaninNew
);
Vec_IntWriteEntry
(
vLits
,
Abc_Lit2Var
(
iLit
),
Abc_ObjId
(
pFaninNew
)
);
}
else
pFaninNew
=
Abc_NtkObj
(
pNtk
,
Vec_IntEntry
(
vLits
,
Abc_Lit2Var
(
iLit
)
)
);
assert
(
Abc_ObjFaninNum
(
pFaninNew
)
==
1
);
}
if
(
pFanin
!=
pFaninNew
)
Abc_ObjPatchFanin
(
pObj
,
pFanin
,
pFaninNew
);
}
}
Vec_IntFree
(
vLits
);
// duplicate network in topo order
return
Abc_NtkDupDfs
(
pNtk
);
}
/**Function*************************************************************
Synopsis [Make sure the network is in topo order without dangling nodes.]
Description [Returns 1 iff the network is fine.]
...
...
src/map/scl/sclSize.h
View file @
f09a7042
...
...
@@ -386,6 +386,7 @@ static inline void Abc_SclDumpStats( SC_Man * p, char * pFileName, abctime Time
/*=== sclBuffer.c ===============================================================*/
extern
Abc_Ntk_t
*
Abc_SclUnBufferPerform
(
Abc_Ntk_t
*
pNtk
,
int
fVerbose
);
extern
int
Abc_SclCheckNtk
(
Abc_Ntk_t
*
p
,
int
fVerbose
);
extern
Abc_Ntk_t
*
Abc_SclPerformBuffering
(
Abc_Ntk_t
*
p
,
int
Degree
,
int
fUseInvs
,
int
fVerbose
);
extern
Abc_Ntk_t
*
Abc_SclBufPerform
(
Abc_Ntk_t
*
pNtk
,
int
FanMin
,
int
FanMax
,
int
fVerbose
);
...
...
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