router2: Allow overriding resource costs
Signed-off-by: gatecat <gatecat@ds0.me>
This commit is contained in:
parent
502fcff765
commit
ab6990f908
@ -355,8 +355,7 @@ struct Router2
|
|||||||
{
|
{
|
||||||
auto &wd = wire_data(wire);
|
auto &wd = wire_data(wire);
|
||||||
auto &nd = nets.at(net->udata);
|
auto &nd = nets.at(net->udata);
|
||||||
float base_cost = ctx->getDelayNS(ctx->getPipDelay(pip).maxDelay() + ctx->getWireDelay(wire).maxDelay() +
|
float base_cost = cfg.get_base_cost(ctx, wire, pip, crit_weight);
|
||||||
ctx->getDelayEpsilon());
|
|
||||||
int overuse = wd.curr_cong;
|
int overuse = wd.curr_cong;
|
||||||
float hist_cost = 1.0f + crit_weight * (wd.hist_cong_cost - 1.0f);
|
float hist_cost = 1.0f + crit_weight * (wd.hist_cong_cost - 1.0f);
|
||||||
float bias_cost = 0;
|
float bias_cost = 0;
|
||||||
|
@ -21,6 +21,13 @@
|
|||||||
|
|
||||||
NEXTPNR_NAMESPACE_BEGIN
|
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
|
struct Router2Cfg
|
||||||
{
|
{
|
||||||
Router2Cfg(Context *ctx);
|
Router2Cfg(Context *ctx);
|
||||||
@ -51,6 +58,7 @@ struct Router2Cfg
|
|||||||
bool perf_profile = false;
|
bool perf_profile = false;
|
||||||
|
|
||||||
std::string heatmap;
|
std::string heatmap;
|
||||||
|
std::function<float(Context *ctx, WireId wire, PipId pip, float crit_weight)> get_base_cost = default_base_cost;
|
||||||
};
|
};
|
||||||
|
|
||||||
void router2(Context *ctx, const Router2Cfg &cfg);
|
void router2(Context *ctx, const Router2Cfg &cfg);
|
||||||
|
Loading…
Reference in New Issue
Block a user