aboutsummaryrefslogtreecommitdiffstats
path: root/common
diff options
context:
space:
mode:
authorEddie Hung <eddieh@ece.ubc.ca>2018-07-30 18:55:22 -0700
committerEddie Hung <eddieh@ece.ubc.ca>2018-07-30 18:55:22 -0700
commit8371c0dd09e5b59189a391fb1b867e5249442046 (patch)
tree2ef96aab1a6c377e58ae929951a7501844343cb9 /common
parent46b74696527d3b217070ff4820b537e0b989a00f (diff)
downloadnextpnr-8371c0dd09e5b59189a391fb1b867e5249442046.tar.gz
nextpnr-8371c0dd09e5b59189a391fb1b867e5249442046.tar.bz2
nextpnr-8371c0dd09e5b59189a391fb1b867e5249442046.zip
Speedup worst_slack computation
Diffstat (limited to 'common')
-rw-r--r--common/place_common.cc6
1 files changed, 3 insertions, 3 deletions
diff --git a/common/place_common.cc b/common/place_common.cc
index 5673c847..9fba90f9 100644
--- a/common/place_common.cc
+++ b/common/place_common.cc
@@ -40,7 +40,7 @@ wirelen_t get_net_metric(const Context *ctx, const NetInfo *net, MetricType type
WireId drv_wire = ctx->getBelPinWire(driver_cell->bel, ctx->portPinFromId(net->driver.port));
if (driver_gb)
return 0;
- float worst_slack = 1000;
+ delay_t worst_slack = std::numeric_limits<delay_t>::max();
int xmin = driver_loc.x, xmax = driver_loc.x, ymin = driver_loc.y, ymax = driver_loc.y;
for (auto load : net->users) {
if (load.cell == nullptr)
@@ -51,7 +51,7 @@ wirelen_t get_net_metric(const Context *ctx, const NetInfo *net, MetricType type
if (ctx->timing_driven && type == MetricType::COST) {
WireId user_wire = ctx->getBelPinWire(load_cell->bel, ctx->portPinFromId(load.port));
delay_t raw_wl = ctx->estimateDelay(drv_wire, user_wire);
- float slack = ctx->getDelayNS(load.budget) - ctx->getDelayNS(raw_wl);
+ auto slack = load.budget - raw_wl;
if (slack < 0)
tns += slack;
worst_slack = std::min(slack, worst_slack);
@@ -67,7 +67,7 @@ wirelen_t get_net_metric(const Context *ctx, const NetInfo *net, MetricType type
ymax = std::max(ymax, load_loc.y);
}
if (ctx->timing_driven && type == MetricType::COST) {
- wirelength = wirelen_t((((ymax - ymin) + (xmax - xmin)) * std::min(5.0, (1.0 + std::exp(-worst_slack / 5)))));
+ wirelength = wirelen_t((((ymax - ymin) + (xmax - xmin)) * std::min(5.0, (1.0 + std::exp(-ctx->getDelayNS(worst_slack) / 5)))));
} else {
wirelength = wirelen_t((ymax - ymin) + (xmax - xmin));
}