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
b01b47e5
Commit
b01b47e5
authored
Sep 28, 2015
by
Alan Mishchenko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Experiments with LUT structure mapping.
parent
ac6066dc
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
42 additions
and
16 deletions
+42
-16
src/aig/gia/giaOf.c
+42
-16
No files found.
src/aig/gia/giaOf.c
View file @
b01b47e5
...
@@ -137,8 +137,8 @@ static inline void Of_ObjUpdateRequired( Of_Man_t * p,int i, int x )
...
@@ -137,8 +137,8 @@ static inline void Of_ObjUpdateRequired( Of_Man_t * p,int i, int x )
static
inline
int
Of_ObjRefInc
(
Of_Man_t
*
p
,
int
i
)
{
return
Of_ObjData
(
p
,
i
)
->
nRefs
++
;
}
static
inline
int
Of_ObjRefInc
(
Of_Man_t
*
p
,
int
i
)
{
return
Of_ObjData
(
p
,
i
)
->
nRefs
++
;
}
static
inline
int
Of_ObjRefDec
(
Of_Man_t
*
p
,
int
i
)
{
return
--
Of_ObjData
(
p
,
i
)
->
nRefs
;
}
static
inline
int
Of_ObjRefDec
(
Of_Man_t
*
p
,
int
i
)
{
return
--
Of_ObjData
(
p
,
i
)
->
nRefs
;
}
static
inline
int
*
Of_ObjCutBestP
(
Of_Man_t
*
p
,
int
*
pCutSet
,
int
iObj
)
{
return
Of_ObjCutBest
(
p
,
iObj
)
?
Of_CutFromHandle
(
pCutSet
,
Of_ObjCutBest
(
p
,
iObj
))
:
NULL
;
}
static
inline
int
*
Of_ObjCutBestP
(
Of_Man_t
*
p
,
int
*
pCutSet
,
int
iObj
)
{
assert
(
iObj
>
0
&&
iObj
<
Gia_ManObjNum
(
p
->
pGia
));
return
Of_ObjCutBest
(
p
,
iObj
)
?
Of_CutFromHandle
(
pCutSet
,
Of_ObjCutBest
(
p
,
iObj
))
:
NULL
;
}
static
inline
void
Of_ObjSetCutBestP
(
Of_Man_t
*
p
,
int
*
pCutSet
,
int
iObj
,
int
*
pCut
)
{
Of_ObjSetCutBest
(
p
,
iObj
,
Of_CutHandle
(
pCutSet
,
pCut
)
);
}
static
inline
void
Of_ObjSetCutBestP
(
Of_Man_t
*
p
,
int
*
pCutSet
,
int
iObj
,
int
*
pCut
)
{
Of_ObjSetCutBest
(
p
,
iObj
,
Of_CutHandle
(
pCutSet
,
pCut
)
);
/*printf( "Setting obj %d with cut %d.\n", iObj, Of_CutHandle(pCutSet, pCut));*/
}
#define Of_SetForEachCut( pList, pCut, i ) for ( i = 0, pCut = pList + 1; i < pList[0]; i++, pCut += Of_CutSize(pCut) + OF_CUT_EXTRA )
#define Of_SetForEachCut( pList, pCut, i ) for ( i = 0, pCut = pList + 1; i < pList[0]; i++, pCut += Of_CutSize(pCut) + OF_CUT_EXTRA )
#define Of_ObjForEachCut( pCuts, i, nCuts ) for ( i = 0, i < nCuts; i++ )
#define Of_ObjForEachCut( pCuts, i, nCuts ) for ( i = 0, i < nCuts; i++ )
...
@@ -419,6 +419,14 @@ static inline void Of_ManLiftCuts( Of_Man_t * p, int iObj )
...
@@ -419,6 +419,14 @@ static inline void Of_ManLiftCuts( Of_Man_t * p, int iObj )
pCut
[
k
]
=
Abc_Var2Lit
(
pCut
[
k
],
0
);
pCut
[
k
]
=
Abc_Var2Lit
(
pCut
[
k
],
0
);
}
}
}
}
static
inline
void
Of_CutPrint
(
Of_Man_t
*
p
,
int
*
pCut
)
{
int
k
,
iVar
;
printf
(
"Cut with %d inputs and function %3d : { "
,
Of_CutSize
(
pCut
),
Of_CutFunc
(
pCut
)
==
OF_NO_FUNC
?
0
:
Of_CutFunc
(
pCut
)
);
Of_CutForEachVar
(
pCut
,
iVar
,
k
)
printf
(
"%d "
,
iVar
);
printf
(
"}
\n
"
);
}
/**Function*************************************************************
/**Function*************************************************************
...
@@ -966,26 +974,33 @@ static inline int Of_ManComputeForwardCut( Of_Man_t * p, int iObj, int * pCut )
...
@@ -966,26 +974,33 @@ static inline int Of_ManComputeForwardCut( Of_Man_t * p, int iObj, int * pCut )
static
inline
int
Of_ManComputeForwardObj
(
Of_Man_t
*
p
,
int
iObj
)
static
inline
int
Of_ManComputeForwardObj
(
Of_Man_t
*
p
,
int
iObj
)
{
{
int
Delay1
=
ABC_INFINITY
;
int
Delay1
=
ABC_INFINITY
;
int
i
,
*
pCut
,
*
pList
=
Of_ObjCutSet
(
p
,
iObj
);
int
i
,
*
pCut
,
*
p
CutMin
=
NULL
,
*
p
List
=
Of_ObjCutSet
(
p
,
iObj
);
// compute cut arrivals
// compute cut arrivals
Of_SetForEachCut
(
pList
,
pCut
,
i
)
Of_SetForEachCut
(
pList
,
pCut
,
i
)
Delay1
=
Abc_MinInt
(
Delay1
,
Of_ManComputeForwardCut
(
p
,
iObj
,
pCut
)
);
{
int
Delay1This
=
Of_ManComputeForwardCut
(
p
,
iObj
,
pCut
);
if
(
Delay1
>
Delay1This
)
{
Delay1
=
Delay1This
;
pCutMin
=
pCut
;
}
}
// if mapping is present, set object arrival equal to cut arrival
// if mapping is present, set object arrival equal to cut arrival
pCut
=
Of_ObjCutBestP
(
p
,
pList
,
iObj
);
if
(
Of_ObjRefNum
(
p
,
iObj
)
)
if
(
pCut
)
Delay1
=
Of_CutDelay1
(
pCut
);
Delay1
=
Of_CutDelay1
(
Of_ObjCutBestP
(
p
,
pList
,
iObj
)
);
else
Of_ObjSetCutBestP
(
p
,
pList
,
iObj
,
pCutMin
);
Of_ObjSetDelay1
(
p
,
iObj
,
Delay1
);
Of_ObjSetDelay1
(
p
,
iObj
,
Delay1
);
return
Delay1
;
return
Delay1
;
}
}
void
Of_ManComputeForward
(
Of_Man_t
*
p
)
void
Of_ManComputeForward
(
Of_Man_t
*
p
)
{
{
int
Time
=
0
;
Gia_Obj_t
*
pObj
;
int
i
;
Gia_Obj_t
*
pObj
;
int
i
;
Gia_ManForEachAnd
(
p
->
pGia
,
pObj
,
i
)
Gia_ManForEachAnd
(
p
->
pGia
,
pObj
,
i
)
if
(
Gia_ObjIsBuf
(
pObj
)
)
if
(
Gia_ObjIsBuf
(
pObj
)
)
Of_ObjSetDelay1
(
p
,
i
,
Of_ObjDelay1
(
p
,
Gia_ObjFaninId0
(
pObj
,
i
))
);
Of_ObjSetDelay1
(
p
,
i
,
Of_ObjDelay1
(
p
,
Gia_ObjFaninId0
(
pObj
,
i
))
);
else
else
Time
=
Abc_MaxInt
(
Time
,
Of_ManComputeForwardObj
(
p
,
i
)
);
Of_ManComputeForwardObj
(
p
,
i
);
// printf( "Best delay = %.2f\n", Of_Int2Flt(Time) );
}
}
static
inline
int
Of_ManComputeRequired
(
Of_Man_t
*
p
)
static
inline
int
Of_ManComputeRequired
(
Of_Man_t
*
p
)
{
{
...
@@ -1012,17 +1027,19 @@ static inline int Of_ManComputeBackwardCut( Of_Man_t * p, int * pCut )
...
@@ -1012,17 +1027,19 @@ static inline int Of_ManComputeBackwardCut( Of_Man_t * p, int * pCut )
int
Of_CutRef_rec
(
Of_Man_t
*
p
,
int
*
pCut
)
int
Of_CutRef_rec
(
Of_Man_t
*
p
,
int
*
pCut
)
{
{
int
i
,
Var
,
Count
=
Of_CutArea
(
p
,
Of_CutSize
(
pCut
));
int
i
,
Var
,
Count
=
Of_CutArea
(
p
,
Of_CutSize
(
pCut
));
//printf( "Refing " ); Of_CutPrint( p, pCut );
Of_CutForEachVar
(
pCut
,
Var
,
i
)
Of_CutForEachVar
(
pCut
,
Var
,
i
)
if
(
Of_ObjCutBest
(
p
,
Var
)
&&
!
Of_ObjRefInc
(
p
,
Var
)
)
if
(
Of_ObjCutBest
(
p
,
Var
)
&&
!
Of_ObjRefInc
(
p
,
Var
)
)
Count
+=
Of_CutRef_rec
(
p
,
Of_ObjCutBestP
(
p
,
Of_ObjCutSet
(
p
,
i
),
Var
)
);
Count
+=
Of_CutRef_rec
(
p
,
Of_ObjCutBestP
(
p
,
Of_ObjCutSet
(
p
,
Var
),
Var
)
);
return
Count
;
return
Count
;
}
}
int
Of_CutDeref_rec
(
Of_Man_t
*
p
,
int
*
pCut
)
int
Of_CutDeref_rec
(
Of_Man_t
*
p
,
int
*
pCut
)
{
{
int
i
,
Var
,
Count
=
Of_CutArea
(
p
,
Of_CutSize
(
pCut
));
int
i
,
Var
,
Count
=
Of_CutArea
(
p
,
Of_CutSize
(
pCut
));
//printf( "Derefing " ); Of_CutPrint( p, pCut );
Of_CutForEachVar
(
pCut
,
Var
,
i
)
Of_CutForEachVar
(
pCut
,
Var
,
i
)
if
(
Of_ObjCutBest
(
p
,
Var
)
&&
!
Of_ObjRefDec
(
p
,
Var
)
)
if
(
Of_ObjCutBest
(
p
,
Var
)
&&
!
Of_ObjRefDec
(
p
,
Var
)
)
Count
+=
Of_CutDeref_rec
(
p
,
Of_ObjCutBestP
(
p
,
Of_ObjCutSet
(
p
,
i
),
Var
)
);
Count
+=
Of_CutDeref_rec
(
p
,
Of_ObjCutBestP
(
p
,
Of_ObjCutSet
(
p
,
Var
),
Var
)
);
return
Count
;
return
Count
;
}
}
static
inline
int
Of_CutAreaDerefed
(
Of_Man_t
*
p
,
int
*
pCut
)
static
inline
int
Of_CutAreaDerefed
(
Of_Man_t
*
p
,
int
*
pCut
)
...
@@ -1038,6 +1055,7 @@ void Of_ManComputeBackward( Of_Man_t * p )
...
@@ -1038,6 +1055,7 @@ void Of_ManComputeBackward( Of_Man_t * p )
int
fFirst
=
(
int
)(
p
->
Iter
==
0
);
int
fFirst
=
(
int
)(
p
->
Iter
==
0
);
int
DelayLut1
=
p
->
pPars
->
nDelayLut1
;
int
DelayLut1
=
p
->
pPars
->
nDelayLut1
;
int
i
,
k
,
Id
,
iVar
,
*
pList
,
*
pCut
,
*
pCutMin
;
int
i
,
k
,
Id
,
iVar
,
*
pList
,
*
pCut
,
*
pCutMin
;
int
AreaBef
=
0
,
AreaAft
=
0
;
// int Count0, Count1;
// int Count0, Count1;
Of_ManComputeRequired
(
p
);
Of_ManComputeRequired
(
p
);
// start references
// start references
...
@@ -1061,7 +1079,7 @@ void Of_ManComputeBackward( Of_Man_t * p )
...
@@ -1061,7 +1079,7 @@ void Of_ManComputeBackward( Of_Man_t * p )
continue
;
continue
;
// deref best cut
// deref best cut
if
(
!
fFirst
)
if
(
!
fFirst
)
Of_CutDeref_rec
(
p
,
Of_ObjCutBestP
(
p
,
Of_ObjCutSet
(
p
,
i
),
i
)
);
AreaBef
=
Of_CutDeref_rec
(
p
,
Of_ObjCutBestP
(
p
,
Of_ObjCutSet
(
p
,
i
),
i
)
);
// select the best cut
// select the best cut
// Count0 = Count1 = 0;
// Count0 = Count1 = 0;
pCutMin
=
NULL
;
pCutMin
=
NULL
;
...
@@ -1085,14 +1103,21 @@ void Of_ManComputeBackward( Of_Man_t * p )
...
@@ -1085,14 +1103,21 @@ void Of_ManComputeBackward( Of_Man_t * p )
}
}
// printf( "%5d : %5d %5d %5d\n", i, Count0, Count1, Required );
// printf( "%5d : %5d %5d %5d\n", i, Count0, Count1, Required );
// the cut is selected
// the cut is selected
assert
(
pCutMin
!=
NULL
);
Of_ObjSetCutBestP
(
p
,
pList
,
i
,
pCutMin
);
Of_ObjSetCutBestP
(
p
,
pList
,
i
,
pCutMin
);
Of_CutForEachVar
(
pCutMin
,
iVar
,
k
)
Of_CutForEachVar
(
pCutMin
,
iVar
,
k
)
{
{
Of_ObjUpdateRequired
(
p
,
iVar
,
Required
-
DelayLut1
);
Of_ObjUpdateRequired
(
p
,
iVar
,
Required
-
DelayLut1
);
if
(
fFirst
)
Of_ObjRefInc
(
p
,
iVar
);
Of_ObjRefInc
(
p
,
iVar
);
}
}
p
->
pPars
->
Area
++
;
// ref best cut
if
(
!
fFirst
)
AreaAft
=
Of_CutRef_rec
(
p
,
pCutMin
);
assert
(
AreaAft
<=
AreaBef
);
// update parameters
p
->
pPars
->
Edge
+=
Of_CutSize
(
pCutMin
);
p
->
pPars
->
Edge
+=
Of_CutSize
(
pCutMin
);
p
->
pPars
->
Area
++
;
}
}
}
}
...
@@ -1113,7 +1138,7 @@ void Of_ManSetDefaultPars( Jf_Par_t * pPars )
...
@@ -1113,7 +1138,7 @@ void Of_ManSetDefaultPars( Jf_Par_t * pPars )
pPars
->
nLutSize
=
4
;
pPars
->
nLutSize
=
4
;
pPars
->
nCutNum
=
16
;
pPars
->
nCutNum
=
16
;
pPars
->
nProcNum
=
0
;
pPars
->
nProcNum
=
0
;
pPars
->
nRounds
=
1
;
pPars
->
nRounds
=
4
;
pPars
->
nRoundsEla
=
0
;
pPars
->
nRoundsEla
=
0
;
pPars
->
nRelaxRatio
=
0
;
pPars
->
nRelaxRatio
=
0
;
pPars
->
nCoarseLimit
=
3
;
pPars
->
nCoarseLimit
=
3
;
...
@@ -1149,12 +1174,13 @@ Gia_Man_t * Of_ManDeriveMapping( Of_Man_t * p )
...
@@ -1149,12 +1174,13 @@ Gia_Man_t * Of_ManDeriveMapping( Of_Man_t * p )
pCut
=
Of_ObjCutBestP
(
p
,
Of_ObjCutSet
(
p
,
i
),
i
);
pCut
=
Of_ObjCutBestP
(
p
,
Of_ObjCutSet
(
p
,
i
),
i
);
Vec_IntWriteEntry
(
vMapping
,
i
,
Vec_IntSize
(
vMapping
)
);
Vec_IntWriteEntry
(
vMapping
,
i
,
Vec_IntSize
(
vMapping
)
);
Vec_IntPush
(
vMapping
,
Of_CutSize
(
pCut
)
);
Vec_IntPush
(
vMapping
,
Of_CutSize
(
pCut
)
);
// printf( "%3d : ", i );
Of_CutForEachVar
(
pCut
,
iVar
,
k
)
Of_CutForEachVar
(
pCut
,
iVar
,
k
)
{
{
Vec_IntPush
(
vMapping
,
iVar
);
Vec_IntPush
(
vMapping
,
iVar
);
// printf( "%d ", iVar );
// printf( "%
3
d ", iVar );
}
}
// printf( "
-- %d\n", i
);
// printf( "
\n"
);
Vec_IntPush
(
vMapping
,
i
);
Vec_IntPush
(
vMapping
,
i
);
}
}
assert
(
Vec_IntCap
(
vMapping
)
==
16
||
Vec_IntSize
(
vMapping
)
==
Vec_IntCap
(
vMapping
)
);
assert
(
Vec_IntCap
(
vMapping
)
==
16
||
Vec_IntSize
(
vMapping
)
==
Vec_IntCap
(
vMapping
)
);
...
...
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