summaryrefslogtreecommitdiffstats
path: root/src/aig/gia/giaLf.c
diff options
context:
space:
mode:
authorAlan Mishchenko <alanmi@berkeley.edu>2017-01-27 15:22:23 -0800
committerAlan Mishchenko <alanmi@berkeley.edu>2017-01-27 15:22:23 -0800
commit596276152c0933f4251c53206ff1d98533b45ab2 (patch)
tree469302cb3eeff9fc26003f457253391444cae5e5 /src/aig/gia/giaLf.c
parentf701a0c659c57b8aa452bed93143a45cf5dcfeb8 (diff)
downloadabc-596276152c0933f4251c53206ff1d98533b45ab2.tar.gz
abc-596276152c0933f4251c53206ff1d98533b45ab2.tar.bz2
abc-596276152c0933f4251c53206ff1d98533b45ab2.zip
Fixing non-reproducability related to floating-point numbers.
Diffstat (limited to 'src/aig/gia/giaLf.c')
-rw-r--r--src/aig/gia/giaLf.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/aig/gia/giaLf.c b/src/aig/gia/giaLf.c
index 7973966a..2c216a9b 100644
--- a/src/aig/gia/giaLf.c
+++ b/src/aig/gia/giaLf.c
@@ -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;