router2: Avoid ripup of critical path
Signed-off-by: David Shah <dave@ds0.me>
This commit is contained in:
parent
3503f4e907
commit
402819c64b
@ -50,6 +50,7 @@ struct Router2
|
|||||||
WireId sink_wire;
|
WireId sink_wire;
|
||||||
ArcBounds bb;
|
ArcBounds bb;
|
||||||
bool routed = false;
|
bool routed = false;
|
||||||
|
float arc_crit = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
// As we allow overlap at first; the nextpnr bind functions can't be used
|
// As we allow overlap at first; the nextpnr bind functions can't be used
|
||||||
@ -116,6 +117,8 @@ struct Router2
|
|||||||
std::vector<NetInfo *> nets_by_udata;
|
std::vector<NetInfo *> nets_by_udata;
|
||||||
std::vector<PerNetData> nets;
|
std::vector<PerNetData> nets;
|
||||||
|
|
||||||
|
bool timing_driven;
|
||||||
|
|
||||||
// Criticality data from timing analysis
|
// Criticality data from timing analysis
|
||||||
NetCriticalityMap net_crit;
|
NetCriticalityMap net_crit;
|
||||||
|
|
||||||
@ -342,6 +345,15 @@ struct Router2
|
|||||||
int source_uses = 0;
|
int source_uses = 0;
|
||||||
if (wd.bound_nets.count(net->udata))
|
if (wd.bound_nets.count(net->udata))
|
||||||
source_uses = wd.bound_nets.at(net->udata).first;
|
source_uses = wd.bound_nets.at(net->udata).first;
|
||||||
|
if (timing_driven) {
|
||||||
|
float max_bound_crit = 0;
|
||||||
|
for (auto &bound : wd.bound_nets)
|
||||||
|
if (bound.first != net->udata)
|
||||||
|
max_bound_crit = std::max(max_bound_crit, nets.at(bound.first).max_crit);
|
||||||
|
if (max_bound_crit >= 0.8 && nd.arcs.at(user).arc_crit < (max_bound_crit + 0.01)) {
|
||||||
|
present_cost *= 1.5;
|
||||||
|
}
|
||||||
|
}
|
||||||
if (pip != PipId()) {
|
if (pip != PipId()) {
|
||||||
Loc pl = ctx->getPipLocation(pip);
|
Loc pl = ctx->getPipLocation(pip);
|
||||||
bias_cost = cfg.bias_cost_factor * (base_cost / int(net->users.size())) *
|
bias_cost = cfg.bias_cost_factor * (base_cost / int(net->users.size())) *
|
||||||
@ -1092,7 +1104,7 @@ struct Router2
|
|||||||
for (size_t i = 0; i < nets_by_udata.size(); i++)
|
for (size_t i = 0; i < nets_by_udata.size(); i++)
|
||||||
route_queue.push_back(i);
|
route_queue.push_back(i);
|
||||||
|
|
||||||
bool timing_driven = ctx->setting<bool>("timing_driven");
|
timing_driven = ctx->setting<bool>("timing_driven");
|
||||||
log_info("Running main router loop...\n");
|
log_info("Running main router loop...\n");
|
||||||
do {
|
do {
|
||||||
ctx->sorted_shuffle(route_queue);
|
ctx->sorted_shuffle(route_queue);
|
||||||
@ -1108,9 +1120,12 @@ struct Router2
|
|||||||
net.max_crit = 0;
|
net.max_crit = 0;
|
||||||
if (fnd == net_crit.end())
|
if (fnd == net_crit.end())
|
||||||
continue;
|
continue;
|
||||||
for (auto c : fnd->second.criticality)
|
for (int i = 0; i < int(fnd->second.criticality.size()); i++) {
|
||||||
|
float c = fnd->second.criticality.at(i);
|
||||||
|
net.arcs.at(i).arc_crit = c;
|
||||||
net.max_crit = std::max(net.max_crit, c);
|
net.max_crit = std::max(net.max_crit, c);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
std::stable_sort(route_queue.begin(), route_queue.end(),
|
std::stable_sort(route_queue.begin(), route_queue.end(),
|
||||||
[&](int na, int nb) { return nets.at(na).max_crit > nets.at(nb).max_crit; });
|
[&](int na, int nb) { return nets.at(na).max_crit > nets.at(nb).max_crit; });
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user