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
f787e75b
Commit
f787e75b
authored
Sep 25, 2013
by
Alan Mishchenko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improving DAG-aware unmapping.
parent
53165710
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
79 additions
and
9 deletions
+79
-9
src/aig/gia/giaShrink7.c
+73
-5
src/misc/vec/vecHsh4.h
+6
-4
No files found.
src/aig/gia/giaShrink7.c
View file @
f787e75b
...
@@ -76,7 +76,7 @@ Unm_Man_t * Unm_ManAlloc( Gia_Man_t * pGia )
...
@@ -76,7 +76,7 @@ Unm_Man_t * Unm_ManAlloc( Gia_Man_t * pGia )
Gia_ManIncrementTravId
(
p
->
pNew
);
Gia_ManIncrementTravId
(
p
->
pNew
);
p
->
pNew
->
nObjs
=
1
;
p
->
pNew
->
nObjs
=
1
;
// start hashing
// start hashing
p
->
pHash
=
Hsh_Int4ManStart
(
10
);
p
->
pHash
=
Hsh_Int4ManStart
(
10
00
);
// truth tables
// truth tables
p
->
vTruths
=
Vec_WrdStart
(
Gia_ManObjNum
(
pGia
)
);
p
->
vTruths
=
Vec_WrdStart
(
Gia_ManObjNum
(
pGia
)
);
p
->
vLeaves
=
Vec_IntStart
(
10
);
p
->
vLeaves
=
Vec_IntStart
(
10
);
...
@@ -103,7 +103,7 @@ Gia_Man_t * Unm_ManFree( Unm_Man_t * p )
...
@@ -103,7 +103,7 @@ Gia_Man_t * Unm_ManFree( Unm_Man_t * p )
/**Function*************************************************************
/**Function*************************************************************
Synopsis []
Synopsis [
Computes truth tables for all LUTs.
]
Description []
Description []
...
@@ -130,14 +130,81 @@ void Unm_ManComputeTruths( Unm_Man_t * p )
...
@@ -130,14 +130,81 @@ void Unm_ManComputeTruths( Unm_Man_t * p )
// compute truth table
// compute truth table
uTruth
=
Shr_ManComputeTruth6
(
p
->
pGia
,
pObj
,
p
->
vLeaves
,
vTruths2
);
uTruth
=
Shr_ManComputeTruth6
(
p
->
pGia
,
pObj
,
p
->
vLeaves
,
vTruths2
);
Vec_WrdWriteEntry
(
p
->
vTruths
,
i
,
uTruth
);
Vec_WrdWriteEntry
(
p
->
vTruths
,
i
,
uTruth
);
if
(
i
%
100
==
0
)
//
if ( i % 100 == 0 )
Kit_DsdPrintFromTruth
(
(
unsigned
*
)
&
uTruth
,
6
),
printf
(
"
\n
"
);
//
Kit_DsdPrintFromTruth( (unsigned *)&uTruth, 6 ), printf( "\n" );
}
}
Vec_WrdFreeP
(
&
vTruths2
);
Vec_WrdFreeP
(
&
vTruths2
);
}
}
/**Function*************************************************************
/**Function*************************************************************
Synopsis [Computes information about node pairs.]
Description []
SideEffects []
SeeAlso []
***********************************************************************/
int
Unm_ManPrintPairStats
(
Unm_Man_t
*
p
)
{
int
i
,
Num
,
nRefs
,
nPairs
=
0
,
nTotal
=
0
,
Counter
[
51
]
=
{
0
};
Num
=
Hsh_Int4ManEntryNum
(
p
->
pHash
);
for
(
i
=
1
;
i
<=
Num
;
i
++
)
{
nRefs
=
Abc_MinInt
(
50
,
Hsh_Int4ObjRes
(
p
->
pHash
,
i
)
);
nTotal
+=
nRefs
;
Counter
[
nRefs
]
++
;
nPairs
+=
(
nRefs
>
1
);
// printf( "(%c, %c) %d\n", 'a' + Hsh_Int4ObjData0(p->pHash, i)-1, 'a' + Hsh_Int4ObjData1(p->pHash, i)-1, nRefs );
// printf( "(%4d, %4d) %d\n", Hsh_Int4ObjData0(p->pHash, i), Hsh_Int4ObjData1(p->pHash, i), nRefs );
}
for
(
i
=
0
;
i
<
51
;
i
++
)
if
(
Counter
[
i
]
>
0
)
printf
(
"%3d : %7d %7.2f %%
\n
"
,
i
,
Counter
[
i
],
100
.
0
*
Counter
[
i
]
*
i
/
nTotal
);
return
nPairs
;
}
void
Unm_ManComputePairs
(
Unm_Man_t
*
p
)
{
Gia_Obj_t
*
pObj
;
int
i
,
k
,
j
,
FanK
,
FanJ
,
Num
;
word
Total
=
0
,
Pairs
=
0
,
Pairs2
=
0
;
Gia_ManSetRefsMapped
(
p
->
pGia
);
Gia_ManForEachLut
(
p
->
pGia
,
i
)
{
Total
+=
Gia_ObjLutSize
(
p
->
pGia
,
i
)
*
(
Gia_ObjLutSize
(
p
->
pGia
,
i
)
-
1
)
/
2
;
pObj
=
Gia_ManObj
(
p
->
pGia
,
i
);
// collect leaves of this gate
Vec_IntClear
(
p
->
vLeaves
);
Gia_LutForEachFanin
(
p
->
pGia
,
i
,
Num
,
k
)
if
(
Gia_ObjRefNumId
(
p
->
pGia
,
Num
)
>
1
)
Vec_IntPush
(
p
->
vLeaves
,
Num
);
if
(
Vec_IntSize
(
p
->
vLeaves
)
<
2
)
continue
;
Pairs
+=
Vec_IntSize
(
p
->
vLeaves
)
*
(
Vec_IntSize
(
p
->
vLeaves
)
-
1
)
/
2
;
// enumerate pairs
Vec_IntForEachEntry
(
p
->
vLeaves
,
FanK
,
k
)
Vec_IntForEachEntryStart
(
p
->
vLeaves
,
FanJ
,
j
,
k
+
1
)
{
if
(
FanK
>
FanJ
)
ABC_SWAP
(
int
,
FanK
,
FanJ
);
Num
=
Hsh_Int4ManInsert
(
p
->
pHash
,
FanK
,
FanJ
,
0
);
Hsh_Int4ObjInc
(
p
->
pHash
,
Num
);
}
}
Total
=
Abc_MaxWord
(
Total
,
1
);
Pairs2
=
Unm_ManPrintPairStats
(
p
);
printf
(
"Total = %8d Pairs = %8d %7.2f %% Pairs2 = %8d %7.2f %%
\n
"
,
(
int
)
Total
,
(
int
)
Pairs
,
100
.
0
*
(
int
)
Pairs
/
(
int
)
Total
,
(
int
)
Pairs2
,
100
.
0
*
(
int
)
Pairs2
/
(
int
)
Total
);
// print statistics
}
/**Function*************************************************************
Synopsis []
Synopsis []
Description []
Description []
...
@@ -151,7 +218,8 @@ Gia_Man_t * Unm_ManTest( Gia_Man_t * pGia )
...
@@ -151,7 +218,8 @@ Gia_Man_t * Unm_ManTest( Gia_Man_t * pGia )
{
{
Unm_Man_t
*
p
;
Unm_Man_t
*
p
;
p
=
Unm_ManAlloc
(
pGia
);
p
=
Unm_ManAlloc
(
pGia
);
Unm_ManComputeTruths
(
p
);
// Unm_ManComputeTruths( p );
Unm_ManComputePairs
(
p
);
Abc_PrintTime
(
1
,
"Time"
,
Abc_Clock
()
-
p
->
clkStart
);
Abc_PrintTime
(
1
,
"Time"
,
Abc_Clock
()
-
p
->
clkStart
);
return
Unm_ManFree
(
p
);
return
Unm_ManFree
(
p
);
}
}
...
...
src/misc/vec/vecHsh4.h
View file @
f787e75b
...
@@ -60,6 +60,8 @@ struct Hsh_Int4Man_t_
...
@@ -60,6 +60,8 @@ struct Hsh_Int4Man_t_
////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////
static
inline
Hsh_Int4Obj_t
*
Hsh_Int4Obj
(
Hsh_Int4Man_t
*
p
,
int
iObj
)
{
return
iObj
?
(
Hsh_Int4Obj_t
*
)
Vec_IntEntryP
(
p
->
vObjs
,
4
*
iObj
)
:
NULL
;
}
static
inline
Hsh_Int4Obj_t
*
Hsh_Int4Obj
(
Hsh_Int4Man_t
*
p
,
int
iObj
)
{
return
iObj
?
(
Hsh_Int4Obj_t
*
)
Vec_IntEntryP
(
p
->
vObjs
,
4
*
iObj
)
:
NULL
;
}
static
inline
int
Hsh_Int4ObjData0
(
Hsh_Int4Man_t
*
p
,
int
i
)
{
return
Hsh_Int4Obj
(
p
,
i
)
->
iData0
;
}
static
inline
int
Hsh_Int4ObjData1
(
Hsh_Int4Man_t
*
p
,
int
i
)
{
return
Hsh_Int4Obj
(
p
,
i
)
->
iData1
;
}
static
inline
int
Hsh_Int4ObjRes
(
Hsh_Int4Man_t
*
p
,
int
i
)
{
return
Hsh_Int4Obj
(
p
,
i
)
->
iRes
;
}
static
inline
int
Hsh_Int4ObjRes
(
Hsh_Int4Man_t
*
p
,
int
i
)
{
return
Hsh_Int4Obj
(
p
,
i
)
->
iRes
;
}
static
inline
void
Hsh_Int4ObjInc
(
Hsh_Int4Man_t
*
p
,
int
i
)
{
Hsh_Int4Obj
(
p
,
i
)
->
iRes
++
;
}
static
inline
void
Hsh_Int4ObjInc
(
Hsh_Int4Man_t
*
p
,
int
i
)
{
Hsh_Int4Obj
(
p
,
i
)
->
iRes
++
;
}
static
inline
void
Hsh_Int4ObjDec
(
Hsh_Int4Man_t
*
p
,
int
i
)
{
Hsh_Int4Obj
(
p
,
i
)
->
iRes
--
;
}
static
inline
void
Hsh_Int4ObjDec
(
Hsh_Int4Man_t
*
p
,
int
i
)
{
Hsh_Int4Obj
(
p
,
i
)
->
iRes
--
;
}
...
@@ -112,7 +114,7 @@ static inline int Hsh_Int4ManEntryNum( Hsh_Int4Man_t * p )
...
@@ -112,7 +114,7 @@ static inline int Hsh_Int4ManEntryNum( Hsh_Int4Man_t * p )
***********************************************************************/
***********************************************************************/
static
inline
int
Hsh_Int4ManHash
(
int
iData0
,
int
iData1
,
int
nTableSize
)
static
inline
int
Hsh_Int4ManHash
(
int
iData0
,
int
iData1
,
int
nTableSize
)
{
{
return
(
4177
*
iData0
+
7873
*
iData1
)
%
nTableSize
;
return
(
4177
*
(
unsigned
)
iData0
+
7873
*
(
unsigned
)
iData1
)
%
(
unsigned
)
nTableSize
;
}
}
static
inline
int
*
Hsh_Int4ManLookup
(
Hsh_Int4Man_t
*
p
,
int
iData0
,
int
iData1
)
static
inline
int
*
Hsh_Int4ManLookup
(
Hsh_Int4Man_t
*
p
,
int
iData0
,
int
iData1
)
{
{
...
@@ -141,6 +143,7 @@ static inline int Hsh_Int4ManInsert( Hsh_Int4Man_t * p, int iData0, int iData1,
...
@@ -141,6 +143,7 @@ static inline int Hsh_Int4ManInsert( Hsh_Int4Man_t * p, int iData0, int iData1,
nObjs
=
Vec_IntSize
(
p
->
vObjs
)
/
4
;
nObjs
=
Vec_IntSize
(
p
->
vObjs
)
/
4
;
if
(
nObjs
>
Vec_IntSize
(
p
->
vTable
)
)
if
(
nObjs
>
Vec_IntSize
(
p
->
vTable
)
)
{
{
// printf( "Resizing...\n" );
Vec_IntFill
(
p
->
vTable
,
Abc_PrimeCudd
(
2
*
Vec_IntSize
(
p
->
vTable
)),
0
);
Vec_IntFill
(
p
->
vTable
,
Abc_PrimeCudd
(
2
*
Vec_IntSize
(
p
->
vTable
)),
0
);
for
(
i
=
1
;
i
<
nObjs
;
i
++
)
for
(
i
=
1
;
i
<
nObjs
;
i
++
)
{
{
...
@@ -153,14 +156,13 @@ static inline int Hsh_Int4ManInsert( Hsh_Int4Man_t * p, int iData0, int iData1,
...
@@ -153,14 +156,13 @@ static inline int Hsh_Int4ManInsert( Hsh_Int4Man_t * p, int iData0, int iData1,
}
}
pPlace
=
Hsh_Int4ManLookup
(
p
,
iData0
,
iData1
);
pPlace
=
Hsh_Int4ManLookup
(
p
,
iData0
,
iData1
);
if
(
*
pPlace
)
if
(
*
pPlace
)
return
0
;
return
*
pPlace
;
assert
(
*
pPlace
==
0
);
*
pPlace
=
nObjs
;
*
pPlace
=
nObjs
;
Vec_IntPush
(
p
->
vObjs
,
iData0
);
Vec_IntPush
(
p
->
vObjs
,
iData0
);
Vec_IntPush
(
p
->
vObjs
,
iData1
);
Vec_IntPush
(
p
->
vObjs
,
iData1
);
Vec_IntPush
(
p
->
vObjs
,
iRes
);
Vec_IntPush
(
p
->
vObjs
,
iRes
);
Vec_IntPush
(
p
->
vObjs
,
0
);
Vec_IntPush
(
p
->
vObjs
,
0
);
return
1
;
return
nObjs
;
}
}
/**Function*************************************************************
/**Function*************************************************************
...
...
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