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
a1b4773c
Commit
a1b4773c
authored
Sep 24, 2014
by
Alan Mishchenko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Printing node type statistics.
parent
7d211820
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
56 additions
and
32 deletions
+56
-32
src/base/wlc/wlcNtk.c
+56
-32
No files found.
src/base/wlc/wlcNtk.c
View file @
a1b4773c
...
...
@@ -214,51 +214,72 @@ int Wlc_NtkMemUsage( Wlc_Ntk_t * p )
SeeAlso []
***********************************************************************/
static
inline
int
Wlc_NtkPrintDistribMakeSign
(
int
s
,
int
s0
,
int
s1
)
static
inline
void
Vec_WrdSelectSortCost2
(
word
*
pArray
,
int
nSize
,
word
*
pCosts
)
{
s
&=
0x3FF
;
s0
&=
0x3FF
;
s1
&=
0x3FF
;
return
(
s1
<<
20
)
|
(
s0
<<
10
)
|
s
;
int
i
,
j
,
best_i
;
for
(
i
=
0
;
i
<
nSize
-
1
;
i
++
)
{
best_i
=
i
;
for
(
j
=
i
+
1
;
j
<
nSize
;
j
++
)
if
(
pCosts
[
j
]
<
pCosts
[
best_i
]
)
best_i
=
j
;
ABC_SWAP
(
word
,
pArray
[
i
],
pArray
[
best_i
]
);
ABC_SWAP
(
word
,
pCosts
[
i
],
pCosts
[
best_i
]
);
}
}
static
inline
word
Wlc_NtkPrintDistribMakeSign
(
int
s
,
int
s0
,
int
s1
)
{
return
((
word
)
s1
<<
42
)
|
((
word
)
s0
<<
21
)
|
(
word
)
s
;
}
static
inline
void
Wlc_NtkPrintDistribFromSign
(
int
sss
,
int
*
s
,
int
*
s0
,
int
*
s1
)
static
inline
void
Wlc_NtkPrintDistribFromSign
(
word
sss
,
int
*
s
,
int
*
s0
,
int
*
s1
)
{
*
s1
=
sss
>>
20
;
*
s0
=
(
sss
>>
10
)
&
0x3FF
;
*
s
=
sss
&
0x3
FF
;
*
s1
=
(
int
)(
sss
>>
42
);
*
s0
=
(
int
)(
sss
>>
21
)
&
0x1FFFFF
;
*
s
=
(
int
)
sss
&
0x1FFF
FF
;
}
static
inline
void
Wlc_NtkPrintDistribAddOne
(
Vec_
Wec_t
*
vTypes
,
Vec_Wec_t
*
vOccurs
,
int
Type
,
int
Sign
)
static
inline
void
Wlc_NtkPrintDistribAddOne
(
Vec_
Ptr_t
*
vTypes
,
Vec_Ptr_t
*
vOccurs
,
int
Type
,
word
Sign
)
{
Vec_
Int_t
*
vType
=
Vec_Wec
Entry
(
vTypes
,
Type
);
Vec_
Int_t
*
vOccur
=
Vec_Wec
Entry
(
vOccurs
,
Type
);
int
i
,
Entry
;
Vec_
Int
ForEachEntry
(
vType
,
Entry
,
i
)
Vec_
Wrd_t
*
vType
=
(
Vec_Wrd_t
*
)
Vec_Ptr
Entry
(
vTypes
,
Type
);
Vec_
Wrd_t
*
vOccur
=
(
Vec_Wrd_t
*
)
Vec_Ptr
Entry
(
vOccurs
,
Type
);
word
Entry
;
int
i
;
Vec_
Wrd
ForEachEntry
(
vType
,
Entry
,
i
)
if
(
Entry
==
Sign
)
{
Vec_
Int
AddToEntry
(
vOccur
,
i
,
1
);
Vec_
Wrd
AddToEntry
(
vOccur
,
i
,
1
);
return
;
}
Vec_
Int
Push
(
vType
,
Sign
);
Vec_
Int
Push
(
vOccur
,
1
);
Vec_
Wrd
Push
(
vType
,
Sign
);
Vec_
Wrd
Push
(
vOccur
,
1
);
}
void
Wlc_NtkPrintDistribSortOne
(
Vec_
Wec_t
*
vTypes
,
Vec_Wec
_t
*
vOccurs
,
int
Type
)
void
Wlc_NtkPrintDistribSortOne
(
Vec_
Ptr_t
*
vTypes
,
Vec_Ptr
_t
*
vOccurs
,
int
Type
)
{
Vec_
Int_t
*
vType
=
Vec_WecEntry
(
vTypes
,
Type
);
Vec_
Int_t
*
vOccur
=
Vec_Wec
Entry
(
vOccurs
,
Type
);
Vec_
IntSelectSortCost2
(
Vec_IntArray
(
vType
),
Vec_IntSize
(
vType
),
Vec_Int
Array
(
vOccur
)
);
Vec_
Int
ReverseOrder
(
vType
);
Vec_
Int
ReverseOrder
(
vOccur
);
Vec_
Wrd_t
*
vType
=
(
Vec_Wrd_t
*
)
Vec_PtrEntry
(
vTypes
,
Type
);
Vec_
Wrd_t
*
vOccur
=
(
Vec_Wrd_t
*
)
Vec_Ptr
Entry
(
vOccurs
,
Type
);
Vec_
WrdSelectSortCost2
(
Vec_WrdArray
(
vType
),
Vec_WrdSize
(
vType
),
Vec_Wrd
Array
(
vOccur
)
);
Vec_
Wrd
ReverseOrder
(
vType
);
Vec_
Wrd
ReverseOrder
(
vOccur
);
}
void
Wlc_NtkPrintDistrib
(
Wlc_Ntk_t
*
p
,
int
fVerbose
)
{
Wlc_Obj_t
*
pObj
;
int
i
,
k
,
Sign
,
s
,
s0
,
s1
;
Vec_Wec_t
*
vTypes
,
*
vOccurs
;
vTypes
=
Vec_WecStart
(
WLC_OBJ_NUMBER
);
vOccurs
=
Vec_WecStart
(
WLC_OBJ_NUMBER
);
Vec_Ptr_t
*
vTypes
,
*
vOccurs
;
word
Sign
;
int
i
,
k
,
s
,
s0
,
s1
;
// allocate statistics arrays
vTypes
=
Vec_PtrStart
(
WLC_OBJ_NUMBER
);
vOccurs
=
Vec_PtrStart
(
WLC_OBJ_NUMBER
);
for
(
i
=
0
;
i
<
WLC_OBJ_NUMBER
;
i
++
)
Vec_PtrWriteEntry
(
vTypes
,
i
,
Vec_WrdAlloc
(
16
)
);
for
(
i
=
0
;
i
<
WLC_OBJ_NUMBER
;
i
++
)
Vec_PtrWriteEntry
(
vOccurs
,
i
,
Vec_WrdAlloc
(
16
)
);
// add nodes
Wlc_NtkForEachObj
(
p
,
pObj
,
i
)
{
// char * pName = Wlc_ObjName(p, i);
// if ( pObj->Type == WLC_OBJ_ARI_MULTI )
if
(
Wlc_ObjSign
(
pObj
)
>
0x3FF
)
printf
(
"Object %d has range %d, which is reduced to %d in the statistics.
\n
"
,
i
,
Wlc_ObjRange
(
pObj
),
Wlc_ObjRange
(
pObj
)
&
0x1FF
);
if
(
Wlc_ObjSign
(
pObj
)
>
0x1FFFFF
)
printf
(
"Object %6d has range %d, which is reduced to %d in the statistics.
\n
"
,
i
,
Wlc_ObjRange
(
pObj
),
Wlc_ObjRange
(
pObj
)
&
0xFFFFF
);
if
(
pObj
->
Beg
)
printf
(
"Object %6d has non-standard range %d=[%d:%d]
\n
"
,
i
,
Wlc_ObjRange
(
pObj
),
pObj
->
End
,
pObj
->
Beg
);
// 0-input types
if
(
pObj
->
Type
==
WLC_OBJ_PI
||
pObj
->
Type
==
WLC_OBJ_CONST
||
pObj
->
Type
==
WLC_OBJ_BIT_CONCAT
)
Sign
=
Wlc_NtkPrintDistribMakeSign
(
Wlc_ObjSign
(
pObj
),
0
,
0
);
...
...
@@ -275,19 +296,22 @@ void Wlc_NtkPrintDistrib( Wlc_Ntk_t * p, int fVerbose )
Wlc_NtkPrintDistribAddOne
(
vTypes
,
vOccurs
,
pObj
->
Type
,
Sign
);
}
// print by occurrence
printf
(
"Format: type ID : occurance name ... (occurrence)<output_range>=<input_range>.<input_range>
\n
"
);
for
(
i
=
0
;
i
<
WLC_OBJ_NUMBER
;
i
++
)
{
Vec_
Int_t
*
vType
=
Vec_Wec
Entry
(
vTypes
,
i
);
Vec_
Int_t
*
vOccur
=
Vec_Wec
Entry
(
vOccurs
,
i
);
Vec_
Wrd_t
*
vType
=
(
Vec_Wrd_t
*
)
Vec_Ptr
Entry
(
vTypes
,
i
);
Vec_
Wrd_t
*
vOccur
=
(
Vec_Wrd_t
*
)
Vec_Ptr
Entry
(
vOccurs
,
i
);
if
(
p
->
nObjs
[
i
]
==
0
)
continue
;
printf
(
"%2d : %6d %-8s "
,
i
,
p
->
nObjs
[
i
],
Wlc_Names
[
i
]
);
// sort by occurence
Wlc_NtkPrintDistribSortOne
(
vTypes
,
vOccurs
,
i
);
Vec_
Int
ForEachEntry
(
vType
,
Sign
,
k
)
Vec_
Wrd
ForEachEntry
(
vType
,
Sign
,
k
)
{
Wlc_NtkPrintDistribFromSign
(
Sign
,
&
s
,
&
s0
,
&
s1
);
printf
(
"(%d)"
,
Vec_IntEntry
(
vOccur
,
k
)
);
if
(
((
k
%
8
)
==
7
&&
s1
)
||
((
k
%
10
)
==
9
&&
!
s1
)
)
printf
(
"
\n
"
);
printf
(
"(%d)"
,
(
int
)
Vec_WrdEntry
(
vOccur
,
k
)
);
printf
(
"%s%d"
,
Abc_LitIsCompl
(
s
)
?
"-"
:
""
,
Abc_Lit2Var
(
s
)
);
if
(
s0
)
printf
(
"=%s%d"
,
Abc_LitIsCompl
(
s0
)
?
"-"
:
""
,
Abc_Lit2Var
(
s0
)
);
...
...
@@ -297,8 +321,8 @@ void Wlc_NtkPrintDistrib( Wlc_Ntk_t * p, int fVerbose )
}
printf
(
"
\n
"
);
}
Vec_
WecFree
(
vTypes
);
Vec_
WecFree
(
vOccurs
);
Vec_
VecFree
(
(
Vec_Vec_t
*
)
vTypes
);
Vec_
VecFree
(
(
Vec_Vec_t
*
)
vOccurs
);
}
void
Wlc_NtkPrintNodes
(
Wlc_Ntk_t
*
p
,
int
Type
)
{
...
...
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