Commit bf6a053c by Alan Mishchenko

Saturating floating point computation.

parent a1dd7e3f
...@@ -1154,7 +1154,11 @@ static inline void Lf_CutParams( Lf_Man_t * p, Lf_Cut_t * pCut, int Required, fl ...@@ -1154,7 +1154,11 @@ static inline void Lf_CutParams( Lf_Man_t * p, Lf_Cut_t * pCut, int Required, fl
else else
{ {
Index = (int)(pBest->Delay[1] + 1 <= Required && Required != ABC_INFINITY); Index = (int)(pBest->Delay[1] + 1 <= Required && Required != ABC_INFINITY);
pCut->Flow += pBest->Flow[Index]; //pCut->Flow += pBest->Flow[Index];
if ( pCut->Flow >= (float)1e32 || pBest->Flow[Index] >= (float)1e32 )
pCut->Flow = (float)1e32;
else
pCut->Flow += pBest->Flow[Index];
} }
Delay = pBest->Delay[Index]; Delay = pBest->Delay[Index];
} }
......
...@@ -1147,7 +1147,11 @@ void Nf_ManCutMatchOne( Nf_Man_t * p, int iObj, int * pCut, int * pCutSet ) ...@@ -1147,7 +1147,11 @@ void Nf_ManCutMatchOne( Nf_Man_t * p, int iObj, int * pCut, int * pCutSet )
if ( pD->D < SCL_INFINITY && pA->D < SCL_INFINITY && ArrivalD + pC->iDelays[k] > Required ) if ( pD->D < SCL_INFINITY && pA->D < SCL_INFINITY && ArrivalD + pC->iDelays[k] > Required )
break; break;
Delay = Abc_MaxInt( Delay, ArrivalD + pC->iDelays[k] ); Delay = Abc_MaxInt( Delay, ArrivalD + pC->iDelays[k] );
AreaF += pBestF[iFanin]->M[fComplF][0].F; //AreaF += pBestF[iFanin]->M[fComplF][0].F;
if ( AreaF >= (float)1e32 || pBestF[iFanin]->M[fComplF][0].F >= (float)1e32 )
AreaF = (float)1e32;
else
AreaF += pBestF[iFanin]->M[fComplF][0].F;
} }
} }
if ( k < nFans ) if ( k < nFans )
......
...@@ -57,7 +57,7 @@ void Cmd_HistoryAddCommand( Abc_Frame_t * p, const char * command ) ...@@ -57,7 +57,7 @@ void Cmd_HistoryAddCommand( Abc_Frame_t * p, const char * command )
return; return;
Len = strlen(command); Len = strlen(command);
strcpy( Buffer, command ); strcpy( Buffer, command );
if ( Buffer[Len-1] == '\n' ) if ( Len > 0 && Buffer[Len-1] == '\n' )
Buffer[Len-1] = 0; Buffer[Len-1] = 0;
if ( strlen(Buffer) > 3 && if ( strlen(Buffer) > 3 &&
strncmp(Buffer,"set",3) && strncmp(Buffer,"set",3) &&
......
...@@ -919,18 +919,22 @@ void If_CutLift( If_Cut_t * pCut ) ...@@ -919,18 +919,22 @@ void If_CutLift( If_Cut_t * pCut )
float If_CutAreaFlow( If_Man_t * p, If_Cut_t * pCut ) float If_CutAreaFlow( If_Man_t * p, If_Cut_t * pCut )
{ {
If_Obj_t * pLeaf; If_Obj_t * pLeaf;
float Flow; float Flow, AddOn;
int i; int i;
Flow = If_CutLutArea(p, pCut); Flow = If_CutLutArea(p, pCut);
If_CutForEachLeaf( p, pCut, pLeaf, i ) If_CutForEachLeaf( p, pCut, pLeaf, i )
{ {
if ( pLeaf->nRefs == 0 || If_ObjIsConst1(pLeaf) ) if ( pLeaf->nRefs == 0 || If_ObjIsConst1(pLeaf) )
Flow += If_ObjCutBest(pLeaf)->Area; AddOn = If_ObjCutBest(pLeaf)->Area;
else else
{ {
assert( pLeaf->EstRefs > p->fEpsilon ); assert( pLeaf->EstRefs > p->fEpsilon );
Flow += If_ObjCutBest(pLeaf)->Area / pLeaf->EstRefs; AddOn = If_ObjCutBest(pLeaf)->Area / pLeaf->EstRefs;
} }
if ( Flow >= (float)1e32 || AddOn >= (float)1e32 )
Flow = (float)1e32;
else
Flow += AddOn;
} }
return Flow; return Flow;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment