Skip to content

Commit

Permalink
Delay compare ops round2
Browse files Browse the repository at this point in the history
  • Loading branch information
jjcherry56 committed Jul 12, 2020
1 parent 9468da1 commit 7653096
Show file tree
Hide file tree
Showing 23 changed files with 291 additions and 243 deletions.
6 changes: 3 additions & 3 deletions dcalc/GraphDelayCalc1.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1246,7 +1246,7 @@ GraphDelayCalc1::findArcDelay(LibertyCell *drvr_cell,
// Merge slews.
const Slew &drvr_slew = graph_->slew(drvr_vertex, drvr_rf, ap_index);
const MinMax *slew_min_max = dcalc_ap->slewMinMax();
if (delayGreater(gate_slew, drvr_slew, dcalc_ap->slewMinMax())
if (delayGreater(gate_slew, drvr_slew, dcalc_ap->slewMinMax(), this)
&& !drvr_vertex->slewAnnotated(drvr_rf, slew_min_max))
graph_->setSlew(drvr_vertex, drvr_rf, ap_index, gate_slew);
if (!graph_->arcDelayAnnotated(edge, arc, ap_index)) {
Expand Down Expand Up @@ -1446,7 +1446,7 @@ GraphDelayCalc1::annotateLoadDelays(Vertex *drvr_vertex,
else {
const Slew &slew = graph_->slew(load_vertex, drvr_rf, ap_index);
if (!merge
|| delayGreater(load_slew, slew, slew_min_max))
|| delayGreater(load_slew, slew, slew_min_max, this))
graph_->setSlew(load_vertex, drvr_rf, ap_index, load_slew);
}
}
Expand All @@ -1459,7 +1459,7 @@ GraphDelayCalc1::annotateLoadDelays(Vertex *drvr_vertex,
Delay wire_delay_extra = extra_delay + wire_delay;
const MinMax *delay_min_max = dcalc_ap->delayMinMax();
if (!merge
|| delayGreater(wire_delay_extra, delay, delay_min_max)) {
|| delayGreater(wire_delay_extra, delay, delay_min_max, this)) {
graph_->setWireArcDelay(wire_edge, drvr_rf, ap_index,
wire_delay_extra);
if (observer_)
Expand Down
24 changes: 16 additions & 8 deletions graph/DelayFloat.cc
Original file line number Diff line number Diff line change
Expand Up @@ -94,15 +94,17 @@ delayEqual(const Delay &delay1,

bool
delayLess(const Delay &delay1,
const Delay &delay2)
const Delay &delay2,
const StaState *)
{
return fuzzyLess(delay1, delay2);
}

bool
delayLess(const Delay &delay1,
const Delay &delay2,
const MinMax *min_max)
const MinMax *min_max,
const StaState *)
{
if (min_max == MinMax::max())
return fuzzyLess(delay1, delay2);
Expand All @@ -112,15 +114,17 @@ delayLess(const Delay &delay1,

bool
delayLessEqual(const Delay &delay1,
const Delay &delay2)
const Delay &delay2,
const StaState *)
{
return fuzzyLessEqual(delay1, delay2);
}

bool
delayLessEqual(const Delay &delay1,
const Delay &delay2,
const MinMax *min_max)
const MinMax *min_max,
const StaState *)
{
if (min_max == MinMax::max())
return fuzzyLessEqual(delay1, delay2);
Expand All @@ -130,15 +134,17 @@ delayLessEqual(const Delay &delay1,

bool
delayGreater(const Delay &delay1,
const Delay &delay2)
const Delay &delay2,
const StaState *)
{
return fuzzyGreater(delay1, delay2);
}

bool
delayGreater(const Delay &delay1,
const Delay &delay2,
const MinMax *min_max)
const MinMax *min_max,
const StaState *)
{
if (min_max == MinMax::max())
return fuzzyGreater(delay1, delay2);
Expand All @@ -148,15 +154,17 @@ delayGreater(const Delay &delay1,

bool
delayGreaterEqual(const Delay &delay1,
const Delay &delay2)
const Delay &delay2,
const StaState *)
{
return fuzzyGreaterEqual(delay1, delay2);
}

bool
delayGreaterEqual(const Delay &delay1,
const Delay &delay2,
const MinMax *min_max)
const MinMax *min_max,
const StaState *)
{
if (min_max == MinMax::max())
return fuzzyGreaterEqual(delay1, delay2);
Expand Down
177 changes: 90 additions & 87 deletions graph/DelayNormal1.cc
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,6 @@
#include "Fuzzy.hh"
#include "Units.hh"
#include "StaState.hh"
// temporary hack
#include "Sta.hh"

// SSTA compilation.
#if (SSTA == 1)
Expand Down Expand Up @@ -185,6 +183,63 @@ makeDelay2(float delay,
return Delay(delay, sigma2);
}

float
delayAsFloat(const Delay &delay,
const EarlyLate *early_late,
const StaState *sta)
{
if (sta->pocvEnabled()) {
if (early_late == EarlyLate::early())
return delay.mean() - delay.sigma() * sta->sigmaFactor();
else if (early_late == EarlyLate::late())
return delay.mean() + delay.sigma() * sta->sigmaFactor();
else
internalError("unknown early/late value.");
}
else
return delay.mean();
}

float
delaySigma2(const Delay &delay,
const EarlyLate *)
{
return delay.sigma2();
}

const char *
delayAsString(const Delay &delay,
const StaState *sta)
{
return delayAsString(delay, sta, sta->units()->timeUnit()->digits());
}

const char *
delayAsString(const Delay &delay,
const StaState *sta,
int digits)
{
const Unit *unit = sta->units()->timeUnit();
if (sta->pocvEnabled()) {
float sigma = delay.sigma();
return stringPrintTmp("%s[%s]",
unit->asString(delay.mean(), digits),
unit->asString(sigma, digits));
}
else
return unit->asString(delay.mean(), digits);
}

const char *
delayAsString(const Delay &delay,
const EarlyLate *early_late,
const StaState *sta,
int digits)
{
float mean_sigma = delayAsFloat(delay, early_late, sta);
return sta->units()->timeUnit()->asString(mean_sigma, digits);
}

bool
delayIsInitValue(const Delay &delay,
const MinMax *min_max)
Expand Down Expand Up @@ -216,175 +271,123 @@ delayEqual(const Delay &delay1,

bool
delayLess(const Delay &delay1,
const Delay &delay2)
const Delay &delay2,
const StaState *sta)
{
Sta *sta = Sta::sta();
return fuzzyLess(delayAsFloat(delay1, EarlyLate::early(), sta),
delayAsFloat(delay2, EarlyLate::early(), sta));
}

bool
delayLess(const Delay &delay1,
float delay2)
float delay2,
const StaState *sta)
{
Sta *sta = Sta::sta();
return fuzzyLess(delayAsFloat(delay1, EarlyLate::early(), sta),
delay2);
}

bool
delayLess(const Delay &delay1,
const Delay &delay2,
const MinMax *min_max)
const MinMax *min_max,
const StaState *sta)
{
if (min_max == MinMax::max())
return delayLess(delay1, delay2);
return delayLess(delay1, delay2, sta);
else
return delayGreater(delay1, delay2);
return delayGreater(delay1, delay2, sta);
}

bool
delayLessEqual(const Delay &delay1,
const Delay &delay2)
const Delay &delay2,
const StaState *sta)
{
Sta *sta = Sta::sta();
return fuzzyLessEqual(delayAsFloat(delay1, EarlyLate::early(), sta),
delayAsFloat(delay2, EarlyLate::early(), sta));
}

bool
delayLessEqual(const Delay &delay1,
float delay2)
float delay2,
const StaState *sta)
{
Sta *sta = Sta::sta();
return fuzzyLessEqual(delayAsFloat(delay1, EarlyLate::early(), sta),
delay2);
}

bool
delayLessEqual(const Delay &delay1,
const Delay &delay2,
const MinMax *min_max)
const MinMax *min_max,
const StaState *sta)
{
if (min_max == MinMax::max())
return delayLessEqual(delay1, delay2);
return delayLessEqual(delay1, delay2, sta);
else
return delayGreaterEqual(delay1, delay2);
return delayGreaterEqual(delay1, delay2, sta);
}

bool
delayGreater(const Delay &delay1,
const Delay &delay2)
const Delay &delay2,
const StaState *sta)

{
Sta *sta = Sta::sta();
return fuzzyGreater(delayAsFloat(delay1, EarlyLate::late(), sta),
delayAsFloat(delay2, EarlyLate::late(), sta));
}

bool
delayGreater(const Delay &delay1,
float delay2)
float delay2,
const StaState *sta)
{
Sta *sta = Sta::sta();
return fuzzyGreater(delayAsFloat(delay1, EarlyLate::late(), sta),
delay2);
}

bool
delayGreaterEqual(const Delay &delay1,
const Delay &delay2)
const Delay &delay2,
const StaState *sta)
{
Sta *sta = Sta::sta();
return fuzzyGreaterEqual(delayAsFloat(delay1, EarlyLate::late(), sta),
delayAsFloat(delay2, EarlyLate::late(), sta));
}

bool
delayGreaterEqual(const Delay &delay1,
float delay2)
float delay2,
const StaState *sta)
{
Sta *sta = Sta::sta();
return fuzzyGreaterEqual(delayAsFloat(delay1, EarlyLate::late(), sta),
delay2);
}

bool
delayGreater(const Delay &delay1,
const Delay &delay2,
const MinMax *min_max)
const MinMax *min_max,
const StaState *sta)
{
if (min_max == MinMax::max())
return delayGreater(delay1, delay2);
return delayGreater(delay1, delay2, sta);
else
return delayLess(delay1, delay2);
return delayLess(delay1, delay2, sta);
}

bool
delayGreaterEqual(const Delay &delay1,
const Delay &delay2,
const MinMax *min_max)
const MinMax *min_max,
const StaState *sta)
{
if (min_max == MinMax::max())
return delayGreaterEqual(delay1, delay2);
else
return delayLessEqual(delay1, delay2);
}

float
delayAsFloat(const Delay &delay,
const EarlyLate *early_late,
const StaState *sta)
{
if (sta->pocvEnabled()) {
if (early_late == EarlyLate::early())
return delay.mean() - delay.sigma() * sta->sigmaFactor();
else if (early_late == EarlyLate::late())
return delay.mean() + delay.sigma() * sta->sigmaFactor();
else
internalError("unknown early/late value.");
}
else
return delay.mean();
}

float
delaySigma2(const Delay &delay,
const EarlyLate *)
{
return delay.sigma2();
}

const char *
delayAsString(const Delay &delay,
const StaState *sta)
{
return delayAsString(delay, sta, sta->units()->timeUnit()->digits());
}

const char *
delayAsString(const Delay &delay,
const StaState *sta,
int digits)
{
const Unit *unit = sta->units()->timeUnit();
if (sta->pocvEnabled()) {
float sigma = delay.sigma();
return stringPrintTmp("%s[%s]",
unit->asString(delay.mean(), digits),
unit->asString(sigma, digits));
}
return delayGreaterEqual(delay1, delay2, sta);
else
return unit->asString(delay.mean(), digits);
}

const char *
delayAsString(const Delay &delay,
const EarlyLate *early_late,
const StaState *sta,
int digits)
{
float mean_sigma = delayAsFloat(delay, early_late, sta);
return sta->units()->timeUnit()->asString(mean_sigma, digits);
return delayLessEqual(delay1, delay2, sta);
}

Delay
Expand Down
Loading

0 comments on commit 7653096

Please sign in to comment.