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
59627615
Commit
59627615
authored
Jan 27, 2017
by
Alan Mishchenko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixing non-reproducability related to floating-point numbers.
parent
f701a0c6
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
27 additions
and
22 deletions
+27
-22
src/aig/gia/giaJf.c
+8
-6
src/aig/gia/giaLf.c
+6
-5
src/aig/gia/giaMf.c
+4
-3
src/aig/gia/giaNf.c
+9
-8
No files found.
src/aig/gia/giaJf.c
View file @
59627615
...
...
@@ -36,6 +36,7 @@ ABC_NAMESPACE_IMPL_START
#define JF_LEAF_MAX 8
#define JF_WORD_MAX ((JF_LEAF_MAX > 6) ? 1 << (JF_LEAF_MAX-6) : 1)
#define JF_CUT_MAX 16
#define JF_EPSILON 0.005
typedef
struct
Jf_Cut_t_
Jf_Cut_t
;
struct
Jf_Cut_t_
...
...
@@ -940,15 +941,16 @@ float Jf_CutCompareDelay( Jf_Cut_t * pOld, Jf_Cut_t * pNew )
{
if
(
pOld
->
Time
!=
pNew
->
Time
)
return
pOld
->
Time
-
pNew
->
Time
;
if
(
pOld
->
pCut
[
0
]
!=
pNew
->
pCut
[
0
]
)
return
pOld
->
pCut
[
0
]
-
pNew
->
pCut
[
0
];
if
(
pOld
->
Flow
!=
pNew
->
Flow
)
return
pOld
->
Flow
-
pNew
->
Flow
;
// if ( pOld->Flow != pNew->Flow ) return pOld->Flow - pNew->Flow;
if
(
pOld
->
Flow
<
pNew
->
Flow
-
JF_EPSILON
)
return
-
1
;
if
(
pOld
->
Flow
>
pNew
->
Flow
+
JF_EPSILON
)
return
1
;
return
0
;
}
float
Jf_CutCompareArea
(
Jf_Cut_t
*
pOld
,
Jf_Cut_t
*
pNew
)
{
// float Epsilon = (float)0.001;
// if ( pOld->Flow > pNew->Flow + Epsilon ) return 1;
// if ( pOld->Flow < pNew->Flow - Epsilon ) return -1;
if
(
pOld
->
Flow
!=
pNew
->
Flow
)
return
pOld
->
Flow
-
pNew
->
Flow
;
// if ( pOld->Flow != pNew->Flow ) return pOld->Flow - pNew->Flow;
if
(
pOld
->
Flow
<
pNew
->
Flow
-
JF_EPSILON
)
return
-
1
;
if
(
pOld
->
Flow
>
pNew
->
Flow
+
JF_EPSILON
)
return
1
;
if
(
pOld
->
pCut
[
0
]
!=
pNew
->
pCut
[
0
]
)
return
pOld
->
pCut
[
0
]
-
pNew
->
pCut
[
0
];
if
(
pOld
->
Time
!=
pNew
->
Time
)
return
pOld
->
Time
-
pNew
->
Time
;
return
0
;
...
...
@@ -1367,7 +1369,7 @@ void Jf_ObjComputeBestCut( Jf_Man_t * p, Gia_Obj_t * pObj, int fEdge, int fEla )
if
(
fEdge
&&
!
fEla
)
Jf_CutSetCost
(
pCut
,
Jf_CutSize
(
pCut
));
Area
=
fEla
?
Jf_CutArea
(
p
,
pCut
,
fEdge
)
:
Jf_CutFlow
(
p
,
pCut
)
+
Jf_CutCost
(
pCut
);
if
(
pCutBest
==
NULL
||
AreaBest
>
Area
||
(
AreaBest
==
Area
&&
TimeBest
>
(
Time
=
Jf_CutArr
(
p
,
pCut
)))
)
if
(
pCutBest
==
NULL
||
AreaBest
>
Area
+
JF_EPSILON
||
(
AreaBest
>
Area
-
JF_EPSILON
&&
TimeBest
>
(
Time
=
Jf_CutArr
(
p
,
pCut
)))
)
pCutBest
=
pCut
,
AreaBest
=
Area
,
TimeBest
=
Time
;
}
Vec_IntWriteEntry
(
&
p
->
vArr
,
iObj
,
Jf_CutArr
(
p
,
pCutBest
)
);
...
...
src/aig/gia/giaLf.c
View file @
59627615
...
...
@@ -36,6 +36,7 @@ ABC_NAMESPACE_IMPL_START
#define LF_NO_LEAF 255
#define LF_CUT_WORDS (4+LF_LEAF_MAX/2)
#define LF_TT_WORDS ((LF_LEAF_MAX > 6) ? 1 << (LF_LEAF_MAX-6) : 1)
#define LF_EPSILON 0.005
typedef
struct
Lf_Cut_t_
Lf_Cut_t
;
struct
Lf_Cut_t_
...
...
@@ -847,16 +848,16 @@ static inline int Lf_CutCompareDelay( Lf_Cut_t * pCut0, Lf_Cut_t * pCut1 )
if
(
pCut0
->
Delay
>
pCut1
->
Delay
)
return
1
;
if
(
pCut0
->
nLeaves
<
pCut1
->
nLeaves
)
return
-
1
;
if
(
pCut0
->
nLeaves
>
pCut1
->
nLeaves
)
return
1
;
if
(
pCut0
->
Flow
<
pCut1
->
Flow
)
return
-
1
;
if
(
pCut0
->
Flow
>
pCut1
->
Flow
)
return
1
;
if
(
pCut0
->
Flow
<
pCut1
->
Flow
-
LF_EPSILON
)
return
-
1
;
if
(
pCut0
->
Flow
>
pCut1
->
Flow
+
LF_EPSILON
)
return
1
;
return
0
;
}
static
inline
int
Lf_CutCompareArea
(
Lf_Cut_t
*
pCut0
,
Lf_Cut_t
*
pCut1
)
{
if
(
pCut0
->
fLate
<
pCut1
->
fLate
)
return
-
1
;
if
(
pCut0
->
fLate
>
pCut1
->
fLate
)
return
1
;
if
(
pCut0
->
Flow
<
pCut1
->
Flow
)
return
-
1
;
if
(
pCut0
->
Flow
>
pCut1
->
Flow
)
return
1
;
if
(
pCut0
->
Flow
<
pCut1
->
Flow
-
LF_EPSILON
)
return
-
1
;
if
(
pCut0
->
Flow
>
pCut1
->
Flow
+
LF_EPSILON
)
return
1
;
if
(
pCut0
->
Delay
<
pCut1
->
Delay
)
return
-
1
;
if
(
pCut0
->
Delay
>
pCut1
->
Delay
)
return
1
;
if
(
pCut0
->
nLeaves
<
pCut1
->
nLeaves
)
return
-
1
;
...
...
@@ -1304,7 +1305,7 @@ void Lf_ObjMergeOrder( Lf_Man_t * p, int iObj )
p
->
nCutEqual
++
;
// area cut
iCutUsed
=
0
;
if
(
nCutsR
>
1
&&
pCutsR
[
0
]
->
Flow
>
pCutsR
[
1
]
->
Flow
)
//&& !pCutsR[1]->fLate ) // can remove !fLate
if
(
nCutsR
>
1
&&
pCutsR
[
0
]
->
Flow
>
pCutsR
[
1
]
->
Flow
+
LF_EPSILON
)
//&& !pCutsR[1]->fLate ) // can remove !fLate
{
pBest
->
Cut
[
1
].
Handle
=
Lf_MemSaveCut
(
&
p
->
vStoreNew
,
pCutsR
[
1
],
iObj
);
pBest
->
Delay
[
1
]
=
pCutsR
[
1
]
->
Delay
;
...
...
src/aig/gia/giaMf.c
View file @
59627615
...
...
@@ -37,6 +37,7 @@ ABC_NAMESPACE_IMPL_START
#define MF_NO_LEAF 31
#define MF_TT_WORDS ((MF_LEAF_MAX > 6) ? 1 << (MF_LEAF_MAX-6) : 1)
#define MF_NO_FUNC 134217727 // (1<<27)-1
#define MF_EPSILON 0.005
typedef
struct
Mf_Cut_t_
Mf_Cut_t
;
struct
Mf_Cut_t_
...
...
@@ -920,8 +921,8 @@ static inline int Mf_SetLastCutContainsArea( Mf_Cut_t ** pCuts, int nCuts )
}
static
inline
int
Mf_CutCompareArea
(
Mf_Cut_t
*
pCut0
,
Mf_Cut_t
*
pCut1
)
{
if
(
pCut0
->
Flow
<
pCut1
->
Flow
)
return
-
1
;
if
(
pCut0
->
Flow
>
pCut1
->
Flow
)
return
1
;
if
(
pCut0
->
Flow
<
pCut1
->
Flow
-
MF_EPSILON
)
return
-
1
;
if
(
pCut0
->
Flow
>
pCut1
->
Flow
+
MF_EPSILON
)
return
1
;
if
(
pCut0
->
Delay
<
pCut1
->
Delay
)
return
-
1
;
if
(
pCut0
->
Delay
>
pCut1
->
Delay
)
return
1
;
if
(
pCut0
->
nLeaves
<
pCut1
->
nLeaves
)
return
-
1
;
...
...
@@ -1544,7 +1545,7 @@ static inline void Mf_ObjComputeBestCut( Mf_Man_t * p, int iObj )
assert
(
!
Mf_CutIsTriv
(
pCut
,
iObj
)
);
assert
(
Mf_CutSize
(
pCut
)
<=
p
->
pPars
->
nLutSize
);
Flow
=
p
->
fUseEla
?
Mf_CutAreaDerefed
(
p
,
pCut
)
:
Mf_CutFlow
(
p
,
pCut
,
&
Time
);
if
(
pCutBest
==
NULL
||
FlowBest
>
Flow
||
(
FlowBest
==
Flow
&&
TimeBest
>
Time
)
)
if
(
pCutBest
==
NULL
||
FlowBest
>
Flow
+
MF_EPSILON
||
(
FlowBest
>
Flow
-
MF_EPSILON
&&
TimeBest
>
Time
)
)
pCutBest
=
pCut
,
FlowBest
=
Flow
,
TimeBest
=
Time
;
}
assert
(
pCutBest
!=
NULL
);
...
...
src/aig/gia/giaNf.c
View file @
59627615
...
...
@@ -41,6 +41,7 @@ ABC_NAMESPACE_IMPL_START
#define NF_CUT_MAX 32
#define NF_NO_LEAF 31
#define NF_NO_FUNC 0x3FFFFFF
#define NF_EPSILON 0.001
typedef
struct
Nf_Cut_t_
Nf_Cut_t
;
struct
Nf_Cut_t_
...
...
@@ -171,7 +172,7 @@ static inline int Nf_CfgCompl( Nf_Cfg_t Cfg, int i )
int
Nf_StoCellIsDominated
(
Mio_Cell2_t
*
pCell
,
int
*
pFans
,
int
*
pProf
)
{
int
k
;
if
(
pCell
->
AreaF
<
Abc_Int2Float
(
pProf
[
0
])
)
if
(
pCell
->
AreaF
+
NF_EPSILON
<
Abc_Int2Float
(
pProf
[
0
])
)
return
0
;
for
(
k
=
0
;
k
<
(
int
)
pCell
->
nFanins
;
k
++
)
if
(
pCell
->
iDelays
[
Abc_Lit2Var
(
pFans
[
k
])]
<
pProf
[
k
+
1
]
)
...
...
@@ -802,8 +803,8 @@ static inline int Nf_CutCompareArea( Nf_Cut_t * pCut0, Nf_Cut_t * pCut1 )
{
if
(
pCut0
->
Useless
<
pCut1
->
Useless
)
return
-
1
;
if
(
pCut0
->
Useless
>
pCut1
->
Useless
)
return
1
;
if
(
pCut0
->
Flow
<
pCut1
->
Flow
)
return
-
1
;
if
(
pCut0
->
Flow
>
pCut1
->
Flow
)
return
1
;
if
(
pCut0
->
Flow
<
pCut1
->
Flow
-
NF_EPSILON
)
return
-
1
;
if
(
pCut0
->
Flow
>
pCut1
->
Flow
+
NF_EPSILON
)
return
1
;
if
(
pCut0
->
Delay
<
pCut1
->
Delay
)
return
-
1
;
if
(
pCut0
->
Delay
>
pCut1
->
Delay
)
return
1
;
if
(
pCut0
->
nLeaves
<
pCut1
->
nLeaves
)
return
-
1
;
...
...
@@ -1162,7 +1163,7 @@ void Nf_ManCutMatchOne( Nf_Man_t * p, int iObj, int * pCut, int * pCutSet )
pD
->
Cfg
.
fCompl
=
0
;
}
if
(
pA
->
F
>
AreaF
)
if
(
pA
->
F
>
AreaF
+
NF_EPSILON
)
{
pA
->
D
=
Delay
;
pA
->
F
=
AreaF
;
...
...
@@ -1310,7 +1311,7 @@ void Nf_ManCutMatch( Nf_Man_t * p, int iObj )
}
//assert( pAp->F < FLT_MAX || pAn->F < FLT_MAX );
// try replacing pos with neg
if
(
pAp
->
D
==
SCL_INFINITY
||
(
pAp
->
F
>
pAn
->
F
+
p
->
InvAreaF
&&
pAn
->
D
+
p
->
InvDelayI
<=
Required
[
0
])
)
if
(
pAp
->
D
==
SCL_INFINITY
||
(
pAp
->
F
>
pAn
->
F
+
p
->
InvAreaF
+
NF_EPSILON
&&
pAn
->
D
+
p
->
InvDelayI
<=
Required
[
0
])
)
{
assert
(
p
->
Iter
>
0
);
*
pAp
=
*
pAn
;
...
...
@@ -1322,7 +1323,7 @@ void Nf_ManCutMatch( Nf_Man_t * p, int iObj )
//printf( "Using inverter to improve area at node %d in phase %d.\n", iObj, 1 );
}
// try replacing neg with pos
else
if
(
pAn
->
D
==
SCL_INFINITY
||
(
pAn
->
F
>
pAp
->
F
+
p
->
InvAreaF
&&
pAp
->
D
+
p
->
InvDelayI
<=
Required
[
1
])
)
else
if
(
pAn
->
D
==
SCL_INFINITY
||
(
pAn
->
F
>
pAp
->
F
+
p
->
InvAreaF
+
NF_EPSILON
&&
pAp
->
D
+
p
->
InvDelayI
<=
Required
[
1
])
)
{
assert
(
p
->
Iter
>
0
);
*
pAn
=
*
pAp
;
...
...
@@ -1778,7 +1779,7 @@ void Nf_ManElaBestMatchOne( Nf_Man_t * p, int iObj, int c, int * pCut, int * pCu
pMb
->
Cfg
=
Nf_Int2Cfg
(
0
);
pMb
->
fBest
=
1
;
// compare
if
(
pRes
->
F
>
pMb
->
F
||
(
pRes
->
F
==
pMb
->
F
&&
pRes
->
D
>
pMb
->
D
)
)
if
(
pRes
->
F
>
pMb
->
F
+
NF_EPSILON
||
(
pRes
->
F
>
pMb
->
F
-
NF_EPSILON
&&
pRes
->
D
>
pMb
->
D
)
)
*
pRes
=
*
pMb
;
return
;
}
...
...
@@ -1814,7 +1815,7 @@ void Nf_ManElaBestMatchOne( Nf_Man_t * p, int iObj, int c, int * pCut, int * pCu
// compute area
pMb
->
F
=
Scl_Int2Flt
((
int
)
Nf_MatchRefArea
(
p
,
iObj
,
c
,
pMb
,
Required
));
// compare
if
(
pRes
->
F
>
pMb
->
F
||
(
pRes
->
F
==
pMb
->
F
&&
pRes
->
D
>
pMb
->
D
)
)
if
(
pRes
->
F
>
pMb
->
F
+
NF_EPSILON
||
(
pRes
->
F
>
pMb
->
F
-
NF_EPSILON
&&
pRes
->
D
>
pMb
->
D
)
)
*
pRes
=
*
pMb
;
}
}
...
...
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