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
de71ef44
Commit
de71ef44
authored
Nov 26, 2016
by
Alan Mishchenko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
New command to profile arithmetic logic cones.
parent
6b55bf02
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
281 additions
and
15 deletions
+281
-15
abclib.dsp
+4
-0
src/base/wlc/module.make
+1
-0
src/base/wlc/wlc.h
+6
-0
src/base/wlc/wlcCom.c
+47
-1
src/base/wlc/wlcNtk.c
+57
-14
src/base/wlc/wlcWin.c
+166
-0
No files found.
abclib.dsp
View file @
de71ef44
...
@@ -807,6 +807,10 @@ SOURCE=.\src\base\wlc\wlcStdin.c
...
@@ -807,6 +807,10 @@ SOURCE=.\src\base\wlc\wlcStdin.c
# End Source File
# End Source File
# Begin Source File
# Begin Source File
SOURCE=.\src\base\wlc\wlcWin.c
# End Source File
# Begin Source File
SOURCE=.\src\base\wlc\wlcWriteVer.c
SOURCE=.\src\base\wlc\wlcWriteVer.c
# End Source File
# End Source File
# End Group
# End Group
...
...
src/base/wlc/module.make
View file @
de71ef44
...
@@ -8,4 +8,5 @@ SRC += src/base/wlc/wlcAbs.c \
...
@@ -8,4 +8,5 @@ SRC += src/base/wlc/wlcAbs.c \
src/base/wlc/wlcReadVer.c
\
src/base/wlc/wlcReadVer.c
\
src/base/wlc/wlcSim.c
\
src/base/wlc/wlcSim.c
\
src/base/wlc/wlcStdin.c
\
src/base/wlc/wlcStdin.c
\
src/base/wlc/wlcWin.c
\
src/base/wlc/wlcWriteVer.c
src/base/wlc/wlcWriteVer.c
src/base/wlc/wlc.h
View file @
de71ef44
...
@@ -244,6 +244,8 @@ static inline Wlc_Obj_t * Wlc_ObjFoToFi( Wlc_Ntk_t * p, Wlc_Obj_t * pObj )
...
@@ -244,6 +244,8 @@ static inline Wlc_Obj_t * Wlc_ObjFoToFi( Wlc_Ntk_t * p, Wlc_Obj_t * pObj )
#define Wlc_ObjForEachFanin( pObj, iFanin, i ) \
#define Wlc_ObjForEachFanin( pObj, iFanin, i ) \
for ( i = 0; (i < Wlc_ObjFaninNum(pObj)) && (((iFanin) = Wlc_ObjFaninId(pObj, i)), 1); i++ )
for ( i = 0; (i < Wlc_ObjFaninNum(pObj)) && (((iFanin) = Wlc_ObjFaninId(pObj, i)), 1); i++ )
#define Wlc_ObjForEachFaninObj( p, pObj, pFanin, i ) \
for ( i = 0; (i < Wlc_ObjFaninNum(pObj)) && (((pFanin) = Wlc_NtkObj(p, Wlc_ObjFaninId(pObj, i))), 1); i++ )
#define Wlc_ObjForEachFaninReverse( pObj, iFanin, i ) \
#define Wlc_ObjForEachFaninReverse( pObj, iFanin, i ) \
for ( i = Wlc_ObjFaninNum(pObj) - 1; (i >= 0) && (((iFanin) = Wlc_ObjFaninId(pObj, i)), 1); i-- )
for ( i = Wlc_ObjFaninNum(pObj) - 1; (i >= 0) && (((iFanin) = Wlc_ObjFaninId(pObj, i)), 1); i-- )
...
@@ -272,6 +274,8 @@ extern char * Wlc_ObjName( Wlc_Ntk_t * p, int iObj );
...
@@ -272,6 +274,8 @@ extern char * Wlc_ObjName( Wlc_Ntk_t * p, int iObj );
extern
void
Wlc_ObjUpdateType
(
Wlc_Ntk_t
*
p
,
Wlc_Obj_t
*
pObj
,
int
Type
);
extern
void
Wlc_ObjUpdateType
(
Wlc_Ntk_t
*
p
,
Wlc_Obj_t
*
pObj
,
int
Type
);
extern
void
Wlc_ObjAddFanins
(
Wlc_Ntk_t
*
p
,
Wlc_Obj_t
*
pObj
,
Vec_Int_t
*
vFanins
);
extern
void
Wlc_ObjAddFanins
(
Wlc_Ntk_t
*
p
,
Wlc_Obj_t
*
pObj
,
Vec_Int_t
*
vFanins
);
extern
void
Wlc_NtkFree
(
Wlc_Ntk_t
*
p
);
extern
void
Wlc_NtkFree
(
Wlc_Ntk_t
*
p
);
extern
void
Wlc_NtkPrintNode
(
Wlc_Ntk_t
*
p
,
Wlc_Obj_t
*
pObj
);
extern
void
Wlc_NtkPrintNodeArray
(
Wlc_Ntk_t
*
p
,
Vec_Int_t
*
vArray
);
extern
void
Wlc_NtkPrintNodes
(
Wlc_Ntk_t
*
p
,
int
Type
);
extern
void
Wlc_NtkPrintNodes
(
Wlc_Ntk_t
*
p
,
int
Type
);
extern
void
Wlc_NtkPrintStats
(
Wlc_Ntk_t
*
p
,
int
fDistrib
,
int
fVerbose
);
extern
void
Wlc_NtkPrintStats
(
Wlc_Ntk_t
*
p
,
int
fDistrib
,
int
fVerbose
);
extern
Wlc_Ntk_t
*
Wlc_NtkDupDfs
(
Wlc_Ntk_t
*
p
);
extern
Wlc_Ntk_t
*
Wlc_NtkDupDfs
(
Wlc_Ntk_t
*
p
);
...
@@ -287,6 +291,8 @@ extern void Wlc_NtkDeleteSim( Vec_Ptr_t * p );
...
@@ -287,6 +291,8 @@ extern void Wlc_NtkDeleteSim( Vec_Ptr_t * p );
extern
int
Wlc_StdinProcessSmt
(
Abc_Frame_t
*
pAbc
,
char
*
pCmd
);
extern
int
Wlc_StdinProcessSmt
(
Abc_Frame_t
*
pAbc
,
char
*
pCmd
);
/*=== wlcReadVer.c ========================================================*/
/*=== wlcReadVer.c ========================================================*/
extern
Wlc_Ntk_t
*
Wlc_ReadVer
(
char
*
pFileName
,
char
*
pStr
);
extern
Wlc_Ntk_t
*
Wlc_ReadVer
(
char
*
pFileName
,
char
*
pStr
);
/*=== wlcWin.c =============================================================*/
extern
void
Wlc_WinProfileArith
(
Wlc_Ntk_t
*
p
);
/*=== wlcWriteVer.c ========================================================*/
/*=== wlcWriteVer.c ========================================================*/
extern
void
Wlc_WriteVer
(
Wlc_Ntk_t
*
p
,
char
*
pFileName
,
int
fAddCos
,
int
fNoFlops
);
extern
void
Wlc_WriteVer
(
Wlc_Ntk_t
*
p
,
char
*
pFileName
,
int
fAddCos
,
int
fNoFlops
);
...
...
src/base/wlc/wlcCom.c
View file @
de71ef44
...
@@ -34,6 +34,7 @@ static int Abc_CommandPs ( Abc_Frame_t * pAbc, int argc, char ** argv );
...
@@ -34,6 +34,7 @@ static int Abc_CommandPs ( Abc_Frame_t * pAbc, int argc, char ** argv );
static
int
Abc_CommandBlast
(
Abc_Frame_t
*
pAbc
,
int
argc
,
char
**
argv
);
static
int
Abc_CommandBlast
(
Abc_Frame_t
*
pAbc
,
int
argc
,
char
**
argv
);
static
int
Abc_CommandPsInv
(
Abc_Frame_t
*
pAbc
,
int
argc
,
char
**
argv
);
static
int
Abc_CommandPsInv
(
Abc_Frame_t
*
pAbc
,
int
argc
,
char
**
argv
);
static
int
Abc_CommandGetInv
(
Abc_Frame_t
*
pAbc
,
int
argc
,
char
**
argv
);
static
int
Abc_CommandGetInv
(
Abc_Frame_t
*
pAbc
,
int
argc
,
char
**
argv
);
static
int
Abc_CommandProfile
(
Abc_Frame_t
*
pAbc
,
int
argc
,
char
**
argv
);
static
int
Abc_CommandTest
(
Abc_Frame_t
*
pAbc
,
int
argc
,
char
**
argv
);
static
int
Abc_CommandTest
(
Abc_Frame_t
*
pAbc
,
int
argc
,
char
**
argv
);
static
inline
Wlc_Ntk_t
*
Wlc_AbcGetNtk
(
Abc_Frame_t
*
pAbc
)
{
return
(
Wlc_Ntk_t
*
)
pAbc
->
pAbcWlc
;
}
static
inline
Wlc_Ntk_t
*
Wlc_AbcGetNtk
(
Abc_Frame_t
*
pAbc
)
{
return
(
Wlc_Ntk_t
*
)
pAbc
->
pAbcWlc
;
}
...
@@ -67,6 +68,7 @@ void Wlc_Init( Abc_Frame_t * pAbc )
...
@@ -67,6 +68,7 @@ void Wlc_Init( Abc_Frame_t * pAbc )
Cmd_CommandAdd
(
pAbc
,
"Word level"
,
"%blast"
,
Abc_CommandBlast
,
0
);
Cmd_CommandAdd
(
pAbc
,
"Word level"
,
"%blast"
,
Abc_CommandBlast
,
0
);
Cmd_CommandAdd
(
pAbc
,
"Word level"
,
"%psinv"
,
Abc_CommandPsInv
,
0
);
Cmd_CommandAdd
(
pAbc
,
"Word level"
,
"%psinv"
,
Abc_CommandPsInv
,
0
);
Cmd_CommandAdd
(
pAbc
,
"Word level"
,
"%getinv"
,
Abc_CommandGetInv
,
0
);
Cmd_CommandAdd
(
pAbc
,
"Word level"
,
"%getinv"
,
Abc_CommandGetInv
,
0
);
Cmd_CommandAdd
(
pAbc
,
"Word level"
,
"%profile"
,
Abc_CommandProfile
,
0
);
Cmd_CommandAdd
(
pAbc
,
"Word level"
,
"%test"
,
Abc_CommandTest
,
0
);
Cmd_CommandAdd
(
pAbc
,
"Word level"
,
"%test"
,
Abc_CommandTest
,
0
);
}
}
...
@@ -554,6 +556,50 @@ int Abc_CommandGetInv( Abc_Frame_t * pAbc, int argc, char ** argv )
...
@@ -554,6 +556,50 @@ int Abc_CommandGetInv( Abc_Frame_t * pAbc, int argc, char ** argv )
SeeAlso []
SeeAlso []
******************************************************************************/
******************************************************************************/
int
Abc_CommandProfile
(
Abc_Frame_t
*
pAbc
,
int
argc
,
char
**
argv
)
{
Wlc_Ntk_t
*
pNtk
=
Wlc_AbcGetNtk
(
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
)
{
Abc_Print
(
1
,
"Abc_CommandProfile(): There is no current design.
\n
"
);
return
0
;
}
Wlc_WinProfileArith
(
pNtk
);
return
0
;
usage:
Abc_Print
(
-
2
,
"usage: %%profile [-vh]
\n
"
);
Abc_Print
(
-
2
,
"
\t
profiles arithmetic components in the word-level networks
\n
"
);
Abc_Print
(
-
2
,
"
\t
-v : toggle printing verbose information [default = %s]
\n
"
,
fVerbose
?
"yes"
:
"no"
);
Abc_Print
(
-
2
,
"
\t
-h : print the command usage
\n
"
);
return
1
;
}
/**Function********************************************************************
Synopsis []
Description []
SideEffects []
SeeAlso []
******************************************************************************/
int
Abc_CommandTest
(
Abc_Frame_t
*
pAbc
,
int
argc
,
char
**
argv
)
int
Abc_CommandTest
(
Abc_Frame_t
*
pAbc
,
int
argc
,
char
**
argv
)
{
{
extern
void
Wlc_NtkSimulateTest
(
Wlc_Ntk_t
*
p
);
extern
void
Wlc_NtkSimulateTest
(
Wlc_Ntk_t
*
p
);
...
@@ -575,7 +621,7 @@ int Abc_CommandTest( Abc_Frame_t * pAbc, int argc, char ** argv )
...
@@ -575,7 +621,7 @@ int Abc_CommandTest( Abc_Frame_t * pAbc, int argc, char ** argv )
}
}
if
(
pNtk
==
NULL
)
if
(
pNtk
==
NULL
)
{
{
Abc_Print
(
1
,
"Abc_Command
Bla
st(): There is no current design.
\n
"
);
Abc_Print
(
1
,
"Abc_Command
Te
st(): There is no current design.
\n
"
);
return
0
;
return
0
;
}
}
// transform
// transform
...
...
src/base/wlc/wlcNtk.c
View file @
de71ef44
...
@@ -44,8 +44,8 @@ static char * Wlc_Names[WLC_OBJ_NUMBER+1] = {
...
@@ -44,8 +44,8 @@ static char * Wlc_Names[WLC_OBJ_NUMBER+1] = {
">>>"
,
// 10: shift right (arithmetic)
">>>"
,
// 10: shift right (arithmetic)
"<<"
,
// 11: shift left
"<<"
,
// 11: shift left
"<<<"
,
// 12: shift left (arithmetic)
"<<<"
,
// 12: shift left (arithmetic)
"rot
ateR"
,
// 13: rotate right
"rot
R"
,
// 13: rotate right
"rot
ateL"
,
// 14: rotate left
"rot
L"
,
// 14: rotate left
"~"
,
// 15: bitwise NOT
"~"
,
// 15: bitwise NOT
"&"
,
// 16: bitwise AND
"&"
,
// 16: bitwise AND
"|"
,
// 17: bitwise OR
"|"
,
// 17: bitwise OR
...
@@ -55,8 +55,8 @@ static char * Wlc_Names[WLC_OBJ_NUMBER+1] = {
...
@@ -55,8 +55,8 @@ static char * Wlc_Names[WLC_OBJ_NUMBER+1] = {
"~^"
,
// 21: bitwise NXOR
"~^"
,
// 21: bitwise NXOR
"[:]"
,
// 22: bit selection
"[:]"
,
// 22: bit selection
"{,}"
,
// 23: bit concatenation
"{,}"
,
// 23: bit concatenation
"z
eroPad"
,
// 24: zero padding
"z
Pad"
,
// 24: zero padding
"s
ignExt"
,
// 25: sign extension
"s
Ext"
,
// 25: sign extension
"!"
,
// 26: logic NOT
"!"
,
// 26: logic NOT
"=>"
,
// 27: logic implication
"=>"
,
// 27: logic implication
"&&"
,
// 28: logic AND
"&&"
,
// 28: logic AND
...
@@ -83,7 +83,7 @@ static char * Wlc_Names[WLC_OBJ_NUMBER+1] = {
...
@@ -83,7 +83,7 @@ static char * Wlc_Names[WLC_OBJ_NUMBER+1] = {
"**"
,
// 49: arithmetic power
"**"
,
// 49: arithmetic power
"-"
,
// 50: arithmetic minus
"-"
,
// 50: arithmetic minus
"sqrt"
,
// 51: integer square root
"sqrt"
,
// 51: integer square root
"squar
e"
,
// 52: integer square
"squar
"
,
// 52: integer square
"table"
,
// 53: bit table
"table"
,
// 53: bit table
NULL
// 54: unused
NULL
// 54: unused
};
};
...
@@ -471,6 +471,57 @@ void Wlc_NtkPrintDistrib( Wlc_Ntk_t * p, int fVerbose )
...
@@ -471,6 +471,57 @@ void Wlc_NtkPrintDistrib( Wlc_Ntk_t * p, int fVerbose )
Vec_VecFree
(
(
Vec_Vec_t
*
)
vOccurs
);
Vec_VecFree
(
(
Vec_Vec_t
*
)
vOccurs
);
Vec_IntFree
(
vAnds
);
Vec_IntFree
(
vAnds
);
}
}
void
Wlc_NtkPrintNode
(
Wlc_Ntk_t
*
p
,
Wlc_Obj_t
*
pObj
)
{
printf
(
"%8d : "
,
Wlc_ObjId
(
p
,
pObj
)
);
printf
(
"%3d%s"
,
Wlc_ObjRange
(
pObj
),
Wlc_ObjIsSigned
(
pObj
)
?
"s"
:
" "
);
if
(
pObj
->
Type
==
WLC_OBJ_CONST
)
printf
(
" "
);
else
{
printf
(
" = %3d%s %5s "
,
Wlc_ObjRange
(
Wlc_ObjFanin0
(
p
,
pObj
)),
Wlc_ObjIsSigned
(
Wlc_ObjFanin0
(
p
,
pObj
))
?
"s"
:
" "
,
Wlc_Names
[(
int
)
pObj
->
Type
]
);
if
(
Wlc_ObjFaninNum
(
pObj
)
>
1
)
printf
(
"%3d%s "
,
Wlc_ObjRange
(
Wlc_ObjFanin1
(
p
,
pObj
)),
Wlc_ObjIsSigned
(
Wlc_ObjFanin1
(
p
,
pObj
))
?
"s"
:
" "
);
else
printf
(
" "
);
if
(
Wlc_ObjFaninNum
(
pObj
)
>
2
)
printf
(
"%3d%s "
,
Wlc_ObjRange
(
Wlc_ObjFanin2
(
p
,
pObj
)),
Wlc_ObjIsSigned
(
Wlc_ObjFanin2
(
p
,
pObj
))
?
"s"
:
" "
);
else
printf
(
" "
);
}
printf
(
" : "
);
printf
(
"%-12s"
,
Wlc_ObjName
(
p
,
Wlc_ObjId
(
p
,
pObj
))
);
if
(
pObj
->
Type
==
WLC_OBJ_CONST
)
{
printf
(
" = %d
\'
%sh"
,
Wlc_ObjRange
(
pObj
),
Wlc_ObjIsSigned
(
pObj
)
?
"s"
:
""
);
if
(
pObj
->
fXConst
)
{
int
k
;
for
(
k
=
0
;
k
<
(
Wlc_ObjRange
(
pObj
)
+
3
)
/
4
;
k
++
)
printf
(
"x"
);
}
else
Abc_TtPrintHexArrayRev
(
stdout
,
(
word
*
)
Wlc_ObjConstValue
(
pObj
),
(
Wlc_ObjRange
(
pObj
)
+
3
)
/
4
);
}
else
{
printf
(
" = %-12s %5s "
,
Wlc_ObjName
(
p
,
Wlc_ObjFaninId0
(
pObj
)),
Wlc_Names
[(
int
)
pObj
->
Type
]
);
if
(
Wlc_ObjFaninNum
(
pObj
)
>
1
)
printf
(
"%-12s "
,
Wlc_ObjName
(
p
,
Wlc_ObjFaninId1
(
pObj
))
);
else
printf
(
" "
);
if
(
Wlc_ObjFaninNum
(
pObj
)
>
2
)
printf
(
"%-12s "
,
Wlc_ObjName
(
p
,
Wlc_ObjFaninId2
(
pObj
))
);
}
printf
(
"
\n
"
);
}
void
Wlc_NtkPrintNodeArray
(
Wlc_Ntk_t
*
p
,
Vec_Int_t
*
vArray
)
{
Wlc_Obj_t
*
pObj
;
int
i
;
Wlc_NtkForEachObjVec
(
vArray
,
p
,
pObj
,
i
)
Wlc_NtkPrintNode
(
p
,
pObj
);
}
void
Wlc_NtkPrintNodes
(
Wlc_Ntk_t
*
p
,
int
Type
)
void
Wlc_NtkPrintNodes
(
Wlc_Ntk_t
*
p
,
int
Type
)
{
{
Wlc_Obj_t
*
pObj
;
Wlc_Obj_t
*
pObj
;
...
@@ -481,15 +532,7 @@ void Wlc_NtkPrintNodes( Wlc_Ntk_t * p, int Type )
...
@@ -481,15 +532,7 @@ void Wlc_NtkPrintNodes( Wlc_Ntk_t * p, int Type )
if
(
(
int
)
pObj
->
Type
!=
Type
)
if
(
(
int
)
pObj
->
Type
!=
Type
)
continue
;
continue
;
printf
(
"%8d :"
,
Counter
++
);
printf
(
"%8d :"
,
Counter
++
);
printf
(
"%8d : "
,
i
);
Wlc_NtkPrintNode
(
p
,
pObj
);
printf
(
"%3d%s = "
,
Wlc_ObjRange
(
pObj
),
Wlc_ObjIsSigned
(
pObj
)
?
"s"
:
" "
);
printf
(
"%3d%s %s "
,
Wlc_ObjRange
(
Wlc_ObjFanin0
(
p
,
pObj
)),
Wlc_ObjIsSigned
(
Wlc_ObjFanin0
(
p
,
pObj
))
?
"s"
:
" "
,
Wlc_Names
[
Type
]
);
printf
(
"%3d%s "
,
Wlc_ObjRange
(
Wlc_ObjFanin1
(
p
,
pObj
)),
Wlc_ObjIsSigned
(
Wlc_ObjFanin1
(
p
,
pObj
))
?
"s"
:
" "
);
printf
(
" : "
);
printf
(
"%-12s = "
,
Wlc_ObjName
(
p
,
i
)
);
printf
(
"%-12s %s "
,
Wlc_ObjName
(
p
,
Wlc_ObjFaninId0
(
pObj
)),
Wlc_Names
[
Type
]
);
printf
(
"%-12s "
,
Wlc_ObjName
(
p
,
Wlc_ObjFaninId1
(
pObj
))
);
printf
(
"
\n
"
);
}
}
}
}
void
Wlc_NtkPrintStats
(
Wlc_Ntk_t
*
p
,
int
fDistrib
,
int
fVerbose
)
void
Wlc_NtkPrintStats
(
Wlc_Ntk_t
*
p
,
int
fDistrib
,
int
fVerbose
)
...
...
src/base/wlc/wlcWin.c
0 → 100644
View file @
de71ef44
/**CFile****************************************************************
FileName [wlcWin.c]
SystemName [ABC: Logic synthesis and verification system.]
PackageName [Verilog parser.]
Synopsis [Parses several flavors of word-level Verilog.]
Author [Alan Mishchenko]
Affiliation [UC Berkeley]
Date [Ver. 1.0. Started - August 22, 2014.]
Revision [$Id: wlcWin.c,v 1.00 2014/09/12 00:00:00 alanmi Exp $]
***********************************************************************/
#include "wlc.h"
#include "base/abc/abc.h"
ABC_NAMESPACE_IMPL_START
////////////////////////////////////////////////////////////////////////
/// DECLARATIONS ///
////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////
/// FUNCTION DEFINITIONS ///
////////////////////////////////////////////////////////////////////////
/**Function*************************************************************
Synopsis [Collect arithmetic nodes.]
Description []
SideEffects []
SeeAlso []
***********************************************************************/
int
Wlc_ObjIsArithm
(
Wlc_Obj_t
*
pObj
)
{
return
pObj
->
Type
==
WLC_OBJ_CONST
||
pObj
->
Type
==
WLC_OBJ_BUF
||
pObj
->
Type
==
WLC_OBJ_BIT_NOT
||
pObj
->
Type
==
WLC_OBJ_BIT_ZEROPAD
||
pObj
->
Type
==
WLC_OBJ_BIT_SIGNEXT
||
// pObj->Type == WLC_OBJ_BIT_SELECT || pObj->Type == WLC_OBJ_BIT_CONCAT ||
pObj
->
Type
==
WLC_OBJ_ARI_ADD
||
pObj
->
Type
==
WLC_OBJ_ARI_SUB
||
pObj
->
Type
==
WLC_OBJ_ARI_MULTI
||
pObj
->
Type
==
WLC_OBJ_ARI_MINUS
;
}
int
Wlc_ObjIsArithmReal
(
Wlc_Obj_t
*
pObj
)
{
return
pObj
->
Type
==
WLC_OBJ_BIT_NOT
||
pObj
->
Type
==
WLC_OBJ_ARI_ADD
||
pObj
->
Type
==
WLC_OBJ_ARI_SUB
||
pObj
->
Type
==
WLC_OBJ_ARI_MULTI
||
pObj
->
Type
==
WLC_OBJ_ARI_MINUS
;
}
int
Wlc_ManCountArithmReal
(
Wlc_Ntk_t
*
p
,
Vec_Int_t
*
vNodes
)
{
Wlc_Obj_t
*
pObj
;
int
i
,
Counter
=
0
;
Wlc_NtkForEachObjVec
(
vNodes
,
p
,
pObj
,
i
)
Counter
+=
Wlc_ObjIsArithmReal
(
pObj
);
return
Counter
;
}
int
Wlc_ObjHasArithm_rec
(
Wlc_Ntk_t
*
p
,
Wlc_Obj_t
*
pObj
)
{
if
(
pObj
->
Type
==
WLC_OBJ_CONST
)
return
0
;
if
(
pObj
->
Type
==
WLC_OBJ_BUF
||
pObj
->
Type
==
WLC_OBJ_BIT_NOT
||
pObj
->
Type
==
WLC_OBJ_BIT_ZEROPAD
||
pObj
->
Type
==
WLC_OBJ_BIT_SIGNEXT
)
return
Wlc_ObjHasArithm_rec
(
p
,
Wlc_ObjFanin0
(
p
,
pObj
)
);
return
pObj
->
Type
==
WLC_OBJ_ARI_ADD
||
pObj
->
Type
==
WLC_OBJ_ARI_SUB
||
pObj
->
Type
==
WLC_OBJ_ARI_MULTI
||
pObj
->
Type
==
WLC_OBJ_ARI_MINUS
;
}
int
Wlc_ObjHasArithmFanins
(
Wlc_Ntk_t
*
p
,
Wlc_Obj_t
*
pObj
)
{
Wlc_Obj_t
*
pFanin
;
int
i
;
assert
(
!
Wlc_ObjHasArithm_rec
(
p
,
pObj
)
);
Wlc_ObjForEachFaninObj
(
p
,
pObj
,
pFanin
,
i
)
if
(
Wlc_ObjHasArithm_rec
(
p
,
pFanin
)
)
return
1
;
return
0
;
}
void
Wlc_WinCompute_rec
(
Wlc_Ntk_t
*
p
,
Wlc_Obj_t
*
pObj
,
Vec_Int_t
*
vLeaves
,
Vec_Int_t
*
vNodes
)
{
Wlc_Obj_t
*
pFanin
;
int
i
;
if
(
pObj
->
Mark
)
return
;
pObj
->
Mark
=
1
;
if
(
!
Wlc_ObjIsArithm
(
pObj
)
)
{
Vec_IntPush
(
vLeaves
,
Wlc_ObjId
(
p
,
pObj
)
);
return
;
}
Wlc_ObjForEachFaninObj
(
p
,
pObj
,
pFanin
,
i
)
Wlc_WinCompute_rec
(
p
,
pFanin
,
vLeaves
,
vNodes
);
Vec_IntPush
(
vNodes
,
Wlc_ObjId
(
p
,
pObj
)
);
}
void
Wlc_WinCleanMark_rec
(
Wlc_Ntk_t
*
p
,
Wlc_Obj_t
*
pObj
)
{
Wlc_Obj_t
*
pFanin
;
int
i
;
if
(
!
pObj
->
Mark
)
return
;
pObj
->
Mark
=
0
;
Wlc_ObjForEachFaninObj
(
p
,
pObj
,
pFanin
,
i
)
Wlc_WinCleanMark_rec
(
p
,
pFanin
);
}
void
Wlc_WinCompute
(
Wlc_Ntk_t
*
p
,
Wlc_Obj_t
*
pObj
,
Vec_Int_t
*
vLeaves
,
Vec_Int_t
*
vNodes
)
{
Vec_IntClear
(
vLeaves
);
Vec_IntClear
(
vNodes
);
if
(
Wlc_ObjHasArithm_rec
(
p
,
pObj
)
)
{
Wlc_WinCompute_rec
(
p
,
pObj
,
vLeaves
,
vNodes
);
Wlc_WinCleanMark_rec
(
p
,
pObj
);
}
else
if
(
Wlc_ObjHasArithmFanins
(
p
,
pObj
)
)
{
Wlc_Obj_t
*
pFanin
;
int
i
;
Wlc_ObjForEachFaninObj
(
p
,
pObj
,
pFanin
,
i
)
if
(
Wlc_ObjHasArithm_rec
(
p
,
pFanin
)
)
Wlc_WinCompute_rec
(
p
,
pFanin
,
vLeaves
,
vNodes
);
Wlc_ObjForEachFaninObj
(
p
,
pObj
,
pFanin
,
i
)
if
(
Wlc_ObjHasArithm_rec
(
p
,
pFanin
)
)
Wlc_WinCleanMark_rec
(
p
,
pFanin
);
}
else
assert
(
0
);
}
void
Wlc_WinProfileArith
(
Wlc_Ntk_t
*
p
)
{
Vec_Int_t
*
vLeaves
=
Vec_IntAlloc
(
1000
);
Vec_Int_t
*
vNodes
=
Vec_IntAlloc
(
1000
);
Wlc_Obj_t
*
pObj
;
int
i
,
Count
=
0
;
Wlc_NtkForEachObj
(
p
,
pObj
,
i
)
pObj
->
Mark
=
0
;
Wlc_NtkForEachObj
(
p
,
pObj
,
i
)
if
(
Wlc_ObjHasArithm_rec
(
p
,
pObj
)
?
Wlc_ObjIsCo
(
pObj
)
:
Wlc_ObjHasArithmFanins
(
p
,
pObj
)
)
{
Wlc_WinCompute
(
p
,
pObj
,
vLeaves
,
vNodes
);
if
(
Wlc_ManCountArithmReal
(
p
,
vNodes
)
<
2
)
continue
;
printf
(
"Arithmetic cone of node %d (%s):
\n
"
,
Wlc_ObjId
(
p
,
pObj
),
Wlc_ObjName
(
p
,
Wlc_ObjId
(
p
,
pObj
))
);
Wlc_NtkPrintNode
(
p
,
pObj
);
Vec_IntReverseOrder
(
vNodes
);
Wlc_NtkPrintNodeArray
(
p
,
vNodes
);
printf
(
"
\n
"
);
Count
++
;
}
Wlc_NtkForEachObj
(
p
,
pObj
,
i
)
assert
(
pObj
->
Mark
==
0
);
printf
(
"Finished printing %d arithmetic cones.
\n
"
,
Count
);
Vec_IntFree
(
vLeaves
);
Vec_IntFree
(
vNodes
);
}
////////////////////////////////////////////////////////////////////////
/// END OF FILE ///
////////////////////////////////////////////////////////////////////////
ABC_NAMESPACE_IMPL_END
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