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
bc1eae79
Commit
bc1eae79
authored
Sep 29, 2015
by
Alan Mishchenko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Experiments with LUT structure mapping.
parent
d4d1ae98
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
36 deletions
+17
-36
src/aig/gia/giaOf.c
+17
-36
No files found.
src/aig/gia/giaOf.c
View file @
bc1eae79
...
@@ -37,7 +37,7 @@ ABC_NAMESPACE_IMPL_START
...
@@ -37,7 +37,7 @@ ABC_NAMESPACE_IMPL_START
#define OF_LEAF_MAX 6
#define OF_LEAF_MAX 6
#define OF_CUT_MAX 32
#define OF_CUT_MAX 32
#define OF_NO_LEAF 31
#define OF_NO_LEAF 31
#define OF_NO_FUNC 0x
3
FFFFFF
#define OF_NO_FUNC 0x
7
FFFFFF
#define OF_INFINITY FLT_MAX
#define OF_INFINITY FLT_MAX
#define OF_CUT_EXTRA 4 // size; delay1, delay2; area
#define OF_CUT_EXTRA 4 // size; delay1, delay2; area
...
@@ -47,8 +47,7 @@ struct Of_Cut_t_
...
@@ -47,8 +47,7 @@ struct Of_Cut_t_
word
Sign
;
// signature
word
Sign
;
// signature
int
Delay
;
// delay
int
Delay
;
// delay
int
Flow
;
// flow
int
Flow
;
// flow
unsigned
iFunc
:
26
;
// function (OF_NO_FUNC)
unsigned
iFunc
:
27
;
// function (OF_NO_FUNC)
unsigned
Useless
:
1
;
// function
unsigned
nLeaves
:
5
;
// leaf number (OF_NO_LEAF)
unsigned
nLeaves
:
5
;
// leaf number (OF_NO_LEAF)
int
pLeaves
[
OF_LEAF_MAX
+
1
];
// leaves
int
pLeaves
[
OF_LEAF_MAX
+
1
];
// leaves
};
};
...
@@ -82,7 +81,6 @@ struct Of_Man_t_
...
@@ -82,7 +81,6 @@ struct Of_Man_t_
// statistics
// statistics
abctime
clkStart
;
// starting time
abctime
clkStart
;
// starting time
double
CutCount
[
6
];
// cut counts
double
CutCount
[
6
];
// cut counts
int
nCutUseAll
;
// objects with useful cuts
};
};
#define OF_NUM 10
#define OF_NUM 10
...
@@ -341,7 +339,6 @@ static inline int Of_CutCreateUnit( Of_Cut_t * p, int i )
...
@@ -341,7 +339,6 @@ static inline int Of_CutCreateUnit( Of_Cut_t * p, int i )
p
->
iFunc
=
2
;
p
->
iFunc
=
2
;
p
->
nLeaves
=
1
;
p
->
nLeaves
=
1
;
p
->
pLeaves
[
0
]
=
i
;
p
->
pLeaves
[
0
]
=
i
;
p
->
Useless
=
0
;
p
->
Sign
=
((
word
)
1
)
<<
(
i
&
0x3F
);
p
->
Sign
=
((
word
)
1
)
<<
(
i
&
0x3F
);
return
1
;
return
1
;
}
}
...
@@ -353,8 +350,8 @@ static inline void Of_Cutprintf( Of_Man_t * p, Of_Cut_t * pCut )
...
@@ -353,8 +350,8 @@ static inline void Of_Cutprintf( Of_Man_t * p, Of_Cut_t * pCut )
printf
(
" %*d"
,
nDigits
,
pCut
->
pLeaves
[
i
]
);
printf
(
" %*d"
,
nDigits
,
pCut
->
pLeaves
[
i
]
);
for
(
;
i
<
(
int
)
p
->
pPars
->
nLutSize
;
i
++
)
for
(
;
i
<
(
int
)
p
->
pPars
->
nLutSize
;
i
++
)
printf
(
" %*s"
,
nDigits
,
" "
);
printf
(
" %*s"
,
nDigits
,
" "
);
printf
(
" }
Useless = %d. D = %4d A = %9.4f
F = %6d "
,
printf
(
" }
D = %4d A = %9d
F = %6d "
,
pCut
->
Useless
,
pCut
->
Delay
,
pCut
->
Flow
,
pCut
->
iFunc
);
pCut
->
Delay
,
pCut
->
Flow
,
pCut
->
iFunc
);
if
(
p
->
vTtMem
)
if
(
p
->
vTtMem
)
Dau_DsdPrintFromTruth
(
Vec_MemReadEntry
(
p
->
vTtMem
,
Abc_Lit2Var
(
pCut
->
iFunc
)),
pCut
->
nLeaves
);
Dau_DsdPrintFromTruth
(
Vec_MemReadEntry
(
p
->
vTtMem
,
Abc_Lit2Var
(
pCut
->
iFunc
)),
pCut
->
nLeaves
);
else
else
...
@@ -382,37 +379,28 @@ static inline int Of_ManPrepareCuts( Of_Cut_t * pCuts, Of_Man_t * p, int iObj, i
...
@@ -382,37 +379,28 @@ static inline int Of_ManPrepareCuts( Of_Cut_t * pCuts, Of_Man_t * p, int iObj, i
}
}
return
Of_CutCreateUnit
(
pCuts
,
iObj
);
return
Of_CutCreateUnit
(
pCuts
,
iObj
);
}
}
static
inline
int
Of_ManSaveCuts
(
Of_Man_t
*
p
,
Of_Cut_t
**
pCuts
,
int
nCuts
,
int
fUseful
)
static
inline
int
Of_ManSaveCuts
(
Of_Man_t
*
p
,
Of_Cut_t
**
pCuts
,
int
nCuts
)
{
{
int
i
,
*
pPlace
,
iCur
,
nInts
=
1
,
nCutsNew
=
0
;
int
i
,
*
pPlace
,
iCur
,
nInts
=
1
,
nCutsNew
=
0
;
for
(
i
=
0
;
i
<
nCuts
;
i
++
)
for
(
i
=
0
;
i
<
nCuts
;
i
++
)
if
(
!
fUseful
||
!
pCuts
[
i
]
->
Useless
)
nInts
+=
pCuts
[
i
]
->
nLeaves
+
OF_CUT_EXTRA
,
nCutsNew
++
;
nInts
+=
pCuts
[
i
]
->
nLeaves
+
OF_CUT_EXTRA
,
nCutsNew
++
;
if
(
(
p
->
iCur
&
0xFFFF
)
+
nInts
>
0xFFFF
)
if
(
(
p
->
iCur
&
0xFFFF
)
+
nInts
>
0xFFFF
)
p
->
iCur
=
((
p
->
iCur
>>
16
)
+
1
)
<<
16
;
p
->
iCur
=
((
p
->
iCur
>>
16
)
+
1
)
<<
16
;
if
(
Vec_PtrSize
(
&
p
->
vPages
)
==
(
p
->
iCur
>>
16
)
)
if
(
Vec_PtrSize
(
&
p
->
vPages
)
==
(
p
->
iCur
>>
16
)
)
Vec_PtrPush
(
&
p
->
vPages
,
ABC_ALLOC
(
int
,
(
1
<<
16
))
);
Vec_PtrPush
(
&
p
->
vPages
,
ABC_
C
ALLOC
(
int
,
(
1
<<
16
))
);
iCur
=
p
->
iCur
;
p
->
iCur
+=
nInts
;
iCur
=
p
->
iCur
;
p
->
iCur
+=
nInts
;
pPlace
=
Of_ManCutSet
(
p
,
iCur
);
pPlace
=
Of_ManCutSet
(
p
,
iCur
);
*
pPlace
++
=
nCutsNew
;
*
pPlace
++
=
nCutsNew
;
for
(
i
=
0
;
i
<
nCuts
;
i
++
)
for
(
i
=
0
;
i
<
nCuts
;
i
++
)
if
(
!
fUseful
||
!
pCuts
[
i
]
->
Useless
)
{
{
*
pPlace
++
=
Of_CutSetBoth
(
pCuts
[
i
]
->
nLeaves
,
pCuts
[
i
]
->
iFunc
);
*
pPlace
++
=
Of_CutSetBoth
(
pCuts
[
i
]
->
nLeaves
,
pCuts
[
i
]
->
iFunc
);
memcpy
(
pPlace
,
pCuts
[
i
]
->
pLeaves
,
sizeof
(
int
)
*
pCuts
[
i
]
->
nLeaves
);
memcpy
(
pPlace
,
pCuts
[
i
]
->
pLeaves
,
sizeof
(
int
)
*
pCuts
[
i
]
->
nLeaves
);
pPlace
+=
pCuts
[
i
]
->
nLeaves
;
pPlace
+=
pCuts
[
i
]
->
nLeaves
;
memset
(
pPlace
,
0xFF
,
sizeof
(
int
)
*
(
OF_CUT_EXTRA
-
1
)
);
memset
(
pPlace
,
0xFF
,
sizeof
(
int
)
*
(
OF_CUT_EXTRA
-
1
)
);
pPlace
+=
OF_CUT_EXTRA
-
1
;
pPlace
+=
OF_CUT_EXTRA
-
1
;
}
}
return
iCur
;
return
iCur
;
}
}
static
inline
int
Of_ManCountUseful
(
Of_Cut_t
**
pCuts
,
int
nCuts
)
{
int
i
,
Count
=
0
;
for
(
i
=
0
;
i
<
nCuts
;
i
++
)
Count
+=
!
pCuts
[
i
]
->
Useless
;
return
Count
;
}
static
inline
void
Of_ManLiftCuts
(
Of_Man_t
*
p
,
int
iObj
)
static
inline
void
Of_ManLiftCuts
(
Of_Man_t
*
p
,
int
iObj
)
{
{
int
i
,
k
,
*
pCut
,
*
pList
=
Of_ObjCutSet
(
p
,
iObj
);
int
i
,
k
,
*
pCut
,
*
pList
=
Of_ObjCutSet
(
p
,
iObj
);
...
@@ -640,8 +628,6 @@ static inline int Of_SetLastCutContainsArea( Of_Cut_t ** pCuts, int nCuts )
...
@@ -640,8 +628,6 @@ static inline int Of_SetLastCutContainsArea( Of_Cut_t ** pCuts, int nCuts )
}
}
static
inline
int
Of_CutCompareArea
(
Of_Cut_t
*
pCut0
,
Of_Cut_t
*
pCut1
)
static
inline
int
Of_CutCompareArea
(
Of_Cut_t
*
pCut0
,
Of_Cut_t
*
pCut1
)
{
{
if
(
pCut0
->
Useless
<
pCut1
->
Useless
)
return
-
1
;
if
(
pCut0
->
Useless
>
pCut1
->
Useless
)
return
1
;
if
(
pCut0
->
Delay
<
pCut1
->
Delay
)
return
-
1
;
if
(
pCut0
->
Delay
<
pCut1
->
Delay
)
return
-
1
;
if
(
pCut0
->
Delay
>
pCut1
->
Delay
)
return
1
;
if
(
pCut0
->
Delay
>
pCut1
->
Delay
)
return
1
;
if
(
pCut0
->
Flow
<
pCut1
->
Flow
)
return
-
1
;
if
(
pCut0
->
Flow
<
pCut1
->
Flow
)
return
-
1
;
...
@@ -701,7 +687,7 @@ void Of_ObjMergeOrder( Of_Man_t * p, int iObj )
...
@@ -701,7 +687,7 @@ void Of_ObjMergeOrder( Of_Man_t * p, int iObj )
int
fComp1
=
Gia_ObjFaninC1
(
pObj
);
int
fComp1
=
Gia_ObjFaninC1
(
pObj
);
int
iSibl
=
Gia_ObjSibl
(
p
->
pGia
,
iObj
);
int
iSibl
=
Gia_ObjSibl
(
p
->
pGia
,
iObj
);
Of_Cut_t
*
pCut0
,
*
pCut1
,
*
pCut0Lim
=
pCuts0
+
nCuts0
,
*
pCut1Lim
=
pCuts1
+
nCuts1
;
Of_Cut_t
*
pCut0
,
*
pCut1
,
*
pCut0Lim
=
pCuts0
+
nCuts0
,
*
pCut1Lim
=
pCuts1
+
nCuts1
;
int
i
,
nCuts
Use
,
nCuts
R
=
0
;
int
i
,
nCutsR
=
0
;
assert
(
!
Gia_ObjIsBuf
(
pObj
)
);
assert
(
!
Gia_ObjIsBuf
(
pObj
)
);
for
(
i
=
0
;
i
<
nCutNum
;
i
++
)
for
(
i
=
0
;
i
<
nCutNum
;
i
++
)
pCutsR
[
i
]
=
pCuts
+
i
;
pCutsR
[
i
]
=
pCuts
+
i
;
...
@@ -769,10 +755,8 @@ void Of_ObjMergeOrder( Of_Man_t * p, int iObj )
...
@@ -769,10 +755,8 @@ void Of_ObjMergeOrder( Of_Man_t * p, int iObj )
}
}
// debug printout
// debug printout
if
(
0
)
if
(
0
)
// if ( iObj % 10000 == 0 )
// if ( iObj == 1090 )
{
{
printf
(
"*** Obj = %d
Useful = %d
\n
"
,
iObj
,
Of_ManCountUseful
(
pCutsR
,
nCutsR
)
);
printf
(
"*** Obj = %d
\n
"
,
iObj
);
for
(
i
=
0
;
i
<
nCutsR
;
i
++
)
for
(
i
=
0
;
i
<
nCutsR
;
i
++
)
Of_Cutprintf
(
p
,
pCutsR
[
i
]
);
Of_Cutprintf
(
p
,
pCutsR
[
i
]
);
printf
(
"
\n
"
);
printf
(
"
\n
"
);
...
@@ -783,11 +767,8 @@ void Of_ObjMergeOrder( Of_Man_t * p, int iObj )
...
@@ -783,11 +767,8 @@ void Of_ObjMergeOrder( Of_Man_t * p, int iObj )
// store the cutset
// store the cutset
Of_ObjSetCutFlow
(
p
,
iObj
,
pCutsR
[
0
]
->
Flow
);
Of_ObjSetCutFlow
(
p
,
iObj
,
pCutsR
[
0
]
->
Flow
);
Of_ObjSetCutDelay
(
p
,
iObj
,
pCutsR
[
0
]
->
Delay
);
Of_ObjSetCutDelay
(
p
,
iObj
,
pCutsR
[
0
]
->
Delay
);
*
Vec_IntEntryP
(
&
p
->
vCutSets
,
iObj
)
=
Of_ManSaveCuts
(
p
,
pCutsR
,
nCutsR
,
0
);
*
Vec_IntEntryP
(
&
p
->
vCutSets
,
iObj
)
=
Of_ManSaveCuts
(
p
,
pCutsR
,
nCutsR
);
p
->
CutCount
[
3
]
+=
nCutsR
;
p
->
CutCount
[
3
]
+=
nCutsR
;
nCutsUse
=
Of_ManCountUseful
(
pCutsR
,
nCutsR
);
p
->
CutCount
[
4
]
+=
nCutsUse
;
p
->
nCutUseAll
+=
nCutsUse
==
nCutsR
;
}
}
void
Of_ManComputeCuts
(
Of_Man_t
*
p
)
void
Of_ManComputeCuts
(
Of_Man_t
*
p
)
{
{
...
...
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