diff --git a/common/router2.cc b/common/router2.cc index 1f9196ab..813249b4 100644 --- a/common/router2.cc +++ b/common/router2.cc @@ -355,8 +355,7 @@ struct Router2 { auto &wd = wire_data(wire); auto &nd = nets.at(net->udata); - float base_cost = ctx->getDelayNS(ctx->getPipDelay(pip).maxDelay() + ctx->getWireDelay(wire).maxDelay() + - ctx->getDelayEpsilon()); + float base_cost = cfg.get_base_cost(ctx, wire, pip, crit_weight); int overuse = wd.curr_cong; float hist_cost = 1.0f + crit_weight * (wd.hist_cong_cost - 1.0f); float bias_cost = 0; diff --git a/common/router2.h b/common/router2.h index 34102f44..629453c6 100644 --- a/common/router2.h +++ b/common/router2.h @@ -21,6 +21,13 @@ NEXTPNR_NAMESPACE_BEGIN +inline float default_base_cost(Context *ctx, WireId wire, PipId pip, float crit_weight) +{ + (void)crit_weight; // unused + return ctx->getDelayNS(ctx->getPipDelay(pip).maxDelay() + ctx->getWireDelay(wire).maxDelay() + + ctx->getDelayEpsilon()); +} + struct Router2Cfg { Router2Cfg(Context *ctx); @@ -51,6 +58,7 @@ struct Router2Cfg bool perf_profile = false; std::string heatmap; + std::function get_base_cost = default_base_cost; }; void router2(Context *ctx, const Router2Cfg &cfg);