diff options
Diffstat (limited to 'common/place_common.cc')
-rw-r--r-- | common/place_common.cc | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/common/place_common.cc b/common/place_common.cc index 5673c847..fd38429f 100644 --- a/common/place_common.cc +++ b/common/place_common.cc @@ -37,10 +37,10 @@ wirelen_t get_net_metric(const Context *ctx, const NetInfo *net, MetricType type return 0; driver_gb = ctx->getBelGlobalBuf(driver_cell->bel); driver_loc = ctx->getBelLocation(driver_cell->bel); - WireId drv_wire = ctx->getBelPinWire(driver_cell->bel, ctx->portPinFromId(net->driver.port)); if (driver_gb) return 0; - float worst_slack = 1000; + delay_t negative_slack = 0; + 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) @@ -49,11 +49,10 @@ wirelen_t get_net_metric(const Context *ctx, const NetInfo *net, MetricType type if (load_cell->bel == BelId()) continue; 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); + delay_t net_delay = ctx->predictDelay(net, load); + auto slack = load.budget - net_delay; if (slack < 0) - tns += slack; + negative_slack += slack; worst_slack = std::min(slack, worst_slack); } @@ -67,11 +66,13 @@ 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)); } + tns += ctx->getDelayNS(negative_slack); return wirelength; } |